简体   繁体   English

SSL:无法加载CA证书文件/etc/pki/tls/certs/ca-bundle.crt

[英]SSL: can't load CA certificate file /etc/pki/tls/certs/ca-bundle.crt

On my local dev machine (osx), I'm using jboss to server web services on 8443. When I hit the urls directly I get the json responses I'm looking for. 在我的本地开发机(osx)上,我正在使用jboss在8443上为Web服务提供服务器。当我直接点击url时,会得到我正在寻找的json响应。 The architecture we have at work includes a middle layer (apache/php) that does authentication and routing. 我们正在使用的体系结构包括执行身份验证和路由的中间层(apache / php)。 If things authenticate then it forwards the request to the backend. 如果事情进行了身份验证,那么它将请求转发到后端。

When I was working with apache on port 80 and jboss on 8081 (using http). 当我在端口80上使用apache和在8081上使用jboss时(使用http)。 Everything worked fine for me. 一切对我来说都很好。 Now that I'm trying to use 8443, things aren't working. 现在,我正在尝试使用8443,因此一切正常。

I recently changed the backend to server through https (8443) instead of http (8081). 我最近将后端通过https(8443)而不是http(8081)更改为服务器。 I can hit the requests on https 8443 directly and get the json response. 我可以直接点击https 8443上的请求并获取json响应。 When I hit apache and it authenticates then tries to redirect to the https 8443 I get the following message from chrome's inspector: "SSL: can't load CA certificate file /etc/pki/tls/certs/ca-bundle.crt". 当我点击apache并进行身份验证然后尝试重定向到https 8443时,我从chrome的检查器收到以下消息:“ SSL:无法加载CA证书文件/etc/pki/tls/certs/ca-bundle.crt”。

在此处输入图片说明

My vhost is setup to catch *:80 requests. 我的虚拟主机设置为捕获*:80请求。 I think I might need to setup vhosts to accept 443 requests or install ca-certificates like talked about in How do I deal with certificates using cURL while trying to access an HTTPS url? 我认为我可能需要设置虚拟主机以接受443个请求或安装ca-certificates在尝试访问HTTPS URL时如何使用cURL处理证书中所述。 . I'm looking to see if anyone knows what the proper direction should be. 我正在寻找是否有人知道正确的方向。

When I look on the file system, the file /etc/pki/tls/certs/ca-bundle.crt doesn't exist. 当我查看文件系统时,文件/etc/pki/tls/certs/ca-bundle.crt不存在。 When I make the request to the middle layer, I see the request hit /var/log/apache2/access_log and nothing comes up in /var/log/apache2/error_log . 当我向中间层发出请求时,我看到该请求命中了/var/log/apache2/access_log ,在/var/log/apache2/error_log什么也没有出现。

What is needed to resolve this issue? 解决此问题需要什么? Is it a configuration of vhosts to catch request to 443? 是否是虚拟主机的配置以捕获对443的请求? Is it to install ca-cert stuff like in the link? 是否要像链接中那样安装ca-cert的东西? A combination of both? 两者结合? Or something else? 或者是其他东西? Please provide enough info on how to solve it, or provide links that provide enough info. 请提供有关如何解决问题的足够信息,或提供提供足够信息的链接。

I solved my issue and am doing a post for documentation purposes, in case anyone else has similar issues. 我已经解决了我的问题,并准备发布以供参考,以防其他人遇到类似问题。 There was a couple of issues I had to resolve to fix this. 我必须解决几个问题才能解决此问题。

PHP Install PHP安装

My /etc/apache2/httpd.conf referenced my default osx php install instead of my home brew install of php. 我的/etc/apache2/httpd.conf引用了我的默认osx php安装,而不是我的home brew安装php。 Solution was to edit the httpd.conf and point it to the right install. 解决方法是编辑httpd.conf并将其指向正确的安装。

#LoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5.so
LoadModule php5_module /usr/local/Cellar/php53/5.3.29_4/libexec/apache2/libphp5.so

You can create a similar setup of php using home brew by the following commands: 您可以通过以下命令使用home brew创建类似的php设置:

brew install homebrew/php/php53
brew install homebrew/php/php53-igbinary --build-from-source
brew install homebrew/php/php53-intl
brew install homebrew/php/php53-mcrypt
brew install homebrew/php/php53-memcached
brew install homebrew/php/php53-mongo
brew install homebrew/php/php53-xdebug

Create the CA Cert Bundle File 创建CA Cert Bundle文件

The system is looking for /etc/pki/tls/certs/ca-bundle.cert which is a standard path on linux, but not on osx. 系统正在寻找/etc/pki/tls/certs/ca-bundle.cert ,这是Linux上的标准路径,而不是osx上的标准路径。 We get around this by generating the file. 我们通过生成文件来解决这个问题。

I generated the .keystore file using keytool and used jboss for my alias. 我使用keytool生成了.keystore文件,并使用jboss作为别名。 In order to build the ca bundle file, we need it to be in the pem format, so we need to add the -rfc to our export statement. 为了构建ca bundle文件,我们需要它采用pem格式,因此我们需要将-rfc添加到我们的export语句中。 Below are the commands: 以下是命令:

cd /usr/local/jboss-eap-6.4/standalone/configuration
keytool -export -alias jboss -file local-sbx.dev.yourcompany.com.crt -keystore .keystore -rfc

After you have the file, you can cat it out and verify that the file has the BEGIN CERTIFICATE and END CERTIFICATE stuff in it. 拥有文件后,您可以将其分类,并验证文件中是否包含BEGIN CERTIFICATEEND CERTIFICATE If so, its in the right format. 如果是这样,则其格式正确。

Lastly, create the directory structure, move the cert to act like the bundle (which is just a bunch of certs appended to each other) and then restart apache: 最后,创建目录结构,移动证书使其像捆绑包一样(只是一堆相互附加的证书),然后重新启动apache:

mkdir -p /etc/pki/tls/certs/
sudo cp local-sbx.dev.yourcompany.com.crt /etc/pki/tls/certs/ca-bundle.crt
sudo apachectl restart

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker:无法读取 CA 证书:没有这样的文件或目录 - Docker: Could not read CA certificate: no such file or directory Pip 安装 TLS CA 问题 - Pip install TLS CA issue 我可以使用 openssl s_client 来检索 MySQL 的 CA 证书吗? - Can I use openssl s_client to retrieve the CA certificate for MySQL? 在OSX 10.5.8上的Qt:“为此目的不信任根CA证书” - Qt on OSX 10.5.8: “The root CA certificate is not trusted for this purpose” 尝试启动docker时不断获取无法读取CA证书 - Keep getting Could not read CA certificate when trying to start docker 使用NSURLConnection的应用程序的iPhone自定义CA证书? - iPhone Custom CA certificate for an application which uses NSURLConnection? cURL错误58:SSL:无法加载证书“...”及其私钥:Mac上的OSStatus -25299 - cURL error 58: SSL: Can't load the certificate “…” and its private key: OSStatus -25299 on Mac 如何将 Apple KeyChain 中的所有 CA 证书导出到单个 PEM 包中? - How do I export all CA certificates from Apple KeyChain into a single PEM bundle? 为在 OS X 上导入钥匙串的 X509 CA 证书添加信任 - Adding trust for a X509 CA certificate imported into keychain on OS X 远程连接到Mac OS X上的MySQL服务器-错误2003(HY000):无法连接到duplessis.umontreal.ca上的MySQL服务器(110) - Remote connection to MySQL server on Mac OS X - ERROR 2003 (HY000): Can't connect to MySQL server on 'duplessis.umontreal.ca' (110)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM