System Administration Guide: IP Services

ProcedureHow to Configure IKE With Self-Signed Public Key Certificates

Self-signed certificates require less overhead than public certificates from a CA, but do not scale very easily.

  1. On the system console, assume the Primary Administrator role or become superuser.

    The Primary Administrator role includes the Primary Administrator profile. To create the role and assign the role to a user, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.


    Note –

    Logging in remotely exposes security-critical traffic to eavesdropping. Even if you somehow protect the remote login, the security of the system is reduced to the security of the remote login session. Use the ssh command for a secure remote login.


  2. Add a self-signed certificate to the ike.privatekeys database.


    # ikecert certlocal -ks|-kc -m keysize -t keytype \
    -D dname -A altname \
    [-S validity-start-time] [-F validity-end-time] [-T token-ID]
    -ks

    Creates a self-signed certificate.

    -kc

    Creates a certificate request. For the procedure, see How to Configure IKE With Certificates Signed by a CA.

    -m keysize

    Is the size of the key. The keysize can be 512, 1024, 2048, 3072, or 4096.

    -t keytype

    Specifies the type of algorithm to use. The keytype can be rsa-sha1, rsa-md5, or dsa-sha1.

    -D dname

    Is the X.509 distinguished name for the certificate subject. The dname typically has the form: C=country, O=organization, OU=organizational unit, CN=common name. Valid tags are C, O, OU, and CN.

    -A altname

    Is the alternate name for the certificate. The altname is in the form of tag=value. Valid tags are IP, DNS, email, and DN.

    -S validity-start-time

    Provides an absolute or relative valid start time for the certificate.

    -F validity-end-time

    Provides an absolute or relative valid end time for the certificate.

    -T token-ID

    Enables a PKCS #11 hardware token to generate the keys. The certificates are then stored in the hardware.

    1. For example, the command on the partym system would appear similar to the following:


      # ikecert certlocal -ks -m 1024 -t rsa-md5 \
      -D "C=US, O=PartyCompany, OU=US-Partym, CN=Partym" \
      -A IP=192.168.13.213
      Creating software private keys.
        Writing private key to file /etc/inet/secret/ike.privatekeys/0.
      Enabling external key providers - done.
      Acquiring private keys for signing - done.
      Certificate: 
       Proceeding with the signing operation.
       Certificate generated successfully (…/publickeys/0)
      Finished successfully.
      Certificate added to database.
      -----BEGIN X509 CERTIFICATE-----
      MIICLTCCAZagAwIBAgIBATANBgkqhkiG9w0BAQQFADBNMQswCQYDVQQGEwJVUzEX
      …
      6sKTxpg4GP3GkQGcd0r1rhW/3yaWBkDwOdFCqEUyffzU
      -----END X509 CERTIFICATE-----
    2. The command on the enigma system would appear similar to the following:


      # ikecert certlocal -ks -m 1024 -t rsa-md5 \
      -D "C=JA, O=EnigmaCo, OU=JA-Enigmax, CN=Enigmax" \
      -A IP=192.168.116.16
      Creating software private keys.
        …
      Certificate added to database.
      -----BEGIN X509 CERTIFICATE-----
      MIICKDCCAZGgAwIBAgIBATANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzEV
      …
      jpxfLM98xyFVyLCbkr3dZ3Tvxvi732BXePKF2A==
      -----END X509 CERTIFICATE-----
  3. Save the certificate and send it to the remote system.

    You can paste the certificate into an email.

    1. For example, you would send the following partym certificate to the enigma administrator:


      To: admin@ja.enigmaexample.com
      From: admin@us.partyexample.com
      Message: -----BEGIN X509 CERTIFICATE-----
      MIICLTCCAZagAwIBAgIBATANBgkqhkiG9w0BAQQFADBNMQswCQYDVQQGEwJVUzEX
      …
      6sKTxpg4GP3GkQGcd0r1rhW/3yaWBkDwOdFCqEUyffzU
      -----END X509 CERTIFICATE-----
    2. The enigma administrator would send you the following enigma certificate:


      To: admin@us.partyexample.com
      From: admin@ja.enigmaexample.com
      Message: -----BEGIN X509 CERTIFICATE-----
      MIICKDCCAZGgAwIBAgIBATANBgkqhkiG9w0BAQQFADBJMQswCQYDVQQGEwJVUzEV
      …
      jpxfLM98xyFVyLCbkr3dZ3Tvxvi732BXePKF2A==
      -----END X509 CERTIFICATE-----
  4. On each system, add the certificate that you received.

    1. Copy the public key from the administrator's email.

    2. Type the ikecert certdb -a command and press the Return key.

      No prompts display when you press the Return key.


      # ikecert certdb -a Press the Return key
      
    3. Paste the public key. Then press the Return key. To end the entry, press Control-D.


      -----BEGIN X509 CERTIFICATE-----
      MIIC…
      …
      ----END X509 CERTIFICATE----- Press the Return key
      <Control>-D
      
  5. Verify with the other administrator that the certificate is from that administrator.

    For example, you can telephone the other administrator to compare the values of the public key hash. The public key hash for the shared certificate must be identical on the two systems.

    1. List the stored certificate on your system.

      For example, on the partym system, the public certificate is in slot 1, and the private certificate is in slot 0.


      partym # ikecert certdb -l
      Certificate Slot Name: 0   Type: rsa-md5 Private Key
          Subject Name: <C=US, O=PartyCompany, OU=US-Partym, CN=Partym>
          Key Size: 1024
          Public key hash: B2BD13FCE95FD27ECE6D2DCD0DE760E2
      
      Certificate Slot Name: 1   Type: rsa-md5 Public Certificate
          (Private key in certlocal slot 0) Points to certificate's private key
          Subject Name: <C=JA, O=EnigmaCo, OU=JA-Enigmax, CN=Enigmax>
          Key Size: 1024
          Public key hash: 2239A6A127F88EE0CB40F7C24A65B818
      
    2. Compare this value with the public key hash on the enigma system.

      You can read the public key hash over the telephone.


      enigma # ikecert certdb -l
      Certificate Slot Name: 4   Type: rsa-md5 Private Key
          Subject Name: <C=JA, O=EnigmaCo, OU=JA-Enigmax, CN=Enigmax>
          Key Size: 1024
          Public key hash: DF3F108F6AC669C88C6BD026B0FCE3A0
      
      Certificate Slot Name: 5   Type: rsa-md5 Public Certificate
          (Private key in certlocal slot 4)
          Subject Name: <C=US, O=PartyCompany, OU=US-Partym, CN=Partym>
          Key Size: 1024
          Public key hash: 2239A6A127F88EE0CB40F7C24A65B818
      
  6. On each system, trust both certificates.

    Edit the /etc/inet/ike/config file to recognize the certificates.

    The administrator of the remote system provides the values for the cert_trust, remote_addr, and remote_id parameters.

    1. For example, on the partym system, the ike/config file would appear similar to the following:


      # Explicitly trust the following self-signed certs
      # Use the Subject Alternate Name to identify the cert
      
      # Verified remote address and remote ID
      # Verified public key hash per telephone call from administrator
      cert_trust "192.168.13.213" Local system's certificate Subject Alt Name
      cert_trust "192.168.116.16" Remote system's certificate Subject Alt Name
      
      ## Parameters that may also show up in rules.
      
      p1_xform 
        { auth_method preshared oakley_group 5 auth_alg sha encr_alg des }
      p2_pfs 5
      
      {
       label "US-partym to JA-enigmax"
       local_id_type dn
       local_id "C=US, O=PartyCompany, OU=US-Partym, CN=Partym"
       remote_id "C=JA, O=EnigmaCo, OU=JA-Enigmax, CN=Enigmax"
      
       local_addr  192.168.13.213
       remote_addr 192.168.116.16
      
       p1_xform
        {auth_method rsa_sig oakley_group 2 auth_alg md5 encr_alg 3des}
      }
    2. On the enigma system, add enigma values for local parameters in the ike/config file.

      For the remote parameters, use partym values. Ensure that the value for the label keyword is unique. This value must be different from the remote system's label value.


      …
      {
       label "JA-enigmax to US-partym"
       local_id_type dn
       local_id "C=JA, O=EnigmaCo, OU=JA-Enigmax, CN=Enigmax"
       remote_id "C=US, O=PartyCompany, OU=US-Partym, CN=Partym"
      
       local_addr  192.168.116.16
       remote_addr 192.168.13.213
      …

Example 22–3 Verifying That a Certificate From Another Administrator is Valid

In this example, the administrators use the Subject Name to verify that the certificates are identical.

The first administrator saves the output of generating and listing the certificate to a file. Because the output of the ikecert command prints to standard error, the administrator redirects standard error to the file.


sys1# cd /
sys1# ikecert certlocal -ks -m1024 -trsa-md5 \
-D"C=US, O=TestCo, CN=Co2Sys" 2>/tmp/for_co2sys
Certificate added to database.
sys1# ikecert certdb -l "C=US, O=TestCo, CN=Co2Sys" 2>>/tmp/for_co2sys

The administrator verifies the contents of the file.


sys1# cat /tmp/for_co2sys
Creating private key.
-----BEGIN X509 CERTIFICATE-----
MIIB7TCCAVagAwIBAgIEZkHfOTANBgkqhkiG9w0BAQQFADAxMQwwCgYDVQQGEwNV
U0ExEDAOBgNVBAoMB3Rlc3RfY28xDzANBgNVBAMTBkVuaWdtYTAeFw0wODAxMTUx
OTI1MjBaFw0xMjAxMTUxOTI1MjBaMDExDDAKBgNVBAYTA1VTQTEQMA4GA1UECgwH
dGVzdF9jbzEPMA0GA1UEAxMGRW5pZ21hMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
iQKBgQCPxGv0rUzHMnFtkx9uwYuPiWbftmWfa9iDt6ELOEuw3zlboy2qtuRUZohz
FIbCxAJevdCY6a+pktvYy3/2nJL0WATObO5T0FKn3F0bphajinLYbyCrYhEzD9E2
gkiT2D9/ttbSiMvi9usphprEDcLAFaWgCJiHnKPBEkjC0vhA3wIDAQABoxIwEDAO
BgNVHQ8BAf8EBAMCBaAwDQYJKoZIhvcNAQEEBQADgYEAL/q6xgweylGQylqLCwzN
5PIpjfzsNPf3saTyh3VplwEOW6WTHwRQT17IO/1Oc6Jnz9Mr0ZrbHWDXq+1sx180
F8+DMW1Qv1UR/lGMq3ufDG3qedmSN6txDF8qLlPCUML0YL8m4oGdewqGb+78aPyE
Y/cJRsK1hWbYyseqcIkjj5k=
-----END X509 CERTIFICATE-----
Certificate Slot Name: 2   Key Type: rsa
        (Private key in certlocal slot 2)
        Subject Name: <C=US, O=TestCo, CN=Co2Sys>
        Key Size: 1024
        Public key hash: C46DE77EF09084CE2B7D9C70479D77FF

Then, the administrator sends the file in an email to the second administrator.

The second administrator places the file in a secure directory, then imports the certificate from the file.


sys2# cd /
sys2# ikecert certdb -a < /sec/co2sys

The ikecert command imports only the text between the -----BEGIN and -----END lines. The administrator verifies that the local certificate has the same public key hash as the public key hash in the co2sys file.


sys2# ikecert certdb -l
Certificate Slot Name: 1   Key Type: rsa
        (Private key in certlocal slot 1)
        Subject Name: <C=US, O=TestCo, CN=Co2Sys>
        Key Size: 1024
        Public key hash: C46DE77EF09084CE2B7D9C70479D77FF

To ensure that the first administrator sent this email, the second administrator telephones the first administrator to verify the Subject Name of the certificate.



Example 22–4 Specifying a Start Time and an End Time for a Certificate

In this example, the administrator on the partym system establishes dates within which the certificate is valid. The certificate is backdated by 2 1/2 days, and is valid for 4 years and 6 months from the date of creation.


# ikecert certlocal -ks -m 1024 -t rsa-md5 \
-D "C=US, O=PartyCompany, OU=US-Partym, CN=Partym" \
-A IP=192.168.13.213 \
-S -2d12h -F +4y6m

The administrator on the enigma system establishes dates within which the certificate is valid. The certificate is backdated by 2 days and is valid until midnight of December 31, 2010.


# ikecert certlocal -ks -m 1024 -t rsa-md5 \
-D "C=JA, O=EnigmaCo, OU=JA-Enigmax, CN=Enigmax" \
-A IP=192.168.116.16 \
-S -2d -F "12/31/2010 12:00 AM"