linux服务器端如何导入根证书

128 views
Skip to first unread message

hui zhang

unread,
Nov 23, 2015, 2:41:02 AM11/23/15
to USTC_LUG
现在有个需求
需要我从一台linux 服务器 c程序  https访问另外一台机器上的web程序
我用openssl SSL_CTX_load_verify_locations 指定了证书目录
访问得到错误结果

verify_callback, error string: self signed certificate in certificate chain


网上查了下, 貌似是认为是自签名,

根证书是comodo的,  linux 貌似没有把这个加入到系统认证库中。


求问

linux 下如何导入根证书?



hugo

unread,
Nov 23, 2015, 3:31:49 AM11/23/15
to ustc...@googlegroups.com
这个的话,要看具体的系统,一些系统 (比如:ubuntu trusty) 应该是证书放到 /etc/ssl/certs/ 目录,然后要在这个目录里创建 hash 连接:

ln -s my_ca.crt `openssl x509 -hash -noout -in my_ca.crt`.0

。 还有一些系统 (比如:centos) 把证书加到 /etc/ssl/certs/ca-bundle.crt 末尾应该就好了。

我觉得你这种情况应该是中间证书的问题,最好是服务器上给出中间证书。
> --
> -- 来自USTC LUG
> 请使用gmail订阅,不要灌水。
> 更多信息more info:http://groups.google.com/group/ustc_lug?hl=en?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "USTC_LUG" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ustc_lug+u...@googlegroups.com.
> To post to this group, send email to ustc...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

hui zhang

unread,
Nov 23, 2015, 3:35:44 AM11/23/15
to ustc...@googlegroups.com
中间证书?
我现在做法是SSL_CTX_load_verify_locations  指定一个目录
该目录下 放置  firefox 导出的证书链上3个级别的证书,  3个证书cat join 在一起 (这样做是不是有问题?)
c_rehash ./path2pem/



You received this message because you are subscribed to a topic in the Google Groups "USTC_LUG" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ustc_lug/yaNb0OLEo-o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ustc_lug+u...@googlegroups.com.

HUGO QIN

unread,
Nov 23, 2015, 3:45:38 AM11/23/15
to ustc...@googlegroups.com

我的意思是 web 端服务器给出中间证书应该可以。

 

如果要 openssl 指定目录的话,三个证书不要 cat join, 分开放在指定的目录里,然后 c_rehash 应该是可以的。

hui zhang

unread,
Nov 23, 2015, 8:10:19 PM11/23/15
to ustc...@googlegroups.com
三个证书不要 cat join  
一样的结果
verify_callback, error string: self signed certificate in certificate chain

我觉得还是系统不信任根证书的问题。

Reply all
Reply to author
Forward
0 new messages