Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Email smtp上的golang“x.509未知权限”,但tls上没有错误_Email_Ssl_Go - Fatal编程技术网

Email smtp上的golang“x.509未知权限”,但tls上没有错误

Email smtp上的golang“x.509未知权限”,但tls上没有错误,email,ssl,go,Email,Ssl,Go,当我试图用golang发送邮件到我的本地postfix服务器时,我收到了错误 x509:由未知权限签署的证书 考虑下面的代码: config := &tls.Config{ServerName: "example.com"} _, err := tls.Dial("tcp", "example.com:443", config) //err == nil c,_ := smtp.Dial("example.com:25") err = c.StartTLS(config) //err =

当我试图用golang发送邮件到我的本地postfix服务器时,我收到了错误 x509:由未知权限签署的证书 考虑下面的代码:

config := &tls.Config{ServerName: "example.com"}
_, err := tls.Dial("tcp", "example.com:443", config)
//err == nil
c,_ := smtp.Dial("example.com:25")
err = c.StartTLS(config)
//err == x509: certificate signed by unknown authority
Apache和postfix都使用由StartSSL签名的相同证书

为什么它在一个例子中被接受,而在另一个例子中被拒绝?
作为旁注:在smtp案例中是否可以获得有关证书的更多信息?

您是否在postfix的cert pem中包含了中间证书?openssl的客户端也可以连接到starttls服务:openssl s_client-connect example.com:25-starttls smtp问题不在于连接本身,而在于证书的验证。即使证书无法验证,openssl s_客户端也会连接,但它会在详细输出中告诉您这一点。