Merge branch 'main' into ipv6

This commit is contained in:
Kristoffer Dalby 2022-01-30 08:21:11 +00:00 committed by GitHub
commit 6f6018bad5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 202 additions and 408 deletions

9
app.go
View file

@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"net"
"net/http"
"net/url"
@ -95,7 +96,8 @@ type Config struct {
DNSConfig *tailcfg.DNSConfig
UnixSocket string
UnixSocket string
UnixSocketPermission fs.FileMode
OIDC OIDCConfig
@ -424,6 +426,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)