http://www.tc.umn.edu/~brams006/selfsign_ubuntu.html
Install Software
sudo apt-get install openssl apache2
Create CA
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
Create Server Key
openssl genrsa -des3 -out server.key 4096
openssl req -new -key server.key -out server.csr
Sign Certificate
openssl x509 -req -days 730 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
Verify Result
openssl rsa -noout -text -in server.key
openssl req -noout -text -in server.csr
openssl rsa -noout -text -in ca.key
openssl x509 -noout -text -in ca.crt
Make Apache Quiet
openssl rsa -in server.key -out server.key.insecure
mv server.key server.key.secure
mv server.key.insecure server.key
Results
server.crt: The self-signed server certificate.
server.csr: Server certificate signing request.
server.key: The private server key, does not require a password when starting Apache.
server.key.secure: The private server key, it does require a password when starting Apache.
ca.crt: The Certificate Authority's own certificate.
ca.key: The key which the CA uses to sign server signing requests.
server.csr: Server certificate signing request.
server.key: The private server key, does not require a password when starting Apache.
server.key.secure: The private server key, it does require a password when starting Apache.
ca.crt: The Certificate Authority's own certificate.
ca.key: The key which the CA uses to sign server signing requests.
Move files
sudo mkdir /etc/apache2/ssl
sudo cp server.key /etc/apache2/ssl
sudo cp server.key /etc/apache2/ssl
sudo cp server.crt /etc/apache2/ssl
Setup SSL module
sudo ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl
sudo mkdir /var/www-ssl
sudo su
cd /etc/apache2/sites-available
cp /etc/apache2/sites-available/default default_original
cp /etc/apache2/sites-available/default-ssl default-ssl_original
cd /etc/apache2/sites-available
cp /etc/apache2/sites-available/default default_original
cp /etc/apache2/sites-available/default-ssl default-ssl_original
Make Sure below in the default-ssl configuration file
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
No comments:
Post a Comment