In this tutorial we’ll install the Debian Linux 9 (squeeze), Apache 2 with mpm-itk (to run each web as a isolated user),...
Create your private certificate authority (CA)
adminCreating a private CA can be useful if you have a lot of services encrypting data for internal use but don’t need the domain to be verified by a public CA like Verisign, Thawte etc. By importing the CA to all computers that will use these services users won’t get the a popup in IE and Firefox saying that the certificate is invalid.
1. Create a CA certificate
Create a private key for your CA:
openssl genrsa -des3 -out ca.key 4096
You will need to enter passphrase, this password will be used everytime you sign a certificate with this CA
Make sure unauthorized users don’t get access to your private key:
chmod 700 ca.key
Create the certificate, this will be shown as the top level certificate when you have signed other certificates so choose expiration day and the certificate contents carefully. All signed certificates will expirate if the top level certificate expires so you may want to choose a few years here
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt
Here is a sample of input values:
Enter pass phrase for ca.key:
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]:US
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Debian Tutorials
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:Debian Tutorials CA
Email Address []:
Common name will be shown when users are displaying details about the certificate
2. Create a certificate request
Create a private key:
openssl genrsa -des3 -out secure.debiantutorials.net.key 4096
Replace secure.debiantutorials.net by your domain name
Create the certificate request
openssl req -new -key secure.debiantutorials.net.key -out secure.debiantutorials.net.csr
Make sure you put your domain name in the “Common Name” field
3. Sign the certificate with your CA certificate
You will need to provide the certificate request here and the CA key
openssl x509 -req -days 365 -in secure.debiantutorials.net.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out secure.debiantutorials.net.crt
4. Remove password from key (optional)
If using the certificate with Apache, Postfix or other services you may need to replace the password in your private key so that the service can start without user interaction
openssl rsa -in secure.debiantutorials.net.key -out secure.debiantutorials.net.key.insecure
mv secure.debiantutorials.net.key secure.debiantutorials.net.key.secure
mv secure.debiantutorials.net.key.insecure secure.debiantutorials.net.key
Set permissions on the keys
chmod 700 secure.debiantutorials.net.key
chmod 700 secure.debiantutorials.net.key.secure