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.
分享到:
相关推荐
延迟队列插件
Bulletproof SSL and TLS by Ivan Ristić Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
### 启用IPv6无线传感器网络的网络层安全 #### 概述 随着技术的发展与融合,IPv6在无线传感器网络(WSN)中的应用变得越来越普遍。这不仅得益于IETF(互联网工程任务组)下属的6lowpan工作组的努力,还因为IPv6...
《RF技术在6G中的应用白皮书——技术与频谱的机会与挑战》是由芬兰奥卢大学发布的关于6G通信的深度研究报告。该白皮书深入探讨了6G通信技术的发展前景、面临的挑战以及可能的应用场景,对于理解6G通信的未来趋势具有...
**应用链接启用 (Application Link Enabling, ALE)** ALE 是 SAP 系统中的一个关键技术,用于在不同组件、模块或系统之间实现数据的实时、自动传输。在本例中,ALE 被用于在一个 SAP 系统内连接两个公司(A 和 B)...
COBIT 5是全球公认的IT治理和管理框架,旨在帮助IT专业人员和企业领导在确保信息系统(IS)的可信度、安全性、风险和控制等方面履行其职责,并向业务交付价值。ISACA,即信息系统审计与控制协会,是一个拥有95,000名...
PAPER_07_Enabling 6.4-Gbps pin LPDDR5 using bandwidth Improvement Techniques.pdf
On-chip communication architectures are critical components of modern SoCs, enabling efficient data transfer between various functional units such as processors, memory subsystems, and I/O interfaces....
区块链技术是一种分布式账本技术,它通过智能地融合对等网络(P2P)、密码学、分布式共识协议和智能合约等技术,构建了一个可在不信任的网络节点之间建立信任的环境。随着其不可变性、透明性和共识的特性,区块链技术...
COBIT是ControlledObjectives for Information and Related Technology的缩写,即信息及相关技术的控制目标。COBIT是 ISACA(信息系统审计和控制联合会)制订的面向过程的信息系统审计和评价的标准。...
Configuring verbose logging for TCP and HTTP-based services • Enabling SSL encryption, gzip compression and geolocation • Modifying HTTP headers, rewriting URLs and setting up redirects • ...
The notion of ontologies is crucial for the purpose of enabling knowledge sharing and reuse. The Handbook on Ontologies provides a comprehensive overview of the current status and future prospectives...
### Java Fast Sockets (JFS):实现高性能集群上的高速Java通信 #### 1. 引言 随着计算技术的发展,高性能计算(High Performance Computing, HPC)领域的需求日益增长,尤其是在并行和分布式计算方面。...
《软件定义无线电使能技术》一书,由Walter Tuttlebee编辑,是Wiley系列在软件无线电领域的权威著作之一,出版于2002年。本书深入探讨了软件无线电的关键技术和潜在应用,旨在为全球移动和个人电信行业的工业界、...
### 关键使能技术(Key Enabling Technologies, KETs)的重要性及战略意义 #### 执行摘要 **关键使能技术对于欧洲的战略重要性** 2020年欧洲战略明确指出,工业竞争力对于促进经济增长与创造就业至关重要,同时也...
### PRISM:实现个人验证代码完整性、未篡改执行及遗留系统上的可信I/O #### 概述 PRISM是一项由Jason Franklin、Mark Luk、Arvind Seshadri和Adrian Perrig等人于2007年在卡内基梅隆大学(Carnegie Mellon ...
SubTrack: Enabling Real-Time Tracking of Subway Riding on Mobile Devices
Enabling the Cerner Instant Access Solution for the Physicia.pdf
6G GAP ANALYSIS AND CANDIDATE ENABLING TECHNOLOGIES.rar