new: add tunnel service

This commit is contained in:
Hiddify
2024-01-29 21:55:01 +01:00
parent 25d5b8a1c5
commit 5fa28220b4
28 changed files with 364 additions and 231 deletions

View File

@@ -56,7 +56,7 @@ func GenerateCertificate(certPath, keyPath string, isServer bool) {
panic(err)
}
defer certFile.Close()
certFile.Chmod(600)
certFile.Chmod(0644)
pem.Encode(certFile, &pem.Block{Type: "CERTIFICATE", Bytes: certDER})
keyFile, err := os.Create(keyPath)
@@ -68,7 +68,7 @@ func GenerateCertificate(certPath, keyPath string, isServer bool) {
if err != nil {
panic(err)
}
keyFile.Chmod(600)
keyFile.Chmod(0644)
pem.Encode(keyFile, &pem.Block{Type: "EC PRIVATE KEY", Bytes: privBytes})
}

View File

@@ -10,7 +10,6 @@ import (
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"github.com/hectane/go-acl"
"io/ioutil"
"math/big"
"os"
@@ -57,7 +56,7 @@ func GenerateCertificate(certPath, keyPath string, isServer bool) {
panic(err)
}
defer certFile.Close()
acl.Chmod(certFile.Name(), 600)
// acl.Chmod(certFile.Name(), 0644)
pem.Encode(certFile, &pem.Block{Type: "CERTIFICATE", Bytes: certDER})
keyFile, err := os.Create(keyPath)
@@ -69,7 +68,7 @@ func GenerateCertificate(certPath, keyPath string, isServer bool) {
if err != nil {
panic(err)
}
acl.Chmod(keyFile.Name(), 600)
// acl.Chmod(keyFile.Name(), 0644)
pem.Encode(keyFile, &pem.Block{Type: "EC PRIVATE KEY", Bytes: privBytes})
}