Przeglądaj źródła

use SIGHUP to restart daemon

Matthew R. Kasun 3 lat temu
rodzic
commit
7fb1696be3
2 zmienionych plików z 25 dodań i 3 usunięć
  1. 20 0
      netclient/daemon/common.go
  2. 5 3
      tls/tls.go

+ 20 - 0
netclient/daemon/common.go

@@ -47,6 +47,26 @@ func Restart() error {
 	return nil
 }
 
+//	os := runtime.GOOS
+//	var err error
+//
+//	time.Sleep(time.Second)
+//
+//	switch os {
+//	case "windows":
+//		RestartWindowsDaemon()
+//	case "darwin":
+//		RestartLaunchD()
+//	case "linux":
+//		RestartSystemD()
+//	case "freebsd":
+//		FreebsdDaemon("restart")
+//	default:
+//		err = errors.New("this os is not yet supported for daemon mode. Run join cmd with flag '--daemon off'")
+//	}
+//	return err
+//}
+
 // Stop - stops a system daemon
 func Stop() error {
 	os := runtime.GOOS

+ 5 - 3
tls/tls.go

@@ -120,11 +120,13 @@ func NewCName(commonName string) pkix.Name {
 }
 
 // NewCSR creates a new certificate signing request for a
-func NewCSR(key ed25519.PrivateKey, name pkix.Name) (*x509.CertificateRequest, error) {
+func NewCSR(key ed25519.PrivateKey, names ...pkix.Name) (*x509.CertificateRequest, error) {
 	dnsnames := []string{}
-	dnsnames = append(dnsnames, name.CommonName)
+	for _, name := range names {
+		dnsnames = append(dnsnames, name.CommonName)
+	}
 	derCertRequest, err := x509.CreateCertificateRequest(rand.Reader, &x509.CertificateRequest{
-		Subject:            name,
+		Subject:            names[0],
 		PublicKey:          key.Public(),
 		DNSNames:           dnsnames,
 		PublicKeyAlgorithm: x509.Ed25519,