Technical Notes |
|
You can use digital certificates to establish secure connections with PKI (Public Key Infrastructure). This technical note outlines how to create and obtain a certificate, import it to the server, and properly configure the server to use certificate authentication.
Rather than using public keys to authenticate your session, you can use certificates that authenticate the server during the Diffie-Hellman key exchange:
To have fully-enabled certificate authentication, both the server and the client must be configured for certificate authentication. However you can opt for server-only or client-only certificate authentication, depending on the needs of your environment. This technical note explains how to configure the F-Secure server. For information about the F-Secure client configuration, see Technical Note 1931.
The steps in this note reflect that OpenSSL on a UNIX server is used to generate the certificate request. You may, however, choose to use a different application to generate the certificate request.
Before you obtain the server certificate, you must verify the server's fully qualified domain name (FQDN) and modify the openssl.cnf file.
To verify the host FQDN, at the command line enter the command
hostnameIt should display the FQDN, for example:
myHost.myCo.comYou will enter the FQDN in the subjectAltName in the openssl.cnf file. If the hostname command does not display the FQDN, please review your host documentation for further information.
Prior to generating the server certificate, the openssl.cnf file must be modified to enable version three extensions for the certificate request. This modification enables you to enter the FQDN for the server, which is required for a successful connection.
# req_extensions = v3_req # The extensions to add to a certificate requestreq_extensions = v3_req # The extensions to add to a certificate requestsubjectAltName=DNS:myHost.myCo.comFollow the steps below to obtain the server certificate.
openssl req newkey rsa:2048 out request.pkcs10 keyout privkeyNote the password you enter when prompted; you will use it in step 5 in the following section.
This command creates two files (privkey and request.pkcs10) in your current folder.
If you choose to submit the request by cutting and pasting the text into the CA’s pkcs10 request form, be certain to copy the entire text including
-----BEGIN CERTIFICATE-----and
-----END CERTIFICATE-----Follow the steps below to configure the server to use certificate authentication.
Note: Do not use DER encoded binary for this step.
Execute the following command, replacing <myReceivedCert> with the certificate you received in step 6:
openssl pkcs12 export inkey privkey in <myReceivedCert> out exported.pkcs12This command creates a file called exported.pkcs12 in your current folder.
ssh-keygen k exported.pkcs12Note the following (when prompted):
For example:
[root@myHost]# ssh-keygen2 -k exported.pkcs12Password needed for PFX integrity check : myPasswordIntegrity check ok.Safe decrypted successfully.Got certificate.Certificate written to file exported.pkcs12_ssh2.crtPassword needed for decrypting the private key : myPasswordGot shrouded key.New passphrase for private key : <leave blank>Again : <leave blank>Successfully saved private key to exported.pkcs12_ssh2This command generates two files:
exported.pkcs12_ssh2.crt (the server certificate)
exported.pkcs12_ssh2 (the server private key)
Note: In some cases the public certificate (*.crt) will be named exported.pkcs12-1_ssh2.crt. If it is, rename it to remove the -1. For example, exported.pkcs12_ssh2.crt.
Under ## General, add the following lines:
HostKeyFile exported.pkcs12_ssh2HostCertificateFile exported.pkcs12_ssh2.crtUnder ## Authentication, add the comment and modify the second line, replacing md5 with sha1:
## Define certs as having sha1 hash, not md5 - Administrator Cert.RSA.Compat.HashScheme sha1Add the following section:
## PKI InformationPki /etc/ssh2/pki/myCARootCert.crt