|
|
|
@ -305,15 +305,17 @@ func main() { |
|
|
|
|
|
|
|
syncScheme = "https://" |
|
|
|
syncPort = appconf.HTTPS_ServerPort |
|
|
|
keyPath := appconf.TLSKeyPath + "00.key" |
|
|
|
certPath := appconf.TLSChainPath + "00.crt" |
|
|
|
|
|
|
|
//certPair, err := tls.LoadX509KeyPair(appconf.TLSCertificateFile, appconf.TLSKeyPath)
|
|
|
|
if !fileExists(appconf.TLSChainPath) || !fileExists(appconf.TLSKeyPath) { |
|
|
|
if !fileExists(certPath) || !fileExists(keyPath) { |
|
|
|
fmt.Println("Provided certificate and/or key file does not exist! Terminating.") |
|
|
|
log.Fatal("Provided certificate and/or key file does not exist! Terminating.") |
|
|
|
} |
|
|
|
|
|
|
|
//Create loader for cert files
|
|
|
|
kpr, err := NewKeypairReloader(appconf.TLSChainPath, appconf.TLSKeyPath) |
|
|
|
kpr, err := NewKeypairReloader(certPath, keyPath) |
|
|
|
if err != nil { |
|
|
|
log.Fatal(err) |
|
|
|
} |
|
|
|
@ -420,10 +422,10 @@ func NewKeypairReloader(certPath, keyPath string) (*keypairReloader, error) { |
|
|
|
result.cert = &cert |
|
|
|
go func() { |
|
|
|
c := make(chan os.Signal, 1) |
|
|
|
signal.Notify(c, syscall.SIGHUP) |
|
|
|
signal.Notify(c, syscall.SIGUSR1) |
|
|
|
for range c { |
|
|
|
log.Printf("Received SIGHUP, reloading TLS certificate and key from %q and %q", appconf.TLSChainPath, appconf.TLSKeyPath) |
|
|
|
fmt.Printf("Received SIGHUP, reloading TLS certificate and key from %q and %q\n", appconf.TLSChainPath, appconf.TLSKeyPath) |
|
|
|
log.Printf("Received SIGHUP, reloading TLS certificate and key from %q and %q", certPath, keyPath) |
|
|
|
fmt.Printf("Received SIGHUP, reloading TLS certificate and key from %q and %q\n", certPath, keyPath) |
|
|
|
if err := result.maybeReload(); err != nil { |
|
|
|
log.Printf("Keeping old TLS certificate because the new one could not be loaded: %v", err) |
|
|
|
fmt.Printf("Keeping old TLS certificate because the new one could not be loaded: %v", err) |
|
|
|
|