fix: Compatible with Windows

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2021-02-19 19:14:43 +08:00
parent 97291a2d8f
commit f3b75f396b
3 changed files with 1 additions and 27 deletions
-1
View File
@@ -43,7 +43,6 @@ Use token
### mTLS
You can enable mTLS by specifying device CA storage (valid file) in config file or from CLI (variable ssl-cacert).
Appending to CA storage is possible on-the-fly, you can reload CA certs by sendig SIGUSR1 signal.
Device(s) without valid CA in storage will be disconnected in TLS handshake.
## Running as a Linux service
+1 -1
View File
@@ -43,7 +43,7 @@
### SSL 双向认证(mTLS)
您可以在配置文件中指定设备 CA 存储(有效文件)或在 CLI 中指定设备 CA 存储(参数 ssl-cacert) 来启用 mTLS。
您可以通过发送 SIGUSR1 信号重新加载 CA 证书。存储中没有有效 CA 的设备将在 TLS 握手中断开连接。
存储中没有有效 CA 的设备将在 TLS 握手中断开连接。
## 作为Linux服务运行
移动rttys可执行程序到/usr/local/bin/
-25
View File
@@ -2,11 +2,8 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"os/signal"
"runtime"
"syscall"
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
@@ -20,8 +17,6 @@ func runRttys(c *cli.Context) {
rlog.SetPath(c.String("log"))
cfg := config.Parse(c)
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGUSR1)
if cfg.HTTPUsername == "" {
fmt.Println("You must configure the http username by commandline or config file")
@@ -51,26 +46,6 @@ func runRttys(c *cli.Context) {
listenDeviceWeb(br)
httpStart(br)
go func() {
for {
s := <-sigs
switch s {
case syscall.SIGUSR1:
if br.devCertPool != nil {
log.Info().Msg("Reload certs for mTLS")
caCert, err := ioutil.ReadFile(cfg.SslCacert)
if err != nil {
log.Info().Msgf("mTLS update faled: %s", err.Error())
} else {
br.devCertPool.AppendCertsFromPEM(caCert)
}
} else {
log.Warn().Msg("Reload certs failed: mTLS not used")
}
}
}
}()
select {}
}