Wednesday, December 08, 2004

Setting up java tomcat on linux VII - HowTo make your own Self-Signed SSL Certificate

cd /usr/local/ssl/bin

### Create server key

openssl genrsa -out mysite.key 1024

Generating RSA private key, 1024 bit long modulus
........................................++++++
....++++++
e is 65537 (0x10001)

### Create certificate request

openssl req -new -key mysite.key -out mysite.csr

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:GB
State or Province Name (full name) [Some-State]:Norfolk
Locality Name (eg, city) []:Norwich
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Manic Miner Ltd
Organizational Unit Name (eg, section) []:Web Development
Common Name (eg, YOUR name) []:dooley.com
Email Address []:webmaster@dooley.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:freedom1
An optional company name []:Manic Miner Ltd

### self sign key (increment the serial number "N" for each new cert)

openssl x509 -req -days 365 -set_serial 001 -in mysite.csr -signkey mysite.key -out mysite.crt

Signature ok
subject=/C=GB/ST=Norfolk/L=Norwich/O=Manic Miner Ltd/OU=Web Development/CN=mysite/emailAddress=webmaster@mysite
Getting Private key

cp myhost.mydomain.* /usr/local/apache2/conf

#edit http.conf (or ssl.conf) file

SSLCeritifcateFile /usr/local/apache2/conf/myhost.mydomain.cert
SSLCertificateKeyFile /usr/local/apache2/conf/myhost.mydomain.key

No comments:

Post a Comment