[Top] [Prev] [Next] [Last]
|
|
Chapter 2Authentication and Encryption
- protecting private information with encryption
- authenticating sites and clients with X.509 certificates
This chapter discusses authentication and encryption topics, including
- SSL and TLS
- encryption
- authentication
- site certificates and keys
- client authentication
- proxy authentication
- private certification authorities
- server security utilities
SSL and TLS
Transport Layer Security (TLS)
- an open, standards-based solution,
- more non-proprietary ciphers,
- better error reporting, and
- HMAC digests instead of MD5.
You can find specifications and other detailed information about TLS at http://www.ietf.org/html.charters/tls-charter.html. At present, few clients support it. However, TLS is expected to be intergrated into many client products in the near future. In particular, the Mozilla Crypto Group is integrating SSLeay, including TLS support, into Netscape's newly released browser source code. For information about this project, see http://mozilla-crypto.ssleay.org/.
Enabling SSL or TLS
SSLFlag on
This directive enables both authentication and encryption functions. You must also include this directive in the main section of your httpd.conf file in order to enable SSL for you main host. You must also choose which protocols the host implements, using the SSLProtocol directive. Stronghold Web Server can implement SSL version 2, SSL version 3, TLS version 1, or all three, depending on how this directive is set.
- to enable all protocols
SSLProtocol all
- to enable all protocols except TLS
SSLProtocol all -TLSv1
- to enable SSL version 3 and TLS version 1
SSLProtocol SSLv3 TLSv1
When TLS is enabled, all SSL directives also pertain to TLS operations. For example, the SSLCipherList directive sets the ciphers that Stronghold uses under SSL. If TLS is also enabled, Stronghold uses the same cipher set for TLS transactions. Likewise, Stronghold uses the server certificates specified by SSLCertificateFile for TLS authentication. All SSL directives can be used with TLS.
Encryption
Ciphers fall into two categories:
- Public key ciphers require two keys: a public key and a private key. The public key encrypts data, but it cannot decrypt the same data. Only the private key can decrypt material that is encrypted with the public key.
Figure 2-1: Encryption and Decryption with Public Key Cryptography
- Symmetric ciphers use a single key for all operations. Under this scheme, the sender and the recipient share the same key and use it for both encryption and decryption.
Figure 2-2: Encryption and Decryption with Symmetric Cryptography
Figure 2-3: Session Key Exchange
The beginning of a secure Web session works like this:
- The client submits a request for a secure file.
- Stronghold Web Server returns its site certificate, which contains the site's public key.
Stronghold may also ask for a client certificate for authentication purposes. Certificates and authentication are discussed in detail in "Authentication" on page 2-9.
- The client generates a session key.
- The client encrypts the session key using the server's public key.
- The client sends the encrypted session key to the server.
- The server uses its private key to decrypt the session key.
- The server encrypts its subsequent responses with the new session key.
- The client encrypts its replies with the session key.
Generating an Encryption Key Pair
Every key pair must be accompanied by a site certificate in order to work. Every host on your server-including all virtual hosts-must have its own key pair and certificate. Stronghold's genkey utility generates a key pair for any host, calls genreq to generate a certificate signing request (CSR), and then calls gencert to create a temporary certificate. You must run genkey for each host on your server. "Site Certificates and Keys" on page 2-12 provides complete instructions for using this utility.
Controlling Stronghold's Ciphers
The security of a cipher depends on
- the size of the key it uses,
- its endurance under the scrutiny of cryptographers, and
- the complexity of its mathematical algorithm.
Stronghold interoperates with these ciphers:
You can see a list of the available ciphers by running the following command:
# ssleay ciphers -v
- SSLCipherList and SSLProxyCipherList apply only to a virtual host and to all objects on that host that do not have either of the other two directives. Although it differs in context, it performs the same function as SSLRequireCipher.
- SSLRequireCipher specifies ciphers that are required for access to an object.
- SSLBanCipher specifies ciphers that are forbidden for access to an object.
The value for each of these directives is a colon-separated list of ciphers. Use the cipher abbreviations shown in the table above. SSLCipherList can also take a number of aliases as values, shown in the table on page 7-110. For example, the following configuration allows three different ciphers for access to the virtual host and (by default) its /about/ directory, but only two for access to its /employees/ directory:
<VirtualHost www.mpp.org:443>
SSLFlag on
SSLCipherList DES-CBC3-MD5:DES-CBC3-SHA:RC4-MD5
<Directory /about/>
FancyIndexing on
</Directory>
<Directory /employees/>
SSLRequireCipher DES-CBC3-MD5
SSLRequireCipher DES-CBC3-SHA
</Directory>
</VirtualHost>
<Directory /links/>
SSLBanCipher NULL-MD5:EXP-RC2-CBC-MD5:EXP-RC4-MD5
</Directory>
NOTE: Use either SSLRequireCipher or SSLBanCipher. Never use both for the same object.
Authentication
- information about the certificate's format
- a unique serial number
- information about the algorithm used to sign the certificate
- the name of the CA that issued the certificate
- the validity period of the certificate
- identifying information about the "subject" or the entity to whom the certificate belongs
- the subject's public key
- the issuing CA's signature
- the certificate belongs to the entity that provided it
- the public key in the certificate belongs to the same entity
- the certificate and the public key have been validated by the CA whose name appears on the certificate
- no one has tampered with the certificate
Stronghold Web Server uses two kinds of certificates:
- Site certificates authenticate Stronghold to clients.
These are discussed in "Site Certificates and Keys" on page 2-12.
- Client certificates authenticate Stronghold to remote servers.
These are discussed in "Client Authentication" on page 2-16.
Independent Certification Authorities
Each of these offers site certificates and client certificates to the general public for a fee, and each is widely accepted around the world. If you are running Stronghold Web Server over the World Wide Web, you must have a site certificate signed by one of these CAs in order to attain credibility when performing secure transactions. Likewise, it's a good idea to accept only client certificates signed by these CAs, unless you choose to run your own private CA as described in "Private Certification Authorities" on page 2-11.
For policy information and current rates, consult the Web site of the CA you intend to petition for a certificate. If you have purchased the Stronghold/Thawte bundle, see "Acquiring a New Certificate and Key Pair" on page 2-12 for information about obtaining your Thawte certificate.
Private Certification Authorities
"Private Certification Authorities" on page 2-22 explains how to create and run a private Certification Authority.
Site Certificates and Keys
- Certificates are stored at ServerRoot/ssl/certs/hostname.cert.
- Key files are stored at ServerRoot/ssl/private/hostname.key.
This section shows you how to acquire, install, and manage site certificates and key pairs.
Acquiring a New Certificate and Key Pair
Figure 2-4: Key Pair and Certificate Generation
NOTE: Since browsers do not recognize your site as a trusted CA, the temporary certificate provides no authentication. A client that encounters a test certificate passes a warning to the user. You must acquire a certificate from a trusted CA in order to conduct secure transactions over the Web.
- Verisign publishes its pricing information at http://www.verisign.com/enroll.s/payment.html and its secure server service agreement at http://www.verisign.com/enroll.s/legal.html.
- Thawte provides a rate table at https://www.thawte.com/pricing.html.
- If you want to use a different CA, be sure to choose one that the clients who access your site can accept.
Stronghold Web Server's installation script also runs genkey as part of the setup sequence. "Requesting a New Certificate for an Existing Key Pair" on page 2-39 provides complete instructions for generating a key pair and requesting a matching certificate.
Installing a Site Certificate
To install a site certificate
- Save the email-attached certificate file in a temporary location, such as /tmp/cert.tmp.
- Run getca, specifying the name of the host that owns this certificate and providing the temporary file as input:
# getca hostname < /tmp/cert.tmp
- Restart Stronghold:
# ServerRoot/reload
- Enter your pass phrase.
Renewing an Expired Certificate
Site certificates are generally issued and billed for one-year periods. Stronghold notifies the server administrator via email when a site certificate is about to expire. You can use the genreq utility to request a new certificate. It asks you for the same information you entered when you first applied for a site certificate. After you use genreq to submit the request, your CA sends you a new certificate via email and bills you for another year. For full instructions, see "Requesting a Renewed Certificate" on page 2-36.
The new certificate you receive is identical to the original, except for its expiration date. After moving your old certificate, you can install the new one as described in "Installing a Site Certificate" on page 2-14. The original key pair works with the new certificate; you do not need to generate a new one.
Troubleshooting Mismatched Certificates and Keys
- the certificate file contains the same public key as the key file
- the key file contains the private key that matches the public key in the certificate file
RSA decrypt error - i=-1 enc_bits=5
To compare a certificate to a key pair
- Run checkcert, specifying the name of the host whose certificate and key you want to check:
# checkcert hostname
- Enter the pass phrase for the host you specified.
- If the certificate and the key pair match, checkcert prints this message and then exits:
Cert hostname.cert matches key hostname.key
- If the certificate and the key pair do not match, check cert responds
The cert stored in
/usr/local/www/ssl/certs/hostname.cert
does not match the key stored in
/usr/local/www/ssl/private/hostname.key.
- If the certificate does not match the key file, press Return.
- If you have another key file associated with this host, move it to the ServerRoot/ssl/private/ directory and run checkcert again to see whether that key pair matches the certificate.
- If you have another certificate file associated with this host, move it to the ServerRoot/ssl/certs/ directory and run checkcert again to see whether that certificate matches the key pair.
- If you cannot match a key file with a valid certificate file, use genreq to request a new certificate that matches an existing key file:
# genreq hostname
Client Authentication
Users can obtain client certificates from an independent CA or a private CA. Client certificates issued by major CAs are designed to provide authentication that any secure server can accept. Stronghold recognizes certificates signed by Verisign and Thawte, and you can add other CAs as described in "Installing New Client CA Certificates" on page 2-18. Certificates issued by private CAs provide authentication only when a user accesses the CA's site. If you run a private CA, for example, other sites do not recognize your organization as a valid CA. Only your organization can verify client certificates signed by your CA.
Controlling Access with Client Certificates
SSLVerifyClient indicates whether a client certificate is required in order to access a host. It has three possible values:
Option Description 0 A client certificate is not needed for access to the host 1 A client certificate is optional for access to the host 2 A client certificate is required for access to the host A client certificate can be used for access control if
- SSLVerifyClient is set to 2,
- Stronghold successfully verifies the certificate's signature, and
- the SSL_Require directive is set.
SSL_Require sets the criteria under which Stronghold Web Server accepts client certificates for access to an object. A client certificate must meet this criteria in order to receive the requested material. This directive's value can be
- "any," meaning that any valid certificate can be used to access the object
- "none," meaning that no certificate is acceptable for accessing the object
- an expression that specifies the content or format of an acceptable certificate
An SSL_Require expression can specify the size of the key used to sign the certificate, the algorithm used to generate the public key contained in the certificate, the geographical location of the certificate's owner, or any other parameter that client certificates contain. For example, you can accept only certificates that belong to clients in Denmark, were issued by your private CA, contain public keys larger than 512 bits, have previously been logged by the server, or belong to Sameer Parekh. The complete rules for building SSL_Require expressions appear on page 7-97.
SSL_Group is a related directive that allows you to create client authentication groups whose members all meet the same criteria. Its valid values are identical to those for SSL_Require, except that the certificate criteria is preceded by a group name. You can use the group name as the value for SSL_Require, specifying that the certificate must meet the criteria for that group. If you use the same client certificate criteria for many different objects, SSL_Group provides a convenient shortcut.
Installing New Client CA Certificates
There are two ways to install a CA certificate:
- append the certificate to the SSLCACertificateFile file
- save the certificate file in the SSLCACertificatePath directory
To append a CA certificate to the root file
- Make sure the new CA certificate is in PEM format.
- Switch to the ServerRoot/ssl/CA/ directory:
# cd ServerRoot/ssl/CA
- Append the new CA certificate to the existing certificate file:
# cat newcert.pem >> client-rootcerts.pem
- If you are installing a certificate chain, repeat these steps for each certificate in the chain.
To save a CA certificate in the CA directory
- Make sure the new CA certificate is in PEM format.
- Copy the certificate file to the ServerRoot/ssl/CA/ directory:
# cp newcert.pem ServerRoot/ssl/CA/newcert.pem
- Switch to the ServerRoot/ssl/CA/ directory.
- Create a hash of the certificate file using the ssleay x509 utility:
# ssleay x509 -hash -noout < newcert.pem
5a35be
- Rename the certificate according to its hash:
# mv newcert.pem 5a35be.0
# ln -s newcert.pem 5a35be.0
- If you are installing a certificate chain, repeat these steps for each certificate in the chain.
Proxy Authentication
- Normal proxy service (configured with ProxyRequests) uses the CONNECT protocol. Normal proxy service passes the browser's client certificate to the remote server during SSL and TLS transactions. The remote server then authenticates the browser and not the proxy server. The browser verifies the remote server's site certificate.
- Mirror proxy service (configured with ProxyPass) uses two separate SSL or TLS connections when the browser specifies the HTTPS protocol: one connection between the browser and the proxy, and one between the proxy and the remote server. Under this configuration, the proxy server verifies the remote server's site certificate, and the remote server may require a proxy client certificate from the proxy server.
Proxy Client Certificates
NOTE: Never use any client certificate other than one specifically intended for the proxy server. If you use a personal client certificate, other users can use the proxy server to access secure sites that accept your certificate.
- perform all SSLor TLS proxy transactions using a normal proxy configuration or
- request a proxy client certificate from a private CA.
Remote servers on the Internet may not accept proxy client certificates issued by a private CA, because they do not have the CA's certificate on file and have no means of verifying the signature. A proxy client certificate from a private CA works best on a private network where all servers are configured to recognize the private CA. For more information, see "Private Certification Authorities" on page 2-22.
Once you have obtained a proxy client certificate, you must use SSLProxyMachineCertPath or SSLProxyMachineCertFile to set its location. If you have multiple proxy client certificates, you can store them in separate files in the SSLProxyMachineCertPath, or append them to the SSLProxyMachineCertFile.
Remote Server Authentication
- RSA Data Security
- Verisign
- Thawte Consulting
There are two ways to install a CA certificate:
- append the certificate to the SSLProxyCACertificateFile file
- save the certificate file in the SSLProxyCACertificatePath directory
To append a CA certificate to the root file
- Make sure the new CA certificate is in PEM format.
- Switch to the ServerRoot/ssl/CA/ directory:
# cd ServerRoot/ssl/CA
- Append the new CA certificate to the existing certificate file:
# cat newcert.pem >> server-rootcerts.pem
- If you are installing a certificate chain, repeat these steps for each certificate in the chain.
To save a CA certificate in the CA directory
- Make sure the new CA certificate is in PEM format.
- Copy the certificate file to the ServerRoot/ssl/CA/ directory:
# cp newcert.pem ServerRoot/ssl/CA/newcert.pem
- Switch to the ServerRoot/ssl/CA/ directory.
- Create a hash of the certificate file using the ssleay x509 utility:
# ssleay x509 -hash -noout < newcert.pem
5a35be
- Rename the certificate file according to its hash:
# mv newcert.pem 5a35be.0
# ln -s newcert.pem 5a35be.0
- If you are installing a certificate chain, repeat these steps for each certificate in the chain.
Private Certification Authorities
- Consult a security expert before building your own CA.
- Do not connect the computer that houses the CA to a network.
- Reserve login access for those who absolutely require it.
- Restrict physical access to the CA by keeping it in a tightly locked room.
- Equip the CA with an RF shield to protect it from radio-frequency surveillance.
- Never store the CA key file unencrypted.
- Instruct your users to generate key pairs of adequate size, preferably 1024-bit.
- create the CA
- configure SSLeay
- distribute the certificate
- set up a CSR service
You also have the option to use Xcert Sentry in tandem with Stronghold Web Server. Xcert Sentry is a sophisticated private-CA tool that includes a Stronghold module, Lightweight Directory Access Protocol (LDAP) support, and an easy-to-use graphical interface. If you want to certify clients as well as servers, you must use Sentry. For more information, see http://www.xcert.com/.
Setting Up a CA
To create a private CA
- Run the makeca utility:
# makeca
- Enter the key size in bits.
NOTE: Keys sizes must be either 512 or 1024 for compatibility with certain browsers. We recommend 1024 bits. Keys larger than 1024 bits are incompatible with some versions of Netscape Navigator and Microsoft Internet Explorer, and with other browsers that use RSA's BSAFE cryptography toolkit.
- Tap out some random keystrokes.
0 * -Enough, thank you.
- Enter the two-letter code for your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your city, town, or other locality.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the domain name of your site.
Once the Certification Authority has been built, you need to
- publish the CA's certificate within your organization
# ssleay x509 -outform DER < ServerRoot/ssl/CA/cacert.pem > ServerRoot/htdocs/myca.cacert
- instruct users to install the certificate in their browsers
Configuring SSLeay
The policy field gives the name of the current CA policy:
policy = policy_match
# For the CA policy
[ policy_match ]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
# For the 'anything' policy
[ policy_anything ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
Signing Certificates
# ssleay req -text -noout < CSRfilename
The program prints the CSR in plaintext.
To sign a certificate
- Save the CSR to a temporary file such as /tmp/csr.
- Run sign_csr:
# sign_csr /tmp/csr
- Press Return.
- Enter the CA pass phrase that you set when you ran makeca.
The program checks the signature on the request, then prints the request fields:
Check that the request matches the signature
Signature ok
The Subjects Distinguished Name is as follows
countryName :PRINTABLE:'US'
stateOrProvinceName :PRINTABLE:'California'
localityName :PRINTABLE:'Oakland'
organizationName :PRINTABLE:'C2Net'
organizationalUnitName:PRINTABLE:'Testing/QA'
commonName :PRINTABLE:'test7.c2.net'
Certificate is to be certified until Mar 31 22:19:53 1998 GMT (365 days)
Sign the certificate? [y/n]:
The expiration date is based on the default_days field in ssleay.conf.
- Enter "Y" to sign the certificate or N to abort.
The program prompts you to commit the signature:
1 out of 1 certificate requests certified, commit? [y/n]
- Enter "Y" to commit or "N" to abort.
- Return the newly-signed certificate to the applicant-for example, as an email attachment.
Security Utilities
- changing the pass phrase
- decrypting a private key
- generating a new key pair and requesting a new certificate
- requesting a renewed certificate
- comparing certificates and key pairs
- requesting a new certificate for an existing key pair
- generating a test certificate
- installing a certificate
- creating a private Certification Authority
- mapping certificates to usernames
- converting a Netscape Commerce certificate to a Stronghold-compatible format
- viewing the contents of a certificate
- administering basic authentication
To add the utilities directory to the PATH variable
- Edit the PATH variable according to the type of UNIX shell you are using:
- From the Bourne shell, Korn shell, or bash, add this line to the root .profile file:
PATH=ServerRoot/bin:$PATH
- If you are using the C shell or tcsh, add this line to the root .cshrc file:
set path=(ServerRoot/bin $PATH)
Be sure to replace ServerRoot with the actual path to your root server directory.
- Save the file.
Changing the Pass Phrase
The change_pass utility changes the pass phrase used to encrypt the private key for a host:
# bin/change_pass hostname
Decrypting a Private Key
The decrypt_key utility decrypts the private key for a host:
# bin/decrypt_key hostname
Generating a New Key Pair and Requesting a New Certificate
The genkey utility generates a public/private key pair, generates a certificate signing request, and generates a test certificate for use in the interim. This section provide complete instructions for using genkey to generate a key pair and request a signed certificate from Verisign, Thawte, and other CAs.
To generate a key pair and request a Verisign certificate
- Run genkey, specifying the name of the host or virtual host:
# bin/genkey hostname
The key will be stored in
ServerRoot/ssl/private/hostname.key
The certificate stored in
ServerRoot/ssl/certs/hostname.cert
- Press Return.
Genkey reminds you to be sure you are not overwriting an existing key pair and certificate.
- Press Return.
Genkey prompts you to specify the size of the key you want to generate.
- Enter a key size in bits.
NOTE: Keys sizes must be either 512 or 1024 for compatibility with certain browsers. We recommend 1024 bits. Keys larger than 1024 bits are incompatible with some versions of Netscape Navigator and Microsoft Internet Explorer, and with other browsers that use RSA's BSAFE cryptography toolkit.
- Tap out some random keystrokes.
0 * -Enough, thank you.
- Enter "Y" to send a CSR.
Genreq takes over for genkey, and asks you which CA you want to petition for a certificate:
Please choose the CA you would like to use:
A) VeriSign
B) Thawte
C) Other
Choose: A
- Enter "A."
- Enter the two-letter code for your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your city, town, or other locality.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the fully-qualified domain name of your site.
The program prints the certificate signing request (CSR), which looks something like this:
-----BEGIN NEW CERTIFICATE REQUEST-----
MIIBEzCBzgIBADB7MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEQ
MA4GA1UEBxMHT2FrbGFuZDEbMBkGA1UEChMSQzJOZXQgU29mdHdhcmUgSW5jMRAw
DgYDVQQLEwdUZXN0aW5nMRYwFAYDVQQDEw1nYWJiZXIuYzIubmV0MEwwDQYJKoZI
hvcNAQEBBQADOwAwOAIxAJukoQhq4LanG2k+/LnRTGJAcgv9LJPsdfCsjqRs8ygo
yaw4ucOEdx+WdnM0x36NcQIDAQABMA0GCSqGSIb3DQEBBAUAAzEABRLR6IkG70oN
G1MnvuMDeWou4kIvc98ysjssCNKsDKsHAXBSEbfsIQs5JRNagVBW
-----END NEWCERTIFICATE REQUEST-----
- Copy the CSR.
- Using your Web browser, access https://digitalid.verisign.com/ss_getCSR.html.
- Paste the CSR into the text box on the Digital ID Enrollment page.
- Click Continue.
- Follow Verisign's online instructions until you complete the enrollment procedure.
- Return to the shell window.
- Enter the two-letter code of your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the "common name," or fully-qualified domain name, of your server.
- Enter the pass phrase you want to use for this host.
NOTE: Even if you have many hosts, Stronghold Web Server only asks for one pass phrase on startup. For this reason, you should use the same pass phrase for all certificate/key pairs for all hosts.
- Enter the pass phrase again for verification.
To generate a key pair and request a Thawte certificate
- Run genkey, specifying the name of the host or virtual host:
# bin/genkey hostname
The key will be called hostname.key.
The certificate will be called hostname.cert.
They will be stored in /usr/local/www/ssl
- Press Return.
Genkey reminds you to be sure you are not overwriting an existing key pair and certificate.
- Press Return.
Genkey prompts you to specify the size of the key you want to generate.
- Enter a key size in bits.
NOTE: Keys sizes must be either 512 or 1024 for compatibility with certain browsers. We recommend 1024 bits. Keys larger than 1024 bits are incompatible with some versions of Netscape Navigator and Microsoft Internet Explorer, and with other browsers that use RSA's BSAFE cryptography toolkit.
- Tap out some random keystrokes.
0 * -Enough, thank you.
- Enter "Y" to send a CSR.
Genreq takes over for genkey, and asks you which CA you want to petition for a certificate:
Please choose the CA you would like to use:
A) VeriSign
B) Thawte
C) Other
Choose: B
- Enter "B."
- Enter the two-letter code for your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your city, town, or other locality.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the fully-qualified domain name of your site.
- Press Return.
- Copy the CSR.
- Using your Web browser, access https://www.thawte.com/cgi-bin/server/step1.sioux.
- Follow Thawte's online instructions until you complete their enrollment procedure.
- Return to the shell window.
- In your shell window, press Return.
- Enter "Y" to confirm that you have successfully completed the Thawte application process.
- Enter the two-letter code of your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the "common name," or fully-qualified domain name, of your server.
- Enter the pass phrase you want to use for this host.
NOTE: Even if you have many hosts, Stronghold only asks for one pass phrase on startup. For this reason, you should use the same pass phrase for all certificate/key pairs for all hosts.
- Enter the pass phrase again for verification.
To generate a key pair and request a nonstandard certificate
- Run genkey, specifying the name of the host or virtual host:
# bin/genkey hostname
The key will be called hostname.key.
The certificate will be called hostname.cert.
They will be stored in /usr/local/www/ssl
- Press Return.
Genkey reminds you to be sure you are not overwriting an existing key pair and certificate.
- Press Return.
Genkey prompts you to specify the size of the key you want to generate.
- Enter a key size in bits.
NOTE: Keys sizes must be either 512 or 1024 for compatibility with certain browsers. We recommend 1024 bits. Keys larger than 1024 bits are incompatible with some versions of Netscape Navigator and Microsoft Internet Explorer, and with other browsers that use RSA's BSAFE cryptography toolkit.
- Tap out some random keystrokes.
0 * -Enough, thank you.
- Enter "Y" to send a CSR.
Genreq takes over for genkey, and asks you which CA you want to petition for a certificate:
Please choose the CA you would like to use:
A) VeriSign
B) Thawte
C) Other
- Enter "C."
- Enter the email address for certificate requests from your CA.
- Enter the two-letter code of your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the "common name," or fully-qualified domain name, of your server.
- Enter the email address of this server's administrator.
- Enter the phone number of this server's administrator.
- If the information you entered is correct, press Return to generate the CSR.
If you made a mistake while entering the information, press ^C to exit.
- Accept the default email submission address for the CA you selected, or use a different one.
- To accept the default email address, press Return.
- To use a different address, enter it at the prompt and press Return.
- Enter the two-letter code of your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the "common name," or fully-qualified domain name, of your server.
- Enter the pass phrase you want to use for this host.
NOTE: Even if you have many hosts, Stronghold Web Server only asks for one pass phrase on startup. For this reason, you should use the same pass phrase for all certificate/key pairs for all hosts.
- Enter the pass phrase again for verification.
Requesting a Renewed Certificate
# bin/genreq hostname
This section contains complete instuctions for requesting a renewed certificate from Verisign, Thawte, and other CAs.
To request a renewed Verisign certificate
- Run genreq:
# bin/genreq hostname
Genreq asks you which CA you want to petition for a certificate:
Please choose the CA you would like to use:
A) VeriSign
B) Thawte
C) Other
Choose: A
- Enter "A."
- Enter the two-letter code for your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your city, town, or other locality.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the fully-qualified domain name of your site.
The program prints the certificate signing request (CSR), which looks something like this:
-----BEGIN NEW CERTIFICATE REQUEST-----
MIIBEzCBzgIBADB7MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEQ
MA4GA1UEBxMHT2FrbGFuZDEbMBkGA1UEChMSQzJOZXQgU29mdHdhcmUgSW5jMRAw
DgYDVQQLEwdUZXN0aW5nMRYwFAYDVQQDEw1nYWJiZXIuYzIubmV0MEwwDQYJKoZI
hvcNAQEBBQADOwAwOAIxAJukoQhq4LanG2k+/LnRTGJAcgv9LJPsdfCsjqRs8ygo
yaw4ucOEdx+WdnM0x36NcQIDAQABMA0GCSqGSIb3DQEBBAUAAzEABRLR6IkG70oN
G1MnvuMDeWou4kIvc98ysjssCNKsDKsHAXBSEbfsIQs5JRNagVBW
-----END NEWCERTIFICATE REQUEST-----
- Copy the CSR.
- Using your Web browser, access https://digitalid.verisign.com/ss_getCSR.html.
- Follow Verisign's online instructions for completing the certificate enrollment process.
- In your shell window, press Return.
- Enter "Y" to confirm that you have successfully completed the Verisign application process.
To request a renewed Thawte certificate
- Run genreq:
# bin/genreq hostname
Genreq asks you which CA you want to petition for a certificate:
Please choose the CA you would like to use:
A) VeriSign
B) Thawte
C) Other
Choose: B
- Enter "B."
- Enter the two-letter code for your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your city, town, or other locality.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the fully-qualified domain name of your site.
- Press Return.
- Copy the CSR.
- Using your Web browser, access https://www.thawte.com/cgi-bin/server/step1.sioux.
- Follow Thawte's online instructions for completing the certificate enrollment process.
- In your shell window, press Return.
- Enter "Y" to confirm that you have successfully completed the Thawte application process.
To request a renewed, nonstandard certificate
- Run genreq:
# bin/genreq hostname
Genreq asks you which CA you want to petition for a certificate:
Please choose the CA you would like to use:
A) VeriSign
B) Thawte
C) Other
- Enter "C."
- Enter the email address for certificate requests from your CA.
- Enter the two-letter code of your country.
This is the same two-letter code used in hostnames in your country, such as DE for Germany or JP for Japan. For the complete list of valid country codes, see Appendix C.
- Enter the full name of your state or province.
- Enter the name of your organization.
- Enter the name of your unit within the organization.
- Enter the "common name," or fully-qualified domain name, of your server.
- Enter the email address of this server's administrator.
- Enter the phone number of this server's administrator.
- If the information you entered is correct, press Return to generate the CSR.
If you made a mistake while entering the information, press ^C to exit.
- Accept the default email submission address for the CA you selected, or use a different one.
- To accept the default email address, press Return.
- To use a different address, enter it at the prompt and press Return.
Comparing Certificates and Key Pairs
The checkcert utility compares a certificate to the current key pair for a host:
# bin/checkcert hostname
- locate the correct key pair, save it as ServerRoot/ssl/private/hostname.key, and run checkcert to make sure it is the correct key pair,
- run genreq if a key pair is already saved with the correct filename, or
- run genkey to generate a new key pair and matching CSR.
Requesting a New Certificate for an Existing Key Pair
# bin/genreq hostname
To generate a new key pair for the new certificate, plus a test certificate, use genkey instead.
Generating a Test Certificate
The gencert utility generates a test certificate for a host:
# bin/gencert hostname
Installing a Certificate
# bin/getca hostname < /tmp/cert.tmp
# rm /tmp/cert.tmp
# reload
Creating a Private Certification Authority
# bin/makeca
Use the key pair to sign certificates in response to CSRs.
After you run makeca, see "Private Certification Authorities" on page 2-22 for detailed instructions on configuring and running your private certification authority.
Mapping Certificates to Usernames
Normally, SSL and TLS access control is configured using the SSL_Require directive, which evaluates certificates based on the contents of their fields. Alternatively, you can combine SSL/TLS certificate authentication with non-SSL/TLS access control by
- mapping certificate files to usernames with the cert2user utility and
- configuring username-based access control with the Require directive.
To map certificates to usernames
- Create a separate directory for client certificates:
# mkdir ServerRoot/client_certs
- Save the client certificate you want to map to a username. Use a temporary location such as /tmp/bobs_cert.pem.
- Run cert2user as follows:
# bin/cert2user certdirectory username certfile
# bin/cert2user ServerRoot/client_certs bob /tmp/bobs_cert.pem
AuthType cert
AuthCertDir ServerRoot/client_certs
satisfy any
require user bob
Converting a Netscape Commerce Certificate and Key Pair
# bin/ns_convert directory hostname
NOTE: Ns_convert cannot convert Netscape Enterprise 2.x certificates.
Viewing the Contents of a Certificate
To view the complete text of a certificate
- Run the x509 utility as an argument to the ssleay command with the -text \xdf ag and the certifi cate fi le as input:
# ServerRoot/bin/ssleay x509 -text -in certfilename
Certificate:
Data:
Version: 1 (0x0)
Serial Number: 0 (0x0)
Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=California, L=Oakland, O=C2Net Software US, OU=Security Services Division, CN=gabber.c2.net
Validity
Not Before: Nov 4 00:30:41 1997 GMT
Not After : Dec 4 00:30:41 1997 GMT
Subject: C=US, ST=California, L=Oakland, O=C2Net Software US, OU=Security Services Division, CN=gabber.c2.net
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (512 bit)
Modulus (512 bit):
00:bf:2e:73:fe:c1:79:10:ed:25:e4:02:dd:0f:8d:
0a:2a:1b:e7:8d:b7:39:fc:db:a9:00:20:7c:99:6a:
cc:41:a7:a9:41:15:a7:de:81:07:74:d9:69:2b:69:
8e:0c:7d:9b:5d:67:d0:3b:47:55:04:7e:85:c3:2f:
95:4b:19:bb:25
Exponent: 65537 (0x10001)
Signature Algorithm: md5WithRSAEncryption
24:ae:ac:b9:59:9a:88:0d:32:df:c0:05:8c:48:31:6a:a6:2f:
6a:ce:1b:7a:c5:8d:b2:03:bf:0d:63:61:e9:5f:4b:e6:4d:8f:
14:49:8f:36:a4:ca:36:d4:ab:6c:54:26:f7:12:b4:c6:ae:7a:
70:8d:62:10:14:8f:f7:ee:8b:3e
-----BEGIN CERTIFICATE-----
MIICBjCCAbACAQAwDQYJKoZIhvcNAQEEBQAwgY0xCzAJBgNVBAYTAlVTMRMwEQYD
VQQIEwpDYWxpZm9ybmlhMRAwDgYDVQQHEwdPYWtsYW5kMRowGAYDVQQKExFDMk5l
dCBTb2Z0d2FyZSBVUzEjMCEGA1UECxMaU2VjdXJpdHkgU2VydmljZXMgRGl2aXNp
b24xFjAUBgNVBAMTDWdhYmJlci5jMi5uZXQwHhcNOTcxMTA0MDAzMDQxWhcNOTcx
MjA0MDAzMDQxWjCBjTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWEx
EDAOBgNVBAcTB09ha2xhbmQxGjAYBgNVBAoTEUMyTmV0IFNvZnR3YXJlIFVTMSMw
IQYDVQQLExpTZWN1cml0eSBTZXJ2aWNlcyBEaXZpc2lvbjEWMBQGA1UEAxMNZ2Fi
YmVyLmMyLm5ldDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC/LnP+wXkQ7SXkAt0P
jQoqG+eNtzn826kAIHyZasxBp6lBFafegQd02WkraY4MfZtdZ9A7R1UEfoXDL5VL
GbslAgMBAAEwDQYJKoZIhvcNAQEEBQADQQAkrqy5WZqIDTLfwAWMSDFqpi9qzht6
xY2yA78NY2HpX0vmTY8USY82pMo21KtsVCb3ErTGrnpwjWIQFI/37os+
-----END CERTIFICATE-----
To view one or more fields of a certificate
- Run ssleay x509 with the -in \xdf ag and one or more of the following fi eld \xdf ags:
For example, run ssleay x509 as follows to view only the beginning date of validity:
# ServerRoot/bin/ssleay x509 -startdate -in certfilename
The x509 utility prints the specifi ed fi eld, followed by the complete, encoded certifi cate:
notBefore=Nov 4 00:30:41 1997 GMT
-----BEGIN CERTIFICATE-----
MIICBjCCAbACAQAwDQYJKoZIhvcNAQEEBQAwgY0xCzAJBgNVBAYTAlVTMRMwEQYD
VQQIEwpDYWxpZm9ybmlhMRAwDgYDVQQHEwdPYWtsYW5kMRowGAYDVQQKExFDMk5l
dCBTb2Z0d2FyZSBVUzEjMCEGA1UECxMaU2VjdXJpdHkgU2VydmljZXMgRGl2aXNp
b24xFjAUBgNVBAMTDWdhYmJlci5jMi5uZXQwHhcNOTcxMTA0MDAzMDQxWhcNOTcx
MjA0MDAzMDQxWjCBjTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWEx
EDAOBgNVBAcTB09ha2xhbmQxGjAYBgNVBAoTEUMyTmV0IFNvZnR3YXJlIFVTMSMw
IQYDVQQLExpTZWN1cml0eSBTZXJ2aWNlcyBEaXZpc2lvbjEWMBQGA1UEAxMNZ2Fi
YmVyLmMyLm5ldDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC/LnP+wXkQ7SXkAt0P
jQoqG+eNtzn826kAIHyZasxBp6lBFafegQd02WkraY4MfZtdZ9A7R1UEfoXDL5VL
GbslAgMBAAEwDQYJKoZIhvcNAQEEBQADQQAkrqy5WZqIDTLfwAWMSDFqpi9qzht6
xY2yA78NY2HpX0vmTY8USY82pMo21KtsVCb3ErTGrnpwjWIQFI/37os+
-----CERTIFICATE-----
Administering Basic Authentication
Basic authentication uses simple usernames and password to authenticate users. Performed over HTTP, basic authentication exposes usernames and passwords to eavesdroppers by transmitting them in plaintext. This authentication scheme can still be useful for low-security applications or over HTTPS. See also "Mapping Certificates to Usernames" on page 2-41 for information about combining basic authentication with SSL/TLS certificate authentication.
This section provides instructions for using the ServerRoot/bin/htpasswd utility to create a password file, add usernames and passwords, and configure basic authentication access control. The directives that implement basic authentication are described in "Basic Authentication" on page 7-89.
To create a password file
- Create a new directory for password files:
# mkdir ServerRoot/basicauth
- Switch to the ServerRoot/bin/ directory.
- Use the htpasswd utility to create a new password file and add yourself, the administrator, as its first user:
# htpasswd -c ServerRoot/basicauth/filename username
- Enter a new password.
- Re-enter your password for confirmation.
To add a user to a password file
- Switch to the ServerRoot/bin/ directory.
- Run the htpasswd utility, specifying an existing password file and the new username:
# htpasswd ServerRoot/basicauth/filename username
- Have the new user enter the new password.
- Have the new user re-enter the password for confirmation.
To configure basic authentication access control
- Open the httpd.conf file using a text editor.
- Create a container for the object you want to control access to, if one does not already exist. For example:
<Directory ServerRoot/htdocs/secret>
. . .
</Directory>
- Inside the container, insert the AuthType directive and set it to "basic."
<Directory ServerRoot/htdocs/secret>
AuthType basic
. . .
</Directory>
- Insert the Require directive after the AuthType directive and set it to "valid-user."
<Directory ServerRoot/htdocs/secret>
AuthType basic
Require valid-user
. . .
</Directory>
Require user user1 user2 user3
- Insert the AuthUserFile directive after the Require directive and specify the path to the password file:
<Directory ServerRoot/htdocs/secret>
AuthType basic
Require valid-user
AuthUserFile filename
. . .
</Directory>
This designates the password file that Stronghold uses to check usernames and passwords.
- Restart the server:
# ServerRoot/bin/reload-server
Optionally, you can add the AuthName directive, which assigns a name to this authentication realm. The server passes the name of the realm to the client when it requests a username and password. This is useful for distinguishing between multiple basic authentication realms in your domain, particularly if users have different passwords for different realms.
moshpit: deadkennedys metallica sexpistols
To use the group file, add the AuthGroupFile directive to the usual set of basic authentication directives, specifying the path to the group file. The basic authentication configuration must also contain one or more AuthUserFile directives specifying the password files that contain the password of members of allowed groups. To allow access by all groups, set the Require directive to "valid-user." To allow access by only certain groups, set it to "group" followed by the list of allowed groups. For example:
Require group moshpit snakepit deeppit
[Top] [Prev] [Next] [Last]
© 1998 C2Net International
Feedback: [email protected]![]()