mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-09 05:12:45 +08:00
支持 私有自签证书
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"crypto/tls"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/bjdgyc/anylink/base"
|
||||
@@ -36,6 +39,19 @@ func startTls() {
|
||||
// certs[0], err = tls.LoadX509KeyPair(certFile, keyFile)
|
||||
// }
|
||||
|
||||
tlscert, _, err := dbdata.ParseCert()
|
||||
if err != nil {
|
||||
base.Fatal("证书加载失败", err)
|
||||
}
|
||||
dbdata.LoadCertificate(tlscert)
|
||||
|
||||
// 计算证书hash值
|
||||
s1 := sha1.New()
|
||||
s1.Write(tlscert.Certificate[0])
|
||||
h2s := hex.EncodeToString(s1.Sum(nil))
|
||||
certHash = strings.ToUpper(h2s)
|
||||
base.Info("certHash", certHash)
|
||||
|
||||
// 修复 CVE-2016-2183
|
||||
// https://segmentfault.com/a/1190000038486901
|
||||
// nmap -sV --script ssl-enum-ciphers -p 443 www.example.com
|
||||
|
Reference in New Issue
Block a user