简体   繁体   English

Jboss7上的COMODO SSL证书

[英]COMODO SSL certificate on Jboss7

I registered a domain and would like to set up SSL encryption for it. 我注册了一个域名,并希望为它设置SSL加密。 My domain provider offered me to get a SSL certificate from COMODO. 我的域名提供商让我从COMODO获得SSL证书。 I generated a key and a csr file using openSSL: 我使用openSSL生成了一个密钥和一个csr文件:

openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out server.csr

The command produced a private key, myserver.key and the csr file. 该命令生成了一个私钥myserver.key和csr文件。 I uploaded the content of the csr to comodo, and after verification, they sent me the following files: 我将csr的内容上传到comodo,经过验证后,他们发给我以下文件:

Root CA Certificate - AddTrustExternalCARoot.crt
Intermediate CA Certificate - COMODORSAAddTrustCA.crt
Intermediate CA Certificate - COMODORSADomainValidationSecureServerCA.crt
Your PositiveSSL Certificate - mydomain.crt

I'm lost on where to go from here. 我迷失在哪里离开这里。 I followed these instructions: 我按照这些说明操作:

https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/638/0/certificate-installation-java-based-web-servers-tomcat-using-keytool https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/638/0/certificate-installation-java-based-web-servers-tomcat-using-keytool

and created a domain.keystore file, but I'm not sure if that's the right thing to do or not. 并创建了一个domain.keystore文件,但我不确定这是否是正确的做法。 My configuration in Jboss now looks like this: 我在Jboss中的配置现在看起来像这样:

<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
    <ssl name="mydomain" password="*****" protocol="TLSv1" certificate-key-file="../standalone/configuration/domain.keystore"/>
</connector>

But that doesn't seem to work. 但这似乎不起作用。 I get no error in the server log, the page simply times out. 我在服务器日志中没有错误,页面只是超时。 If i use http it works normally. 如果我使用http它正常工作。 Any advice? 有什么建议?

EDIT: 编辑:

I took a different approach, I generated my keystore in this way: 我采取了不同的方法,我以这种方式生成了我的密钥库:

keytool -genkey -alias domain -keyalg RSA -keysize 2048 -keystore domain.keystore

then I uploaded the new csr info to comodo and got the three .crt certificates back. 然后我将新的csr信息上传到comodo并获得了三个.crt证书。 I imported them into the keystore with this command: 我使用以下命令将它们导入密钥库:

keytool -import -trustcacerts -alias domain -file domain.crt -keystore domain.keystore

and then I used the keystore in the standalone.xml in this way: 然后我以这种方式使用standalone.xml中的密钥库:

<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
    <ssl name="domain-ssl" key-alias="domain" password="******" certificate-key-file="../standalone/configuration/domain.keystore" protocol="TLSv1"/>
</connector>

The server starts, but when I try to connect to it, my browser says that the connection is untrusted: 服务器启动,但是当我尝试连接它时,我的浏览器说连接是不可信的:

domain uses an invalid security certificate.
The certificate is not trusted because it is self-signed.
(Error code: sec_error_ca_cert_invalid)

I finally managed to get the installation right! 我终于设法让安装正确! Here's how you do it: 这是你如何做到的:

Install the COMODO certificates into your keystore wit this command: 使用以下命令将COMODO证书安装到密钥库中:

keytool -import -trustcacerts -alias <filename> -file <filename>.crt -keystore domain.keystore

in the following order: 按以下顺序:

» Root: AddTrustExternalCARoot.crt
» Intermediate 1: COMODOAddTrustServerCA.crt
» Intermediate 2: COMODOExtendedValidationSecureServerCA.crt 

Then install your domain certificate: 然后安装域证书:

keytool -import -trustcacerts -alias mykey -file yourDomainName.crt -keystore domain.keystore

You should use the same alias instead of mykey, that you used to generate your keystore. 您应该使用相同的别名而不是mykey,用于生成密钥库。 If you do everything correctly, you should get this output: 如果你正确地做了一切,你应该得到这个输出:

Certificate reply was installed in keystore

Anything else means, you probably didn't use the correct alias. 其他任何意思,你可能没有使用正确的别名。 The final thing you need to do is to modify your standalone.xml like this: 您需要做的最后一件事是修改您的standalone.xml,如下所示:

<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
    <ssl name="<domain>-ssl" key-alias="<domain>" password="******" certificate-key-file="../standalone/configuration/<domain>.keystore"/>
</connector>

And you should be good to go! 你应该好好去!

 My domain provider offered me to get a SSL certificate from COMODO... ... Any advice? 

Don't pay for the certificate. 不要支付证书。 You can get a free Class 1 certificate from Startcom . 您可以从Startcom获得免费的Class 1证书。 The Class 1 is good for server authentication without a wildcard domain. Class 1适用于没有通配符域的服务器身份验证。 If you want an extended validation certificate or a wilcard certificate, then you will have to buy a Class 2 or higher. 如果您需要扩展验证证书或威尔卡证书,则必须购买2级或更高级别的证书。

Also, while Startcom issues the certificate for free, they charge for revocation because that's where the cost lies. 此外,虽然Startcom免费发放证书,但他们会收取撤销费用,因为这是成本所在。


I'm lost on where to go from here... 我迷失在哪里离开这里......

Convert Intermediate CA Certificate - COMODORSAAddTrustCA.crt , Intermediate CA Certificate - COMODORSADomainValidationSecureServerCA.crt and Your PositiveSSL Certificate - mydomain.crt to PEM files. 转换Intermediate CA Certificate - COMODORSAAddTrustCA.crtIntermediate CA Certificate - COMODORSADomainValidationSecureServerCA.crtYour PositiveSSL Certificate - mydomain.crt到PEM文件。 PEM are the ones that start with ----- BEGIN CERTIFICATE ----- and finish with ----- END CERTIFICATE ----- . PEM是以----- BEGIN CERTIFICATE -----开头并以----- END CERTIFICATE -----

Then, concatenate your three PEM files into a single file. 然后,将三个PEM文件连接成一个文件。 The file will have three certificates in it. 该文件中将包含三个证书。 Call it mydomain-chain.pem , and load that into your server. 将其mydomain-chain.pemmydomain-chain.pem ,并将其加载到您的服务器中。 Also load myserver.key into your server. 还要将myserver.key加载到您的服务器中。

Don't do anything with Root CA Certificate - AddTrustExternalCARoot.crt . 不要对Root CA Certificate - AddTrustExternalCARoot.crt做任何事情。 Clients have to use it as a root. 客户端必须将其用作根。 There's no {use|need} to send it to the client in the ServerHello . 没有{use | need}将它发送到ServerHello的客户端。

You can test your setup with the following. 您可以使用以下方法测试您的设置。 Notice how the client uses the root: 请注意客户端如何使用root:

openssl s_client -connect myserver:443 -CAfile AddTrustExternalCARoot.crt

The command should end with Verify (0) OK or similar. 该命令应以Verify (0) OK或类似结束。

Failed to load keystore type JKS with path ../standalone/configuration/mydomain-chain.pem due to Invalid keystore format: which mean your keystore is not valid. 由于密钥库格式无效,无法使用路径../standalone/configuration/mydomain-chain.pem加载密钥库类型JKS:这意味着您的密钥库无效。 Dont create new one use the keystore file you were created while submitting csr file to them. 不要创建新的密钥库文件使用您向其提交csr文件时创建的密钥库文件。 Use same keystore if you change the keystore its not accept. 如果更改密钥库不接受,请使用相同的密钥库。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM