You may wish to refer to the config files included in that post, and even use them as a basis for your own configuration. I found them to be very complete and functional, and was able to get IPsec working with pre-shared keys in just a few minutes using them.
- FreeS/WAN does not support agressive mode, so racoon must be configured to use main mode.
- FreeS/WAN does not support single DES because the encryption is too weak. It does support 3DES, and can apparently be patched to support AES (rijndael), though I have not tried this.
- "situation identity_only; identifier address;" was needed in racoon ; It was not the default.
This creates a new 2048 bit RSA keypair and stores the public part in an x.509 certificate in PEM format called caCert.pem. This certificate is valid for 1095 days, or 3 years. In order for this command to properly generate a certificate, OpenSSL's openssl.cnf file must exist and have valid contents. A sample openssl.cnf file is included with the OpenSSL distribution and provides a framework for you to modify. Most modifications must be made in the CA_default section. Be sure that the files referenced there actually exist and that they have valid contents. See the OpenSSL ca(1) manual page for more info.openssl req -x509 -days 1095 -newkey rsa:2048 -keyout caKey.pem -out caCert.pem
Certificate creation and signingln -s caCert.pem `openssl x509 -noout -hash -in caCert.pem`.0
hostReq.pem must then be signed by the CA:openssl req -newkey rsa:1024 -keyout hostKey.pem -out hostReq.pem
This creates a PEM formatted x.509 certificate in hostCert.pem that is valid for 1 year. This certificate should then be copied back to the host that made the request and installed such that the IPsec implementation knows where to find it.openssl ca -in hostReq.pem -days 365 -out hostCert.pem -notext
openssl x509 -in hostCert.pem -outform DER -out x509cert.der
conn freeswan-kame
auto=start
authby=rsasig
type=transport
left=192.168.2.99
leftnexthop=192.168.2.1
leftrsasigkey=%cert
leftid="C=US/ST=Massachusetts/O=morgul.net/CN=freeswan/Email=root@morgul.net"
right=10.0.0.1
rightrsasigkey=%cert
rightid="C=US/ST=Massachusetts/O=morgul.net/CN=kame/Email=root@morgul.net"
In this example, the "left" host is the Linux FreeS/WAN system. The authentication
type is set to "rsasig", just as it would be if you were using standard unsigned
RSA keys for authentication. The key, however, is set to the special
value '%cert'. The 'leftid' field is the subject field from the FreeS/WAN
system's certificate. This value can be obtained via the following openssl
command:
openssl -in /etc/x509cert.der -inform DER -noout -subjectBe sure to remove the leading '/' from the string that is output by that command.
remote 192.168.2.99
{
exchange_mode main,aggressive;
situation identity_only;
my_identifier asn1dn "C=US/ST=Massachusetts/O=morgul.net/CN=kame/Email=root@morgul.net";
peers_identifier asn1dn "C=US/ST=Massachusetts/O=morgul.net/CN=freeswan/Email=root@morgul.net";
certificate_type x509 "myHostCert.pem"
"myHostKey.pem";
passive off;
nonce_size 16;
lifetime time 30 min;
# sec,min,hour
initial_contact on;
support_mip6 on;
proposal_check obey;
# obey, strict or claim
proposal {
encryption_algorithm 3des;
hash_algorithm sha1;
authentication_method rsasig;
dh_group 2 ;
}
}
One thing that you may notice here is that the 'certificate_type' line contains
information not found anywhere in the Linux configuration. That's because
this is where racoon is told about the location for its certificate and key
files. In Linux, the certificate used is always /etc/x509cert.der, and
they private key path is given in /etc/ipsec.secrets. Otherwise, the
information here should be fairly straightforward.