我有一台运行 JBoss 的服务器。当我输入错误的 URL 到该服务器时,它会给我这样的版本:JBossWeb/2.0.1.GA - 那是什么版本的 JBoss?将为我购买并提供 SSL 证书,以便我可以将其安装在 JBoss 中。我真的很感激任何 HOWTO 或任何有关如何在 JBoss 上安装现成的 SSL 证书的信息。如果将从其他销售 SSL 证书的公司购买此 SSL 证书,我是否需要使用 openssl 生成任何文件?
在此先感谢您的帮助。
最佳答案
您可以生成自己的 SSL 证书:
首先您需要创建一个自签名证书。您可以使用 Java 附带的 keytools 应用程序执行此操作。打开命令提示符并运行以下命令。您需要更改 Jboss conf 目录的路径以反射(reflect)您的安装:
C:\>keytool -genkey -alias tomcat -keyalg RSA -keystore C:\jboss-2.0.1.GA\server\default\conf\localhost.keystore
当出现提示时,请在所有地方使用密码 changeit。请务必回答第一个问题的本地主机:
Enter keystore password: changeit
Re-enter new password: changeit
What is your first and last name?
[Unknown]: localhost
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]: NZ
Is CN=localhost, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=NZ correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password): changeit
Re-enter new password: changeit
Next up you need to configure tomcat to create a SSL connector.
Edit C:\jboss-2.0.1.GA\server\default\deploy\jboss-web.deployer\server.xml and find the commented out SSL connector example, uncomment it and tweak it as follows:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="${jboss.server.home.dir}/conf/localhost.keystore"
keystorePass="changeit"
/>
最后,将两个系统属性添加到您的 Jboss 启动命令中,以使 javax.net.ssl 库使用您的新 keystore 。仅当您需要向自己进行 SSL 调用时才需要这些。我需要它们,因为我有 CAS 和 3 个使用 CAS 进行身份验证的应用程序都在同一个开发 Jboss 实例中运行:
-Djavax.net.ssl.trustStore=C:\jboss-2.0.1.GA\server\default\conf\localhost.keystore
-Djavax.net.ssl.trustStorePassword=changeit
好的,现在浏览到 http://localhost:8443/
您的浏览器会提示自签名证书。只需按照浏览器的说明将此证书添加为安全异常(exception),这样您就不会再收到提示,您就大功告成了。
关于ssl - 在 JBoss 上安装 SSL 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17394478/