Digi-Access™ Setup and Implementation on Apache 1.3 (mod_ssl) Web Server
1. Enabling SSL communication security on Apache 1.3 web server
1.1 Generating a Certificate Signing Request (CSR) using Apache 1.3
1.2 Installing your Digi-SSL™ Certificate on Apache 1.3
1.2.1 Installing your Digi-SSL™ Certificate
1.2.2 Installing the CA Chain file containing the Root & Intermediate Certificates
2. Enabling Client Certificate Authentication on Apache web server
2.1 Obtaining the Digi-Sign Certification Authority Certificate Chain
2.2 Configuring Apache 1.3 for Digi-Access™ Client Certificate Authentication
3. Obtaining a Digi-ID™ [1] Client Certificate from Digi-Sign
3.1 Applying for a Digi-ID™ Certificate
3.2 Activating and Installing a Digi-ID™ Certificate
Table 1 - Standard CGI/1.0, Apache and SSL related variables
Table 2 - SSI/CGI Environment Variables 10
To enable the SSL facility on Apache 1.3, an SSL (Digi-SSL™) certificate is required.
Digi-SSL™ certificate can be obtained directly from Digi-Sign and requires a CSR (Certificate Signing Request) code.
A CSR is a file/string containing your certificate application information, including your Public Key, Company Name and the Common Name (in most cases FQDN - Fully Qualified Domain Name host name).
Generate your CSR and then copy and paste the contents of the CSR file into the
Digi-Sign Digi-SSL™ web application form:
https://www.digi-sign.com/order/digi-ssl/index.php [2]
To generate keys (private and public) and Certificate Signing Request do:
For a 128 bit Certificate:
openssl req -new -newkey rsa:1024 -keyout myserver.key -nodes -out server.csr
For a 256 bit Certificate:
openssl req -new -newkey rsa:2048 -keyout myserver.key -nodes -out server.csr
This creates two files. The file myserver.key contains a private key; do not disclose this file to anyone. Carefully protect the private key.
In particular, be sure to backup the private key, as there is no means to recover it should it be lost. The private key is used as input in the command to generate a Certificate Signing Request (CSR).
You will now be asked to enter details to be entered into your CSR. What you are about to enter is what is called a Distinguished Name or a DN.
For some fields there will be a default value, If you enter '.', the field will be left blank.
Please enter the following 'extra' attributes to be sent with your certificate request
A challenge password []:
An optional company name []:
-----
Use the name of the web server as Common Name (CN). If the domain name is mydomain.com append the domain to the hostname (use the fully qualified domain name).
The fields email address, optional company name and challenge password can be left blank for a web server certificate.
Your CSR will now be created. Open the server.csr in a text editor and copy and paste the contents into the online enrolment form when requested.
When you make your application, make sure you include the CSR in its entirety into the appropriate section of the Digi-SSL™ web application form – including:
You will receive 2 Certificates from Digi-Sign. When viewed in a text editor, these certificates will look something like:
Save/upload these Certificates to the web server configuration directory (or other safe directory on the server hard drive that you will be using to hold your certificates). In this example we will use /etc/ssl/crt/. Both the public and private key files will already be in this directory. The private key used in the example will be labeled private.key and the public key will be yourdomainname.cer.
It is recommended that you make the directory that contains the private key file only readable by root.
You will need to install the chain certificates (root and intermediates) in order for browsers to trust your certificate.
As well as your Digi-SSL™ certificate (yourdomainname.cer), two other certificates, named UTN-USERFirst-Hardware.crt and Digi-SignCADigi-SSLXp.crt or Digi-SignCADigi-SSLXs.crt, might also be attached to the email from Digi-Sign.
Apache users will not require these certificates. Instead you can install the root and intermediate certificates (CA Chain) using a 'bundle' file method. The CA 'bundle' file - in most cases will be attached to the email from Digi-Sign, however you can also download it from the following URLs:
CA Bundle for Digi-Acess™ setup with Digi-SSL™ Xp CA:
http://www.digi-sign.com/downloads/certificates/digi-access/BundledCAXp.pem [3]
CA Bundle for Digi-Acess™ setup with Digi-SSL™ Xs CA:
http://www.digi-sign.com/downloads/certificates/digi-access/BundledCAXs.pem [4]
In the Virtual Host settings for your site, in the httpd.conf file (or other file where you keep your Virtual Host configuration), you will need to complete the following:
If you are using a different location and certificate file names you will need to change the path and filename to reflect your server.
The SSL section of the updated httpd config file should now read similar to this example (depending on your naming and directories used):
SSLCertificateKeyFile /etc/ssl/crt/private.key
SSLCACertificateFile /etc/httpd/conf/ca-bundle/BundledCA.cer
Important: Save your httpd.conf file and restart Apache.
To enable Client Certificate Authentication on Apache 1.3 you will need to obtain your own Digi-ID™ [1] Client Certificate, Certification Authority Certificate Chain (CA Chain) and setup Authentication Rules using the httpd.conf file and Apache configuration directives.
Since Apache is using the SSLCACertificateFile configuration directive to point to the Certification Authority Chain for both SSL Certificates [5] and Client Certificate Authentication, assuming you have already setup this directive in step 1.2.2, you can omit this section.
If however, you have not obtained/received the ca-bundle file, you may download it from the following URLs:
CA Bundle for Digi-Acess™ setup with Digi-SSL™ Xp CA:
http://www.digi-sign.com/downloads/certificates/digi-access/BundledCAXp.pem [3]
CA Bundle for Digi-Acess™ setup with Digi-SSL™ Xs CA:
http://www.digi-sign.com/downloads/certificates/digi-access/BundledCAXs.pem [4]
To configure Apache, do:
- Open for editing the httpd.conf Apache configuration file
- Locate the Virtual Host section for your SSL secured site
- You will need to decide whether you wish to secure the entire site or just a particular directory. Both options will use the same Apache configuration directives, however if you wish to implement per directory authentication, you will need to add all of the necessary directives below into the specified directory options section, i.e. within the following directory directives:
- Add the following directive line into your site/directory configuration section:
SSLOptions +StdEnvVars +ExportCertData
This directive can be used to control various run-time options on a per-site and per- directory basis. Normally, if multiple SSLOptions could apply to a directory, then the most specific one is taken completely; the options are not merged. However if all the options on the SSLOptions directive are preceded by a plus (+) or minus (-) symbol, the options are merged. Any options preceded by a (+) are added to the options currently in force, and any options preceded by a (-) are removed from the options currently in force.
When the option StdEnvVars is enabled, the standard set of SSL related CGI/SSI environment variables are created. This per default is disabled for performance reasons, because the information extraction step is a rather expensive operation. Enable this option for CGI and SSI requests only.
When the option ExportCertData is enabled, additional CGI/SSI environment variables are created: SSL_SERVER_CERT, SSL_CLIENT_CERT and SSL_CLIENT_CERT_CHAIN (with n = 0,1,2,..). These contain the PEM-encoded X.509 Certificates of server and client for the current HTTPS connection and can be used by CGI scripts for deeper Certificate checking. Additionally all other certificates of the client certificate [6] chain are provided, too. This bloats up the environment a little bit which is why you have to use this option to enable it on demand.
The expression must match the following syntax (given as a BNF grammar notation):
comp ::= word "==" word | word "eq" word
| word "!=" word | word "ne" word
| word "<" word | word "lt" word
| word "<=" word | word "le" word
| word ">" word | word "gt" word
| word ">=" word | word "ge" word
| word "in" "{" wordlist "}"
| word "=~" regex
| word "!~" regex
wordlist ::= word
| wordlist "," word
word ::= digit
| cstring
| variable
| function
digit ::= [0-9]+
cstring ::= "..."
variable ::= "%{" varname "}"
function ::= funcname "(" funcargs ")"
while for varname any variable from Table 1 can be used. Finally for funcname the following functions are available: file(filename)
This function takes one string argument and expands to the contents of the file. This is especially useful for matching these contents against a regular expression, etc.
Notice that expression is first parsed into an internal machine representation and then evaluated in a second step. Actually, in Global and Per-Server Class context expression is parsed at start-up time and at runtime only the machine representation is executed. For Per-Directory context this is different: here expression has to be parsed and immediately executed for every request.
For more information about the above directive, visit the Apache home website (http://www.apache.org [7]) or contact Digi-Sign Support at support@digi-sign.com [8]
- Some Apache versions, depending if you are implementing a CGI application with
Digi-Access™ may require the following directive to be present:
This directive defines environment variables based on attributes of the request. These attributes can be the values of various HTTP request header fields (see RFC2616 (http://www.rfc-editor.org/rfc/rfc2616.txt [9]) for more information about these), or of other aspects of the request, including the following:
If the attribute name doesn't match any of the special keywords, nor any of the request's header field names, it is tested as the name of an environment variable in the list of those associated with the request. This allows SetEnvIf directives to test against the result of prior matches.
Only those environment variables defined by earlier SetEnvIf[NoCase] directives are available for testing in this manner. 'Earlier' means that they were defined at a broader scope (such as server-wide) or previously in the current directive's scope.
Important: Save your httpd.conf file and restart Apache.
Links:
[1] http://www2.digi-sign.com/digi-id
[2] https://www.digi-sign.com/order/digi-ssl/index.php
[3] http://www.digi-sign.com/downloads/certificates/digi-access/BundledCAXp.pem
[4] http://www.digi-sign.com/downloads/certificates/digi-access/BundledCAXs.pem
[5] http://www2.digi-sign.com/ssl+certificate
[6] http://www2.digi-sign.com/digital+certificate
[7] http://www.apache.org
[8] mailto:support@digi-sign.com
[9] http://www.rfc-editor.org/rfc/rfc2616.txt