Search

Пользовательский поиск

Thursday, 8 September 2011

Install a self-signed certificate for testing HTTPS/SSL

U should create  three files:
  •  a self-signed certificate file (ssl-cert.crt), which  is used by Browser.
  •  a public key file(ssl-cert.pfx) with proof of identity for signed and/or encrypted message, which  is used by Browser. The public key can be derived from its corresponding private key.
  • a privet key file(ssl-cert-private.key),  which is used by Apache.
How to Create the SSL X.509 Certificates? 


 Import certificate into Google Chrome (other browsers - try to figure it out on your own):
  • Go to Preferences, click "Under the hood".
  • Under HTTPS/SSL, click on "Manage Certificates".
  • Click "Import..." and import your ssl-cert.pfx file. Your certificate should appear now in the list of "Your Certificates".
  • Go to "Authorities", click "Import.." and import your ssl-cert.crt file. The name should now appear under the list of Authorities.
Configure Apache to work with SSL
  • Execute: 
           sudo cp ssl-cert.crt /etc/ssl/certs; 
           sudo cp ssl-cert-private.key /etc/ssl/private/ 
           sudo a2enmod ssl
           cd /etc/apache2/sites-enabled/; 
           sudo ln -s ../sites-available/default-ssl 000-default-ssl
  • Edit /etc/apache2/sites-available/
default-ssl, and replace the following lines:         SSLCertificateFile    /etc/ssl/certs/ssl-cert-



snakeoil.pem
        SSLCertificateKeyFile /etc/ssl/private/ssl-cert-



snakeoil.key
  • With the following lines:
       #SSLCertificateFile    /etc/ssl/certs/ssl-cert-



snakeoil.pem
         SSLCertificateFile /etc/ssl/certs/ssl-cert.crt
      #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-



snakeoil.key
        SSLCertificateKeyFile /etc/ssl/private/ssl-cert-



private.key 
  • Restart Apache by executing the following command: 
        sudo service apache2 restart 


Now when you access the website your certificate should be valid.

No comments:

Post a Comment