Project

General

Profile

Setting-up a Simple CA Using the strongSwan PKI Tool » History » Version 13

« Previous - Version 13/38 (diff) - Next » - Current version
Andreas Steffen, 24.12.2009 09:37
Warning against keeping CA key on VPN gateway


Setting-up a simple CA using strongSwan PKI tool

This How-To sets up a Certificate Authority using strongSwan PKI tool, keeping it as simple as possible.

CA certificate

First, generate a private key, the default generates a 2048 bit RSA key:

ipsec pki --gen > caKey.der

For a real-world setup, make sure to keep this key private.

Now self-sign a CA certificate using the generated key:

ipsec pki --self --in caKey.der --dn "C=CH, O=strongSwan, CN=strongSwan CA" --ca > caCert.der

Adjust the distinguished name to your needs, it will be included in all issued certificates.

That's it, your CA is ready to issue certificates.

End entity certificates

For each peer, generate a private key and issue a certificate using your new CA:

ipsec pki --gen > peerKey.der

ipsec pki --pub --in peerKey.der | ipsec pki --issue --cacert caCert.der --cakey caKey.der 
                                             --dn "C=CH, O=strongSwan, CN=peer" > peerCert.der

The second command extracts the public key and issues a certificate using your CA. Distribute private key and certificate to your peer.

Install certificates

Certificates and keys are stored in the /etc/ipsec.d/ subdirectory tree:

Never store the private key caKey.der of the Certification Authority (CA) on a VPN gateway with direct access to the Internet since a theft of this key will completely compromise your PKI.