Warning! Proof-of-concept. Not yet production code. Please feel free to experiment and report back to me.
This was last touched 2012.
I have written a proof of concept implementation of a system for IPsec authentication with bare public keys (that is, not X.509 nor OpenPGP certificates) in DNS.
Three scenarios are suggested:
Endpoints already known by name use DNS to find and load public keys
and configure a security policy (tunnel or transport). When traffic
comes either way the Security Association is established. This
scenario requires autosp.pl
and the patched racoon.
A forwarding DNS resolver (ns.pl
) traps A/AAAA queries, loads keys
from DNS and creates security policies. The non-initiating node uses
the scenario below. This might be used for a form of opportunistic
encryption.
The IKE daemon on both ends loads keys from DNS when receiving the peer's name as identification in the IKE dialogue. This has similar properties as Better-than-nothing Security (BTNS) if used both ways.
For background, goals and a discussion, see the forthcoming article.
This project was sponsored in part by the .SE Foundation during 2011/2012.
You might also be interested in my BTNS project.
I have patched the racoon IKE server from ipsec-tools and its management program, racoonctl. I have made three changes:
racoon's management protocol has been changed so bare RSA public keys can be loaded into a running racoon using racoonctl with a new command, “load-key”.
racoon.conf now allows “peers_certfile” to be a bare “plain_rsa”, that is, with no file argument. This is to be used with “load-key”.
racoon can query for IPSECKEY records when it receives a fully qualified domain name (FQDN) as identification from the peer and extracts a bare RSA public key from the IPSECKEY record. Note that in a possible future production system it would perhaps be better to use the CERT payload to transfer bare public keys.
If you already know your peer's name you can start autosp.pl
and it
will automatically query for the peer's addresses and public key, load
the key into racoon and configure a security policy. This can be used
to establish transport mode communication or a tunnel between nodes
that are both using dynamic IP addresses such as most home networks.
ns.pl
is a small forwarding resolver using Perl's
Net::DNS module. The resolver sits on the
local node and captures attempts to query for A and AAAA records. When
it captures these DNS queries it forwards them to a real resolver and
additionally queries for a public key record (IPSECKEY) for the same
name.
If an IPSECKEY record is found the resolver loads the key into a running IKE daemon, racoon (see below). The resolver then creates a security policy to trigger the IKE dialogue.
The resolver can be used together with a full validating DNSSEC resolver for added security.
Note that in a production system this functionality would most likely be merged with the real resolver.
You can use git clone
directly on:
http://hack.org/mc/git/ns
You can use git clone
directly on:
http://hack.org/mc/git/ipsec-tools
There are two branches, master and loadkey.
If you want the whole shebang, go for master.
If you only want the changes that implements the loadkey command, use the loadkey branch.
For your convenience I have also released the diffs from ipsec-tools 0.8.0 here:
The master:
ipsec-tools-20120531.patch.bz2
Only loadkey changes:
ipsec-tools-loadkey-20120531.patch.bz2
These patches should build on FreeBSD and if you follow the instructions in the howto it might also build on Linux.
Please note that I've changed the flex files token.l
and
cftoken.l
. This will regenerate the corresponding token.c
and
cftoken.c
that was included in the original tar ball but the changes
to the *.c files are not included in the patches proper.
Warning: This set of patches are not always in sync with the git repository. For the latest code changes please clone from git.
Using racoon with IPSECKEY records on FreeBSD.
Last updated: <2015-08-17 09:45:32 CEST>