Generating
X.509 Certificates using openssl
Setting up openssl and
building your Root CA
- Install and compile openssl
- Add /usr/local/ssl/bin and /usr/local/ssl/misc to your path
- Make a new
directory to place your Certificates. Change into this directory.
- Edit the file
/usr/local/ssl/openssl.cnf and
change the following entries:
- default_days = 3650
- default_bits = 2048
This sets 10 year validity on your root CA with 2048 bits.
- Now generate
your Root CA using the command “sh
CA.sh –newca”
- Edit the file
/usr/local/ssl/openssl.cnf and
change the following entry:
- default_days = 1825
This sets 5 year validity on
your certificates
Generating and installing the
Certificate for your FreeSwan gateway
- Generate a
private key and Certificate Request for your FreeSwan Gateway using “sh CA.sh –newreq”
- Sign the
request using “sh CA.sh –sign”
- Rename the
two files “newreq.pem” & “newcert.pem” to something
meanigful. These are the files needed for your Freeswan gateway.
- Extract your
private key using “fswcert –k
newreq.pem”. Place this data into your “/etc/ipsec.secrets” file.
- Install your
gateway’s certificate in binary DER format: “openssl x509 –in newcert.pem –outform der –out /etc/x509cert.der”
- Install your
Root CA in DER format: “openssl x509
–in demoCA/cacert.pem –outform DER –out /etc/ipsec.d/cacerts/RootCA.der”
- Generate a
Certificate revocation list: “openssl
ca –gencrl –out crl.pem”
- Install the
crl: “mv crl.pem /etc/ipsec.d/crls”
- Restart
FreeSwan
Generating and installing the
Certificate for your Windows 2000 Client
- Generate a
private key and Certificate Request for your FreeSwan Gateway using “sh CA.sh –newreq”
- Sign the
request using “sh CA.sh –sign”
- Rename the
two files “newreq.pem” & “newcert.pem” to something
meanigful. These are the files needed for your Windows Client
- Pack the
files you need into a PKCS#12 file: “openssl
pkcs12 –export –in newcert.pem –inkey newreq.pem –certfile
demoCA/cacert.pem –out W2000.p12”
- Get the ID
for your Gateway (Freeswan) side: “openssl
x509 –in newcert.pem –noout –subject”. Place this ID in your FreeSwan
Configuration.
- Get the
RootCA ID for your Client (W2000) side: After installing the certificates
using the Management Console use the MMC to get the DSN of the Root CA.
Cut and paste this ID into
your ipsec.conf. You should use the name Windows shows you, as W2k uses a
slightly different syntax.