Web Security
[ Home ] [ Slides ] [ Examples ] [ Exercises ] [ Resources ]

Exercise HTTPS, Certificates and PKI

Solutions for this exercise

We want to install a Secure application

First step is to create an application that needs to be secured.

Create certificates

We need to create:

Tools

In this exercise, we use the Apache mod_ssl module, such as the Openssl software. Both are contained in the XAMPP distribution.
We will use the file httpd.conf that contains the main configurations of Apache. This file referes to another file extra/httpd-ssl.conf which contains the configurations for the mod_ssl module.
The server is preinstalled with self signed certificate and key, which are stored in the directories ssl.crt/ (CRT for certificate) and ssl.key/. The following lines in the config file correspond to the two directories:
SSLCertificateFile /opt/lampp/etc/ssl.crt/server.crt
SSLCertificateKeyFile /opt/lampp/etc/ssl.key/server.key

Creation of a Certifiate Authority (CA)

In the config directory of XAMPP, you find a file openssl.cnf (on the Linux platform it may be found in the directory /opt/lampp/etc/). You may edit this file if you want to change default values for the creation of a new certificate (country, Organisational Unit, etc.).
Execute the following command in a working directory:
/opt/lampp/bin/CA.pl -newca
(for windows, you may use CA.BAT or CA.pl (even if the file is a phps file, rename it as CA.pl) instead)
Just fill out all the questions. This program creates a directory ./demoCA which contains all the demo files needed.
If you are under windows, this part may not work at all, so you can simply download a demoCA directory demoCA.zip. In this version, the passphrase is albert (it is used to access the private key of the CA).
Now, we are the certificate authority.

Configure Apache to recognise users authentified by this CA

Edit extra/httpd-ssl.conf

Create Certificate for new Users

Configure your browser(s)

Restrict access only to the folder secureArea


Copyright Emmanuel Benoist 2008-2013