Enabling SSL on JBoss

Step 1)
First of all, we are going to make a keystore. This is the place we are going to store the keys in on the serverside. We will use the Java-tool keytool for this. The algorithm used here is RSA.

At the selected directory:
keytool -genkey -alias <alias name> -keyalg RSA -keystore ./name.keystore

Fill in all the information that is asked.
A keystore with the name name.keystore is generated.

Step 2)
Then we have to make a Certificate Signing Request (CSR) for the Certificate Authority. We can get this signed by a certifying authority like verisign or thwate

keytool -certreq -keystore ./name.keystore -alias <alias name> -file < CSR file name>.csr

Enter the keystore password.
A < CSR file name>.csr file is generated.

If you are getting the CSR signed by a certifying authority, then skip the next step.
Step 3)
If you are using going to sign using your own CSR by using, for example, OpenSSL, then the steps are:

(This assumes that you are working on a Linux machine with OpenSSL, which can be obtained from www.openssl.org. Follow the procedure to install OpenSSL)
To Sign the certificate:
Make a new directory:

cd usr/local/
mkdir newCA

Copy openssl.cnf and CA.sh
from the OpenSSL apps directory to your new directory (newCA)
cp ../../openssl-0.9.6a/apps/openssl.cnf newCA/
cp ../../openssl-0.9.6a/apps/CA.sh newCA/

Edit your new copy of openssl.cnf and CA.sh:
Set the dir variable to the current directory
dir . # (“.” Specifies current directory where everything is kept)
Set the CATOP variable to the current directory:
CATOP=. # (“.” Specifies current directory where everything is kept)

Create the certificates for Certification Authority:
cd newCA
chmod 744 CA.sh (only if necessary)
CA.sh –newca
ls -l



Send the < CSR file name>.csr file to Certification authority and Creating Server Certificate

cp < CSR file name>.csr  /usr/local/newCA
or ftp the < CSR file name>.csr  file to the m/c acting as CA.
cd /usr/local/newCA

Create the certificate

openssl x509 -req -in < CSR file name>.csr -out <pem file name>.pem -CA cacert.pem -CAkey private/cakey.pem -CAcreateserial -days 365 -outform PEM

Optionally convert the server certificate from PEM encoding to DER for distributing to Clients:

openssl x509 -inform pem -outform der < cacert.pem > cacert.cer

We receive two files, cacert.der, containing the CA's public key and a file <pem file name>.pem, containing the public key signed by the CA using the CA's private key. I will now import these two files into my keystore (the order is important!):

Step 4)
keytool -import -alias <alias name> -file cacert.der -keystore ./name.keystore

Step 5)
keytool -import -alias <alias name> -file <pem file name>.pem  -keystore ./name.keystore


Important remark: if you get an exception that looks like this: java.security.NoSuchAlgorithmException: Algorithm TLS not available, take a look at this file: $JAVA_HOME/jre/lib/security/java.security. Check if the com.sun.net.ssl.internal.ssl.Provider is in the list of Providers:
#
# List of providers and their preference orders (see above):
#
security.provider.1=sun.security.provider.Sun
security.provider.2=com.sun.net.ssl.internal.ssl.Provider
security.provider.3=com.sun.rsajca.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider


And we have to add jcert.jar, jnet.jar and jsse.jar files to the $JAVA_HOME /jre/lib/ext folder and set the class path to the same.

Tomcat over SSL (HTTPS)
If we have Tomcat running as a jBoss service, we need to make a few changes in some configuration files:
1. $JBOSS_DIST/server/default/conf/jboss-service.xml
We want JaasSecurityDomain as SecurityManagerClass instead of JaasSecurityManager, so we need to change this in the file:
<!-- JAAS security manager and realm mapping -->
<mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
    name="jboss.security:service=JaasSecurityManager">
    <attribute name="SecurityManagerClassName">
        org.jboss.security.plugins.JaasSecurityDomain
    </attribute>
</mbean>

2. $JBOSS_DIST/server/default/conf/jboss-service.xml
Add the below lines after the paragraph mentioned above in jboss-service.xml

<mbean code="org.jboss.security.plugins.JaasSecurityDomain"
    name="Security:service=JaasSecurityDomain,domain=TomcatSSL">
    <depends>jboss.security:service=JaasSecurityManager</depends>
    <constructor>
        <arg type="java.lang.String" value="TomcatSSL" />
    </constructor>

    <attribute name="KeyStoreURL">put the path to your name.keystore file here</attribute>
    <attribute name="KeyStorePass">put your name.keystore password here</attribute>
</mbean>

3. $JBOSS_DIST/server/default/deploy/tomcat4-service.xml
This is the final step: We remove the Connector that listens on port 8080 and replace it by one that listens on port 8443

Add the following lines:

<Connector className="org.apache.catalina.connector.http.HttpConnector"
              port="8443" enableLookups="true" scheme="https" secure="true" debug="0">
                <Factory className="org.apache.catalina.net.SSLServerSocketFactory"
                         keystoreFile="d:\.keystore" keystorePass="123456" clientAuth="false" protocol="TLS"/>
            </Connector>

After:

<!-- A HTTP Connector on port 8080 -->
           <Connector className = "org.apache.catalina.connector.http.HttpConnector"
               port = "8080" minProcessors = "3" maxProcessors = "10" enableLookups = "true"
               acceptCount = "10" debug = "0" connectionTimeout = "60000"/>


When you connect to your server now, don't use port http://localhost:8080, use https://localhost:8443 instead. If you used a selfsigned certificate or if your CA is not known in your browser, a confirmation dialog box will open and ask if you 'trust' the issuer of the certificate.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux无法启动并显示"enabling bluetooth devices"(启用蓝牙设备)错误时,可能会有几个原因导致这个问题。下面是可能的解决方法: 1. 重新启动:首先,尝试重新启动计算机,有时候只是一个临时的问题。 2. 检查蓝牙设备:确认蓝牙设备是否已正确连接到计算机,并且处于开启状态。详细步骤可能因你使用的Linux发行版而有所不同。 3. 检查蓝牙驱动程序:确保已正确安装蓝牙驱动程序,并且驱动程序的版本与你的Linux发行版兼容。你可以在官方Linux支持页面上查找适用于你的蓝牙设备和Linux版本的最新驱动程序。如有必要,尝试更新或重新安装驱动程序。 4. 检查蓝牙服务:有时候,蓝牙服务可能未正确启动或出现故障。在终端中输入命令`sudo systemctl status bluetooth`来检查蓝牙服务的状态。如果显示为未运行或错误状态,尝试重新启动蓝牙服务(`sudo systemctl restart bluetooth`)或重启整个系统。 5. 检查配置文件:如果问题仍然存在,可能是配置文件出现了问题。尝试打开蓝牙服务的配置文件(通常位于`/etc/bluetooth/main.conf`或`/etc/bluetooth/bluetooth.conf`)并检查是否有任何错误或不一致的设置。如果有,请根据需要进行修改并保存更改。 如果上述的解决方法无效,那可能意味着你的蓝牙设备与Linux发行版不兼容或存在硬件故障。在这种情况下,你可以尝试在Linux社区或官方支持渠道上寻求帮助,或者考虑使用其他蓝牙适配器或设备。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值