Enabling SSL on JBoss

本文详细介绍了如何使用Java工具生成证书密钥对,制作证书签名请求,并将其导入到keystore中。进一步指导如何在Tomcat服务器上进行SSL配置,实现HTTPS服务。包括了使用OpenSSL进行证书签名、证书转换等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.
<think>嗯,用户遇到了在Linux系统中启用wlan0接口监控模式失败的问题,错误提示是"Operation not supported"。这通常意味着网卡驱动或硬件本身不支持监控模式。 用户可能正在进行无线网络安全测试或网络分析,比如使用Wireshark抓取802.11帧,或者运行aircrack-ng等工具。ta的当前进展卡在了基础环境配置阶段,情绪可能有些挫败。 从技术角度看,这个问题需要分三层排查:首先是硬件兼容性,其次是驱动支持,最后是配置命令。特别要注意引用[2]提到的内核驱动中monitor模式的具体实现逻辑,这解释了为什么有些网卡即使加载了驱动也无法支持该模式。 用户提供的四个引用很有价值:引用[1]直接展示了错误现象;引用[2]揭示了驱动层的关键判断逻辑;引用[3]说明网卡识别问题;引用[4]则提供了特定工具的解决方案参考。不过用户没有提到是否使用特定工具如csitool,所以通用解决方案更合适。 排查路径应该从最基础的开始:先用lspci确认网卡型号,因为有些廉价网卡(如某些Realtek型号)确实硬件不支持监控模式。如果硬件支持,再看驱动——引用[3]提到的ifconfig wlan0 up是必要前提,但用户似乎已通过这个步骤。 特别值得注意的是引用[4]提到的编译问题,这提示我们:如果是自己编译的驱动,可能需要清理重建。不过对大多数用户而言,更常见的是需要安装backport驱动,就像解决方案里提到的ath9k_htc那种情况。 最后准备在回答里补充两个技术细节:一是用iw list检查支持模式比iwconfig更可靠;二是airmon-ng套件能自动处理驱动重载。不过后者可能会让输出过于冗长,所以决定放在补充说明里。</think>在 Linux 中启用 `wlan0` 接口的监控模式失败(错误提示:`Operation not supported`)通常由以下原因导致,请按顺序排查: --- ### 🔧 核心排查步骤 1. **检查网卡硬件支持** ```bash sudo iw list | grep -A 10 "Supported interface modes" | grep "monitor" ``` - ✅ **若有输出**:网卡支持监控模式 - ❌ **若无输出**:网卡硬件或驱动不支持(需更换网卡或安装驱动)[^1][^2] 2. **验证驱动兼容性** ```bash lsmod | grep -i <driver_name> # 如 ath9k, rtl88xxau, iwlwifi ``` - **常见问题**: - 开源驱动(如 `ath9k`)通常支持,闭源驱动可能受限 - 部分网卡需安装特定驱动(如 `rtl88xxau` 需手动编译) 3. **尝试替代工具激活** ```bash sudo airmon-ng start wlan0 # 使用 airmon-ng 工具(推荐) ``` - 自动处理驱动冲突(如杀死干扰进程)[^3] - 成功后会生成新接口名(如 `wlan0mon`) 4. **卸载并重载驱动** ```bash sudo modprobe -r <driver_name> # 卸载驱动 sudo modprobe <driver_name> # 重载驱动 sudo ip link set wlan0 up # 重新启用接口 ``` --- ### 🛠 高级解决方案 #### 情况1:网卡驱动不支持 - **安装兼容驱动**(以 Realtek RTL8812AU 为例): ```bash git clone https://github.com/aircrack-ng/rtl8812au.git cd rtl8812au make && sudo make install sudo reboot ``` #### 情况2:内核冲突或进程占用 - **终止干扰进程**: ```bash sudo airmon-ng check kill # 自动结束 NetworkManager 等进程 ``` #### 情况3:USB网卡供电/硬件问题 - 更换USB接口或使用带电源的USB Hub - 检查 `dmesg | grep wlan0` 是否有硬件报错 --- ### 📌 验证监控模式 成功激活后检查: ```bash iwconfig wlan0 | grep Mode # 输出应为:Mode:Monitor ``` --- ### 💎 总结流程 ```mermaid graph TD A[启用失败 Operation not supported] --> B{检查硬件支持 iw list} B -->|支持| C[用 airmon-ng 激活] B -->|不支持| D[更换网卡/编译驱动] C --> E[验证 iwconfig] E -->|成功| F[开始抓包/测试] E -->|失败| G[卸载重载驱动] G --> C ``` > ⚠️ **注意**:虚拟机中通常无法启用监控模式,需使用物理机或兼容的USB网卡。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值