Merge branch 'main' into configurable-mtls

This commit is contained in:
Kristoffer Dalby 2022-01-29 20:15:58 +00:00 committed by GitHub
commit 0609c97459
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 268 additions and 424 deletions

9
app.go
View file

@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"net"
"net/http"
"net/url"
@ -96,7 +97,8 @@ type Config struct {
DNSConfig *tailcfg.DNSConfig
UnixSocket string
UnixSocket string
UnixSocketPermission fs.FileMode
OIDC OIDCConfig
@ -427,6 +429,11 @@ func (h *Headscale) Serve() error {
return fmt.Errorf("failed to set up gRPC socket: %w", err)
}
// Change socket permissions
if err := os.Chmod(h.cfg.UnixSocket, h.cfg.UnixSocketPermission); err != nil {
return fmt.Errorf("failed change permission of gRPC socket: %w", err)
}
// Handle common process-killing signals so we can gracefully shut down:
sigc := make(chan os.Signal, 1)
signal.Notify(sigc, os.Interrupt, syscall.SIGTERM)