This section gives an overview of:
This section is intended to cover only the essentials, things you should know before trying to use FreeS/WAN.
For more detailed background information, see the history and politics and IPsec protocols sections.
FreeS/WAN is a Linux implementation of the IPsec (IP security) protocols. IPsec provides encryption and authentication services at the IP (Internet Protocol) level of the network protocol stack.
Working at this level, IPsec can protect any traffic carried over IP, unlike other encryption which generally protects only a particular higher-level protocol -- PGP for mail, SSH for remote login, SSL for web work, and so on. This approach has both considerable advantages and some limitations. For discussion, see our IPsec section
IPsec can be used on any machine which does IP networking. Dedicated IPsec gateway machines can be installed wherever required to protect traffic. IPsec can also run on routers, on firewall machines, on various application servers, and on end-user desktop or laptop machines.
Three protocols are used
Our implementation has three main parts:
IPsec is optional for the current (version 4) Internet Protocol. FreeS/WAN adds IPsec to the Linux IPv4 network stack. Implementations of IP version 6 are required to include IPsec. Work toward integrating FreeS/WAN into the Linux IPv6 stack has started.
For more information on IPsec, see our IPsec protocols section, our collection of IPsec links or the RFCs which are the official definitions of these protocols.
IPsec is designed to let different implementations work together. We provide:
The VPN Consortium fosters cooperation among implementers and interoperability among implementations. Their web site has much more information.
Because IPsec operates at the network layer, it is remarkably flexible and can be used to secure nearly any type of Internet traffic. Two applications, however, are extremely widespread:
There is enough opportunity in these applications that vendors are flocking to them. IPsec is being built into routers, into firewall products, and into major operating systems, primarily to support these applications. See our list of implementations for details.
We support both of those applications, and various less common IPsec applications as well, but we also add one of our own:
This is an extension we are adding to the protocols. FreeS/WAN is the first prototype implementation, though we hope other IPsec implementations will adopt the technique once we demonstrate it. See project goals below for why we think this is important.
A somewhat more detailed description of each of these applications is below. Our quickstart section will show you how to build each of them.
A VPN, or Virtual Private N etwork lets two networks communicate securely when the only connection between them is over a third network which they do not trust.
The method is to put a security gateway machine between each of the communicating networks and the untrusted network. The gateway machines encrypt packets entering the untrusted net and decrypt packets leaving it, creating a secure tunnel through it.
If the cryptography is strong, the implementation is careful, and the administration of the gateways is competent, then one can reasonably trust the security of the tunnel. The two networks then behave like a single large private network, some of whose links are encrypted tunnels through untrusted nets.
Actual VPNs are often more complex. One organisation may have fifty branch offices, plus some suppliers and clients, with whom it needs to communicate securely. Another might have 5,000 stores, or 50,000 point-of-sale devices. The untrusted network need not be the Internet. All the same issues arise on a corporate or institutional network whenever two departments want to communicate privately with each other.
Administratively, the nice thing about many VPN setups is that large parts of them are static. You know the IP addresses of most of the machines involved. More important, you know they will not change on you. This simplifies some of the admin work. For cases where the addresses do change, see the next section.
The prototypical "Road Warrior" is a traveller connecting to home base from a laptop machine. Administratively, most of the same problems arise for a telecommuter connecting from home to the office, especially if the telecommuter does not have a static IP address.
For purposes of this document:
These require somewhat different setup than VPN gateways with static addresses and with client systems behind them, but are basically not problematic.
There are some difficulties which appear for some road warrior connections:
In most situations, however, FreeS/WAN supports road warrior connections just fine.
One of the reasons we are working on FreeS/WAN is that it gives us the opportunity to add what we call opportuntistic encryption. This means that any two FreeS/WAN gateways will be able to encrypt their traffic, even if the two gateway administrators have had no prior contact and neither system has any preset information about the other.
Both systems pick up the authentication information they need from the DNS (domain name service), the service they already use to look up IP addresses. Of course the administrators must put that information in the DNS, and must set up their gateways with opportunistic encryption enabled. Once that is done, everything is automatic. The gateways look for opportunities to encrypt, and encrypt whatever they can. Whether they also accept unencrypted communication is a policy decision the administrator can make.
This technique can give two large payoffs:
Opportunistic encryption is not (yet?) a standard part of the IPsec protocols, but an extension we are proposing and demonstrating. For details of our design, see links below.
Only one current product we know of implements a form of opportunistic encryption. Secure sendmail will automatically encrypt server-to-server mail transfers whenever possible.
A complication, which applies to any type of connection -- VPN, Road Warrior or opportunistic -- is that a secure connection cannot be created magically. There must be some mechanism which enables the gateways to reliably identify each other. Without this, they cannot sensibly trust each other and cannot create a genuinely secure link.
Any link they do create without some form of authentication will be vulnerable to a man-in-the-middle attack. If Alice and Bob are the people creating the connection, a villian who can re-route or intercept the packets can pose as Alice while talking to Bob and pose as Bob while talking to Alice. Alice and Bob then both talk to the man in the middle, thinking they are talking to each other, and the villain gets everything sent on the bogus "secure" connection.
There are two ways to build links securely, both of which exclude the man-in-the middle:
Automatic keying is much more secure, since if an enemy gets one key only messages between the previous re-keying and the next are exposed. It is therefore the usual mode of operation for most IPsec deployment, and the mode we use in our setup examples. FreeS/WAN does support manual keying for special circumstanes. See this section.
For automatic keying, the two systems must authenticate each other during the negotiations. There is a choice of methods for this:
Public key techniques are much preferable, for reasons discussed later, and will be used in all our setup examples. FreeS/WAN does also support auto-keying with shared secret authentication. See this section.
For complete information on the project, see our web site, freeswan.org.
In summary, we are implementing the IPsec protocols for Linux and extending them to do opportunistic encryption.
Our overall goal in FreeS/WAN is to make the Internet more secure and more private.
Our IPsec implementation supports VPNs and Road Warriors of course. Those are important applications. Many users will want FreeS/WAN to build corporate VPNs or to provide secure remote access.
However, our goals in building it go beyond that. We are trying to help build security into the fabric of the Internet so that anyone who choses to communicate securely can do so, as easily as they can do anything else on the net.
More detailed objectives are:
If we can get opportunistic encryption implemented and widely deployed, then it becomes impossible for even huge well-funded agencies to monitor the net.
See also our section on history and politics of cryptography, which includes our project leader's rationale for starting the project.
Two of the team are from the US and can therefore contribute no code:
The rest of the team are Canadians, working in Canada. ( Why Canada?)
The project is funded by civil libertarians who consider our goals worthwhile. Most of the team are paid for this work.
People outside this core team have made substantial contributions. See
Additional contributions are welcome. See the FAQ for details.
Unfortunately the export laws of some countries restrict the distribution of strong cryptography. FreeS/WAN is therefore not in the standard Linux kernel and not in all CD or web distributions.
FreeS/WAN is, however, quite widely used. Products we know of that use it are listed below. We would appreciate hearing, via the mailing lists, of any we don't know of.
FreeS/WAN is included in various general-purpose Linux distributions, mostly from countries (shown in brackets) with more sensible laws:
For distributions which do not include FreeS/WAN and are not Redhat (which we develop and test on), there is additional information in our compatibility section.
The server edition of Corel Linux (Canada) also had FreeS/WAN, but Corel have dropped that product line.
FreeS/WAN is also included in several distributions aimed at the market for turnkey business servers:
Several distributions intended for firewall and router applications include FreeS/WAN:
There are also several sets of scripts available for managing a firewall which is also acting as a FreeS/WAN IPsec gateway. See this list.
Several vendors use FreeS/WAN as the IPsec component of a turnkey firewall or VPN product.
Software-only products:
Products that include the hardware:
Rebel.com, makers of the Netwinder Linux machines (ARM or Crusoe based), had a product that used FreeS/WAN. The company is in receivership so the future of the Netwinder is at best unclear. PKIX patches for FreeS/WAN developed at Rebel are listed in our web links document.
For some distributions which do not include FreeS/WAN, it may be possible to install using RPM (Redhat Package Manager), rather than going through our more complex procedure.
Some caution is required on this. The RPMs are specific to a Linux distribution and an attempt to use them on another distribution is likely to cause problems.
RPMs for FreeS/WAN 1.91 and Red Hat 7.1 or 7.2 are available for download from Steamballoon. Check there for later versions.
As of version 1.93, the FreeS/WAN distribution incorporates some of the Steamballoon work, providing a facility for building your own RPMs. Details are in our installation document.
FreeS/WAN documentation up to version 1.5 was available only in HTML. Now we ship two formats:
and provide a Makefile to generate other formats if required:
The Makefile assumes the htmldoc tool is available. You can download it from Easy Software.
All formats should be available at the following websites:
The distribution tarball has only the two HTML formats.
Note: If you need the latest doc version, for example to see if anyone has managed to set up interoperation between FreeS/WAN and whatever, then you should download the current snapshot. What is on the web is documentation as of the last release. Snapshots have all changes I've checked in to date.
As with most things on any Unix-like system, most parts of Linux FreeS/WAN are documented in online manual pages. We provide a list of FreeS/WAN man pages, with links to HTML versions of them.
The man pages describing configuration files are:
Man pages for common commands include:
You can read these either in HTML using the links above or with the man(1) command.
In the event of disagreement between this HTML documentation and the man pages, the man pages are more likely correct since they are written by the implementers. Please report any such inconsistency on the mailing list.
Text files in the main distribution directory are README, INSTALL, CREDITS, CHANGES, BUGS and COPYING.
The Libdes encryption library we use has its own documentation. You can find it in the library directory..
Throughout this documentation, I write as if the reader had at least a general familiarity with Linux, with Internet Protocol networking, and with the basic ideas of system and network security. Of course that will certainly not be true for all readers, and quite likely not even for a majority.
However, I must limit amount of detail on these topics in the main text. For one thing, I don't understand all the details of those topics myself. Even if I did, trying to explain everything here would produce extremely long and almost completely unreadable documentation.
If one or more of those areas is unknown territory for you, there are plenty of other resources you could look at:
Also, I do make an effort to provide some background material in these documents. All the basic ideas behind IPsec and FreeS/WAN are explained here. Explanations that do not fit in the main text, or that not everyone will need, are often in the glossary , which is the largest single file in this document set. There is also a background file containing various explanations too long to fit in glossary definitions. All files are heavily sprinkled with links to each other and to the glossary. If some passage makes no sense to you, try the links.
For other reference material, see the bibliography and our collection of web links.
Of course, no doubt I get this (and other things) wrong sometimes. Feedback via the mailing lists is welcome.
Until quite recently, there was only one FreeS/WAN mailing list, and archives of it were:
The two archives use completely different search engines. You might want to try both.More recently we have expanded to five lists, each with its own archive.
More information on mailing lists.
Various user-written HowTo documents are available. The ones covering FreeS/WAN-to-FreeS/WAN connections are:
User-wriiten HowTo material may be especially helpful if you need to interoperate with another IPsec implementation. We have neither the equipment nor the manpower to test such configurations. Users seem to be doing an admirable job of filling the gaps.
Check what version of FreeS/WAN user-written documents cover. The software is under active development and the current version may be significantly different from what an older document describes.
Two design documents show team thinking on new developments:
Both documents are works in progress and are frequently revised. For the latest version, see the design mailing list. Comments should go to that list.
There is now an Internet Draft on Opportunistic Encryption by Michael Richardson, Hugh Redelmeier and Henry Spencer. This is a first step toward getting the protocol standardised so there can be multiple implementations of it. Discussion of it takes place on the IETF IPsec Working Group mailing list.
A number of papers giving further background on FreeS/WAN, or exploring its future or its applications, are also available:
Several of these provoked interesting discussions on the mailing lists, worth searching for in the archives.
There are also several papers in languages other than English, see our web links.
All code and documentation written for this project is distributed under either the GNU General Public License (GPL) or the GNU Library General Public License. For details see the COPYING file in the distribution.
Not all code in the distribution is ours, however. See the CREDITS file for details. In particular, note that the Libdes library and the version of MD5 that we use each have their own license.
FreeS/WAN is available from a number of sites.
Our primary site, is at xs4all (Thanks, folks!) in Holland:
There are also mirror sites all over the world:
Thanks to those folks as well.
There is also an archive of Linux crypto software called "munitions", with its own mirrors in a number of countries. It includes FreeS/WAN, though not always the latest version. Some of its sites are:
Any of those will have a list of other "munitions" mirrors. There is also a CD available.
For more detailed background information, see:
To begin working with FreeS/WAN, go to our quickstart guide.
This page will get you started using Linux FreeS/WAN with opportunistic encryption (OE). OE enables you to set up IPsec tunnels to a site without co-ordinating with the site administrator, and without hand configuring each tunnel. If enough sites support OE, a "FAX effect" occurs, and many of us can communicate without eavesdroppers.
Opportunistic encryption is new technology and we are still working out some fine points. Please see this list of known issues.
To set up opportunistic encryption, you will need:
Note: Only Linux FreeS/WAN supports opportunistic encryption.
Our instructions are for a recent Red Hat with a stock Red Hat kernel. For other ways to install, see our install document.
Check your kernel version with
uname -a
From our FTP site, get the kernel module which matches your kernel. For example:
freeswan-module-1.99_2.4.18_3-0.i386.rpm
Note: Our kernel modules will only work on the Red Hat kernel they were built for, since they are very sensitive to small changes in the kernel.
Get FreeS/WAN utilities to match. For example:
freeswan-1.99_2.4.18_3-0.i386.rpm
While you're at our ftp site, grab the RPM signing key
freeswan-rpmsign.asc
If you're running RedHat 8.x, import this key into the RPM database:
rpm --import freeswan-rpmsign.asc
For RedHat 7.x systems, you'll need to add it to your PGP keyring:
pgp -ka freeswan-rpmsign.asc
Check the signatures on both RPMs using:
rpm --checksig freeswan-module-1.99_2.4.18_3-0.i386.rpm
rpm --checksig freeswan-1.99_2.4.18_3-0.i386.rpm
You should see:
freeswan-module-1.99_2.4.18_3-0.i386.rpm: pgp md5 OK
freeswan-1.99_2.4.18_3-0.i386.rpm: pgp md5 OK
Become root:
su
Install your RPMs with:
rpm -ivh freeswan-module-1.99_2.4.18_3-0.i386.rpm
rpm -ivh freeswan-1.99_2.4.18_3-0.i386.rpm
Then, start FreeS/WAN:
service ipsec start
To check that you have a successful install, run:
ipsec verify
You should see at least:
Checking your system to see if IPsec got installed and started correctly
Version check and ipsec on-path [OK]
Checking for KLIPS support in kernel [OK]
Checking for RSA private key (/etc/ipsec.secrets) [OK]
Checking that pluto is running [OK]
If any of these first four checks fails, see our troubleshooting guide.
Determine the fullest form of opportunism your system can support.
When you set yourself up as an opportunistic initiator:
Find a DNS forward domain where you can publish your key. You'll need access to the DNS zone files for that domain. For the following examples, we'll use "example.com".
Dynamic IP users take note: the domain where you place your key need not be associated with the IP address for your system, or even with your system's usual hostname.
Choose a name within that domain which you will use to identify your machine. Normally, but not always, your ID is the same as your machine name. Our machine is called xy, and we'll choose the corresponding FQDN xy.example.com.
Generate a DNS KEY record containing your system's public key with the command:
ipsec showhostkey
This command takes the contents of /etc/ipsec.secrets and reformats it into something usable by ISC's BIND. The result should look like this (with the key data trimmed down for clarity):
; RSA 2048 bits xy.example.com Sat Apr 15 13:53:22 2000
xy.example.com. IN KEY 0x4200 4 1 AQOF8tZ2...+buFuFn/
Change xy.example.com to your FQDN.
Insert the record into DNS, or have a system adminstrator do it for you. It may take up to 48 hours for the record to propagate, but it's usually much quicker.
Check your DNS work
ipsec verify
You ought to see something like:
Looking for forward key for xy.example.com [OK]
For this type of opportunism, only the forward key test is relevant.
If your FreeS/WAN is older than 1.98b, simply query your nameserver (here, 1.2.3.254):
dig @1.2.3.254 xy.example.com KEY
You should see (with the key again shortened):
;; ANSWER SECTION:
xy.example.com. 6835 IN KEY 16896 4 1 AQO6DJc6LIwGq82ehvIGLKn4S...
In /etc/ipsec.conf find conn me-to-anyone
Make it look like:
conn me-to-anyone
left=%defaultroute
leftrsasigkey=%dnsondemand
right=%opportunistic
rightrsasigkey=%dnsondemand
keylife=1h
rekey=no
leftid=@xy.example.com # put your ID here
auto=route # be sure this is enabled
Put your FQDN ID, preceded by an @sign, in place of @xy.example.com. Be sure auto=route is enabled.
Restart FreeS/WAN so that the new configuration takes effect:
service ipsec restart
That's it! Test your connection.
This allows you to initiate and receive opportunistic connections from one machine.
Generate a KEY record:
ipsec showhostkey
This command takes the contents of /etc/ipsec.secrets and reformats it into something usable by ISC's BIND. It will yield (with key data trimmed for clarity):
; RSA 2048 bits xy.example.com Sat Apr 15 13:53:22 2000 xy.example.com IN KEY 0x4200 4 1 AQOF8tZ2...+buFuFn/
Edit it to insert the IP address in reverse map format. In our example, 1.2.3.4 becomes 4.3.2.1.in-addr.arpa. The result:
; RSA 2048 bits xy.example.com Sat Apr 15 13:53:22 2000 4.3.2.1.in-addr.arpa. IN KEY 0x4200 4 1 AQOF8tZ2...+buFuFn/
This lets others know that this machine can receive opportunistic connections. It also lets them know that the machine is authorized to encrypt on its own behalf.
Use the command:
ipsec showhostkey --txt 1.2.3.4
where you replace 1.2.3.4 with your public IP.
The record (with key shortened) looks like:
; RSA 2048 bits xy.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
Send these records to your ISP, to be published in your IP's reverse map. It may take up to 48 hours for these to propagate, but usually takes much less time.
Test that your KEY has been published by querying your nameserver (here, 1.2.3.254):
dig @1.2.3.254 4.3.2.1.in-addr.arpa. KEY
You should see (with the key shortened for clarity):
;; ANSWER SECTION:
xy.example.com. 6835 IN KEY 16896 4 1 AQO6DJc6LIwGq82ehvIGLKn4S...
Next, test that your TXT record is visible:
dig @1.2.3.254 4.3.2.1.in-addr.arpa. TXT
You should see (with the key shortened for clarity):
;; ANSWER SECTION:
xy.example.com. 6835 IN KEY 16896 4 1 AQO6DJc6LIwGq82ehvIGLKn4S...
Find conn me-to-anyone in /etc/ipsec.conf:
Adjust it to look like:
conn me-to-anyone
left=%defaultroute
leftrsasigkey=%dnsondemand
right=%opportunistic
rightrsasigkey=%dnsondemand
keylife=1h
rekey=no
auto=route # be sure this is enabled
# Note there is NO leftid=
If you've previously configured for initiator-only opportunism, remove leftid=
#leftid=xy.example.com
Restart FreeS/WAN so that it reads the new settings:
service ipsec restart
If you are running a default install of RedHat 8.0, take note: you will need to alter your iptables rule setup to allow IPSec traffic through your firewall. See our firewall document for sample rules you can add to /etc/sysconfig/iptables to permit this.
More information.That's it. Now, test your connection.
You need these so that your Opportunistic peers can:
On the gateway, generate a TXT record with:
ipsec showhostkey --txt 1.2.3.4
Use your gateway address in place of 1.2.3.4
You should see (keys are trimmed for clarity throughout our example):
; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
This MUST BE the same key as in your gateway's KEY record, or nothing will work.
In a text file, make one copy of this TXT record for each subnet node:
; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
Above each entry, insert a line like this:
1.42.42.42.in-addr.arpa. IN PTR arthur.example.com
It must include:
The result will be a file full of TXT records, like this:
1.42.42.42.in-addr.arpa. IN PTR arthur.example.com
; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
2.42.42.42.in-addr.arpa. IN PTR ford.example.com
; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
3.42.42.42.in-addr.arpa. IN PTR trillian.example.com
; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
IN TXT "X-IPsec-Server(10)=1.2.3.4" " AQOF8tZ2...+buFuFn/"
Ask your ISP to publish these records in your reverse map.
Check a couple of records with commands like this one:
dig @1.2.3.254 1.42.42.42.in-addr.arpa. TXT
Replace 1.2.3.254 with your nameserver's IP, and 1.42.42.42.in-addr.arpa. with the reverse-format IP of one of your subnet nodes.
You should see:
ANSWER SECTION: 1.42.42.42.in-addr.arpa. 180 IN TXT "X-IPsec-Server(10)=1.2.3.4 " AQOF8tZ2...+buFuFn/"
In /etc/ipsec.conf place this before me-to-anyone :
conn subnet-to-anyone
also=me-to-anyone
leftsubnet=42.42.42.0/24
More detail.
Once again, restart FreeS/WAN to complete the configuration changes:
service ipsec restart
Proceed to the next section and test away.
The quick method is:
links oetest.freeswan.org
A thought for the paranoid -- the feds are probably watching that site. You should see:
You seem to be connecting from: 1.2.3.4 which DNS says is:
xy.example.com
_________________________________________________________________
Status E-route
OE enabled 16 192.139.46.73/32 -> 1.2.3.4/32 =>
tun0x2097@1.2.3.5
OE enabled 176 192.139.46.77/32 -> 1.2.3.4/32 =>
tun0x208a@1.2.3.5
If you do not see this, see this section of the FAQ.
Congratulations! Your machine will now encrypt whenever it can.
If you haven't already, read up on our known issues, below. Or, proceed to make some vpn connections.
This firewalling information supplements our quickstart guide.
It includes tips for firewalling:
and a list of helpful resources.
Firewall rules on a standalone system doing IPsec can be very simple.
The first step is to allow IPsec packets (IKE on UDP port 500 plus ESP, protocol 50) in and out of your gateway. A script to set up iptables(8) rules for this is:
# edit this line to match the interface you use as default route # ppp0 is correct for many modem, DSL or cable connections # but perhaps not for you world=ppp0 # # allow IPsec # # IKE negotiations iptables -A INPUT -p udp -i $world --sport 500 --dport 500 -j ACCEPT iptables -A OUTPUT -p udp -o $world --sport 500 --dport 500 -j ACCEPT # ESP encryption and authentication iptables -A INPUT -p 50 -i $world -j ACCEPT iptables -A OUTPUT -p 50 -o $world -j ACCEPT
Optionally, you could restrict this, allowing these packets only to and from a list of known gateways.
A second firewalling step -- access controls built into the IPsec protocols -- is automatically applied:
These errors are logged. See our troubleshooting document for details.
As an optional third step, you may wish to filter packets emerging from your opportunistic tunnels. These packets arrive on an interface such as ipsec0, rather than eth0, ppp0 or whatever. For example, in an iptables(8) rule set, you would use:
In this way, you can apply whatever additional filtering you like to these packets.
The packets emerging on ipsec0 are likely to be things that a client application on your machine requested: web pages, e-mail, file transfers and so on. However, any time you initiate an opportunistic connection, you open a two-way connection to another machine (or network). It is conceivable that a Bad Guy there could take advantage of your link.
For more information, read the next section.
The basic firewalling for IPsec does not change when you support incoming connections as well as connections you initiate. You must still allow IKE (UDP port 500) and ESP (protocol 50) packets to and from your machine, as in the rules given above.
However, there is an additional security concern when you allow incoming opportunistic connections. Incoming opportunistic packets enter your machine via an IPSec tunnel. That is, they all appear as ESP (protocol 50) packets, concealing whatever port and protocol characteristics the packet within the tunnel has. Contained in the tunnel as they pass through ppp0 or eth0, these packets can bypass your usual firewall rules on these interfaces.
Consequently, you will want to firewall your ipsec interfaces the way you would any publicly accessible interface.
A simple way to do this is to create one iptables(8) table with all your filtering rules for incoming packets, and apply the entire table to all public interfaces, including ipsec interfaces.
On a gateway, the IPsec-related firewall rules applied for input and output on the Internet side are exactly as shown above. A gateway exchanges exactly the same things -- UDP 500 packets and IPsec packets -- with other gateways that a standalone system does, so it can use exactly the same firewall rules as a standalone system would.
However, on a gateway there are additional things to do:
You need additional rules to handle these things. For example, adding some rules to the set shown above we get:
# edit this line to match the interface you use as default route # ppp0 is correct for many modem, DSL or cable connections # but perhaps not for you world=ppp0 # # edit these lines to describe your internal subnet and interface localnet=42.42.42.0/24 internal=eth1 # # allow IPsec # # IKE negotiations iptables -A INPUT -p udp -i $world --sport 500 --dport 500 -j ACCEPT iptables -A OUTPUT -p udp -o $world --sport 500 --dport 500 -j ACCEPT # ESP encryption and authentication iptables -A INPUT -p 50 -i $world -j ACCEPT iptables -A OUTPUT -p 50 -o $world -j ACCEPT # # packet forwarding for an IPsec gateway # simplest possible rules $ forward everything, with no attempt to filter # # handle packets emerging from IPsec # ipsec+ means any of ipsec0, ipsec1, ... iptables -A FORWARD -d $localnet -i ipsec+ -j ACCEPT # simple rule for outbound packets # let local net send anything # IPsec will encrypt some of it iptables -A FORWARD -s $localnet -i $internal -j ACCEPT
On a production gateway, you would no doubt need tighter rules than the above.
For more information, see these handy resources:
These are sample ipsec.conf(5) configuration files for opportunistic encryption, with comments. Much of this configuration will be unnecessary with the new defaults proposed for FreeS/WAN 2.x.
Full instructions for this setup are in our quickstart guide.
The ipsec.conf file for an initiate-only opportunistic setup is:
# general IPsec setup
config setup
# Use the default interface
interfaces=%defaultroute
# Use auto= parameters in conn descriptions to control startup actions.
plutoload=%search
plutostart=%search
# defaults for subsequent connection descriptions
conn %default
# How to authenticate gateways
authby=rsasig
# default is
# load connection description into Pluto's database
# so it can respond if another gatway initiates
# individual connection descriptions may override this
auto=add
# description for opportunistic connections
conn me-to-anyone
left=%defaultroute # all connections should use default route
right=%opportunistic # anyone we can authenticate
rightrsasigkey=%dns # look up their key in DNS
auto=route # set up for opportunistic
rekey=no # let unused connections die
leftid=@xy.example.com # our identity for IPSec negotiations
# must match DNS and ipsec.secrets
Normally, the last line above is the only one that you need to edit. However, some people may need to customize the interfaces= line in the "config setup" section. All other sections are identical for any standalone machine doing opportunistic encryption.
The @ sign in the leftid= makes the ID go "over the wire" as a Fully Qualified Domain Name (FQDN). Without it, an IP address would be used and this won't work.
The conn is not used to supply either public key. Your private key is in ipsec.secrets(5) and, for opportunistic encryption, the public keys for remote gateways are all looked up in DNS.
FreeS/WAN authenticates opportunistic encryption by RSA signature only, so "public key" and "private key" refer to these keys.
While the left and right designations here are arbitrary, we follow a convention of using left for local and right for remote.
Continue configuring initiate-only opportunism.
# description for opportunistic connections
conn me-to-anyone
left=%defaultroute # all connections should use default route
right=%opportunistic # anyone we can authenticate
rightrsasigkey=%dns # look up their key in DNS
auto=route # set up for opportunistic
rekey=no # let unused connections die
Note that leftid= has been removed.
Continue configuring full opportunism.
Here is our new connection, with comments:
conn us-to-office
#
# information obtained from office system admin
# goes to the right of the = signs in these lines
# values shown here are just for example
#
left=1.2.3.4 # gateway IP address
leftsubnet=42.42.42.0/24 # the office network
leftid=@gateway.example.com
# real keys are much longer than shown here
leftrsasigkey=0s1LgR7/oUM...
#
# our stuff
#
# all connections should use our default route
# also controls the source address on IPsec packets
right=%defaultroute
# our identity for IPsec negotiations
rightid=@xy.example.com
Everything else remains as it was when we had only opportunistic connections.
Return to our quickstart document.
Once you have more than one connection, you may want to design your ipsec.conf in a modular fashion. This will help you avoid retyping information. Use also= to include one full or partial connection description within another.
Here is a sample modular ipsec.conf file for our situation. Since the right... information is common to both our connections, we place it in the partial connection our_stuff, which looks like:
conn our_stuff
# all connections should use our default route
# also controls the source address on IPsec packets
right=%defaultroute
# our identity for IPsec negotiations
# must match what is in DNS and ipsec.secrets(5)
rightid=@xy.example.com
We then include this information in other conns with the line:
also=our_stuff
For this to work, conn our_stuff must come last.
The resulting modular ipsec.conf looks like:
# general IPsec setup
config setup
# Use the default interface
interfaces=%defaultroute
# Use auto= parameters in conn descriptions to control startup actions.
plutoload=%search
plutostart=%search
# description for opportunistic connections
conn me-to-anyone
also=our_stuff # our system details, stored below
left=%opportunistic # anyone we can authenticate
leftrsasigkey=%dns # look up their key in DNS
auto=route # set up for opportunistic
rekey=no # let unused connections die
# pre-configured link to office network
# added for this example
conn us-to-office
also=our_stuff # our system details, stored below
#
# information obtained from office system admin
# goes to the right of the = signs in these lines
# values shown here are just for example
#
left=1.2.3.4 # gateway IP address
leftsubnet=42.42.42.0/24 # the office network
leftid=@gateway.example.com
# real keys are much longer than shown here
leftrsasigkey=0s1LgR7/oUM...
# description of our system
# included in other connection descriptions via also= lines
# must come after the lines that use it
conn our_stuff
# all connections should use our default route
# also controls the source address on IPsec packets
right=%defaultroute
# our identity for IPsec negotiations
# must match what is in DNS and ipsec.secrets(5)
rightid=@xy.example.com
Note that you cannot put an auto=start line into an included connection like our_stuff.
Of course, if need be, you can mix modular and nonmodular elements in any ipsec.conf.
Go back to configuring a road warrior.
This is a collection of questions and answers, mostly taken from the FreeS/WAN mailing list. See the project web site for more information. All the FreeS/WAN documentation is online there.
Contributions to the FAQ are welcome. Please send them to the project mailing list.
FreeS/WAN is a Linux implementation of the IPsec protocols, providing security services at the IP (Internet Protocol) level of the network.
For more detail, see our introduction document or the FreeS/WAN project web site.
To start setting it up, go to our quickstart guide.
Our web links document has information on IPsec for other systems.
See our troubleshooting document. It may guide you to a solution. If not, see its problem reporting section.
Basically, what it says is give us the output from ipsec barf from both gateways. Without full information, we cannot diagnose a problem. However, ipsec barf produces a lot of output. If at all possible, please make barfs accessible via the web or FTP rather than sending enormous mail messages.
Use the users mailing list for problem reports, rather than mailing developers directly.
For problems involving interoperation with another IPsec implementation, try our interoperation document . If that does not help, try the mailing list. In this area, the users often know more than the developers.
Support beyond what the mailing list can provide is also available. See the next several questions.
See also these essays on How To Ask Questions The Smart Way and How to Report Bugs Effectively.
There are a number of Linux distributions or firewall products which include FreeS/WAN. See this list. Using one of these, chosen to match your requirements and budget, may save you considerable time and effort.
If you don't know your requirements, start by reading Schneier's Secrets and Lies. That gives the best overview of security issues I have seen. Then consider hiring a consultant (see next question) to help define your requirements.
If you want the help of a contractor, or to hire staff with FreeS/WAN expertise, you could:
For companies offerring support, see the next question.
Many of the distributions or firewall products which include FreeS/WAN (see this list) come with commercial support or have it available as an option.
Various companies specialize in commercial support of open source software. Our project leader was a founder of the first such company, Cygnus Support. It has since been bought by Redhat. Another such firm is Linuxcare.
The current release is the highest-numbered tarball on our distribution site. Almost always, any of the mirrors will have the same file, though perhaps not for a day or so after a release.
Unfortunately, the web site is not always updated as quickly as it should be. At time of writing, for example, 1.96 has been on the FTP site for about two weeks, but the web site still lists 1.95 as current, and the 1.96 documentation is not yet on the web site.
We are working on fixing this, but it is complicated with our team in North America, the site in Europe and everyone involved having other tasks as well.
We try to do a release in the first week of every month except January and August. We might adjust this a week either way because people are away at conferences or whatever.
If pre-release tests fail and the fix appears complex, or more generally if the code does not appear stable when a release is scheduled, we will just skip that release. This appears a better strategy than rushing complex work to produce a late release.
For serious bugs, we may bring out an extra bug-fix release. These get numbers in the normal release series. For example, there was a bug found in FreeS/WAN 1.6, so we did another release less than two weeks later. The bug-fix release was called 1.7, not something like 1.6a or 1.6.1.
Any problems we are aware of at the time of a release are documented in the BUGS file for that release. You should also look at the CHANGES file.
Bugs discovered after a release are discussed on the mailing lists. The easiest way to check for any problems in the current code would be to peruse Claudia's weekly summaries on the briefs list, archived here.
You are free to modify FreeS/WAN in any way. See the discussion of licensing in our introduction document.
Before investing much energy in any such project, we suggest that you
This may prevent duplicated effort, or lead to interesting collaborations.
Users have also contributed heavily to documentation, both by creating their own HowTos and by posting things on the mailing lists which I have quoted in these HTML docs.
There are, however, some caveats.
FreeS/WAN is being implemented in Canada, by Canadians, largely to ensure that is it is entirely free of export restrictions. See this discussion. We cannot accept code contributions from US residents or citizens, not even one-line bugs fixes. The reasons for this were recently discussed extensively on the mailing list, in a thread starting here.
Not all contributions are of interest to us. The project has a set of fairly ambitious and quite specific goals, described in our introduction. Contributions that lead toward these goals are likely to be welcomed enthusiastically. Other contributions may be seen as lower priority, or even as a distraction.
Discussion of possible contributions takes place on the design mailing list.
The only formal design documents are a few papers in the last category above. All the other categories, however, have things to say about design as well.
The IPsec protocols are designed to support interoperation. In theory, any two IPsec implementations should be able to talk to each other. In practice, it is considerably more complex. We have a whole interoperation document devoted to this problem.
An important part of that document is links to the many user-written HowTos on interoperation between FreeS/WAN and various other implementations. Often the users know more than the developers about these issues (and almost always more than me :-), so these documents may be your best resource.
Linux FreeS/WAN can interoperate with many IPsec implementations, including earlier versions of Linux FreeS/WAN itself.
In a few cases, there are some complications. See our interoperation document for details.
There is no hard limit, but see below.
There is no hard limit, but see next question.
A quick summary:
Beyond about 50 tunnels it needs careful management.
See our FreeS/WAN performance document for details.
We build and test on Redhat distributions, but FreeS/WAN runs just fine on several other distributions, sometimes with minor fiddles to adapt to the local environment. Details are in our compatibility document. Also, some distributions or products come with FreeS/WAN included.
FreeS/WAN is intended to run on all CPUs Linux supports . We know of it being used in production on x86, ARM, Alpha and MIPS. It has also had successful tests on PPC and SPARC, though we don't know of actual use there. Details are in our compatibility document.
FreeS/WAN is designed to work on any SMP architecture Linux supports, and has been tested successfully on at least dual processor Intel architecture machines. Details are in our compatibility document.
It might, but we strongly recommend using a recent 2.2 or 2.4 series kernel. Sometimes the newer versions include security fixes which can be quite important on a gateway.
Also, we use recent kernels for development and testing, so those are better tested and, if you do encounter a problem, more easily supported. If something breaks applying recent FreeS/WAN patches to an older kernel, then "update your kernel" is almost certain to be the first thing we suggest. It may be the only suggestion we have.
The precise kernel versions supported by a particular FreeS/WAN release are given in the README file of that release.
See the following question for more on kernels.
Sometimes yes, but quite often, no.
Kernel versions supported are given in the README file of each FreeS/WAN release. Typically, they are whatever production kernels were current at the time of our release (or shortly before; we might release for kernel n just as Linus releases n+1 ). Often FreeS/WAN will work on slightly later kernels as well, but of course this cannot be guaranteed.
For example, FreeS/WAN 1.91 was released for kernels 2.2.19 or 2.4.5, the current kernels at the time. It also worked on 2.4.6, 2.4.7 and 2.4.8, but 2.4.9 had changes that caused compilation errors if it was patched with FreeS/WAN 1.91.
When such changes appear, we put a fix in the FreeS/WAN snapshots, and distribute it with our next release. However, this is not a high priority for us, and it may take anything from a few days to several weeks for such a problem to find its way to the top of our kernel programmer's To-Do list. In the meanwhile, you have two choices:
We don't even try to keep up with kernel changes outside the main 2.2 and 2.4 branches, such as the 2.4.x-ac patched versions from Alan Cox or the 2.5 series of development kernels. We'd rather work on developing the FreeS/WAN code than on chasing these moving targets. We are, however, happy to get patches for problems discovered there.
See also the Choosing a kernel section of our installation document.
IPsec is designed to work over any network that IP works over, and FreeS/WAN is intended to work over any network interface hardware that Linux supports.
If you have working IP on some unusual interface -- perhaps Arcnet, Token Ring, ATM or Gigabit Ethernet -- then IPsec should "just work".
That said, practice is sometimes less tractable than theory. Our testing is done almost entirely on:
If you have some other interface, especially an uncommon one, it is entirely possible you will get bitten either by a FreeS/WAN bug which our testing did not turn up, or by a bug in the driver that shows up only with our loads.
If IP works on your interface and FreeS/WAN doesn't, seek help on the mailing lists.
Another FAQ section describes MTU problems . These are a possibility for some interfaces.
For a discussion of which parts of the IPsec specifications FreeS/WAN does and does not implement, see our compatibility document.
For information on some often-requested features, see below.
Yes, FreeS/WAN can be used to build site-to-site Virtual Private Networks.
This application is discussed in our introduction and an example given in our FreeS/WAN quickstart document.
Yes, FreeS/WAN can be used to connect remote users. In the documentation, we refer to them as "Road Warriors".
This application is discussed in our introduction and an example given in our FreeS/WAN quickstart document.
Road warriors using Windows or Macintosh may need an IPsec client program for their machines.
Yes, but there are severe restrictions, so we strongly recommend using RSA keys for authentication instead.
See this FAQ question.
Yes, it is a common practice to use IPsec over wireless networks because their built-in encryption, WEP, is insecure.
There is some discussion in our advanced configuration document.
FreeS/WAN, as distributed, does not currently support use of X.509 or other PKI certificates for authentication of gateways. We are concentrating on moving toward authentication via Secure DNS and opportunistic encryption; X.509 support is not (or at least not yet) on the priority list.
On the other hand, it is a priority for some users and user-contributed patches to add X.509 certificate support to FreeS/WAN have been available for some time. From mailing list reports, they seem to be quite widely used and to work well.
See the patches section of our web references document for details.
Not yet. So far, there is no standard way to authenticate users for IPsec, though there is a very active IETF working group looking at the problem, and several vendors have implemented various things already.
In the absence of a standard, user authentication has not been a priority for the FreeS/WAN team, and is unlikely to become one. This would be a good project for a volunteer, perhaps a staff member or contractor at some company that needs the feature. Certainly our team would co-operate with such an effort; we just don't have time to do it.
The patches section of our web links document has links to some user work on this.
Of course, there are various ways to avoid any requirement for user authentication in IPsec. Consider the situation where road warriors build IPsec tunnels to your office net and you are considering requiring user authentication during tunnel negotiation. Alternatives include:
If either of those is trustworthy, it is not clear that you need user authentication in IPsec.
Some IPsec implementations allow you to make the source address on packets sent by a Road Warrior machine be something other than the address of its interface to the Internet. This is sometimes described as assigning a virtual identity to that machine.
FreeS/WAN does not directly support this, but it can be done. See this FAQ question.
No, single DES is not used either at the IKE level for negotiating connections or at the IPsec level for actually building them.
Single DES is insecure. As we see it, it is more important to deliver real security than to comply with a standard which has been subverted into allowing use of inadequate methods. See this discussion.
If you want to interoperate with an IPsec implementation which offers only DES, see our interoperation document.
AES is a new US government block cipher standard to replace the obsolete DES.
At time of writing (March 2002), the FreeS/WAN distribution does not yet support AES but user-written patches are available to add it. Our kernel programmer is working on integrating those patches into the distribution, and there is active discussion of this on the design mailimg list.
Currently triple DES is the only cipher supported. AES will almost certainly be added (see previous question), and it is likely that in the process we will also add the other two AES finalists with open licensing, Twofish and Serpent.
We are extremely reluctant to add other ciphers. This would make both use and maintenance of FreeS/WAN more complex without providing any clear benefit. Complexity is emphatically not desirable in a security product.
Various users have written patches to add other ciphers. We provide links to these.
Yes, you can do this. Here are the details, in a mailing list message from Pluto programmer Hugh Redelmeier:
| How can I reload config's without restarting all of pluto and klips? I am using
| FreeSWAN -> PGPNet in a medium sized production environment, and would like to be
| able to add new connections ( i am using include config/* ) without dropping current
| SA's.
|
| Can this be done?
|
| If not, are there plans to add this kind of feature?
ipsec auto --add whatever
This will look in the usual place (/etc/ipsec.conf) for a conn named
whatever and add it.
If you added new secrets, you need to do
ipsec auto --rereadsecrets
before Pluto needs to know those secrets.
| I have looked (perhaps not thoroughly enough tho) to see how to do this:
There may be more bits to look for, depending on what you are trying
to do.
Another useful command here is
Yes. This is done all the time. See the discussion in our setup document. The only restriction is that the subnets on the two ends must not overlap. See the next question.
Here is a mailing list message on the topic. The user incorrectly thinks you need a 2.4 kernel for this -- actually various people have been doing it on 2.0 and 2.2 for quite some time -- but he has it right for 2.4.
Subject: Double NAT and freeswan working :)
Date: Sun, 11 Mar 2001
From: Paul Wouters <paul@xtdnet.nl>
Just to share my pleasure, and make an entry for people who are searching
the net on how to do this. Here's the very simple solution to have a double
NAT'ed network working with freeswan. (Not sure if this is old news, but I'm
not on the list (too much spam) and I didn't read this in any HOWTO/FAQ/doc
on the freeswan site yet (Sandy, put it in! :)
10.0.0.0/24 --- 10.0.0.1 a.b.c.d ---- a.b.c.e {internet} ----+
|
10.0.1.0/24 --- 10.0.1.1 f.g.h.i ---- f.g.h.j {internet} ----+
the goal is to have the first network do a VPN to the second one, yet also
have NAT in place for connections not destinated for the other side of the
NAT. Here the two Linux security gateways have one real IP number (cable
modem, dialup, whatever.
The problem with NAT is you don't want packets from 10.*.*.* to 10.*.*.*
to be NAT'ed. While with Linux 2.2, you can't, with Linux 2.4 you can.
(This has been tested and works for 2.4.2 with Freeswan snapshot2001mar8b)
relevant parts of /etc/ipsec.conf:
left=f.g.h.i
leftsubnet=10.0.1.0/24
leftnexthop=f.g.h.j
leftfirewall=yes
leftid=@firewall.netone.nl
leftrsasigkey=0x0........
right=a.b.c.d
rightsubnet=10.0.0.0/24
rightnexthop=a.b.c.e
rightfirewall=yes
rightid=@firewall.nettwo.nl
rightrsasigkey=0x0......
# To authorize this connection, but not actually start it, at startup,
# uncomment this.
auto=add
and now the real trick. Setup the NAT correctly on both sites:
iptables -t nat -F
iptables -t nat -A POSTROUTING -o eth0 -d \! 10.0.0.0/8 -j MASQUERADE
This tells the NAT code to only do NAT for packets with destination other then
10.* networks. note the backslash to mask the exclamation mark to protect it
against the shell.
Happy painting :)
Paul
No. The notion that IP addresses are unique is one of the fundamental principles of the IP protocol. Messing with it is exceedingly perilous.
Fairly often a situation comes up where a company has several branches, all using the same non-routable addresses, perhaps 192.168.0.0/24. This works fine as long as those nets are kept distinct. The IP masquerading on their firewalls ensures that packets reaching the Internet carry the firewall address, not the private address.
This can break down when IPsec enters the picture. FreeS/WAN builds a tunnel that pokes through both masquerades and delivers packets from leftsubnet to rightsubnet and vice versa. For this to work, the two subnets must be distinct.
There are several solutions to this problem.
Usually, you re-number the subnets. Perhaps the Vancouver office becomes 192.168.101.0/24, Calgary 192.168.102.0/24 and so on. FreeS/WAN can happily handle this. With, for example leftsubnet=192.168.101.0/24 and rightsubnet=192.168.102.0/24 in a connection description, any machine in Calgary can talk to any machine in Vancouver. If you want to be more restrictive and use something like leftsubnet=192.168.101.128/25 and rightsubnet=192.168.102.240/28 so only certain machines on each end have access to the tunnel, that's fine too.
You could also split the subnet into smaller ones, for example using 192.168.1.0/25 in Vancouver and rightsubnet=192.168.0.128/25 in Calgary.
Alternately, you can just give up routing directly to machines on the subnets. Omit the leftsubnet and rightsubnet parameters from your connection descriptions. Your IPsec tunnels will then run between the public interfaces of the two firewalls. Packets will be masqueraded both before they are put into tunnels and after they emerge. Your Vancouver client machines will see only one Calgary machine, the firewall.
Often it would be convenient to be able to give a Road Warrior an IP address which appears to be on the local network. Some IPsec implementations have support for this, sometimes calling the feature "virtual identity".
Currently (Sept 2002) FreeS/WAN does not support this, and we have no definite plans to add it. The difficulty is that is not yet a standard mechanism for it. There is an Internet Draft for a method of doing it using DHCP which looks promising. FreeS/WAN may support that in a future release.
In the meanwhile, you can do it yourself using the Linux iproute2(8) facilities. Details are in this paper.
Another method has also been discussed on the mailing list.:
For example, you might have:
You then set up routing so that the office machines use the IPsec gateway as their route to a.b.c.128/25. The leftsubnet parameter tells the road warriors to use tunnels to reach a.b.c.0/25, so you should have two-way communication. Depending or your network and applications, there may be some additional work to do on DNS or Windows configuration
Yes. This is easily done, using
In either case, each Road Warrior must have a different key or certificate.
This cannot be made to work using pre-shared key authentication; see the next question for details.
If you expect to have more than a few dozen Road Warriors connecting simultaneously, you may need a fairly powerful gateway machine. See our document on FreeS/WAN performance.
No. There is no way to do this securely, and there is no way to fix the problem.
You can have multiple Road Warriors using shared secret authentication only if they all use the same secret. This creates problems:
This is a designed-in limitation of the IKE key negotiation protocol, not a problem with our implementation.
When using shared secrets, the protocol requires that the responding gateway be able to determine which secret to use at a time when all it knows about the initiator is an IP address. This works fine if you know the initiator's address in advance and can use it to look up the appropiriate secret. However, it fails for Road Warriors since the gateway cannot know their IP addresses in advance.
We very strongly recommend that you avoid using shared secret authentication for multiple Road Warriors. Use RSA authentication instead.
With RSA signatures (or certificates) the protocol is slightly different. The initiator provides an identifier early in the exchange and the responder can use that identifier to look up the correct key or certificate. See above.
From project technical lead Henry Spencer:
> Do QoS add to FreeS/WAN? > For example integrating DiffServ and FreeS/WAN? With a current version of FreeS/WAN, you will have to add hidetos=no to the config-setup section of your configuration file. By default, the TOS field of tunnel packets is zeroed; with hidetos=no, it is copied from the packet inside. (This is a modest security hole, which is why it is no longer the default.) DiffServ does not interact well with tunneling in general. Ways of improving this are being studied.
Copying the TOS (type of service) information from the encapsulated packet to the outer header reveals the TOS information to an eavesdropper. This does not tell him much, but it might be of use in traffic analysis. Since we do not have to give it to him, our default is not to.
See ipsec.conf(5) for more on the hidetos= parameter.
There is no general mechanism to do this is in the IPsec protocols.
From time to time, there is discussion on the IETF Working Group mailing list of adding a "keep-alive" mechanism (which some say should be called "make-dead"), but it is a fairly complex problem and no consensus has been reached on whether or how it should be done.
The protocol does have optional delete-SA messages which one side can send when it closes a connection in hopes this will cause the other side to do the same. FreeS/WAN does not currently support these. In any case, they would not solve the problem since:
However, connections do have limited lifetimes and you can control how many attempts your gateway makes to rekey before giving up. For example, you can set:
conn default
keyingtries=3
keylife=30m
With these settings old connections will be cleaned up. Within 30 minutes of the other end dying, rekeying will be attempted. If it succeeds, the new connection replaces the old one. If it fails, no new connection is created. Either way, the old connection is taken down when its lifetime expires.
Here is a mailing list message on the topic from FreeS/WAN tech support person Claudia Schmeing:
You ask how to determine whether a tunnel is redundant:
> Can anybody explain the best way to determine this. Esp when a RW has
> disconnected? I thought 'ipsec auto --status' might be one way.
If a tunnel goes down from one end, Linux FreeS/WAN on the
other end has no way of knowing this until it attempts to rekey.
Once it tries to rekey and fails, it will 'know' that the tunnel is
down.
Because it doesn't have a way of knowing the state until this point,
it will also not be able to tell you the state via ipsec auto --status.
> However, comparing output from a working tunnel with that of one that
> was closed
> did not show clearly show tunnel status.
If your tunnel is down but not 'unrouted' (see man ipsec_auto), you
should not be able to ping the opposite side of the tunnel. You can
use this as an indicator of tunnel status.
On a related note, you may be interested to know that as of 1.7,
redundant tunnels caused by RW disconnections are likely to be
less of a pain. From doc/CHANGES:
There is a new configuration parameter, uniqueids, to control a new Pluto
option: when a new connection is negotiated with the same ID as an old
one, the old one is deleted immediately. This should help eliminate
dangling Road Warrior connections when the same Road Warrior reconnects.
It thus requires that IDs not be shared by hosts (a previously legal but
probably useless capability). NOTE WELL: the sample ipsec.conf now has
uniqueids=yes in its config-setup section.
Cheers,
Claudia
This is possible, but not easy. FreeS/WAN technical lead Henry Spencer wrote:
> 5. If the ISDN link goes down in between and is reestablished, the SAs > are still up but the eroute are deleted and the IPsec interface shows > garbage (with ifconfig) > 6. Only restarting IPsec will bring the VPN back online. This one is awkward to solve. If the real interface that the IPsec interface is mounted on goes down, it takes most of the IPsec machinery down with it, and a restart is the only good way to recover. The only really clean fix, right now, is to split the machines in two: 1. A minimal machine serves as the network router, and only it is aware that the link goes up and down. 2. The IPsec is done on a separate gateway machine, which thinks it has a permanent network connection, via the router. This is clumsy but it does work. Trying to do both functions within a single machine is tricky. There is a software package (diald) which will give the illusion of a permanent connection for demand-dialed modem connections; I don't know whether it's usable for ISDN, or whether it can be made to cooperate properly with FreeS/WAN. Doing a restart each time the interface comes up *does* work, although it is a bit painful. I did that with PPP when I was running on a modem link; it wasn't hard to arrange the PPP scripts to bring IPsec up and down at the right times. (I'd meant to investigate diald but never found time.) In principle you don't need to do a complete restart on reconnect, but you do have to rebuild some things, and we have no nice clean way of doing only the necessary parts.
In the same thread, one user commented:
Subject: Re: linux-ipsec: IPsec and Dial Up Connections Date: Wed, 22 Nov 2000 From: Andy Bradford <andyb@calderasystems.com> On Wed, 22 Nov 2000 19:47:11 +0100, Philip Reetz wrote: > Are there any ideas what might be the cause of the problem and any way > to work around it. > Any help is highly appreciated. On my laptop, when using ppp there is a ip-up script in /etc/ppp that will be executed each time that the ppp interface is brought up. Likewise there is an ip-down script that is called when it is taken down. You might consider custimzing those to stop and start FreeS/Wan with each connection. I believe that ISDN uses the same files, though I could be wrong---there should be something similar though.
This is possible in theory, but we are short on practical details. If you do this, please let us know via the mailing lists.
There is a list message with links to relevant resources.
FreeS/WAN is a fairly complex product. (Neither the networks it runs on nor the protocols it uses are simple, so it could hardly be otherwise.) It therefore sometimes exhibits behaviour which can be somewhat confusing, or has problems which are not easy to diagnose. This section tries to explain those problems.
Setup and configuration of FreeS/WAN are covered in other documentation sections:
However, we also list some of the commonest problems here.
This question is dealt with in the advanced configuration section under the heading multiple tunnels.
The standard subnet-to-subnet tunnel protects traffic only between the subnets. To test it, you must use pings that go from one subnet to the other.
For example, suppose you have:
subnet a.b.c.0/24
|
eth1 = a.b.c.1
gate1
eth0 = 1.2.3.4
|
~ internet ~
|
eth0 = 4.3.2.1
gate2
eth1 = x.y.z.1
|
subnet x.y.z.0/24
and the connection description:
conn abc-xyz
left=1.2.3.4
leftsubnet=a.b.c.0/24
right=4.3.2.1
rightsubnet=x.y.z.0/24
You can test this connection description only by sending a ping that will actually go through the tunnel. Assuming you have machines at addresses a.b.c.2 and x.y.z.2, pings you might consider trying are:
Only the first of these is a useful test of this tunnel. The others do not use the tunnel. Depending on other details of your setup and routing, they:
In some cases, you may be able to get around this. For the example network above, you could use:
ping -I a.b.c.1 x.y.z.1
Both the adresses given are within protected subnets, so this should go through the tunnel.
If required, you can build additional tunnels so that all the machines involved can talk to all the others. See multiple tunnels in the advanced configuration document for details.
Users fairly often report various problems involving long delays, sometimes on tunnel setup and sometimes on operations done through the tunnel, occasionally on simple things like ping or more often on more complex operations like doing NFS or Samba through the tunnel.
Almost always, these turn out to involve failure of a DNS lookup. The timeouts waiting for DNS are typically set long so that you won't time out when a query involves multiple lookups or long paths. Genuine failures therefore produce long delays before they are detected.
A mailing list message from project technical lead Henry Spencer:
> ... when i run /etc/rc.d/init.d/ipsec start, i get: > ipsec_setup: Starting FreeS/WAN IPsec 1.5... > and it just sits there, doesn't give back my bash prompt. Almost certainly, the problem is that you're using DNS names in your ipsec.conf, but DNS lookups are not working for some reason. You will get your prompt back... eventually. But the DNS timeouts are long. Doing something about this is on our list, but it is not easy.
In the meanwhile, we recommend that connection descriptions in ipsec.conf(5) use numeric IP addresses rather than names which will require a DNS lookup.
Names that do not require a lookup are fine. For example:
These are fine. The @ sign prevents any DNS lookup. However, do not attempt to give the gateway address as left=camelot.example.org . That requires a lookup.
A post from one user after solving a problem with long delays:
Subject: Final Answer to Delay!!! Date: Mon, 19 Feb 2001 From: "Felippe Solutions" <felippe@solutionstecnologia.com.br> Sorry people, but seems like the Delay problem had nothing to do with freeswan. The problem was DNS as some people sad from the beginning, but not the way they thought it was happening. Samba, ssh, telnet and other apps try to reverse lookup addresses when you use IP numbers (Stupid that ahh). I could ping very fast because I always ping with "-n" option, but I don't know the option on the other apps to stop reverse addressing so I don't use it.
This post is fairly typical. These problems are often tricky and frustrating to diagnose, and most turn out to be DNS-related.
One suggestion for diagnosis: test with both names and addresses if possible. For example, try all of:
If these behave differently, the problem must be DNS-related since the three commands do exactly the same thing except for DNS lookups.
IPsec connections are designed to carry only packets travelling between pre-defined connection endpoints. As project technical lead Henry Spencer put it:
IPsec tunnels are not just virtual wires; they are virtual wires with built-in access controls. Negotiation of an IPsec tunnel includes negotiation of access rights for it, which don't include packets to/from other IP addresses. (The protocols themselves are quite inflexible about this, so there are limits to what we can do about it.)
For fairly obvious security reasons, and to comply with the IPsec RFCs, KLIPS drops any packets it receives that are not allowed on the tunnels currently defined. So if you send it packets with route(8), and suitable tunnels are not defined, the packets vanish. Whether this is reported in the logs depends on the setting of klipsdebug in your ipsec.conf(5) file.
To rescue vanishing packets, you must ensure that suitable tunnels for them exist, by editing the connection descriptions in ipsec.conf(5). For example, supposing you have a simple setup:
leftsubnet -- leftgateway === internet === roadwarrior
If you want to give the roadwarrior access to some resource that is located behind the left gateway but is not in the currently defined left subnet, then the usual procedure is to define an additional tunnel for those packets by creating a new connection description.
In some cases, it may be easier to alter an existing connection description, enlarging the definition of leftsubnet. For example, instead of two connection descriptions with 192.168.8.0/24 and 192.168.9.0/24 as their leftsubnet parameters, you can use a single description with 192.168.8.0/23.
If you have multiple endpoints on each side, you need to ensure that there is a route for each pair of endpoints. See this example.
This is a special case of the vanishing packet problem described in the previous question. Whenever KLIPS sees packets for which it does not have a tunnel, it drops them.
When a tunnel goes away, either because negotiations with the other gateway failed or because you gave an ipsec auto --down command, the route to its other end is left pointing into KLIPS, and KLIPS will drop packets it has no tunnel for.
This is a documented design decision, not a bug. FreeS/WAN must not automatically adjust things to send packets via another route. The other route might be insecure.
Of course, re-routing may be necessary in many cases. In those cases, you have to do it manually or via scripts. We provide the ipsec auto --unroute command for these cases.
From ipsec_auto(8):
Normally, pluto establishes a route to the destination specified for a connection as part of the --up operation. However, the route and only the route can be established with the --route operation. Until and unless an actual connection is established, this discards any packets sent there, which may be preferable to having them sent elsewhere based on a more general route (e.g., a default route).
Normally, pluto's route to a destination remains in place when a --down operation is used to take the connection down (or if connection setup, or later automatic rekeying, fails). This permits establishing a new connection (perhaps using a different specification; the route is altered as necessary) without having a ``window'' in which packets might go elsewhere based on a more general route. Such a route can be removed using the --unroute operation (and is implicitly removed by --delete).
See also this mailing list message.
If firewalls filter out:
then IPsec cannot work. The first thing to check if packets seem to be vanishing is the firewall rules on the two gateway machines and any other machines along the path that you have access to.
For details, see our document on firewalls .
Some advice from technical lead Henry Spencer on diagnosing such problems:
> > Packets vanishing between the hardware interface and the ipsecN interface > > is usually the result of firewalls not being configured to let them in... > > Thanks for the suggestion. If only it were that simple! My ipchains startup > script does take care of that, but just in case I manually inserted rules > accepting everything from london on dublin. No difference. The other thing to check is whether the "RX packets dropped" count on the ipsecN interface (run "ifconfig ipsecN", for N=1 or whatever, to see the counts) is rising. If so, then there's some sort of configuration mismatch between the two ends, and IPsec itself is rejecting them. If none of the ipsecN counts is rising, then the packets are never reaching the IPsec machinery, and the problem is almost certainly in firewalls etc.
Networks being what they are, IPsec connections can be broken for any number of reasons, ranging from hardware failures to various software problems such as the path MTU problems discussed elsewhere in the FAQ. Fortunately, various diagnostic tools exist that help you sort out many of the possible problems.
There is one situation, however, where FreeS/WAN (using default settings) may destroy a connection for no readily apparent reason. This occurs when things are misconfigured so that two tunnels from the same gateway expect the same subnet on the far end.
In this situation, the first tunnel comes up fine and works until the second is established. At that point, because of the way we track connections internally, the first tunnel ceases to exist as far as this gateway is concerned. Of course the far end does not know that, and a storm of error messages appears on both systems as it tries to use the tunnel.
If the far end gives up, goes back to square one and negotiates a new tunnel, then that wipes out the second tunnel and ...
The solution is simple. Do not build multiple conn descriptions with the same remote subnet.
This is actually intended to be a feature, rather than a bug. Consider the situation where a single remote system goes down, then comes back up and reconnects to the gateway. It is useful to have the gateway tear down the old tunnel and recover resources when the reconnection is made. It recognises that situation by checking the remote subnet for each tunnel it builds and discarding duplicates. This works fine as long as you don't configure multiple tunnels with the same remote subnet.
If this behaviour is inconvenient for you, you can disable it by setting uniqueids=no in ipsec.conf(5).
Attempting to look at IPsec packets by running monitoring tools on the IPsec gateway machine can produce silly results. That machine is mangling the packets for IPsec, and possibly for firewall or NAT purposes as well. If the internals of the machine's IP stack are not what the monitoring tool expects, then the tool can misinterpret them and produce nonsense output.
See our testing document for more detail.
As far as traceroute can see, the two gateways are one hop apart; the data packet goes directly from one to the other through the tunnel. Of course the outer packets that implement the tunnel pass through whatever lies between the gateways, but those packets are built and dismantled by the gateways. Traceroute does not see them and cannot report anything about their path.
Here is a mailing list message with more detail.
Date: Mon, 14 May 2001 To: linux-ipsec@freeswan.org From: "John S. Denker" <jsd@research.att.com< Subject: Re: traceroute: one virtual hop At 02:20 PM 5/14/01 -0400, Claudia Schmeing wrote: > >> > A bonus question: traceroute in subnet to subnet enviroment looks like: >> > >> > traceroute to andris.dmz (172.20.24.10), 30 hops max, 38 byte packets >> > 1 drama (172.20.1.1) 0.716 ms 0.942 ms 0.434 ms >> > 2 * * * >> > 3 andris.dmz (172.20.24.10) 73.576 ms 78.858 ms 79.434 ms >> > >> > Why aren't there the other hosts which take part in the delivery during > * * * ? > >If there is an ipsec tunnel between GateA and Gate B, this tunnel forms a >'virtual wire'. When it is tunneled, the original packet becomes an inner >packet, and new ESP and/or AH headers are added to create an outer packet >around it. You can see an example of how this is done for AH at >doc/ipsec.html#AH . For ESP it is similar. > >Think about the packet's path from the inner packet's perspective. >It leaves the subnet, goes into the tunnel, and re-emerges in the second >subnet. This perspective is also the only one available to the >'traceroute' command when the IPSec tunnel is up. Claudia got this exactly right. Let me just expand on a couple of points: *) GateB is exactly one (virtual) hop away from GateA. This is how it would be if there were a physically private wire from A to B. The virtually private connection should work the same, and it does. *) While the information is in transit from GateA to GateB, the hop count of the outer header (the "envelope") is being decremented. The hop count of the inner header (the "contents" of the envelope) is not decremented and should not be decremented. The hop count of the outer header is not derived from and should not be derived from the hop count of the inner header. Indeed, even if the packets did time out in transit along the tunnel, there would be no way for traceroute to find out what happened. Just as information cannot leak _out_ of the tunnel to the outside, information cannot leak _into_ the tunnel from outside, and this includes ICMP messages from routers along the path. There are some cases where one might wish for information about what is happening at the IP layer (below the tunnel layer) -- but the protocol makes no provision for this. This raises all sorts of conceptual issues. AFAIK nobody has ever cared enough to really figure out what _should_ happen, let alone implement it and standardize it. *) I consider the "* * *" to be a slight bug. One might wish for it to be replaced by "GateB GateB GateB". It has to do with treating host-to-subnet traffic different from subnet-to-subnet traffic (and other gory details). I fervently hope KLIPS2 will make this problem go away. *) If you want to ask questions about the link from GateA to GateB at the IP level (below the tunnel level), you have to ssh to GateA and launch a traceroute from there.
It is often useful in debugging to test things one at a time:
FreeS/WAN releases are tested for all of these, so you can be reasonably certain they can do them all. Of course, that does not mean they will on the first try, especially if you have some unusual configuration.
The rest of this section gives information on diagnosing the problem when each of the above steps fails.
Suspect one of:
This is a fairly common problem when attempting to configure multiple manually keyed connections from a single gateway.
Each connection must be identified by a unique SPI value. For automatic connections, these values are assigned automatically. For manual connections, you must set them with spi= statements in ipsec.conf(5).
Each manual connection must have a unique SPI value in the range 0x100 to 0x999. Two or more with the same value will fail. For details, see our doc section Using manual keying in production and the man page ipsec.conf(5).
The most common reason for this behaviour is a firewall dropping the UDP port 500 packets used in key negotiation.
Other possibilities:
One common configuration error is forgetting that you need auto=add to load the connection description on the receiving end so it recognises the connection when the other end asks for it.
Some possibile problems are discussed in out interoperation document.
When we first added compression, we saw some problems:
We have not seen either problem in some time (at least six months as I write in March 2002), but if you have some unusual configuration then you may see them.
If tests with ping(1) and a small packet size succeed, but tests or transfers with larger packet sizes fail, suspect problems with packet fragmentation and perhaps path MTU discovery.
Our troubleshooting document covers these problems. Information on the underlying mechanism is in our background document.
This is described under I cannot ping... above.
Pluto needs the GMP (GNU
Multi-Precision) library for the large integer calculations it uses in public key cryptography. This error message indicates a failure to find the library. You must install it before Pluto will compile.
The GMP library is included in most Linux distributions. Typically, there are two RPMs, libgmp and libgmp-devel, You need to install both, either from your distribution CDs or from your vendor's web site.
On Debian, a mailing list message reports that the command to give is
For more information and the latest version, see the GMP home page.
We have had several reports of this message appearing, all on SPARC Linux. Here is a mailing message on a solution:
> ipsec_sha1.c: In function `SHA1Transform': > ipsec_sha1.c:95: virtual memory exhausted I'm seeing exactly the same problem on an Ultra with 256MB ram and 500 MB swap. Except I am compiling version 1.5 and its Red Hat 6.2. I can get around this by using -O instead of -O2 for the optimization level. So it is probably a bug in the optimizer on the sparc complier. I'll try and chase this down on the sparc lists.
Here is a discussion of this error from FreeS/WAN "listress" (mailing list tech support person) Claudia Schmeing. The "FAQ on the network unreachable error" which she refers to is the next question below.
> I reached the point where the two boxes (both on dial-up connections, but > treated as static IPs by getting the IP and editing ipsec.conf after the > connection is established) to the point where they exchange some info, but I > get an error like "route-client command exited with status 7 \n internal > error". > Where can I find a description of this error? In general, if the FAQ doesn't cover it, you can search the mailing list archives - I like to use http://www.sandelman.ottawa.on.ca/linux-ipsec/ but you can see doc/mail.html for different archive formats. Your error comes from the _updown script, which performs some routing and firewall functions to help Linux FreeS/WAN. More info is available at doc/firewall.html and man ipsec.conf. Its routing is integral to the health of Linux FreeS/WAN; it also provides facility to insert custom firewall rules to be executed when you create or destroy a connection. Yours is, of course, a routing error. You can be fairly sure the routing machinery is saying "network is unreachable". There's a FAQ on the "network is unreachable" error, but more information is available now; read on. If your _updown script is recent (for example if it shipped with Linux FreeS/WAN 1.91), you will see another debugging line in your logs that looks something like this: > output: /usr/local/lib/ipsec/_updown: `route add -net 128.174.253.83 > netmask 255.255.255.255 dev ipsec0 gw 66.92.93.161' failed This is, of course, the system route command that exited with status 7, (ie. failed). Man route for details. Seeing the command typed out yields more information. If your _updown script is older, you may wish to update it to show the command explicitly. Three parameters fed to the route command: net, netmask and gw [gateway] are derived from things you've put in ipsec.conf. Net and netmask are derived from the peer's IP and mask. In more detail: You may see a routing error when routing to a client (ie. subnet), or to a host (IPSec gateway or freestanding host; a box that does IPSec for itself). In _updown, the "route-client" section is responsible to set up the route for IPSec'd (usually, read 'tunneled') packets headed to a peer subnet. Similarly, route-host routes IPSec'd packets to a peer host or IPSec gateway. When routing to a 'client', net and netmask are ipsec.conf's left- or rightsubnet (whichever is not local). Similarly, when routing to a 'host' the net is left or right. Host netmask is always /32, indicating a single machine. Gw is nexthop's value. Again, the value in question is left- or rightnexthop, whichever is local. Where left/right or left-/rightnexthop has the special value %defaultroute (described in man ipsec.conf), gw will automagically get the value of the next hop on the default route. Q: "What's a nexthop and why do I need one?" A: 'nexthop' is a routing kluge; its value is the next hop away from the machine that's doing IPSec, and toward your IPSec peer. You need it to get the processed packets out of the local system and onto the wire. While we often route other packets through the machine that's now doing IPSec, and are done with it, this does not suffice here. After packets are processed with IPSec, this machine needs to know where they go next. Of course using the 'IPSec gateway' as their routing gateway would cause an infinite loop! [To visualize this, see the packet flow diagram at doc/firewall.html.] To avoid this, we route packets through the next hop down their projected path. Now that you know the background, consider: 1. Did you test routing between the gateways in the absence of Linux FreeS/WAN, as recommended? You need to ensure the two machines that will be running Linux FreeS/WAN can route to one another before trying to make a secure connection. 2. Is there anything obviously wrong with the sense of your route command? Normally, this problem is caused by an incorrect local nexthop parameter. Check out the use of %defaultroute, described in man ipsec.conf. This is a simple way to set nexthop for most people. To figure nexthop out by hand, traceroute in-the-clear to your IPSec peer. Nexthop is the traceroute's first hop after your IPSec gateway.
This message is not from FreeS/WAN, but from the Linux IP stack itself. That stack is seeing packets it has no route for, either because your routing was broken before FreeS/WAN started or because FreeS/WAN's changes broke it.
Here is a message from Claudia suggesting ways to diagnose and fix such problems:
You write, > I have correctly installed freeswan-1.8 on RH7.0 kernel 2.2.17, but when > I setup a VPN connection with the other machine(RH5.2 Kernel 2.0.36 > freeswan-1.0, it works well.) it told me that > "SIOCADDRT:Network is unreachable"! But the network connection is no > problem. Often this error is the result of a misconfiguration. Be sure that you can route successfully in the absence of Linux FreeS/WAN. (You say this is no problem, so proceed to the next step.) Use a custom copy of the default updownscript. Do not change the route commands, but add a diagnostic message revealing the exact text of the route command. Is there a problem with the sense of the route command that you can see? If so, then re-examine those ipsec.conf settings that are being sent to the route command. You may wish to use the ipsec auto --route and --unroute commands to troubleshoot the problem. See man ipsec_auto for details.
Since the above message was written, we have modified the updown script to provide a better diagnostic for this problem. Check /var/log/messages.
See also the FAQ question route-client (or host) exited with status 7.
These messages indicate an installation failure. The kernel you are running does not contain the KLIPS (kernel IPsec) code.
Note that the "modprobe: Can't locate module ipsec" message appears even if you are not using modules. If there is no KLIPS in your kernel, FreeS/WAN tries to load it as a module. If that fails, you get this message.
Commands you can quickly try are:
If those don't find the problem, you have to go back and check through the install procedure to see what was missed.
Here is one of Claudia's messages on the topic:
> I tried to install freeswan 1.8 on my mandrake 7.2 test box. ... > It does show version and some output for whack. Yes, because the Pluto (daemon) part of ipsec is installed correctly, but as we see below the kernel portion is not. > However, I get the following from /var/log/messages: > > Mar 11 22:11:55 pavillion ipsec_setup: Starting FreeS/WAN IPsec 1.8... > Mar 11 22:12:02 pavillion ipsec_setup: modprobe: Can't locate module ipsec > Mar 11 22:12:02 pavillion ipsec_setup: Fatal error, kernel appears to lack > KLIPS. This is your problem. You have not successfully installed a kernel with IPSec machinery in it. Did you build Linux FreeS/WAN as a module? If so, you need to ensure that your new module has been installed in the directory where your kernel loader normally finds your modules. If not, you need to ensure that the new IPSec-enabled kernel is being loaded correctly. See also doc/install.html, and INSTALL in the distro.
Quoting Henry:
Note that by default, FreeS/WAN is now set up to
(a) authenticate with RSA keys, and
(b) fetch the public key of the far end from DNS.
Explicit attention to ipsec.conf will be needed if you want
to do something different.
and Claudia, responding to the same user:
You write, > My current setup in ipsec.conf is leftrsasigkey=%dns I have > commented this and authby=rsasig out. I am able to get ipsec running, > but what I find is that the documentation only specifies for %dns are > there any other values that can be placed in this variable other than > %dns and the key? I am also assuming that this is where I would place > my public key for the left and right side as well is this correct? Valid values for authby= are rsasig and secret, which entail authentication by RSA signature or by shared secret, respectively. Because you have commented authby=rsasig out, you are using the default value of authby=secret. When using RSA signatures, there are two ways to get the public key for the IPSec peer: either copy it directly into *rsasigkey= in ipsec.conf, or fetch it from dns. The magic value %dns for *rsasigkey parameters says to try to fetch the peer's key from dns. For any parameters, you may find their significance and special values in man ipsec.conf. If you are setting up keys or secrets, be sure also to reference man ipsec.secrets.
This is a fatal error. FreeS/WAN cannot cope with two or more interfaces using the same IP address. You must re-configure to avoid this.
A mailing list message on the topic from Pluto developer Hugh Redelmeier:
| I'm trying to get freeswan working between two machine where one has a ppp | interface. | I've already suceeded with two machines with ethernet ports but the ppp | interface is causing me problems. | basically when I run ipsec start i get | ipsec_setup: Starting FreeS/WAN IPsec 1.7... | ipsec_setup: 003 IP interfaces ppp1 and ppp0 share address 192.168.0.10! | ipsec_setup: 003 IP interfaces ppp1 and ppp2 share address 192.168.0.10! | ipsec_setup: 003 IP interfaces ppp0 and ppp2 share address 192.168.0.10! | ipsec_setup: 003 no public interfaces found | | followed by lots of cannot work out interface for connection messages | | now I can specify the interface in ipsec.conf to be ppp0 , but this does | not affect the above behaviour. A quick look in server.c indicates that the | interfaces value is not used but some sort of raw detect happens. | | I guess I could prevent the formation of the extra ppp interfaces or | allocate them different ip but I'd rather not. if at all possible. Any | suggestions please. Pluto won't touch an interface that shares an IP address with another. This will eventually change, but it probably won't happen soon. For now, you will have to give the ppp1 and ppp2 different addresses.
A mailing list message form technical lead Henry Spencer:
> When FreeS/WAN IPsec 1.7 is starting on my 2.0.38 Linux kernel the following > error message is generated: > ipsec_setup: Cannot adjust kernel flags, no /proc/sys/net/ipsec directory! > What is supposed to create this directory and how can I fix this problem? I think that directory is a 2.2ism, although I'm not certain (I don't have a 2.0.xx system handy any more for testing). Without it, some of the ipsec.conf config-setup flags won't work, but otherwise things should function.
You also need to enable the /proc filesystem in your kernel configuration for these operations to work.
Pluto messages often indicate where Pluto is in the IKE protocols. The letters indicate Main mode or Q uick mode and Initiator or Responder. The numerals are message sequence numbers. For more detail, see our IPsec section.
From Pluto programmer Hugh Redelmeier:
| Jan 17 16:21:10 remus Pluto[13631]: "jumble" #1: responding to Main Mode from Road Warrior 130.205.82.46 | Jan 17 16:21:11 remus Pluto[13631]: "jumble" #1: no suitable connection for peer @banshee.wittsend.com | | The connection "jumble" has nothing to do with the incoming | connection requests, which were meant for the connection "banshee". You are right. The message tells you which Connection Pluto is currently using, which need not be the right one. It need not be the right one now for the negotiation to eventually succeed! This is described in ipsec_pluto(8) in the section "Road Warrior Support". There are two times when Pluto will consider switching Connections for a state object. Both are in response to receiving ID payloads (one in Phase 1 / Main Mode and one in Phase 2 / Quick Mode). The second is not unique to Road Warriors. In fact, neither is the first any more (two connections for the same pair of hosts could differ in Phase 1 ID payload; probably nobody else has tried this).
Older versions of FreeS/WAN used this message. The same error now gives the "we have no ipsecN ..." error described just below.
Each Pluto needs to know whether it is running on the machine which the connection description calls left or on right . It figures that out by:
Normally a match is found. Then Pluto knows where it is and can set up other things (for example, if it is left) using parameters such as leftsubnet and leftnexthop, and sending its outgoing packets to right.
If no match is found, it emits the above error message.
This error message occurs when a remote system attempts to negotiate a connection and Pluto does not have a connection description that matches what the remote system has requested. The most common cause is a configuration error on one end or the other.
Parameters involved in this match are left, right , leftsubnet and rightsubnet.
The match must be exact. For example, if your left subnet is a.b.c.0/24 then neither a single machine in that net nor a smaller subnet such as a.b.c.64/26 will be considered a match.
The message can also occur when an appropriate description exists but Pluto has not loaded it. Use an auto=add statement in the connection description, or an ipsec auto --add <conn_name> command, to correct this.
An explanation from the Pluto developer:
| Jul 12 15:00:22 sohar58 Pluto[574]: "corp_road" #2: cannot respond to IPsec
| SA request because no connection is known for
| 216.112.83.112/32===216.112.83.112...216.67.25.118
This is the first message from the Pluto log showing a problem. It
means that PGPnet is trying to negotiate a set of SAs with this
topology:
216.112.83.112/32===216.112.83.112...216.67.25.118
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^
client on our side our host PGPnet host, no client
None of the conns you showed look like this.
Use
ipsec auto --status
to see a snapshot of what connections are in pluto, what
negotiations are going on, and what SAs are established.
The leftsubnet= (client) in your conn is 216.112.83.64/26. It must
exactly match what pluto is looking for, and it does not.
This is similar to the no connection known error, but occurs at a different point in Pluto processing.
Here is one of Claudia's messages explaining the problem:
You write, > What could be the reason of the following error? > "no suitable connection for peer '@xforce'" When a connection is initiated by the peer, Pluto must choose which entry in the conf file best matches the incoming connection. A preliminary choice is made on the basis of source and destination IPs, since that information is available at that time. A payload containing an ID arrives later in the negotiation. Based on this id and the *id= parameters, Pluto refines its conn selection. ... The message "no suitable connection" indicates that in this refining step, Pluto does not find a connection that matches that ID. Please see "Selecting a connection when responding" in man ipsec_pluto for more details.
See also Connection names in Pluto error messages.
Here is one of Claudia's messages discussing this problem:
You write,
> May 22 10:46:31 debian Pluto[25834]: packet from x.y.z.p:10014:
> initial Main Mode message from x.y.z.p:10014
but no connection has been authorized
This error occurs early in the connection negotiation process,
at the first step of IKE negotiation (Main Mode), which is itself the
first of two negotiation phases involved in creating an IPSec connection.
Here, Linux FreeS/WAN receives a packet from a potential peer, which
requests that they begin discussing a connection.
The "no connection has been authorized" means that there is no connection
description in Linux FreeS/WAN's internal database that can be used to
link your ipsec interface with that peer.
"But of course I configured that connection!"
It may be that the appropriate connection description exists in ipsec.conf
but has not been added to the database with ipsec auto --add myconn or the
auto=add method. Or, the connection description may be misconfigured.
The only parameters that are relevant in this decision are left= and right= .
Local and remote ports are also taken into account -- we see that the port
is printed in the message above -- but there is no way to control these
in ipsec.conf.
Failure at "no connection has been authorized" is similar to the
"no connection is known for..." error in the FAQ, and the "no suitable
connection" error described in the snapshot's FAQ. In all three cases,
Linux FreeS/WAN is trying to match parameters received in the
negotiation with the connection description in the local config file.
As it receives more information, its matches take more parameters into
account, and become more precise: first the pair of potential peers,
then the peer IDs, then the endpoints (including any subnets).
The "no suitable connection for peer *" occurs toward the end of IKE
(Main Mode) negotiation, when the IDs are matched.
"no connection is known for a/b===c...d" is seen at the beginning of IPSec
(Quick Mode, phase 2) negotiation, when the connections are matched using
left, right, and any information about the subnets.
This message occurs when the other system attempts to negotiate a connection using single DES, which we do not support because it is insecure.
Our interoperation document has suggestions for how to deal with systems that attempt to use single DES.
This message means that the other gateway has made a proposal for connection parameters, but nothing they proposed is acceptable to Pluto. Possible causes include:
A more detailed explanation, from Pluto programmer Hugh Redelmeier:
Background:
When one IKE system (for example, Pluto) is negotiating with another
to create an SA, the Initiator proposes a bunch of choices and the
Responder replies with one that it has selected.
The structure of the choices is fairly complicated. An SA payload
contains a list of lists of "Proposals". The outer list is a set of
choices: the selection must be from one element of this list.
Each of these elements is a list of Proposals. A selection must be
made from each of the elements of the inner list. In other words,
*all* of them apply (that is how, for example, both AH and ESP can
apply at once).
Within each of these Proposals is a list of Transforms. For each
Proposal selected, one Transform must be selected (in other words,
each Proposal provides a choice of Transforms).
Each Transform is made up of a list of Attributes describing, well,
attributes. Such as lifetime of the SA. Such as algorithm to be
used. All the Attributes apply to a Transform.
You will have noticed a pattern here: layers alternate between being
disjunctions ("or") and conjunctions ("and").
For Phase 1 / Main Mode (negotiating an ISAKMP SA), this structure is
cut back. There must be exactly one Proposal. So this degenerates to
a list of Transforms, one of which must be chosen.
In your case, no proposal was considered acceptable to Pluto (the
Responder). So negotiation ceased. Pluto logs the reason it rejects
each Transform. So look back in the log to see what is going wrong.
On Fri, 29 Jun 2001, Rodrigo Gruppelli wrote: > ...Well, it seem that there's > another problem with it. When I try to generate a pair of RSA keys, > rsasigkey cores dump... *That* is a neon sign flashing "GMP LIBRARY IS BROKEN". Rsasigkey calls GMP a lot, and our own library a little bit, and that's very nearly all it does. Barring bugs in its code or our library -- which have happened, but not very often -- a problem in rsasigkey is a problem in GMP.
See the next question for how to deal with GMP errors.
Pluto has died. Signal 4 is SIGILL, illegal instruction.
The most likely cause is that your GMP (GNU multi-precision) library is compiled for a different processor than what you are running on. Pluto uses that library for its public key calculations.
Try getting the GMP sources and recompile for your processor type. Most Linux distributions will include this source, or you can download it from the GMP home page.
From John Denker, on the mailing list:
1) The log message some IKE message we sent has been rejected with ECONNREFUSED (kernel supplied no details) is much more suitable than the previous version. Thanks. 2) Minor suggestion for further improvement: it might be worth mentioning that the command tcpdump -i eth1 icmp[0] != 8 and icmp[0] != 0 is useful for tracking down the details in question. We shouldn't expect all IPsec users to figure that out on their own. The log message might even provide a hint as to where to look in the docs.
Reply From Pluto developer Hugh Redelmeier
Good idea. I've added a bit pluto(8)'s BUGS section along these lines. I didn't have the heart to lengthen this message.
This message means KLIPS has received a packet for which no IPsec tunnel has been defined.
Here is a more detailed duscussion from the team's tech support person Claudia Schmeing, responding to a query on the mailing list:
> Why ipsec reports no eroute! ???? IP Masq... is disabled. In general, more information is required so that people on the list may give you informed input. See doc/prob.report.
The document she refers to has since been replaced by a section of the troubleshooting document.
However, I can make some general comments on this type of error. This error usually looks something like this (clipped from an archived message): > ttl:64 proto:1 chk:45459 saddr:192.168.1.2 daddr:192.168.100.1 > ... klips_debug:ipsec_findroute: 192.168.1.2->192.168.100.1 > ... klips_debug:rj_match: * See if we match exactly as a host destination > ... klips_debug:rj_match: ** try to match a leaf, t=0xc1a260b0 > ... klips_debug:rj_match: *** start searching up the tree, t=0xc1a260b0 > ... klips_debug:rj_match: **** t=0xc1a260c8 > ... klips_debug:rj_match: **** t=0xc1fe5960 > ... klips_debug:rj_match: ***** not found. > ... klips_debug:ipsec_tunnel_start_xmit: Original head/tailroom: 2, 28 > ... klips_debug:ipsec_tunnel_start_xmit: no eroute!: ts=47.3030, dropping. What does this mean? - -------------------- "eroute" stands for "extended route", and is a special type of route internal to Linux FreeS/WAN. For more information about this type of route, see the section of man ipsec_auto on ipsec auto --route. "no eroute!" here means, roughly, that Linux FreeS/WAN cannot find an appropriate tunnel that should have delivered this packet. Linux FreeS/WAN therefore drops the packet, with the message "no eroute! ... dropping", on the assumption that this packet is not a legitimate transmission through a properly constructed tunnel. How does this situation come about? - ----------------------------------- Linux FreeS/WAN has a number of connection descriptions defined in ipsec.conf. These must be successfully brought "up" to form actual tunnels. (see doc/setup.html's step 15, man ipsec.conf and man ipsec_auto for details). Such connections are often specific to the endpoints' IPs. However, in some cases they may be more general, for example in the case of Road Warriors where left or right is the special value %any. When Linux FreeS/WAN receives a packet, it verifies that the packet has come through a legitimate channel, by checking that there is an appropriate tunnel through which this packet might legitimately have arrived. This is the process we see above. First, it checks for an eroute that exactly matches the packet. In the example above, we see it checking for a route that begins at 192.168.1.2 and ends at 192.168.100.1. This search favours the most specific match that would apply to the route between these IPs. So, if there is a connection description exactly matching these IPs, the search will end there. If not, the code will search for a more general description matching the IPs. If there is no match, either specific or general, the packet will be dropped, as we see, above. Unless you are working with Road Warriors, only the first, specific part of the matching process is likely to be relevant to you. "But I defined the tunnel, and it came up, why do I have this error?" - --------------------------------------------------------------------- One of the most common causes of this error is failure to specify enough connection descriptions to cover all needed tunnels between any two gateways and their respective subnets. As you have noticed, troubleshooting this error may be complicated by the use of IP Masq. However, this error is not limited to cases where IP Masq is used. See doc/configuration.html#multitunnel for a detailed example of the solution to this type of problem.
The documentation section she refers to is now here.
This error message occurs when two manual connections are set up with the same SPI value.
See the FAQ for One manual connection works, but second one fails.
This message is harmless. The IKE protocol provides for a number of optional messages types:
An implementation is never required to send these, but they are allowed to. The receiver is not required to do anything with them. FreeS/WAN ignores them, but notifies you via the logs.
For the "ignoring delete SA Payload" message, see also our discussion of cleaning up dead tunnels.
As a matter of policy, some of our mailing lists need to be open to non-subscribers. Project management feel strongly that maintaining this openness is more important than blocking spam.
This has been discussed several times at some length on the list. See the list archives. Bringing the topic up again is unlikely to be useful. Please don't. Or at the very least, please don't without reading the archives and being certain that whatever you are about to suggest has not yet been discussed.
Project technical lead Henry Spencer summarised one discussion:
For the third and last time: this list *will* *not* do address-based filtering. This is a policy decision, not an implementation problem. The decision is final, and is not open to discussion. This needs to be communicated better to people, and steps are being taken to do that.
Adding this FAQ section is one of the steps he refers to.
You have various options other than just putting up with the spam, filtering it yourself, or unsubscribing:
A number of tools are available to filter mail.
If you use your ISP's mail server rather than running your own, consider suggesting to the ISP that they tag suspected spam as this ISP does. They could just refuse mail from dubious sources, but that is tricky and runs some risk of losing valuable mail or senselessly annoying senders and their admins. However, they can safely tag and deliver dubious mail. The tags can greatly assist your filtering.
For information on tracking down spammers, see these HowTos, or the Sputum site. Sputum have a Linux anti-spam screensaver available for download.
Here is a more detailed message from Henry:
On Mon, 15 Jan 2001, Jay Vaughan wrote:
> I know I'm flogging a dead horse here, but I'm curious as to the reasons for
> an aversion for a subscriber-only mailing list?
Once again: for legal reasons, it is important that discussions of these
things be held in a public place -- the list -- and we do not want to
force people to subscribe to the list just to ask one question, because
that may be more than merely inconvenient for them. There are also real
difficulties with people who are temporarily forced to use alternate
addresses; that is precisely the time when they may be most in need of
help, yet a subscribers-only policy shuts them out.
These issues do not apply to most mailing lists, but for a list that is
(necessarily) the primary user support route for a crypto package, they
are very important. This is *not* an ordinary mailing list; it has to
function under awkward constraints that make various simplistic solutions
inapplicable or undesirable.
> We're *ALL* sick of hearing about list management problems, not just you
> old-timers, so why don't you DO SOMETHING EFFECTIVE ABOUT IT...
Because it's a lot harder than it looks, and many existing "solutions"
have problems when examined closely.
> A suggestion for you, based on 10 years of experience with management of my
> own mailing lists would be to use mailman, which includes pretty much every
> feature under the sun that you guys need and want, plus some. The URL for
> mailman...
I assure you, we're aware of mailman. Along with a whole bunch of others,
including some you almost certainly have never heard of (I hadn't!).
> As for the argument that the list shouldn't be configured to enforce
> subscription - I contend that it *SHOULD* AT LEAST require manual address
> verification in order for posts to be redirected.
You do realize, I hope, that interposing such a manual step might cause
your government to decide that this is not truly a public forum, and thus
you could go to jail if you don't get approval from them before mailing to
it? If you think this sounds irrational, your government is noted for
making irrational decisions in this area; we can't assume that they will
suddenly start being sensible. See above about awkward constraints. You
may be willing to take the risk, but we can't, in good conscience, insist
that all users with problems do so.
Henry Spencer
henry@spsystems.net
and a message on the topic from project leader John Gilmore:
Subject: Re: The linux-ipsec list's topic
Date: Sat, 30 Dec 2000
From: John Gilmore <gnu@toad.com>
I'll post this single message, once only, in this discussion, and then
not burden the list with any further off-topic messages. I encourage
everyone on the list to restrain themself from posting ANY off-topic
messages to the linux-ipsec list.
The topic of the linux-ipsec mailing list is the FreeS/WAN software.
I frequently see "discussions about spam on a list" overwhelm the
volume of "actual spam" on a list. BOTH kinds of messages are
off-topic messages. Twenty anti-spam messages take just as long to
detect and discard as twenty spam messages.
The Linux-ipsec list encourages on-topic messages from people who have
not joined the list itself. We will not censor messages to the list
based on where they originate, or what return address they contain.
In other words, non-subscribers ARE allowed to post, and this will not
change. My own valid contributions have been rejected out-of-hand by
too many other mailing lists for me to want to impose that censorship
on anybody else's contributions. And every day I see the damage that
anti-spam zeal is causing in many other ways; that zeal is far more
damaging to the culture of the Internet than the nuisance of spam.
In general, it is the responsibility of recipients to filter,
prioritize, or otherwise manage the handling of email that comes to
them. It is not the responsibility of the rest of the Internet
community to refrain from sending messages to recipients that they
might not want to see. If your software infrastructure for managing
your incoming email is insufficient, then improve it. If you think
the signal-to-noise ratio on linux-ipsec is too poor, then please
unsubscribe. But don't further increase the noise by posting to the
linux-ipsec list about those topics.
John Gilmore
founder & sponsor, FreeS/WAN project
The various components of Linux FreeS/WAN are of course documented in standard Unix manual pages, accessible via the man(1) command.
Links here take you to an HTML version of the man pages.
These files are also discussed in the configuration section.
Many users will never give most of the FreeS/WAN commands directly. Configure the files listed above correctly and everything should be automatic.
The exceptions are commands for mainpulating the RSA keys used in Pluto authentication:
Note that:
The following commands are fairly likely to be used, if only for testing and status checks:
The lower-level utilities listed below are normally invoked via scripts listed above, but they can also be used directly when required.
FreeS/WAN, or other IPsec implementations, frequently run on gateway machines, the same machines running firewall or packet filtering code. This document discusses the relation between the two.
The firewall code in 2.4 and later kernels is called Netfilter. The user-space utility to manage a firwewall is iptables(8). See the netfilter/iptables web site for details.
The basic constraint is that an IPsec gateway must have packet filters that allow IPsec packets, at least when talking to other IPsec gateways:
Your gateway and the other IPsec gateways it communicates with must be able to exchange these packets for IPsec to work. Firewall rules must allow UDP 500 and at least one of AH or ESP on the interface that communicates with the other gateway.
For nearly all FreeS/WAN applications, you must allow UDP port 500 and the ESP protocol.
There are two ways to set this up:
Both methods are described in more detail below.
It is possible to set up both firewalling and IPsec with appropriate scripts at boot and then not use leftupdown= and rightupdown=, or use them only for simple up and down operations.
Basically, the technique is
Since Pluto authenticates its partners during the negotiation, and KLIPS drops packets for which no tunnel has been negotiated, this may be all you need.
In simple cases, you need only a few rules, as in this example:
# allow IPsec # # IKE negotiations iptables -A INPUT -p udp --sport 500 --dport 500 -j ACCEPT iptables -A OUTPUT -p udp --sport 500 --dport 500 -j ACCEPT # ESP encrypton and authentication iptables -A INPUT -p 50 -j ACCEPT iptables -A OUTPUT -p 50 -j ACCEPT # uncomment for AH authentication header # iptables -A INPUT -p 51 -j ACCEPT # iptables -A OUTPUT -p 51 -j ACCEPT
However, while it is certainly possible to create an elaborate set of rules yourself (please let us know via the mailing list if you do), it may be both easier and more secure to use a set which has already been published and tested.
The published rule sets we know of are described in the next section.
It is therefore reasonably straightforward to filter these packets in whatever way suits your situation.
In some cases rules that work fine before you add IPsec may require modification to work with IPsec.
This is especially likely for rules that deal with interfaces on the Internet side of your system. IPsec adds a new interface; often the rules must change to take account of that.
For example, consider the rules given in this section of the Netfilter documentation:
Most people just have a single PPP connection to the Internet, and don't
want anyone coming back into their network, or the firewall:
## Insert connection-tracking modules (not needed if built into kernel).
# insmod ip_conntrack
# insmod ip_conntrack_ftp
## Create chain which blocks new connections, except if coming from inside.
# iptables -N block
# iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT
# iptables -A block -m state --state NEW -i ! ppp0 -j ACCEPT
# iptables -A block -j DROP
## Jump to that chain from INPUT and FORWARD chains.
# iptables -A INPUT -j block
# iptables -A FORWARD -j block
On an IPsec gateway, those rules may need to be modified. The above allows new connections from anywhere except ppp0. That means new connections from ipsec0 are allowed.
Do you want to allow anyone who can establish an IPsec connection to your gateway to initiate TCP connections to any service on your network? Almost certainly not if you are using opportunistic encryption. Quite possibly not even if you have only explicitly configured connections.
To disallow incoming connections from ipsec0, change the middle section above to:
## Create chain which blocks new connections, except if coming from inside.
# iptables -N block
# iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT
# iptables -A block -m state --state NEW -i ppp+ -j DROP
# iptables -A block -m state --state NEW -i ipsec+ -j DROP
# iptables -A block -m state --state NEW -i -j ACCEPT
# iptables -A block -j DROP
The original rules accepted NEW connections from anywhere except ppp0. This version drops NEW connections from any PPP interface (ppp+) and from any ipsec interface (ipsec+), then accepts the survivors.
Of course, these are only examples. You will need to adapt them to your own situation.
Several sets of firewall rules that work with FreeS/WAN are available.
One user, Rob Hutton, posted his boot time scripts to the mailing list, and we included them in previous versions of this documentation. They are still available from our web site. However, they were for an earlier FreeS/WAN version so we no longer recommend them. Also, they had some bugs. See this message.
Those scripts were based on David Ranch's scripts for his "Trinity OS" for setting up a secure Linux. Check his home page for the latest version and for information on his book on securing Linux. If you are going to base your firewalling on Ranch's scripts, we recommend using his latest version, and sending him any IPsec modifications you make for incorporation into later versions.
We have had several mailing lists reports of good results using FreeS/WAN with Seawall (the Seattle Firewall). See that project's home page on Sourceforge.
Another set of firewall scripts with IPsec support are the RCF or rc.firewall scripts. See their home page.
Asgard's Realm has set of firewall scripts with FreeS/WAN support, for 2.4 kernels and iptables.
One user gave considerable detail on his scripts, including supporting IPX through the tunnel. His message was too long to conveniently be quoted here, so I've put it in a separate file.
The ipsec.conf(5) configuration file has three pairs of parameters used to specify an interface between FreeS/WAN and firewalling code.
Note that using these is not required if you have a static firewall setup. In that case, you just set your firewall up at boot time (in a way that permits the IPsec connections you want) and do not change it thereafter. Omit all the FreeS/WAN firewall parameters and FreeS/WAN will not attempt to adjust firewall rules at all. See above for some information on appropriate scripts.
However, if you want your firewall rules to change when IPsec connections change, then you need to use these parameters.
One pair of parmeters are set in the config setup section of the ipsec.conf(5) file and affect all connections:
They can also be used in other ways. For example, you might have prepluto add a module to your kernel for the secure network interface or make a dialup connection, and then have postpluto remove the module or take the connection down.
The other parameters are set in connection descriptions. They can be set in individual connection descriptions, and could even call different scripts for each connection for maximum flexibility. In most applications, however, it makes sense to use only one script and to call it from conn %default section so that it applies to all connections.
You can:
Note that only one of these should be used. You cannot sensibly use both. Since our default script is obsolete (designed for firewalls using ipfwadm(8) on 2.0 kernels), most users who need this service will need to write a custom script.
We supply a default script named _updown.
Set these to yes and Pluto will call our default script _updown with appropriate arguments whenever it:
The supplied default _updown script is appropriate for simple cases using the ipfwadm(8) firewalling package.
You can also write your own script and have Pluto call it. Just put the script's name in one of these ipsec.conf(5) lines:
Your script should take the same arguments and use the same environment variables as _updown. See the "updown command" section of the ipsec_pluto(8) man page for details.
Note that you should not modify our _updown script in place . If you did that, then upgraded FreeS/WAN, the upgrade would install a new default script, overwriting your changes.
Our _updown is for firewalls using ipfwadm(8), the firewall code for the 2.0 series of Linux kernels. If you are using the more recent packages ipchains(8) (for 2.2 kernels) or iptables(8) (2.4 kernels), then you must do one of:
You can write a script to do whatever you need with firewalling. Specify its name in a [left|right]updown= parameter in ipsec.conf(5) and Pluto will automatically call it for you.
The arguments Pluto passes such a script are the same ones it passes to our default _updown script, so the best way to build yours is to copy ours and modify the copy.
Note, however, that you should not modify our _updown script in place. If you did that, then upgraded FreeS/WAN, the upgrade would install a new default script, overwriting your changes.
Network Address Translation, also known as IP masquerading, is a method of allocating IP addresses dynamically, typically in circumstances where the total number of machines which need to access the Internet exceeds the supply of IP addresses.
Any attempt to perform NAT operations on IPsec packets between the IPsec gateways creates a basic conflict:
For AH, which authenticates parts of the packet header including source and destination IP addresses, this is fatal. If NAT changes those fields, AH authentication fails.
For IKE and ESP it is not necessarily fatal, but is certainly an unwelcome complication.
This problem can be avoided by having the masquerading take place on or behind the IPsec gateway.
This can be done physically with two machines, one physically behind the other. A picture, using SG to indicate IPsec S ecurity Gateways, is:
clients --- NAT ----- SG ---------- SG
two machines
In this configuration, the actual client addresses need not be given in the leftsubnet= parameter of the FreeS/WAN connection description. The security gateway just delivers packets to the NAT box; it needs only that machine's address. What that machine does with them does not affect FreeS/WAN.
A more common setup has one machine performing both functions:
clients ----- NAT/SG ---------------SG
one machine
Here you have a choice of techniques depending on whether you want to make your client subnet visible to clients on the other end:
In this case, no masquerading is done. Packets to or from the client subnet are encrypted or decrypted without any change to their client subnet addresses, although of course the encapsulating packets use gateway addresses in their headers. Clients behind the right security gateway see a route via that gateway to the left subnet.
We recommend not trying to build IPsec connections which pass through a NAT machine. This setup poses problems:
clients --- SG --- NAT ---------- SG
If you must try it, some references are:
Other documents which may be relevant include:
Of course simply allowing UDP 500 and ESP packets is not the whole story. Various other issues arise in making IPsec and packet filters co-exist and even co-operate. Some of them are summarised below.
Basic IPsec packet filtering rules deal only with packets addressed to or sent from your IPsec gateway.
It is a separate policy decision whether to permit such packets to pass through the gateway so that client machines can build end-to-end IPsec tunnels of their own. This may not be practical if you are using NAT (IP masquerade) on your gateway, and may conflict with some corporate security policies.
Where possible, allowing this is almost certainly a good idea. Using IPsec on an end-to-end basis is more secure than gateway-to-gateway.
Doing it is quite simple. You just need firewall rules that allow UDP port 500 and protocols 50 and 51 to pass through your gateway. If you wish, you can of course restrict this to certain hosts.
One application of this is for the telecommuter who might have:
Sunset==========West------------------East ================= firewall --- the Internet
home network untrusted net corporate network
The subnet on the right is 0.0.0.0/0, the whole Internet. The West gateway is set up so that it allows only IPsec packets to East in or out.
This configuration is used in AT&T Research's network. For details, see the papers links in our introduction.
Another application would be to set up firewall rules so that an internal machine, such as an employees-only web server, could not talk to the outside world except via specific IPsec tunnels.
It is possible to use firewall rules to restrict UDP 500, ESP and AH packets so that these packets are accepted only from known gateways. This is not strictly necessary since FreeS/WAN will discard packets from unknown gateways. You might, however, want to do it for any of a number of reasons. For example:
It is not possible to use only static firewall rules for this filtering if you do not know the other gateways' IP addresses in advance, for example if you have "road warriors" who may connect from a different address each time or if want to do opportunistic encryption to arbitrary gateways. In these cases, you can accept UDP 500 IKE packets from anywhere, then use the updown script feature of pluto(8) to dynamically adjust firewalling for each negotiated tunnel.
Firewall packet filtering does not much reduce the risk of a denial of service attack on FreeS/WAN. The firewall can drop packets from unknown gateways, but KLIPS does that quite efficiently anyway, so you gain little. The firewall cannot drop otherwise legitmate packets that fail KLIPS authentication, so it cannot protect against an attack designed to exhaust resources by making FreeS/WAN perform many expensive authentication operations.
In summary, firewall filtering of IPsec packets from unknown gateways is possible but not strictly necessary.
When the IPsec gateway is also acting as your firewall, other packet filtering rules will be in play. In general, those are outside the scope of this document. See our Linux firewall links for information. There are a few types of packet, however, which can affect the operation of FreeS/WAN or of diagnostic tools commonly used with it. These are discussed below.
ICMP is the Internet Control Message Protocol. It is used for messages between IP implementations themselves, whereas IP used is used between the clients of those implementations. ICMP is, unsurprisingly, used for control messages. For example, it is used to notify a sender that a desination is not reachable, or to tell a router to reroute certain packets elsewhere.
ICMP handling is tricky for firewalls.
ICMP does not use ports. Messages are distinguished by a "message type" field and, for some types, by an additional "code" field. The definitive list of types and codes is on the IANA site.
One expert uses this definition for ICMP message types to be dropped at the firewall.
# ICMP types which lack socially redeeming value. # 5 Redirect # 9 Router Advertisement # 10 Router Selection # 15 Information Request # 16 Information Reply # 17 Address Mask Request # 18 Address Mask Reply badicmp='5 9 10 15 16 17 18'
A more conservative approach would be to make a list of allowed types and drop everything else.
Whichever way you do it, your ICMP filtering rules on a FreeS/WAN gateway should allow at least the following ICMP packet types:
It is fairly common for firewalls to drop ICMP echo packets addressed to machines behind the firewall. If that is your policy, please create an exception for such packets arriving via an IPsec tunnel, at least during intial testing of those tunnels.
The traceroute(1) utility uses UDP port numbers from 33434 to approximately 33633. Generally, these should be allowed through for troubleshooting.
Some firewalls drop these packets to prevent outsiders exploring the protected network with traceroute(1). If that is your policy, consider creating an exception for such packets arriving via an IPsec tunnel, at least during intial testing of those tunnels.
Windows 2000 does, and products designed for compatibility with it may, build L2TP tunnels over IPsec connections.
For this to work, you must allow UDP protocol 1701 packets coming out of your tunnels to continue to their destination. You can, and probably should, block such packets to or from your external interfaces, but allow them from ipsec0.
See also our Windows 2000 interoperation discussion.
IPsec uses three main types of packet:
All of those packets should have appropriate IPsec gateway addresses in both the to and from IP header fields. Firewall rules can check this if you wish, though it is not strictly necessary. This is discussed in more detail later.
IPsec processing of incoming packets authenticates them then removes the ESP or AH header and decrypts if necessary. Successful processing exposes an inner packet which is then delivered back to the firewall machinery, marked as having arrived on an ipsec[0-3] interface. Firewall rules can use that interface label to distinguish these packets from unencrypted packets which are labelled with the physical interface they arrived on (or perhaps with a non-IPsec virtual interface such as ppp0).
One of our users sent a mailing list message with a diagram of the packet flow.
Some protocols, such as TCP and UDP, have the notion of ports. Others protocols, including ESP and AH, do not. Quite a few IPsec newcomers have become confused on this point. There are no ports in the ESP or AH protocols, and no ports used for them. For these protocols, the idea of ports is completely irrelevant.
The protocol numbers for ESP or AH are used in the 'next header' field of the IP header. On most non-IPsec packets, that field would have one of:
Each header in the sequence tells what the next header will be. IPsec adds headers for ESP or AH near the beginning of the sequence. The original headers are kept and the 'next header' fields adjusted so that all headers can be correctly interpreted.
For example, using [ ] to indicate data protected by ESP and unintelligible to an eavesdropper between the gateways:
Part of the ESP header itself is encrypted, which is why the [ indicating protected data appears in the middle of some lines above. The next header field of the ESP header is protected. This makes traffic analysis more difficult. The next header field would tell an eavesdropper whether your packet was UDP to the gateway, TCP to the gateway, or encapsulated IP. It is better not to give this information away. A clever attacker may deduce some of it from the pattern of packet sizes and timings, but we need not make it easy.
IPsec allows various combinations of these to match local policies, including combinations that use both AH and ESP headers or that nest multiple copies of these headers.
For example, suppose my employer has an IPsec VPN running between two offices so all packets travelling between the gateways for those offices are encrypted. If gateway policies allow it (The admins could block UDP 500 and protocols 50 and 51 to disallow it), I can build an IPsec tunnel from my desktop to a machine in some remote office. Those packets will have one ESP header throughout their life, for my end-to-end tunnel. For part of the route, however, they will also have another ESP layer for the corporate VPN's encapsulation. The whole header scheme for a packet on the Internet might be:
The first ESP (outermost) header is for the corporate VPN. The inner ESP header is for the secure machine-to-machine link.
Here are some mailing list comments from pluto(8) developer Hugh Redelmeier on an earlier draft of this document:
There are many important things left out
- firewalling is important but must reflect (implement) policy. Since
policy isn't the same for all our customers, and we're not experts,
we should concentrate on FW and MASQ interactions with FreeS/WAN.
- we need a diagram to show packet flow WITHIN ONE MACHINE, assuming
IKE, IPsec, FW, and MASQ are all done on that machine. The flow is
obvious if the components are run on different machines (trace the
cables).
IKE input:
+ packet appears on public IF, as UDP port 500
+ input firewalling rules are applied (may discard)
+ Pluto sees the packet.
IKE output:
+ Pluto generates the packet & writes to public IF, UDP port 500
+ output firewalling rules are applied (may discard)
+ packet sent out public IF
IPsec input, with encapsulated packet, outer destination of this host:
+ packet appears on public IF, protocol 50 or 51. If this
packet is the result of decapsulation, it will appear
instead on the paired ipsec IF.
+ input firewalling rules are applied (but packet is opaque)
+ KLIPS decapsulates it, writes result to paired ipsec IF
+ input firewalling rules are applied to resulting packet
as input on ipsec IF
+ if the destination of the packet is this machine, the
packet is passed on to the appropriate protocol handler.
If the original packet was encapsulated more than once
and the new outer destination is this machine, that
handler will be KLIPS.
+ otherwise:
* routing is done for the resulting packet. This may well
direct it into KLIPS for encoding or encrypting. What
happens then is described elsewhere.
* forwarding firewalling rules are applied
* output firewalling rules are applied
* the packet is sent where routing specified
IPsec input, with encapsulated packet, outer destination of another host:
+ packet appears on some IF, protocol 50 or 51
+ input firewalling rules are applied (but packet is opaque)
+ routing selects where to send the packet
+ forwarding firewalling rules are applied (but packet is opaque)
+ packet forwarded, still encapsulated
IPsec output, from this host or from a client:
+ if from a client, input firewalling rules are applied as the
packet arrives on the private IF
+ routing directs the packet to an ipsec IF (this is how the
system decides KLIPS processing is required)
+ if from a client, forwarding firewalling rules are applied
+ KLIPS eroute mechanism matches the source and destination
to registered eroutes, yielding a SPI group. This dictates
processing, and where the resulting packet is to be sent
(the destinations SG and the nexthop).
+ output firewalling is not applied to the resulting
encapsulated packet
- Until quite recently, KLIPS would double encapsulate packets that
didn't strictly need to be. Firewalling should be prepared for
those packets showing up as ESP and AH protocol input packets on
an ipsec IF.
- MASQ processing seems to be done as if it were part of the
forwarding firewall processing (this should be verified).
- If a firewall is being used, it is likely the case that it needs to
be adjusted whenever IPsec SAs are added or removed. Pluto invokes
a script to do this (and to adjust routing) at suitable times. The
default script is only suitable for ipfwadm-managed firewalls. Under
LINUX 2.2.x kernels, ipchains can be managed by ipfwadm (emulation),
but ipchains more powerful if manipulated using the ipchains command.
In this case, a custom updown script must be used.
We think that the flexibility of ipchains precludes us supplying an
updown script that would be widely appropriate.
This document covers several general places where you might have a problem:
This document also contains notes which expand on points made in these sections, and tips for problem reporting. If the other end of your connection is not FreeS/WAN, you'll also want to read our interoperation document.
With the RPM method:
freeswan-1.98_2.4.18_3custom-0.i386.rpm
freeswan-module-1.98_2.4.18_3custom-0.i386.rpm
When installing from source, you may find these problems:
ipsec verify checks a number of FreeS/WAN essentials. Here are some hints on what do to when your system doesn't check out:
| Problem | Status | Action |
| ipsec not on-path |
Add /usr/local/sbin to your PATH. | |
| Missing KLIPS support | critical | See this FAQ. |
| No RSA private key |
Follow these instructions to create an RSA key pair for your host. RSA keys are:
| |
| pluto not running | critical |
service ipsec start |
| No port 500 hole | critical | Open port 500 for IKE negotiation. |
| Port 500 check N/A | Check that port 500 is open for IKE negotiation. | |
| Failed DNS checks | Opportunistic encryption requires information from DNS. To set this up, see our instructions. | |
| No public IP address | Check that the interface which you want to protect with IPSec is up and running. |
When you fail to bring up a tunnel, you'll need to find out:
before you can diagnose your problem .
You can see connection states (STATE_MAIN_I1 and so on) when you bring up a connection on the command line. If you have missed this, or brought up your connection automatically, use:
ipsec auto --status
The most relevant state is the last one reached.
Negotiations should proceed though various states, in the processes of:
These are done and a connection is established when you see messages like:
000 #21: "myconn" STATE_MAIN_I4 (ISAKMP SA established)...
000 #2: "myconn" STATE_QUICK_I2 (sent QI2, IPsec SA established)...
Look for the key phrases are "ISAKMP SA established" and "IPSec SA established", with the relevant connection name. Often, this happens at STATE_MAIN_I4 and STATE_QUICK_I2, respectively.
ipsec auto --status will tell you what states have been achieved, rather than the current state. Since determining the current state is rather more difficult to do, current state information is not available from Linux FreeS/WAN. If you are actively bringing a connection up, the status report's last states for that connection likely reflect its current state. Beware, though, of the case where a connection was correctly brought up but is now downed: Linux FreeS/WAN will not notice this until it attempts to rekey. Meanwhile, the last known state indicates that the connection has been established.
If your connection is stuck at STATE_MAIN_I1, skip straight to here.
Solving most errors will require you to find verbose error text, either on the command line or in the logs.
Note that you can get more detail from ipsec auto using the --verbose flag:
ipsec auto --verbose --up west-east
More complete information can be gleaned from the log files.
The amount of description you'll get here depends on ipsec.conf debug settings, klipsdebug= and plutodebug=. When troubleshooting, set at least one of these to all, and when done, reset it to none so your logs don't fill up. Note that you must have enabled the klipsdebug compile-time option for the klipsdebug configuration switch to work.
For negotiation problems plutodebug is most relevant. klipsdebug applies mainly to attempts to use an already-established connection. See also this description of the division of duties within Linux FreeS/WAN.
After raising your debug levels, restart Linux FreeS/WAN to ensure that ipsec.conf is reread, then recreate the error to generate verbose logs.
ipsec barf (8) collects a bunch of useful debugging information, including these logs Use the command
ipsec barf > barf.west
to generate one.
Search out the failure point in your logs. Are there a handful of lines which succinctly describe how things are going wrong or contrary to your expectation? Sometimes the failure point is not immediately obvious: Linux FreeS/WAN's errors are usually not marked "Error". Have a look in the FAQ for what some common failures look like.
Tip: problems snowball. Focus your efforts on the first problem, which is likely to be the cause of later errors.
Also find error text on the peer IPSec box. This gives you two perspectives on the same failure.
At times you will require information which only one side has. The peer can merely indicate the presence of an error, and its approximate point in the negotiations. If one side keeps retrying, it may be because there is a show stopper on the other side. Have a look at the other side and figure out what it doesn't like.
If the other end is not Linux FreeS/WAN, the principle is the same: replicate the error with its most verbose logging on, and capture the output to a file.
This error commonly happens because IKE (port 500) packets, needed to negotiate an IPSec connection, cannot travel freely between your IPSec gateways. See our firewall document for details.
Other errors require a bit more digging. Use the following resources:
If you have failed to solve your problem with the help of these resources, send a detailed problem report to the users list, following these guidelines.
Test your connection by sending packets through it. The simplest way to do this is with ping, but the ping needs to test the correct tunnel. See this example scenario if you don't understand this.
If your ping returns, test any other connections you've brought u all check out, great. You may wish to test with large packets for MTU problems.
If your ping fails to return, generate an ipsec barf debugging report on each IPSec gateway. On a non-Linux FreeS/WAN implementation, gather equivalent information. Use this, and the tips in the next sections, to troubleshoot. Are you sure that both endpoints are capable of hearing and responding to ping?
IPSec may be dropping your ping packets since they do not belong in the tunnels you have constructed:
In either case, you will often see a message like:
klipsdebug... no eroute
which we discuss in this FAQ.
Note:
If you've confirmed your configuration assumptions, the problem is almost certainly with routing or firewalling. Isolate the problem using interface statistics, firewall statistics, or a packet sniffer.
Interface reports and firewall statistics can help you track down lost packets at a glance.
Check any firewall statistics you may be keeping on your IPSec gateways, for dropped packets.
Both cat /proc/net/dev and ifconfig display interface statistics, and both are included in ipsec barf. Use either to check if any interface has dropped packets. If you find that one has, test whether this is related to your ping. While you ping continuously, print that interface's statistics several times. Does its drop count increase in proportion to the ping? If so, check why the packets are dropped there.
To do this, look at the firewall rules that apply to that interface. If the interface is an IPSec interface, more information may be available in the log. Grep for the word "drop" in a log which was created with klipsdebug=all as the error happened.
See also this discussion on interpreting ifconfig statistics.
If you have checked configuration assumptions, routing, and firewall rules, and your interface statistics yield no clue, it remains for you to investigate the mystery of the lost packet by the most thorough method: with a packet sniffer (providing, of course, that this is legal where you are working).
In order to detect packets on the ipsec virtual interfaces, you will need an up-to-date sniffer (tcpdump, ethereal, ksnuffle) on your IPSec gateway machines. You may also find it useful to sniff the ping endpoints.
Ping, and examine each interface along the projected path, checking for your ping's arrival. If it doesn't get to the the next stop, you have narrowed down where to look for it. In this way, you can isolate a problem area, and narrow your troubleshooting focus.
Within a machine running Linux FreeS/WAN, this packet flow diagram will help you anticipate a packet's path.
Note that:
Once you isolate where the packet is lost, take a closer look at firewall rules, routing and configuration assumptions as they affect that specific area. If the packet is lost on an IPSec gateway, comb through klipsdebug output for anomalies.
If the packet goes through both gateways successfully and reaches the ping target, but does not return, suspect routing. Check that the ping target routes packets back to the IPSec gateway.
Here, too, log information can be useful. Start with the guidelines above.
For connection use problems, set klipsdebug=all. Note that you must have enabled the klipsdebug compile-time option to do this. Restart Linux FreeS/WAN so that it rereads ipsec.conf, then recreate the error condition. When searching through klipsdebug data, look especially for the keywords "drop" (as in dropped packets) and "error".
Often the problem with connection use is not software error, but rather that the software is behaving contrary to expectation.
To interpret the Linux FreeS/WAN log text you've found, use the same resources as indicated for troubleshooting connection negotiation: the FAQ , our background document, and the list archives. Looking in the KLIPS code is only for the very brave.
If you are still stuck, send a detailed problem report to the users' list.
If each of your connections passed the ping test, you may wish to test by pinging with large packets (2000 bytes or larger). If it does not return, suspect MTU issues, and see this discussion.
In most users' view, a simple ping test, and perhaps a large-packet ping test suffice to indicate a working IPSec connection.
Some people might like to do additional stress tests prior to production use. They may be interested in this testing protocol we use at interoperation conferences, aka "bakeoffs". We also have a testing directory that ships with the release.
Ask for troubleshooting help on the users' mailing list, users@lists.freeswan.org. While sometimes an initial query with a quick description of your intent and error will twig someone's memory of a similar problem, it's often necessary to send a second mail with a complete problem report.
The essay How to Report Bugs Effectively contains good guidelines.
When reporting problems to the mailing list(s), please include:
To report a problem, send mail about it to the users' list. If you are certain that you have found a bug, report it to the bugs list. If you encounter a problem while doing your own coding on the Linux FreeS/WAN codebase and think it is of interest to the design team, notify the design list. When in doubt, default to the users' list. More information about the mailing lists is found here.
For a number of reasons -- including export-control regulations affecting almost any private discussion of encryption software -- we prefer that problem reports and discussions go to the lists, not directly to the team. Beware that the list goes worldwide; US citizens, read this important information about your export laws. If you're using this software, you really should be on the lists. To get onto them, visit lists.freeswan.org.
If you do send private mail to our coders or want a private reply from them, please make sure that the return address on your mail (From or Reply-To header) is a valid one. They have more important things to do than to unravel addresses that have been mangled in an attempt to confuse spammers.
The following sections supplement the Guide: information available on your system; testing between security gateways; ifconfig reports for KLIPS debugging; using GDB on Pluto.
Linux FreeS/WAN logs to:
Check both places to get full information. If you find nothing, check your syslogd.conf(5) to see where your /etc/syslog.conf or equivalent is directing authpriv messages.
Other man pages are on this list and in
Sometimes you need to test a subnet-subnet tunnel. This is a tunnel between two security gateways, which protects traffic on behalf of the subnets behind these gateways. On this network:
Sunset==========West------------------East=========Sunrise
IPSec gateway IPSec gateway
local net untrusted net local net
you might name this tunnel sunset-sunrise. You can test this tunnel by having a machine behind one gateway ping a machine behind the other gateway, but this is not always convenient or even possible.
Simply pinging one gateway from the other is not useful. Such a ping does not normally go through the tunnel. The tunnel handles traffic between the two protected subnets, not between the gateways . Depending on the routing in place, a ping might
Neither event tells you anything about the tunnel. You can explicitly create an eroute to force such packets through the tunnel, or you can create additional tunnels as described in our configuration document, but those may be unnecessary complications in your situation.
The trick is to explicitly test between both gateways' private-side IP addresses. Since the private-side interfaces are on the protected subnets, the resulting packets do go via the tunnel. Use either ping -I or traceroute -i, both of which allow you to specify a source interface. (Note: unsupported on older Linuxes). The same principles apply for a road warrior (or other) case where only one end of your tunnel is a subnet.
When diagnosing problems using ifconfig statistics, you may wonder what type of activity increments a particular counter for an ipsecN device. Here's an index, posted by KLIPS developer Richard Guy Briggs:
Here is a catalogue of the types of errors that can occur for which
statistics are kept when transmitting and receiving packets via klips.
I notice that they are not necessarily logged in the right counter.
. . .
Sources of ifconfig statistics for ipsec devices
rx-errors:
- packet handed to ipsec_rcv that is not an ipsec packet.
- ipsec packet with payload length not modulo 4.
- ipsec packet with bad authenticator length.
- incoming packet with no SA.
- replayed packet.
- incoming authentication failed.
- got esp packet with length not modulo 8.
tx_dropped:
- cannot process ip_options.
- packet ttl expired.
- packet with no eroute.
- eroute with no SA.
- cannot allocate sk_buff.
- cannot allocate kernel memory.
- sk_buff internal error.
The standard counters are:
struct enet_statistics
{
int rx_packets; /* total packets received */
int tx_packets; /* total packets transmitted */
int rx_errors; /* bad packets received */
int tx_errors; /* packet transmit problems */
int rx_dropped; /* no space in linux buffers */
int tx_dropped; /* no space available in linux */
int multicast; /* multicast packets received */
int collisions;
/* detailed rx_errors: */
int rx_length_errors;
int rx_over_errors; /* receiver ring buff overflow */
int rx_crc_errors; /* recved pkt with crc error */
int rx_frame_errors; /* recv'd frame alignment error */
int rx_fifo_errors; /* recv'r fifo overrun */
int rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */
int tx_aborted_errors;
int tx_carrier_errors;
int tx_fifo_errors;
int tx_heartbeat_errors;
int tx_window_errors;
};
of which I think only the first 6 are useful.
You may need to use the GNU debugger, gdb(1), on Pluto. This should be necessary only in unusual cases, for example if you encounter a problem which the Pluto developer cannot readily reproduce or if you are modifying Pluto.
Here are the Pluto developer's suggestions for doing this:
Can you get a core dump and use gdb to find out what Pluto was doing
when it died?
To get a core dump, you will have to set dumpdir to point to a
suitable directory (see ipsec.conf(5)).
To get gdb to tell you interesting stuff:
$ script
$ cd dump-directory-you-chose
$ gdb /usr/local/lib/ipsec/pluto core
(gdb) where
(gdb) quit
$ exit
The resulting output will have been captured by the script command in
a file called "typescript". Send it to the list.
Do not delete the core file. I may need to ask you to print out some
more relevant stuff.
Note that the dumpdir parameter takes effect only when the IPsec subsystem is restarted -- reboot or ipsec setup restart.
Much of this document is quoted directly from the Linux FreeS/WAN mailing list. Thanks very much to the community of testers, patchers and commenters there, especially the ones quoted below but also various contributors we haven't quoted.
In general, do not expect Linux FreeS/WAN to do everything yet. This is a work-in-progress and some parts of the IPsec specification are not yet implemented.
Things we do, as of version 1.96:
In negotiating a keying connection (ISAKMP SA, Phase 1) we propose both groups when we are the initiator, and accept either when a peer proposes them. Once the keying connection is made, we propose only the alternative agreed there for data connections (IPsec SA's, Phase 2) negotiated over that keying connection.
In negotiations, we propose both of these and accept either.
All combinations of implemented transforms are supported. Note that some form of packet-level authentication is required whenever encryption is used. Without it, the encryption will not be secure.
Things we deliberately omit which are required in the RFCs are:
Since these are the only encryption algorithms and DH group the RFCs require, it is possible in theory to have a standards-conforming implementation which will not interpoperate with FreeS/WAN. Such an implementation would be inherently insecure, so we do not consider this a problem.
Anyway, most implementations sensibly include more secure options as well, so dropping null encryption, single DES and Group 1 does not greatly hinder interoperation in practice.
We also do not implement some optional features allowed by the RFCs:
In theory, this should cause no interoperation problems since all implementations are required to support the more secure main mode, whether or not they also allow aggressive mode.
In practice, it does sometimes produce problems with implementations such as Windows 2000 where aggressive mode is the default. Typically, these are easily solved with a configuration change that overrides that default.
Things we don't yet do, as of version 1.96:
Currently Triple DES is the only encryption method Pluto will negotiate.
No additional encryption transforms are implemented, though the RFCs allow them and some other IPsec implementations support various of them. We are not eager to add more. See this FAQ question.
AES, the successor to the DES standard, is an excellent candidate for inclusion in FreeS/WAN, see links to user patches.
No optional additional authentication transforms are currently implemented. Likely SHA-256, SHA-384 and SHA-512 will be added when AES is.
To fully comply with the RFCs, it is not enough just to accept only packets which survive any firewall rules in place to limit what IPsec packets get in, and then pass KLIPS authentication. That is what FreeS/WAN currently does.
We should also apply additional tests, for example ensuring that all packets emerging from a particular tunnel have source and destination addresses that fall within the subnets defined for that tunnel, and that packets with those addresses that did not emerge from the appropriate tunnel are disallowed.
This will be done as part of a KLIPS rewrite. See these links and the design mailing list for discussion.
We use PF-key Version Two for communication between the KLIPS kernel code and the Pluto Daemon. PF-Key v2 is defined by RFC 2367.
The "PF" stands for Protocol Family. PF-Inet defines a kernel/userspace interface for the TCP/IP Internet protocols (TCP/IP), and other members of the PF series handle Netware, Appletalk, etc. PF-Key is just a PF for key-related matters.
PF-Key came out of Berkeley Unix work and is used in the various BSD IPsec implementations, and in Solaris. This means there is some hope of porting our Pluto(8) to one of the BSD distributions, or of running their photurisd(8) on Linux if you prefer Photuris key management over IKE.
It is, however, more complex than that. The PK-Key RFC deliberately deals only with keying, not policy management. The three PF-Key implementations we have looked at -- ours, OpenBSD and KAME -- all have extensions to deal with security policy, and the extensions are different. There have been discussions aimed at sorting out the differences, perhaps for a version three PF-Key spec. All players are in favour of this, but everyone involved is busy and it is not clear whether or when these discussions might bear fruit.
We develop and test on Redhat Linux using the most recent kernel in the 2.2 and 2.4 series. In general, we recommend you use the latest kernel in one of those series. Complications and caveats are discussed below.
Consider upgrading to the 2.2 kernel series. If you want to stay with the 2.0 series, then we strongly recommend 2.0.39. Some useful security patches were added in 2.0.38.
Various versions of the code have run at various times on most 2.0.xx kernels, but the current version is only lightly tested on 2.0.39, and not at all on older kernels.
Some of our patches for older kernels are shipped in 2.0.37 and later, so they are no longer provided in FreeS/WAN. This means recent versions of FreeS/WAN will probably not compile on anything earlier than 2.0.37.
In general, we suggest the latest 2.2 kernel or 2.4 for production use.
Of course no release can be guaranteed to run on kernels more recent than it is, so quite often there will be no stable FreeS/WAN for the absolute latest kernel. See the FAQ for discussion.
We develop and test on Redhat 6.1 for 2.2 kernels, and on Redhat 7.1 or 7.2 for 2.4, so minor changes may be required for other distributions.
There are some problems with FreeS/WAN on Redhat 7.0. They are soluble, but we recommend you upgrade to a later Redhat instead..
Redhat 7 ships with two compilers.
Kernel Makefiles have gcc as a default, and must be adjusted to use kgcc before a kernel will compile on 7.0. This mailing list message gives details:
Subject: Re: AW: Installing IPsec on Redhat 7.0 Date: Thu, 1 Feb 2001 14:32:52 -0200 (BRST) From: Mads Rasmussen <mads@cit.com.br> > From www.redhat.com/support/docs/gotchas/7.0/gotchas-7-6.html#ss6.1 cd to /usr/src/linux and open the Makefile in your favorite editor. You will need to look for a line similar to this: CC = $(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH) This line specifies which C compiler to use to build the kernel. It should be changed to: CC = $(CROSS_COMPILE)kgcc -D__KERNEL__ -I$(HPATH) for Red Hat Linux 7. The kgcc compiler is egcs 2.91.66. From here you can proceed with the typical compiling steps.
Check the mailing list archive for more recent news.
SuSE 6.3 and later versions, at least in Europe, ship with FreeS/WAN included.
Here are some notes for an earlier SuSE version.
Date: Mon, 30 Nov 1998
From: Peter Onion <ponion@srd.bt.co.uk>
... I got Saturdays snapshot working between my two SUSE5.3 machines at home.
The mods to the install process are quite simple. From memory and looking at
the files on the SUSE53 machine here at work....
And extra link in each of the /etc/init.d/rc?.d directories called K35ipsec
which SUSE use to shut a service down.
A few mods in /etc/init.d/ipsec to cope with the different places that SUSE
put config info, and remove the inculsion of /etc/rc.d/init.d/functions and .
/etc/sysconfig/network as they don't exists and 1st one isn't needed anyway.
insert ". /etc/rc.config" to pick up the SUSE config info and use
if test -n "$NETCONFIG" -a "$NETCONFIG" != "YAST_ASK" ; then
to replace
[ ${NETWORKING} = "no" ] && exit 0
Create /etc/sysconfig as SUSE doesn't have one.
I think that was all (but I prob forgot something)....
You may also need to fiddle initialisation scripts to ensure that /var/run/pluto.pid is removed when rebooting. If this file is present, Pluto does not come up correctly.
Subject: Re: linux-IPsec: Slackware distribution Date: Thu, 15 Apr 1999 12:07:01 -0700 From: Evan Brewer <dmessiah@silcon.com> > Very shortly, I will be needing to install IPsec on at least gateways that > are running Slackware. . . . The only trick to getting it up is that on the slackware dist there is no init.d directory in /etc/rc.d .. so create one. Then, what I do is take the IPsec startup script which normally gets put into the init.d directory, and put it in /etc/rc.d and name ir rc.ipsec .. then I symlink it to the file in init.d. The only file in the dist you need to really edit is the utils/Makefile, setup4: Everything else should be just fine.
A year or so later:
Subject: Re: HTML Docs- Need some cleanup? Date: Mon, 8 Jan 2001 From: Jody McIntyre <jodym@oeone.com> I have successfully installed FreeS/WAN on several Slackware 7.1 machines. FreeS/WAN installed its rc.ipsec file in /etc/rc.d. I had to manually call this script from rc.inet2. This seems to be an easier method than Evan Brewer's.
A recent (Nov 2001) mailing list points to a web page on setting up several types of tunnel, including IPsec, on Debian.
Some older information:
Subject: FreeS/WAN 1.0 on Debian 2.1
Date: Tue, 20 Apr 1999
From: Tim Miller <cerebus+counterpane@haybaler.sackheads.org>
Compiled and installed without error on a Debian 2.1 system
with kernel-source-2.0.36 after pointing RCDIR in utils/Makefile to
/etc/init.d.
/var/lock/subsys/ doesn't exist on Debian boxen, needs to be
created; not a fatal error.
Finally, IPsec scripts appear to be dependant on GNU awk
(gawk); the default Debian awk (mawk-1.3.3-2) had fatal difficulties.
With gawk installed and /etc/alternatives/awk linked to /usr/bin/gawk
operation appears flawless.
The scripts in question have been modified since this was posted. Awk versions should no longer be a problem.
Subject: Re: HTML Docs- Need some cleanup? Date: Mon, 08 Jan 2001 From: Andy Bradford <andyb@calderasystems.com> On Sun, 07 Jan 2001 22:59:05 EST, Sandy Harris wrote: > Intel Linux distributions other than Redhat 5.x and 6.x > Redhat 7.0 > SuSE Linux > SuSE Linux 5.3 > Slackware > Debian Can you please include Caldera in this list? I have tested it since FreeS/Wan 1.1 and it works great with our systems---provided one follows the FreeS/Wan documentation. :-) Thank you, Andy
FreeS/WAN has been run sucessfully on a number of different CPU architectures. If you have tried it on one not listed here, please post to the mailing list.
Subject: linux-ipsec: Netwinder diffs Date: Wed, 06 Jan 1999 From: rhatfield@plaintree.com I had a mistake in my IPsec-auto, so I got things working this morning. Following are the diffs for my changes. Probably not the best and cleanest way of doing it, but it works. . . .
These diffs are in the 0.92 and later distributions, so these should work out-of-the-box on Netwinder.
Subject: Compiling FreeS/WAN 1.1 on YellowDog Linux (PPC) Date: 11 Dec 1999 From: Darron Froese <darron@fudgehead.com> I'm summarizing here for the record - because it's taken me many hours to do this (multiple times) and because I want to see IPsec on more linuxes than just x86. Also, I can't remember if I actually did summarize it before... ;-) I'm working too many late hours. That said - here goes. 1. Get your linux kernel and unpack into /usr/src/linux/ - I used 2.2.13. <http://www.kernel.org/pub/linux/kernel/v2.2/linux-2.2.13.tar.bz2> 2. Get FreeS/WAN and unpack into /usr/src/freeswan-1.1 <ftp://ftp.xs4all.nl/pub/crypto/freeswan/freeswan-1.1.tar.gz> 3. Get the gmp src rpm from here: <ftp://ftp.yellowdoglinux.com//pub/yellowdog/champion-1.1/SRPMS/SRPMS/gmp-2.0.2-9a.src.rpm> 4. Su to root and do this: rpm --rebuild gmp-2.0.2-9a.src.rpm You will see a lot of text fly by and when you start to see the rpm recompiling like this: Executing: %build + umask 022 + cd /usr/src/redhat/BUILD + cd gmp-2.0.2 + libtoolize --copy --force Remember to add `AM_PROG_LIBTOOL' to `configure.in'. You should add the contents of `/usr/share/aclocal/libtool.m4' to `aclocal.m4'. + CFLAGS=-O2 -fsigned-char + ./configure --prefix=/usr Hit Control-C to stop the rebuild. NOTE: We're doing this because for some reason the gmp source provided with FreeS/WAN 1.1 won't build properly on ydl. cd /usr/src/redhat/BUILD/ cp -ar gmp-2.0.2 /usr/src/freeswan-1.1/ cd /usr/src/freeswan-1.1/ rm -rf gmp mv gmp-2.0.2 gmp 5. Open the freeswan Makefile and change the line that says: KERNEL=$(b)zimage (or something like that) to KERNEL=vmlinux 6. cd ../linux/ 7. make menuconfig Select an option or two and then exit - saving your changes. 8. cd ../freeswan-1.1/ ; make menugo That will start the whole process going - once that's finished compiling, you have to install your new kernel and reboot. That should build FreeS/WAN on ydl (I tried it on 1.1).And a later message on the same topic:
Subject: Re: FreeS/WAN, PGPnet and E-mail Date: Sat, 22 Jan 2000 From: Darron Froese <darron@fudgehead.com> on 1/22/00 6:47 PM, Philip Trauring at philip@trauring.com wrote: > I have a PowerMac G3 ... The PowerMac G3 can run YDL 1.1 just fine. It should also be able to run FreeS/WAN 1.2patch1 with a couple minor modifications: 1. In the Makefile it specifies a bzimage for the kernel compile - you have to change that to vmlinux for the PPC. 2. The gmp source that comes with FreeS/WAN (for whatever reason) fails to compile. I have gotten around this by getting the gmp src rpm from here: ftp://ftp.yellowdoglinux.com//pub/yellowdog/champion-1.1/SRPMS/SRPMS/gmp-2.0.2-9a.src.rpm If you rip the source out of there - and place it where the gmp source resides it will compile just fine.
FreeS/WAN no longer includes GMP source.
One user reports success on the Mach-based micro kernel Linux.
Subject: Smiles on sparc and ppc Date: Fri, 10 Mar 2000 From: Jake Hill <jah@alien.bt.co.uk> You may or may not be interested to know that I have successfully built FreeS/WAN on a number of non intel alpha architectures; namely on ppc and sparc and also on osfmach3/ppc (MkLinux). I can report that it just works, mostly, with few changes.
Subject: IT WORKS (again) between intel & alpha :-))))) Date: Fri, 29 Jan 1999 From: Peter Onion <ponion@srd.bt.co.uk> Well I'm happy to report that I've got an IPsec connection between by intel & alpha machines again :-)) If you look back on this list to 7th of December I wrote... -On 07-Dec-98 Peter Onion wrote: -> -> I've about had enuf of wandering around inside the kernel trying to find out -> just what is corrupting outgoing packets... - -Its 7:30 in the evening ..... - -I FIXED IT :-)))))))))))))))))))))))))))))))) - -It was my own fault :-(((((((((((((((((( - -If you ask me very nicly I'll tell you where I was a little too over keen to -change unsigned long int __u32 :-) OPSE ... - -So tomorrow it will full steam ahead to produce a set of diffs/patches against -0.91 - -Peter Onion.
In general (there have been some glitches), FreeS/WAN has been running on Alphas since then.
Several users have reported success with FreeS/WAN on SPARC Linux. Here is one mailing list message:
Subject: Smiles on sparc and ppc Date: Fri, 10 Mar 2000 From: Jake Hill <jah@alien.bt.co.uk> You may or may not be interested to know that I have successfully built FreeS/WAN on a number of non intel alpha architectures; namely on ppc and sparc and also on osfmach3/ppc (MkLinux). I can report that it just works, mostly, with few changes. I have a question, before I make up some patches. I need to hack gmp/mpn/powerpc32/*.s to build them. Is this ok? The changes are trivial, but could I also use a different version of gmp? Is it vanilla here? I guess my only real headache is from ipchains, which appears to stop running when IPsec has been started for a while. This is with 2.2.14 on sparc.
This message, from a different mailing list, may be relevant for anyone working with FreeS/WAN on Suns:
Subject: UltraSPARC DES assembler
Date: Thu, 13 Apr 2000
From: svolaf@inet.uni2.dk (Svend Olaf Mikkelsen)
To: coderpunks@toad.com
An UltraSPARC assembler version of the LibDES/SSLeay/OpenSSL des_enc.c
file is available at http://inet.uni2.dk/~svolaf/des.htm.
This brings DES on UltraSPARC from slower than Pentium at the same
clock speed to significantly faster.
We know FreeS/WAN runs on at least some MIPS processors because Lasat manufacture an IPsec box based on an embedded MIPS running Linux with FreeS/WAN. We have no details.
The Merilus Firecard, a Linux firewall on a PCI card, is based on a Crusoe processor and supports FreeS/WAN.
Subject: Re: Crypto hardware support Date: Mon, 03 Jul 2000 From: Dan DeVault <devault@tampabay.rr.com> .... I have been running uClinux with FreeS/WAN 1.4 on a system built by Moreton Bay ( http://www.moretonbay.com ) and it was using a Coldfire processor and was able to do the Triple DES encryption at just about 1 mbit / sec rate....... they put a Hi/Fn 7901 hardware encryption chip on their board and now their system does over 25 mbit of 3DES encryption........ pretty significant increase if you ask me.
FreeS/WAN is designed to work on SMP (symmetric multi-processing) Linux machines and is regularly tested on dual processor x86 machines.
We do not know of any testing on multi-processor machines with other CPU architectures or with more than two CPUs. Anyone who does test this, please report results to the mailing list .
The current design does not make particularly efficient use of multiprocessor machines; some of the kernel work is single-threaded.
Supporting hardware cryptography accelerators has not been a high priority for the development team because it raises a number of fairly complex issues:
That said, we have a report of FreeS/WAN working with one crypto accelerator and some work is going on to modify KLIPS to create a clean generic interface to such products. See this web page for some of the design discussion.
More recently, a patch to support some hardware accelerators has been posted:
Subject: [Design] [PATCH] H/W acceleration patch Date: Tue, 18 Sep 2001 From: "Martin Gadbois" <martin.gadbois@colubris.com> Finally!! Here's a web site with H/W acceleration patch for FreeS/WAN 1.91, including S/W and Hifn 7901 crypto support. http://sources.colubris.com/ Martin Gadbois
Hardware accelerators could take performance well beyond what FreeS/WAN can do in software (discussed here ). Here is some discussion off the IETF IPsec list, October 2001:
... Currently shipping chips deliver, 600 mbps throughput on a single stream of 3DES IPsec traffic. There are also chips that use multiple cores to do 2.4 gbps. We (Cavium) and others have announced even faster chips. ... Mid 2002 versions will handle at line rate (OC48 and OC192) IPsec and SSL/TLS traffic not only 3DES CBC but also AES and arc4.
The patches to date support chips that have been in production for some time, not the state-of-the-art latest-and-greatest devices described in that post. However, they may still outperform software and they almost certainly reduce CPU overhead.
The Internet currently runs on version four of the IP protocols. IPv4 is what is in the standard Linux IP stack, and what FreeS/WAN was built for. In IPv4, IPsec is an optional feature.
The next version of the IP protocol suite is version six, usually abbreviated either as "IPv6" or as "IPng" for "IP: the next generation". For IPv6, IPsec is a required feature. Any machine doing IPv6 is required to support IPsec, much as any machine doing (any version of) IP is required to support ICMP.
There is a Linux implementation of IPv6 in Linux kernels 2.2 and above. For details, see the FAQ. It does not yet support IPsec. The USAGI project are also working on IPv6 for Linux.
FreeS/WAN was originally built for the current standard, IPv4, but we are interested in seeing it work with IPv6. Some progress has been made, and a patched version with IPv6 support is available. For more recent information, check the mailing list.
IPv6 has been specified by an IETF working group. The group's page lists over 30 RFCs to date, and many Internet Drafts as well. The overview is RFC 2460. Major features include:
A number of projects are working on IPv6 implementation. A prominent Open Source effort is KAME, a collaboration among several large Japanese companies to implement IPv6 for Berkeley Unix. Other major players are also working on IPv6. For example, see pages at:
The 6bone (IPv6 backbone) testbed network has been up for some time. There is an active IPv6 user group.
One of the design goals for IPv6 was that it must be possible to convert from v4 to v6 via a gradual transition process. Imagine the mess if there were a "flag day" after which the entire Internet used v6, and all software designed for v4 stopped working. Almost every computer on the planet would need major software changes! There would be huge costs to replace older equipment. Implementers would be worked to death before "the day", systems administrators and technical support would be completely swamped after it. The bugs in every implementation would all bite simultaneously. Large chunks of the net would almost certainly be down for substantial time periods. ...
Fortunately, the design avoids any "flag day". It is therefore a little tricky to tell how quickly IPv6 will take over. The transition has certainly begun. For examples, see announcements from NTT and Nokia. However, it is not yet clear how quickly the process will gain momentum, or when it will be completed. Likely large parts of the Internet will remain with IPv4 for years to come.
| FreeS/WAN VPN | Road Warrior | OE | ||||
| PSK | RSA Secret | X.509
(requires patch) | Manual
Keying | |||
| More Compatible | ||||||
| isakmpd (OpenBSD) | Yes | Yes | Yes | No | ||
| Kame (FreeBSD, NetBSD) | Yes | Yes | Yes | No | ||
| McAfee VPN
was PGPNet | Yes | Yes | Yes | Yes | No | |
| Microsoft
Windows 2000/XP | Yes | Yes |
with FreeS/WAN
as Warrior | No | ||
| Safenet SoftPK
/SoftRemote | Yes | Yes | Yes | No | ||
| SSH Sentinel | Yes | Yes | Yes | No | ||
| Other | ||||||
| AshleyLaurent
VPCom | Yes | No | ||||
| Borderware | Yes | No | No | |||
| Checkpoint FW-1 | Yes | No | ||||
| Checkpoint VPN1 | Yes/Partial | No | ||||
| Cisco with 3DES | Yes | Maybe | No | |||
| F-Secure | Yes | No | ||||
| Gauntlet GVPN | Yes | No | ||||
| IBM AS/400 | Yes | No | ||||
| Lucent | Yes | No | ||||
| Netscreen 5xp | Yes | No | ||||
| Nortel Conitivity | Partial | No | ||||
| RadGuard | Yes | No | ||||
| Raptor (NT) | Yes | Yes | No | |||
| Raptor (Solaris) | Yes | No | ||||
| Redcreek Ravlin | Yes/Partial | No | ||||
| Shiva
LANRover | Yes | No | ||||
| Sun Solaris | Yes | No | ||||
| SonicWall | Yes | No | ||||
| Timestep | Yes | No | ||||
| Watchguard
Firebox | Yes | Yes | No | |||
| Xedia Access Point
/QVPN | Yes | No | ||||
| PSK | RSA Secret | X.509
(requires patch) | Manual
Keying | |||
| FreeS/WAN VPN | Road Warrior | OE | ||||
Our information comes primarily from mailing list reports and tutorials.
The FreeS/WAN project needs you! We rely on the user community to keep up to date. Mail users@lists.freeswan.org with your interop success stories.
| Yes | People report that this works for them. |
| [Blank] | We don't know. |
| No | We have reason to believe it was, at some point, not possible to get this to work. |
| Partial | Partial success. For example, a connection can be created from one end only. |
| Yes/Partial | Mixed reports. |
| Maybe | We think the answer is "yes", but need confirmation. |
OpenBSD FAQ: Using
IPsec
Hans-Joerg Hoexer's interop Linux-OpenBSD (PSK)
Skyper's configuration
(PSK)
Kame homepage, with FAQ
NetBSD's IPSec FAQ
Itojun's Kame-FreeS/WAN interop tips (PSK)
Ghislaine
Labouret's French page with links to matching FreeS/WAN and Kame
configs (RSA)
Ghislaine's post explaining some peculiarities
Frodo's Kame-FreeS/WAN interop (X.509)
Using Kame as a WAVEsec client
Rekeying problem with FreeS/WAN and older PGPNets
DHCP over IPSEC HOWTO for FreeS/WAN (requires X.509 and dhcprelay patches)
Jean-Francois
Nadeau's Net-net Configuration (PSK)
Telenor's
Node-node Config (Transport-mode PSK)
Marcus Mueller's HOWTO using his
VPN config tool (X.509). Tool also works with PSK.
Nate Carlson's HOWTO using same tool (Road Warrior with X.509).
Unusually, FreeS/WAN is the Road Warrior here.
Oscar Delgado's PDF (X.509, no configs)
Microsoft's Win2k IPsec debugging tips
MS VPN may fall back to 1DES
Whit Blauvelt's SoftRemote tips
Jean-Francois
Nadeau's Practical Configuration (Road Warrior with PSK)
Terradon Communications' PDF (Road Warrior with PSK)
Red Baron Consulting's PDF (Road Warrior with X.509)
SSH's
Sentinel-FreeSWAN interop PDF (X.509)
Potential problem unless using Legacy Proposal option
Successful interop report, no details
Philip Reetz' configs (PSK)
Borderware server does not support FreeS/WAN road warriors
Older Borderware may not support Diffie Hellman groups 2, 5
Text goes here.
Text goes here.
Text goes here.
Text goes here.
Richard Welty's tips and tricks
Text goes here.
Text goes here.
Text goes here.
Text goes here.
Text goes here.
Text goes here.
Text goes here.
Text goes here.
Text goes here.
Text goes here.
WatchGuard's HOWTO (PSK)
Ronald C. Riviera's Settings (PSK)
Old known issue with auto keying
Tips on key generation and format (Manual)
Hybrid IPsec/L2TP connection settings (X.509)
Xedia's LAN-LAN links don't use multiple tunnels
That explanation, continued
In normal operation, the main concern is the overhead for encryption, decryption and authentication of the actual IPsec (ESP and/or AH) data packets. Tunnel setup and rekeying occur so much less frequently than packet processing that, in general, their overheads are not worth worrying about.
At startup, however, tunnel setup overheads may be significant. If you reboot a gateway and it needs to establish many tunnels, expect some delay. This and other issues for large gateways are discussed below.
The University of Wales at Aberystwyth has done quite detailed speed tests and put their results on the web.
Davide Cerri's thesis (in Italian) includes performance results for FreeS/WAN and for TLS. He posted an English summary on the mailing list.
Steve Bellovin used one of AT&T Research's FreeS/WAN gateways as his data source for an analysis of the cache sizes required for key swapping in IPsec. Available as text or PDF slides for a talk on the topic.
See also the NAI work mentioned in the next section.
We can come up with a formula that roughly relates CPU speed to the rate of IPsec processing possible. It is far from exact, but should be usable as a first approximation.
An analysis of authentication overheads for high-speed networks, including some tests using FreeS/WAN, is on the NAI Labs site. In particular, see figure 3 in this PDF document. Their estimates of overheads, measured in Pentium II cycles per byte processed are:
| IPsec | authentication | encryption | cycles/byte | |
|---|---|---|---|---|
| Linux IP stack alone | no | no | no | 5 |
| IPsec without crypto | yes | no | no | 11 |
| IPsec, authentication only | yes | SHA-1 | no | 24 |
| IPsec with encryption | yes | yes | yes | not tested |
Overheads for IPsec with encryption were not tested in the NAI work, but Antoon Bosselaers' web page gives cost for his optimised Triple DES implementation as 928 Pentium cycles per block, or 116 per byte. Adding that to the 24 above, we get 140 cycles per byte for IPsec with encryption.
At 140 cycles per byte, a 140 MHz machine can handle a megabyte -- 8 megabits -- per second. Speeds for other machines will be proportional to this. To saturate a link with capacity C megabits per second, you need a machine running at C * 140/8 = C * 17.5 MHz.
However, that estimate is not precise. It ignores the differences between:
and does not account for some overheads you will almost certainly have:
so we suggest using C * 25 to get an estimate with a bit of a built-in safety factor.
This covers only IP and IPsec processing. If you have other loads on your gateway -- for example if it is also working as a firewall -- then you will need to add your own safety factor atop that.
This estimate matches empirical data reasonably well. For example, Metheringham's tests, described below, show a 733 topping out between 32 and 36 Mbit/second, pushing data as fast as it can down a 100 Mbit link. Our formula suggests you need at least an 800 to handle a fully loaded 32 Mbit link. The two results are consistent.
Some examples using this estimation method:
| Interface | Machine speed in MHz | |||
|---|---|---|---|---|
| Type | Mbit per
second | Estimate
Mbit*25 | Minimum IPSEC gateway | Minimum with other
load
(e.g. firewall) |
| DSL | 1 | 25 MHz | whatever you have | 133, or better if you have it |
| cable modem | 3 | 75 MHz | ||
| any link, light load | 5 | 125 MHz | 133 | 200+, almost any surplus machine |
| Ethernet | 10 | 250 MHz | surplus 266 or 300 | 500+ |
| fast link, moderate load | 20 | 500 MHz | 500 | 800+, any current off-the-shelf PC |
| T3 or E3 | 45 | 1125 MHz | 1200 | 1500+ |
| fast Ethernet | 100 | 2500 MHz | // not feasible with 3DES in software on current machines // | |
| OC3 | 155 | 3875 MHz | ||
Such an estimate is far from exact, but should be usable as minimum requirement for planning. The key observations are:
AES is a new US government block cipher standard, designed to replace the obsolete DES. If FreeS/WAN using 3DES is not fast enough for your application, the AES patch may help.
To date (March 2002) we have had only one mailing list report of measurements with the patch applied. It indicates that, at least for the tested load on that user's network, AES roughly doubles IPsec throughput. If further testing confirms this, it may prove possible to saturate an OC3 link in software on a high-end box.
Also, some work is being done toward support of hardware IPsec acceleration which might extend the range of requirements FreeS/WAN could meet.
CPU speed may be the main issue for IPsec performance, but of course it isn't the only one.
You need good ethernet cards or other network interface hardware to get the best performance. See this ethernet information page and this Linux network driver page.
The current FreeS/WAN kernel code is largely single-threaded. It is SMP safe, and will run just fine on a multiprocessor machine ( discussion), but the load within the kernel is not shared effectively. This means that, for example to saturate a T3 -- which needs about a 1200 MHz machine -- you cannot expect something like a dual 800 to do the job.
On the other hand, SMP machines do tend to share loads well so -- provided one CPU is fast enough for the IPsec work -- a multiprocessor machine may be ideal for a gateway with a mixed load.
FreeS/WAN allows a single gateway machine to build tunnels to many others. There may, however, be some problems for large numbers as indicated in this message from the mailing list:
Subject: Re: Maximum number of ipsec tunnels? Date: Tue, 18 Apr 2000 From: "John S. Denker" <jsd@research.att.com> Christopher Ferris wrote: >> What are the maximum number ipsec tunnels FreeS/WAN can handle?? Henry Spencer wrote: >There is no particular limit. Some of the setup procedures currently >scale poorly to large numbers of connections, but there are (clumsy) >workarounds for that now, and proper fixes are coming. 1) "Large" numbers means anything over 50 or so. I routinely run boxes with about 200 tunnels. Once you get more than 50 or so, you need to worry about several scalability issues: a) You need to put a "-" sign in syslogd.conf, and rotate the logs daily not weekly. b) Processor load per tunnel is small unless the tunnel is not up, in which case a new half-key gets generated every 90 seconds, which can add up if you've got a lot of down tunnels. c) There's other bits of lore you need when running a large number of tunnels. For instance, systematically keeping the .conf file free of conflicts requires tools that aren't shipped with the standard freeswan package. d) The pluto startup behavior is quadratic. With 200 tunnels, this eats up several minutes at every restart. I'm told fixes are coming soon. 2) Other than item (1b), the CPU load depends mainly on the size of the pipe attached, not on the number of tunnels.
It is worth noting that item (1b) applies only to repeated attempts to re-key a data connection (IPsec SA, Phase 2) over an established keying connection (ISAKMP SA, Phase 1). There are two ways to reduce this overhead using settings in ipsec.conf(5):
The overheads for establishing keying connections (ISAKMP SAs, Phase 1) are lower because for these Pluto does not perform expensive operations before receiving a reply from the peer.
A gateway that does a lot of rekeying -- many tunnels and/or low settings for tunnel lifetimes -- will also need a lot of random numbers from the random(4) driver.
Even a 486 can handle a T1 line, according to this mailing list message:
Subject: Re: linux-ipsec: IPSec Masquerade Date: Fri, 15 Jan 1999 11:13:22 -0500 From: Michael Richardson . . . A 486/66 has been clocked by Phil Karn to do 10Mb/s encryption.. that uses all the CPU, so half that to get some CPU, and you have 5Mb/s. 1/3 that for 3DES and you get 1.6Mb/s....
and a piece of mail from project technical lead Henry Spencer:
Oh yes, and a new timing point for Sandy's docs... A P60 -- yes, a 60MHz Pentium, talk about antiques -- running a host-to-host tunnel to another machine shows an FTP throughput (that is, end-to-end results with a real protocol) of slightly over 5Mbit/s either way. (The other machine is much faster, the network is 100Mbps, and the ether cards are good ones... so the P60 is pretty definitely the bottleneck.)
From the above, and from general user experience as reported on the list, it seems clear that a cheap surplus machine -- a reasonable 486, a minimal Pentium box, a Sparc 5, ... -- can easily handle a home office or a small company connection using any of:
If available, we suggest using a Pentium 133 or better. This should ensure that, even under maximum load, IPsec will use less than half the CPU cycles. You then have enough left for other things you may want on your gateway -- firewalling, web caching, DNS and such.
Here is some additional data from the mailing list.
Subject: FreeSWAN (specically KLIPS) performance measurements
Date: Thu, 01 Feb 2001
From: Nigel Metheringham <Nigel.Metheringham@intechnology.co.uk>
I've spent a happy morning attempting performance tests against KLIPS
(this is due to me not being able to work out the CPU usage of KLIPS so
resorting to the crude measurements of maximum throughput to give a
baseline to work out loading of a box).
Measurements were done using a set of 4 boxes arranged in a line, each
connected to the next by 100Mbit duplex ethernet. The inner 2 had an
ipsec tunnel between them (shared secret, but I was doing measurements
when the tunnel was up and running - keying should not be an issue
here). The outer pair of boxes were traffic generators or traffic sink.
The crypt boxes are Compaq DL380s - Uniprocessor PIII/733 with 256K
cache. They have 128M main memory. Nothing significant was running on
the boxes other than freeswan. The kernel was a 2.2.19pre7 patched
with freeswan and ext3.
Without an ipsec tunnel in the chain (ie the 2 inner boxes just being
100BaseT routers), throughput (measured with ttcp) was between 10644
and 11320 KB/sec
With an ipsec tunnel in place, throughput was between 3268 and 3402
KB/sec
These measurements are for data pushed across a TCP link, so the
traffic on the wire between the 2 ipsec boxes would have been higher
than this....
vmstat (run during some other tests, so not affecting those figures) on
the encrypting box shows approx 50% system & 50% idle CPU - which I
don't believe at all. Interactive feel of the box was significantly
sluggish.
I also tried running the kernel profiler (see man readprofile) during
test runs.
A box doing primarily decrypt work showed basically nothing happening -
I assume interrupts were off.
A box doing encrypt work showed the following:-
Ticks Function Load
~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
956 total 0.0010
532 des_encrypt2 0.1330
110 MD5Transform 0.0443
97 kmalloc 0.1880
39 des_encrypt3 0.1336
23 speedo_interrupt 0.0298
14 skb_copy_expand 0.0250
13 ipsec_tunnel_start_xmit 0.0009
13 Decode 0.1625
11 handle_IRQ_event 0.1019
11 .des_ncbc_encrypt_end 0.0229
10 speedo_start_xmit 0.0188
9 satoa 0.0225
8 kfree 0.0118
8 ip_fragment 0.0121
7 ultoa 0.0365
5 speedo_rx 0.0071
5 .des_encrypt2_end 5.0000
4 _stext 0.0140
4 ip_fw_check 0.0035
2 rj_match 0.0034
2 ipfw_output_check 0.0200
2 inet_addr_type 0.0156
2 eth_copy_and_sum 0.0139
2 dev_get 0.0294
2 addrtoa 0.0143
1 speedo_tx_buffer_gc 0.0024
1 speedo_refill_rx_buf 0.0022
1 restore_all 0.0667
1 number 0.0020
1 net_bh 0.0021
1 neigh_connected_output 0.0076
1 MD5Final 0.0083
1 kmem_cache_free 0.0016
1 kmem_cache_alloc 0.0022
1 __kfree_skb 0.0060
1 ipsec_rcv 0.0001
1 ip_rcv 0.0014
1 ip_options_fragment 0.0071
1 ip_local_deliver 0.0023
1 ipfw_forward_check 0.0139
1 ip_forward 0.0011
1 eth_header 0.0040
1 .des_encrypt3_end 0.0833
1 des_decrypt3 0.0034
1 csum_partial_copy_generic 0.0045
1 call_out_firewall 0.0125
Hope this data is helpful to someone... however the lack of visibility
into the decrypt side makes things less clear
Another user reported some results for connections with and without IP compression:
Subject: [Users] Speed with compression
Date: Fri, 29 Jun 2001
From: John McMonagle <johnm@advocap.org>
Did a couple tests with compression using the new 1.91 freeswan.
Running between 2 sites with cable modems. Both using approximately
130 mhz pentium.
Transferred files with ncftp.
Compressed file was a 6mb compressed installation file.
Non compressed was 18mb /var/lib/rpm/packages.rpm
Compressed vpn regular vpn
Compress file 42.59 kBs 42.08 kBs
regular file 110.84 kBs 41.66 kBs
Load was about 0 either way.
Ping times were very similar a bit above 9 ms.
Compression looks attractive to me.
Later in the same thread, project technical lead Henry Spencer added:
> is there a reason not to switch compression on? I have large gateway boxes > connecting 3 connections, one of them with a measly DS1 link... Run some timing tests with and without, with data and loads representative of what you expect in production. That's the definitive way to decide. If compression is a net loss, then obviously, leave it turned off. If it doesn't make much difference, leave it off for simplicity and hence robustness. If there's a substantial gain, by all means turn it on. If both ends support compression and can successfully negotiate a compressed connection (trivially true if both are FreeS/WAN 1.91), then the crucial question is CPU cycles. Compression has some overhead, so one question is whether *your* data compresses well enough to save you more CPU cycles (by reducing the volume of data going through CPU-intensive encryption/decryption) than it costs you. Last time I ran such tests on data that was reasonably compressible but not deliberately contrived to be so, this generally was not true -- compression cost extra CPU cycles -- so compression was worthwhile only if the link, not the CPU, was the bottleneck. However, that was before the slow-compression bug was fixed. I haven't had a chance to re-run those tests yet, but it sounds like I'd probably see a different result.The bug he refers to was a problem with the compression libraries that had us using C code, rather than assembler, for compression. It was fixed before 1.91.
If you want to measure the loads FreeS/WAN puts on a system, note that tools such as top or measurements such as load average are more-or-less useless for this. They are not designed to measure something that does most of its work inside the kernel.
Here is a message from FreeS/WAN kernel programmer Richard Guy Briggs on this:
> I have a batch of boxes doing Freeswan stuff. > I want to measure the CPU loading of the Freeswan tunnels, but am > having trouble seeing how I get some figures out... > > - Keying etc is in userspace so will show up on the per-process > and load average etc (ie pluto's load) Correct. > - KLIPS is in the kernel space, and does not show up in load average > I think also that the KLIPS per-packet processing stuff is running > as part of an interrupt handler so it does not show up in the > /proc/stat system_cpu or even idle_cpu figures It is not running in interrupt handler. It is in the bottom half. This is somewhere between user context (careful, this is not userspace!) and hardware interrupt context. > Is this correct, and is there any means of instrumenting how much the > cpu is being loaded - I don't like the idea of a system running out of > steam whilst still showing 100% idle CPU :-) vmstat seems to do a fairly good job, but use a running tally to get a good idea. A one-off call to vmstat gives different numbers than a running stat. To do this, put an interval on your vmstat command line.and another suggestion from the same thread:
Subject: Re: Measuring the CPU usage of Freeswan Date: Mon, 29 Jan 2001 From: Patrick Michael Kane <modus@pr.es.to> The only truly accurate way to accurately track FreeSWAN CPU usage is to use a CPU soaker. You run it on an unloaded system as a benchmark, then start up FreeSWAN and take the difference to determine how much FreeSWAN is eating. I believe someone has done this in the past, so you may find something in the FreeSWAN archives. If not, someone recently posted a URL to a CPU soaker benchmark tool on linux-kernel.
Not all types of testing are described here. Other parts of the documentation describe some tests:
The test setups and procedures described here can also be used in other testing, but this document focuses on testing the IPsec functionality of FreeS/WAN.
User Mode Linux allows you to run Linux as a user process on another Linux machine.
As of 1.92, the distribution has a new directory named testing. It contains a collection of test scripts and sample configurations. Using these, you can bring up several copies of Linux in user mode and have them build tunnels to each other. This lets you do some testing of a FreeS/WAN configuration on a single machine.
You need a moderately well-endowed machine for this to work well. Each UML wants about 16 megs of memory by default, which is plenty for FreeS/WAN usage. Typical regression testing only occasionally uses as many as 4 UMLs. If one is doing nothing else with the machine (in particular, not running X on it), then 128 megs and a 500MHz CPU are fine.
Documentation on these scripts is here. There is also documentation on automated testing here.A common test setup is to put a machine with dual Ethernet cards in between two gateways under test. You need at least five machines; two gateways, two clients and a testing machine in the middle.
The central machine both routes packets and provides a place to run diagnostic software for checking IPsec packets. See next section for discussion of using tcpdump(8) for this.
This makes things more complicated than if you just connected the two gateway machines directly to each other, but it also makes your test setup much more like the environment you actually use IPsec in. Those environments nearly always involve routing, and quite a few apparent IPsec failures turn out to be problems with routing or with firewalls dropping packets. This approach lets you deal with those problems on your test setup.
What you end up with looks like:
subnet a.b.c.0/24
|
eth1 = a.b.c.1
gate1
eth0 = 192.168.p.1
|
|
eth0 = 192.168.p.2
route/monitor box
eth1 = 192.168.q.2
|
|
eth0 = 192.168.q.1
gate2
eth1 = x.y.z.1
|
subnet x.y.z.0/24
Where p and q are any convenient values that do not interfere with other routes you may have. The ipsec.conf(5) file then has, among other things:
conn abc-xyz
left=192.168.p.1
leftnexthop=192.168.p.2
right=192.168.q.1
rightnexthop=192.168.q.2
Once that works, you can remove the "route/monitor box", and connect the two gateways to the Internet. The only parameters in ipsec.conf(5) that need to change are the four shown above. You replace them with values appropriate for your Internet connection, and change the eth0 IP addresses and the default routes on both gateways.
Note that nothing on either subnet needs to change. This lets you test most of your IPsec setup before connecting to the insecure Internet.
A number of tools are available for looking at packets. We will discuss using tcpdump(8), a common Linux tool included in most distributions. Alternatives offerring more-or-less the same functionality include:
See also this index of packet sniffers.
tcpdump(8) may misbehave if run on the gateways themselves. It is designed to look into a normal IP stack and may become confused if you ask it to display data from a stack which has IPsec in play.
At one point, the problem was quite severe. Recent versions of tcpdump, however, understand IPsec well enough to be usable on a gateway. You can get the latest version from tcpdump.org.
Even with a recent tcpdump, some care is required. Here is part of a post from Henry on the topic:
> a) data from sunset to sunrise or the other way is not being > encrypted (I am using tcpdump (ver. 3.4) -x/ping -p to check > packages) What *interface* is tcpdump being applied to? Use the -i option to control this. It matters! If tcpdump is looking at the ipsecN interfaces, e.g. ipsec0, then it is seeing the packets before they are encrypted or after they are decrypted, so of course they don't look encrypted. You want to have tcpdump looking at the actual hardware interfaces, e.g. eth0. Actually, the only way to be *sure* what you are sending on the wire is to have a separate machine eavesdropping on the traffic. Nothing you can do on the machines actually running IPsec is 100% guaranteed reliable in this area (although tcpdump is a lot better now than it used to be).
The most certain way to examine IPsec packets is to look at them on the wire. For security, you need to be certain, so we recommend doing that. To do so, you need a separate sniffer machine located between the two gateways. This machine can be routing IPsec packets, but it must not be an IPsec gateway. Network configuration for such testing is discussed above.
Here's another mailing list message with advice on using tcpdump(8):
Subject: RE: [Users] Encrypted??? Date: Thu, 29 Nov 2001 From: "Joe Patterson" <jpatterson@asgardgroup.com> tcpdump -nl -i $EXT-IF proto 50 -nl tells it not to buffer output or resolve names (if you don't do that it may confuse you by not outputing anything for a while), -i $EXT-IF (replace with your external interface) tells it what interface to listen on, and proto 50 is ESP. Use "proto 51" if for some odd reason you're using AH, and "udp port 500" if you want to see the isakmp key exchange/tunnel setup packets. You can also run `tcpdump -nl -i ipsec0` to see what traffic is on that virtual interface. Anything you see there *should* be either encrypted or dropped (unless you've turned on some strange options in your ipsec.conf file) Another very handy thing is ethereal (http://www.ethereal.com/) which runs on just about anything, has a nice gui interface (or a nice text-based interface), and does a great job of protocol breakdown. For ESP and AH it'll basically just tell you that there's a packet of that protocol, and what the spi is, but for isakmp it'll actually show you a lot of the tunnel setup information (until it gets to the point in the protocol where isakmp is encrypted....)
The question of how to verify that messages are actually encrypted has been extensively discussed on the mailing list. See this thread.
If you just want to verify that packets are encrypted, look at them with a packet sniffer (see previous section ) located between the gateways. The packets should, except for some of the header information, be utterly unintelligible. The output of good encryption looks exactly like random noise.
A packet sniffer can only tell you that the data you looked at was encrypted. If you have stronger requirements -- for example if your security policy requires verification that plaintext is not leaked during startup or under various anomolous conditions -- then you will need to devise much more thorough tests. If you do that, please post any results or methodological details which your security policy allows you to make public.
You can put recognizable data into ping packets with something like:
ping -p feedfacedeadbeef 11.0.1.1
"feedfacedeadbeef" is a legal hexadecimal pattern that is easy to pick out of hex dumps.
For other protocols, you may need to check if you have encrypted data or ASCII text. Encrypted data has approximately equal frequencies for all 256 possible characters. ASCII text has most characters in the printable range 0x20-0x7f, a few control characters less than 0x20, and none at all in the range 0x80-0xff. 0x20, space, is a good character to look for. In normal English text space occurs about once in seven characters, versus about once in 256 for random or encrypted data.
One thing to watch for: the output of good compression, like that of good encryption, looks just like random noise. You cannot tell just by looking at a data stream whether it has been compressed, encrypted, or both. You need a little care not to mistake compressed data for encrypted data in your testing.
Note also that weak encryption also produces random-looking output. You cannot tell whether the encryption is strong by looking at the output. To be sure of that, you would need to have both the algorithms and the implementation examined by experts.
For IPsec, you can get partial assurance from interoperability tests. See our interop document. When twenty products all claim to implement 3DES, and they all talk to each other, you can be fairly sure they have it right. Of course, you might wonder whether all the implementers are consipring to trick you or, more plausibly, whether some implementations might have "back doors" so they can get also it wrong when required.. If you're seriously worried about things like that, you need to get the code you use audited (good luck if it is not Open Source), or perhaps to talk to a psychiatrist about treatments for paranoia.
Additional information on testing can be found in these mailing list messages:
This section lists many of the options available when configuring a Linux kernel, and explains how they should be set on a FreeS/WAN IPsec gateway.
Note that in many cases you do not need to mess with these.
You may have a Linux distribution which comes with FreeS/WAN installed (see this list). In that case, you need not do a FreeS/WAN installation or a kernel configuration. Of course, you might still want to configure and rebuild your kernel to improve performance or security. This can be done with standard tools described in the Kernel HowTo.
If you need to install FreeS/WAN, then you do need to configure a kernel. However, you may choose to do that using the simplest procedure:
This document is for those who choose to configure their FreeS/WAN kernel themselves.
Help text for most kernel options is included with the kernel files, and is accessible from within the configuration utilities. We assume you will refer to that, and to the Kernel HowTo, as necessary. This document covers only the FreeS/WAN-specific aspects of the problem.
To avoid duplication, this document section does not cover settings for the additional IPsec-related kernel options which become available after you have patched your kernel with FreeS/WAN patches. There is help text for those available from within the configuration utility.
We assume a common configuration in which the FreeS/WAN IPsec gateway is also doing ipchains(8) firewalling for a local network, and possibly masquerading as well.
Some suggestions below are labelled as appropriate for "a true paranoid". By this we mean they may cause inconvenience and it is not entirely clear they are necessary, but they appear to be the safest choice. Not using them might entail some risk. Of course one suggested mantra for security administrators is: "I know I'm paranoid. I wonder if I'm paranoid enough."
Six labels are used to indicate how options should be set. We mark the labels with [square brackets]. For two of these labels, you have no choice:
those must be set correctly or FreeS/WAN will not work
FreeS/WAN should work with any settings of the others, though of course not all combinations have been tested. We do label these in various ways, but these labels are only suggestions.
Of course complexity is an enemy in any effort to build secure systems. For maximum security, any feature that can reasonably be turned off should be. "If in doubt, leave it out."
Indentation is based on the nesting shown by 'make menuconfig' with a 2.2.16 kernel for the i386 architecture.
For most FreeS/WAN work, no is the preferred setting. Using new or untested components is too risky for a security gateway.
However, for some hardware (such as the author's network cards) the only drivers available are marked new/experimental. In such cases, you must enable this option or your cards will not appear under "network device support". A true paranoid would leave this option off and replace the cards.
With modules disabled, an attacker cannot install a bogus module. The only way he can achieve the same effects is to install a new kernel and reboot. This is considerably more likely to be noticed.
Many FreeS/WAN gateways run with modules enabled. This simplifies some administrative tasks and some ipchains features are available only as modules. Once an enemy has root on your machine your security is nil, so arguably defenses which come into play only in that situation are pointless.
echo 1 > /proc/sys/net/ipv4/ipforwardturns IP forwarding on.
Disabling this option breaks many firewall scripts. A true paranoid would disable it anyway since it might conceivably be of use to an attacker.
Even if the IPsec gateway is not your primary firewall, we suggest setting this so that you can protect the gateway with at least basic local packet filters.
It should be possible to use IPv4 FreeS/WAN on a machine which also does IPv6. This combination is not yet well tested. We would be quite interested in hearing results from anyone expermenting with it, via the mailing list.
We do not recommend using IPv6 on production FreeS/WAN gateways until more testing has been done.
We do not recommend this. Keep the software on your gateway as simple as possible. If you need a Linux-based Appletalk or IPX server, use a separate machine.
The development team test almost entirely on 10 or 100 megabit Ethernet and modems. In principle, any device that can do IP should be just fine for IPsec, but in the real world any device that has not been well-tested is somewhat risky. By all means try it, but don't bet your project on it until you have solid test results.
If you disabled experimental drivers in the Code maturity section above, then those drivers will not be shown here. Check that option before going off to hunt for missing drivers.
If you want Linux to automatically find more than one ethernet interface at boot time, you need to:
append="ether=0,0,eth0 ether=0,0,eth1"to your /etc/lilo.conf file. In some cases you may need to specify parameters such as IRQ or base address. The example uses "0,0" for these, which tells the system to search. If the search does not succeed on your hardware, then you should retry with explicit parameters. See the lilo.conf(5) man page for details.
If you are comfortable with C source code, it is likely a good idea to go in and adjust the #define lines in /usr/src/linux/drivers/char/random.c to ensure that all sources of randomness are enabled. Relying solely on keyboard and mouse randomness is dubious procedure for a gateway machine. You could also increase the randomness pool size from the default 512 bytes (128 32-bit words).
This document describes various options for FreeS/WAN configuration which are less used or more complex (often both) than the standard cases described in our quickstart document.
Nearly all of the overhead in IPsec processing is in the encryption and authentication of packets. Our performance document discusses these overheads.
Beside those overheads, the cost of managing additional tunnels is trivial. Whether your gateway supports one tunnel or ten just does not matter. A hundred might be a problem; there is a section on this in the performance document.
So, in nearly all cases, if using multiple tunnels gives you a reasonable way to describe what you need to do, you should describe it that way in your configuration files.
For example, one user recently asked on a mailing list about this network configuration:
netA---gwA---gwB---netB
|----netC
netA and B are secured netC not.
netA and gwA can not access netC
The user had constructed only one tunnel, netA to netB, and wanted to know how to use ip-route to get netC packets into it. This is entirely unnecessary. One of the replies was:
The simplest way and indeed the right way to
solve this problem is to set up two connections:
leftsubnet=NetA
left=gwA
right=gwB
rightsubnet=NetB
and
leftsubnet=NetA
left=gwA
right=gwB
rightsubnet=NetC
This would still be correct even if we added nets
Of course another possibility would be to just use one tunnel, with a subnet mask that includes both netB and netC (or B, C, D, ...). See next section.
In general, you can construct as many tunnels as you need. Networks like netC in this example that do not connect directly to the gateway are fine, as long as the gateway can route to them.
The number of tunnels can become an issue if it reaches 50 or so. This is discussed in the performance document. Look there for information on supporting hundreds of Road Warriors from one gateway.
If you find yourself with too many tunnels for some reason like
having eight subnets at one location and nine at another so you end up
with
The subnets used in leftsubnet and rightsubnet can be of any size that fits your needs, and they need not correspond to physical networks.
You adjust the size by changing the subnet mask , the number after the slash in the subnet description. For example
As an example of using these in connection descriptions, suppose your company's head office has four physical networks using the address ranges:
You can use exactly those subnets in your connection descriptions, or use larger subnets to grant broad access if required:
or use smaller subnets to restrict access:
To be exact, 192.68.103.64/28 means all addresses whose top 28 bits match 192.168.103.64. There are 16 of these because there are 16 possibilities for the remainingg 4 bits. Their addresses are 192.168.103.64 to 192.168.103.79.
Each connection description can use a different subnet if required.
It is possible to use all the examples above on the same FreeS/WAN gateway, each in a different connection description, perhaps for different classes of user or for different remote offices.
It is also possible to have multiple tunnels using different leftsubnet descriptions with the same right. For example, when the marketing manager is on the road he or she might have access to:
This takes three tunnels, but tunnels are cheap. If the laptop is set up to build all three tunnels automatically, then he or she can access all these machines concurrently, perhaps from different windows.
Here is the usual network picture for a site-to-site VPN::
Sunset==========West------------------East=========Sunrise
local net untrusted net local net
and for the Road Warrior::
telecommuter's PC or
traveller's laptop
Sunset==========West------------------East
corporate LAN untrusted net
Other configurations are also possible.
A telecommuter might have:
Sunset==========West------------------East ================= firewall --- the Internet
home network untrusted net corporate network
This can be described as a special case of the general subnet-to-subnet connection. The subnet on the right is 0.0.0.0/0, the whole Internet.
West (the home gateway) can have its firewall rules set up so that only IPsec packets to East are allowed out. It will then behave as if its only connection to the world was a wire to East.
When machines on the home network need to reach the Internet, they do so via the tunnel, East and the corporate firewall. From the viewpoint of the Internet (perhaps of some EvilDoer trying to break in!), those home office machines are behind the firewall and protected by it.
Another possible configuration comes up when you do not trust the local network, either because you have very high security standards or because your are using easily-intercepted wireless signals.
Some wireless networks have built-in encryption called WEP, but its security is dubious. It is a fairly common practice to use IPsec instead.
In this case, part of your network may look like this:
West-----------------------------East == the rest of your network
workstation untrusted wireless net
Of course, there would likely be several wireless workstations, each with its own IPsec tunnel to the East gateway.
The connection descriptions look much like Road Warrior descriptions:
The rightsubnet= parameter might be set in any of several ways:
Of course you can mix and match these as required. For example, a university might allow faculty full Internet access while letting student laptops connect only to a group of lab machines.
One choice you need to make before configuring additional connections is what type or types of connections you will use. There are several options, and you can use more than one concurrently.
IPsec allows two types of connections, with manual or automatic keying. FreeS/WAN starts them with commands such as:
ipsec manual --start name
ipsec auto --up name
The difference is in how they are keyed.
A third method, using RSA keys embedded in X.509 certtificates, is provided by user patches.
Manually keyed connections provide weaker security than automatically keyed connections. An opponent who reads ipsec.secrets(5) gets your encryption key and can read all data encrypted by it. If he or she has an archive of old messages, all of them back to your last key change are also readable.
With automatically-(re)-keyed connections, an opponent who reads ipsec.secrets(5) gets the key used to authenticate your system in IKE -- the shared secret or your private key, depending what authentication mechanism is in use. However, he or she does not automatically gain access to any encryption keys or any data.
An attacker who has your authentication key can mount a man-in-the-middle attack and, if that succeeds, he or she will get encryption keys and data. This is a serious danger, but it is better than having the attacker read everyting as soon as he or she breaks into ipsec.secrets(5).. Moreover, the keys change often so an opponent who gets one key does not get a large amount of data. To read all your data, he or she would have to do a man-in-the-middle attack at every key change.
We discuss using manual keying in production below, but this is not recommended except in special circumstances, such as needing to communicate with some implementation that offers no auto-keyed mode compatible with FreeS/WAN.
Manual keying may also be useful for testing. There is some discussion of this in our FAQ.
The IKE protocol which Pluto uses to negotiate connections between gateways must use some form of authentication of peers. A gateway must know who it is talking to before it can create a secure connection. We support two basic methods for this authentication:
There are, howver, several variations on the RSA theme, using different methods of managing the RSA keys:
Public keys in ipsec.conf(5 ) give a reasonably straightforward method of specifying keys for explicitly configured connections.
Putting public keys in DNS allows us to support opportunistic encryption. Any two FreeS/WAN gateways can provide secure communication, without either of them having any preset information about the other.
X.509 certificates may be required to interface to various PKIs.
Authentication with a public key method such as RSA has some important advantages over using shared secrets.
If the branch offices need to talk to each other, this becomes
problematic. You need another
For larger numbers of branches, the number of connections and secrets increases quadratically and managing them becomes a nightmare. A 1000-gateway fully connected network needs 499,500 secrets, each known to exactly two players. There are ways to reduce this problem, for example by introducing a central key server, but these involve additional communication overheads, more administrative work, and new threats that must be carefully guarded against.
As network size increaes, the number of public keys used increases linearly with the number of nodes. This still requires careful administration in large applications, but is nothing like the disaster of a quadratic increase. On a 1000-gateway network, you have 1000 private keys, each of which must be kept secure on one machine, and 1000 public keys which must be distributed. This is not a trivial problem, but it is manageable.
There is also a disadvantage:
This is partly counterbalanced by the fact that the key is never transmitted and remains under your control at all times. It is likely necessary, however, to take account of this in setting security policy. For example, you should change gateway keys when an administrator leaves the company, and should change them periodically in any case.
Overall, public key methods are more secure, more easily managed and more flexible. We recommend that they be used for all connections, unless there is a compelling reason to do otherwise.
Generally, public key methods are preferred for reasons given above, but shared secrets can be used with no loss of security, just more work and perhaps more need to take precautions.
What I call "shared secrets" are sometimes also called "pre-shared keys". They are used only for for authentication, never for encryption. Calling them "pre-shared keys" has confused some users into thinking they were encryption keys, so I prefer to avoid the term..
If you are interoperating with another IPsec implementation, you may find its documentation calling them "passphrases".
If shared secrets are to be used to authenticate communication for the Diffie-Hellman key exchange in the IKE protocol, then those secrets must be stored in /etc/ipsec.secrets. For details, see the ipsec.secrets(5) man page.
A few considerations are vital:
Each line has the IP addresses of the two gateways plus the secret. It should look something like this:
10.0.0.1 11.0.0.1 : PSK "jxTR1lnmSjuj33n4W51uW3kTR55luUmSmnlRUuWnkjRj3UuTV4T3USSu23Uk55nWu5TkTUnjT"
PSK indicates the use of a pre-s hared key. The quotes and the whitespace shown are required.
You can use any character string as your secret. For security, it should be both long and extremely hard to guess. We provide a utility to generate such strings, ipsec_ranbits(8).
You want the same secret on the two gateways used, so you create a line with that secret and the two gateway IP addresses. The installation process supplies an example secret, useful only for testing. You must change it for production use.
You must deliver this file, or the relevant part of it, to the other gateway machine by some secure means. Don't just FTP or mail the file! It is vital that the secrets in it remain secret. An attacker who knew those could easily have all the data on your "secure" connection.
This file must be owned by root and should have permissions rw-------.
You can use a shared secret to support a single road warrior connecting to your gateway, and this is a reasonable thing to do in some circumstances. Public key methods have advantages, discussed above, but they are not critical in this case.
To do this, the line in ipsec.secrets(5) is something like:
10.0.0.1 0.0.0.0 : PSK "jxTR1lnmSjuj33n4W51uW3kTR55luUmSmnlRUuWnkjRj3UuTV4T3USSu23Uk55nWu5TkTUnjT"where the 0.0.0.0 means that any IP address is acceptable.
For more than one road warrior, shared secrets are not recommended. If shared secrets are used, then when the responder needs to look up the secret, all it knows about the sender is an IP address. This is fine if the sender is at a fixed IP address specified in the config file. It is also fine if only one road warrior uses the wildcard 0.0.0.0 address. However, if you have more than one road warrior using shared secret authentication, then they must all use that wildcard and therefore all road warriors using PSK autentication must use the same secret. Obviously, this is insecure.
For multiple road warriors, use public key authentication. Each roadwarrior can then have its own identity (our leftid= or rightid= parameters), its own public/private key pair, and its own secure connection.
Generally, automatic keying is preferred over manual keying for production use because it is both easier to manage and more secure. Automatic keying frees the admin from much of the burden of managing keys securely, and can provide perfect forward secrecy. This is discussed in more detail above.
However, it is possible to use manual keying in production if that is what you want to do. This might be necessary, for example, in order to interoperate with some device that either does not provide automatic keying or provides it in some version we cannot talk to.
Note that with manual keying all security rests with the keys . If an adversary acquires your keys, you've had it. He or she can read everything ever sent with those keys, including old messages he or she may have archived.
You need to be really paranoid about keys if you're going to rely on manual keying for anything important.
Linux FreeS/WAN provides some facilities to help with this. In particular, it is good policy to keep keys in separate files so you can edit configuration information in /etc/ipsec.conf without exposing keys to "shoulder surfers" or network snoops. We support this with the also= and include syntax in ipsec.conf(5).
See the last example in our examples file. In the /etc/ipsec.conf conn samplesep section, it has the line:
also=samplesep-keys
which tells the "ipsec manual" script to insert the configuration description labelled "samplesep-keys" if it can find it. The /etc/ipsec.conf file must also have a line such as:
include ipsec.*.conf
which tells it to read other files. One of those other files then might contain the additional data:
conn samplesep-keys spi=0x200 esp=3des-md5-96 espenckey=0x01234567_89abcdef_02468ace_13579bdf_12345678_9abcdef0 espauthkey=0x12345678_9abcdef0_2468ace0_13579bdf
The first line matches the label in the "also=" line, so the indented lines are inserted. The net effect is exactly as if the inserted lines had occurred in the original file in place of the "also=" line.
Variables set here are:
Note that the example keys we supply are intended only for testing. For real use, you should go to automatic keying. If that is not possible, create your own keys for manual mode and keep them secret
Of course, any files containing keys must have 600 permissions and be owned by root.
If you connect in this way to multiple sites, we recommend that you keep keys for each site in a separate file and adopt some naming convention that lets you pick them all up with a single "include" line. This minimizes the risk of losing several keys to one error or attack and of accidentally giving another site admin keys which he or she has no business knowing.
Also note that if you have multiple manually keyed connections on a single machine, then the spi parameter must be different for each one. Any 3-digit hex number is OK, provided they are different for each connection. We reserve the range 0x100 to 0xfff for manual connections. Pluto assigns SPIs from 0x1000 up for automatically keyed connections.
If ipsec.conf(5) contains keys for manual mode connections, then it too must have permissions rw-------. We recommend instead that, if you must manual keying in production, you keep the keys in separate files.
Note also that ipsec.conf is installed with permissions rw-r--r--. If you plan to use manually keyed connections for anything more than initial testing, you must:
We recommend the latter method for all but the simplest configurations.
You can create new random keys with the ranbits(8) utility. For example, the commands:
umask 177
ipsec ranbits 192 > temp
ipsec ranbits 128 >> temp
create keys in the sizes needed for our default algorithms:
If you want to use SHA instead of MD5, that requires a 160-bit key
Note that any temporary files used must be kept secure since they contain keys. That is the reason for the umask command above. The temporary file should be deleted as soon as you are done with it. You may also want to change the umask back to its default value after you are finished working on keys.
The ranbits utility may pause for a few seconds if not enough entropy is available immediately. See ipsec_ranbits(8) and random(4) for details. You may wish to provide some activity to feed entropy into the system. For example, you might move the mouse around, type random characters, or do du /usr > /dev/null in the background.
You can tell the system to set up connections automatically at boot time by putting suitable stuff in /etc/ipsec.conf on both systems. The relevant section of the file is labelled by a line reading config setup.
Details can be found in the ipsec.conf(5) man page. We also provide a file of example configurations.
The most likely options are something like:
Note that for PPP, you give the ppp[0-9] device name here, not the underlying device such as modem (or eth1 if you are using PPPoE).
Note that Pluto does not currently pay attention to this variable. The variable controls setup messages only.
"yes" is strongly recommended for production use so that the keying daemon (Pluto) will automatically re-key the connections regularly. The ipsec-auto parameters ikelifetime, ipseclifetime and reykeywindow give you control over frequency of rekeying.
If plutoload is "%search", Pluto will load any connections whose description includes "auto=add" or "auto=start".
If plutostart is "%search", Pluto will start any connections whose description includes "auto=start".
Note that, for a connection intended to be permanent, both gateways should be set try to start the tunnel. This allows quick recovery if either gateway is rebooted or has its IPsec restarted. If only one gateway is set to start the tunnel and the other gateway restarts, the tunnel may not be rebuilt.
The example assumes you are at the Reno office and will use IPsec to Vancouver, New York City and Amsterdam.
Consider a pair of subnets, each with a security gateway, connected via the Internet:
192.168.100.0/24 left subnet
|
192.168.100.1
North Gateway
101.101.101.101 left
|
101.101.101.1 left next hop
[Internet]
202.202.202.1 right next hop
|
202.202.202.202 right
South gateway
192.168.200.1
|
192.168.200.0/24 right subnet
A tunnel specification such as:
conn northnet-southnet
left=101.101.101.101
leftnexthop=101.101.101.1
leftsubnet=192.168.100.0/24
leftfirewall=yes
right=202.202.202.202
rightnexthop=202.202.202.1
rightsubnet=192.168.200.0/24
rightfirewall=yes
will allow machines on the two subnets to talk to each other. You might
test this by pinging from polarbear (192.168.100.7) to penguin
(192.168.200.5).
However, this does not cover other traffic you might want to secure. To handle all the possibilities, you might also want these connection descriptions:
conn northgate-southnet
left=101.101.101.101
leftnexthop=101.101.101.1
right=202.202.202.202
rightnexthop=202.202.202.1
rightsubnet=192.168.200.0/24
rightfirewall=yes
conn northnet-southgate
left=101.101.101.101
leftnexthop=101.101.101.1
leftsubnet=192.168.100.0/24
leftfirewall=yes
right=202.202.202.202
rightnexthop=202.202.202.1
Without these, neither gateway can do IPsec to the remote subnet. There is no IPsec tunnel or eroute set up for the traffic.
In our example, with the non-routable 192.168.* addresses used, packets would simply be discarded. In a different configuration, with routable addresses for the remote subnet, they would be sent unencrypted since there would be no IPsec eroute and there would be a normal IP route.
You might also want:
conn northgate-southgate
left=101.101.101.101
leftnexthop=101.101.101.1
right=202.202.202.202
rightnexthop=202.202.202.1
This is required if you want the two gateways to speak IPsec to each other.
This requires a lot of duplication of details. Judicious use of also= and include can reduce this problem.
Note that, while FreeS/WAN supports all four tunnel types, not all implementations do. In particular, some versions of Windows 2000 and the freely downloadable version of PGP provide only "client" functionality. You cannot use them as gateways with a subnet behind them. To get that functionality, you must upgrade to Windows 2000 server or the commercially available PGP products.
Subject: Re: linux-ipsec: IPSec packets not entering tunnel? Date: Mon, 20 Nov 2000 From: Justin Guyett <jfg@sonicity.com> On Mon, 20 Nov 2000, Claudia Schmeing wrote: > Right Left > "home" "office" > 10.92.10.0/24 ---- 24.93.85.110 ========= 216.175.164.91 ---- 10.91.10.24/24 > > I've created all four tunnels, and can ping to test each of them, > *except* homegate-officenet. I keep wondering why people create all four tunnels. Why not route traffic generated from home to 10.91.10.24/24 out ipsec0 with iproute2? And 99% of the time you don't need to access "office" directly, which means you can eliminate all but the subnet<->subnet connection.and FreeS/WAN technical lead Henry Spencer's comment:
> I keep wondering why people create all four tunnels. Why not route > traffic generated from home to 10.91.10.24/24 out ipsec0 with iproute2? This is feasible, given some iproute2 attention to source addresses, but it isn't something we've documented yet... (partly because we're still making some attempt to support 2.0.xx kernels, which can't do this, but mostly because we haven't caught up with it yet). > And 99% of the time you don't need to access "office" directly, which > means you can eliminate all but the subnet<->subnet connection. Correct in principle, but people will keep trying to ping to or from the gateways during testing, and sometimes they want to run services on the gateway machines too.
What we call extruded subnets are a special case of VPNs.
If your buddy has some unused IP addresses, in his subnet far off at the other side of the Internet, he can loan them to you... provided that the connection between you and him is fast enough to carry all the traffic between your machines and the rest of the Internet. In effect, he "extrudes" a part of his address space over the network to you, with your Internet traffic appearing to originate from behind his Internet gateway.
Suppose your friend has a.b.c.0/24 and wants to give you a.b.c.240/28. The initial situation is:
subnet gateway Internet a.b.c.0/24 a.b.c.1 p.q.r.swhere anything from the Internet destined for any machine in a.b.c.0/24 is routed via p.q.r.s and that gateway knows what to do from there.
Of course it is quite normal for various smaller subnets to exist behind your friend's gateway. For example, your friend's company might have a.b.c.16/28=development, a.b.c.32/28=marketing and so on. The Internet neither knows not cares about this; it just delivers packets to the p.q.r.s and lets the gateway do whatever needs to be done from there.
What we want to do is take a subnet, perhaps a.b.c.240/28, out of your friend's physical location while still having your friend's gateway route to it. As far as the Internet is concerned, you remain behind that gateway.
subnet gateway Internet your gate extruded
a.b.c.0/24 a.b.c.1 p.q.r.s d.e.f.g a.b.c.240/28
========== tunnel ==========
The extruded addresses have to be a complete subnet.
In our example, the friend's security gateway is also his Internet gateway, but this is not necessary. As long as all traffic from the Internet to his addresses passes through the Internet gate, the security gate could be a machine behind that. The IG would need to route all traffic for the extruded subnet to the SG, and the SG could handle the rest.
First, configure your subnet using the extruded addresses. Your security gateway's interface to your subnet needs to have an extruded address (possibly using a Linux virtual interface , if it also has to have a different address). Your gateway needs to have a route to the extruded subnet, pointing to that interface. The other machines at your site need to have addresses in that subnet, and default routes pointing to your gateway.
If any of your friend's machines need to talk to the extruded subnet, they need to have a route for the extruded subnet, pointing at his gateway.
Then set up an IPsec subnet-to-subnet tunnel between your gateway and his, with your subnet specified as the extruded subnet, and his subnet specified as "0.0.0.0/0". Do it with manual keying first for testing, and then with automatic keying for production use.
The tunnel description should be:
conn extruded
left=p.q.r.s
leftsubnet=0.0.0.0/0
right=d.e.f.g
rightsubnet=a.b.c.0/28
If either side was doing firewalling for the extruded subnet before the IPsec connection is set up, ipsec_manual and ipsec_auto need to know about that (via the {left|right}firewall parameters) so that it can be overridden for the duration of the connection.
And it all just works. Your SG routes traffic for 0.0.0.0/0 -- that is, the whole Internet -- through the tunnel to his SG, which then sends it onward as if it came from his subnet. When traffic for the extruded subnet arrives at his SG, it gets sent through the tunnel to your SG, which passes it to the right machine.
Remember that when ipsec_manual or ipsec_auto takes a connection down, it does not undo the route it made for that connection. This lets you take a connection down and bring up a new one, or a modified version of the old one, without having to rebuild the route it uses and without any risk of packets which should use IPsec accidentally going out in the clear. Because the route always points into KLIPS, the packets will always go there. Because KLIPS temporarily has no idea what to do with them (no eroute for them), they will be discarded.
If you do want to take the route down, this is what the "unroute" operation in manual and auto is for. Just do an unroute after doing the down.
Note that the route for a connection may have replaced an existing non-IPsec route. Nothing in Linux FreeS/WAN will put that pre-IPsec route back. If you need it back, you have to create it with the route command.
Here is a mailing list message about another way to configure for road warrior support:
Subject: Re: linux-ipsec: understanding the vpn
Date: Thu, 28 Oct 1999 10:43:22 -0400
From: Irving Reid <irving@nevex.com>
> local-------linux------internet------mobile
> LAN box user
> ...
> now when the mobile user connects to the linux box
> it is given a virtual IP address, i have configured it to
> be in the 10.x.x.x range. mobile user and linux box
> have a tunnel between them with these IP addresses.
> Uptil this all is fine.
If it is possible to configure your mobile client software *not* to
use a virtual IP address, that will make your life easier. It is easier
to configure FreeS/WAN to use the actual address the mobile user gets
from its ISP.
Unfortunately, some Windows clients don't let you choose.
> what i would like to know is that how does the mobile
> user communicate with other computers on the local
> LAN , of course with the vpn ?
> what IP address should the local LAN
> computers have ? I guess their default gateway
> should be the linux box ? and does the linux box need
> to be a 2 NIC card box or one is fine.
As someone else stated, yes, the Linux box would usually be the default
IP gateway for the local lan.
However...
If you mobile user has software that *must* use a virtual IP address,
the whole picture changes. Nobody has put much effort into getting
FreeS/WAN to play well in this environment, but here's a sketch of one
approach:
Local Lan 1.0.0.0/24
|
+- Linux FreeS/WAN 1.0.0.2
|
| 1.0.0.1
Router
| 2.0.0.1
|
Internet
|
| 3.0.0.1
Mobile User
Virtual Address: 1.0.0.3
Note that the Local Lan network (1.0.0.x) can be registered, routable
addresses.
Now, the Mobile User sets up an IPSec security association with the
Linux box (1.0.0.2); it should ESP encapsulate all traffic to the
network 1.0.0.x **EXCEPT** UDP port 500. 500/udp is required for the key
negotiation, which needs to work outside of the IPSec tunnel.
On the Linux side, there's a bunch of stuff you need to do by hand (for
now). FreeS/WAN should correctly handle setting up the IPSec SA and
routes, but I haven't tested it so this may not work...
The FreeS/WAN conn should look like:
conn mobile
right=1.0.0.2
rightsubnet=1.0.0.0/24
rightnexthop=1.0.0.1
left=0.0.0.0 # The infamous "road warrior"
leftsubnet=1.0.0.3/32
Note that the left subnet contains *only* the remote host's virtual
address.
Hopefully the routing table on the FreeS/WAN box ends up looking like
this:
% netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
1.0.0.0 0.0.0.0 255.255.255.0 U 1500 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 3584 0 0 lo
0.0.0.0 1.0.0.1 0.0.0.0 UG 1500 0 0 eth0
1.0.0.3 1.0.0.1 255.255.255.255 UG 1433 0 0 ipsec0
So, if anybody sends a packet for 1.0.0.3 to the Linux box, it should
get bundled up and sent through the tunnel. To get the packets for
1.0.0.3 to the Linux box in the first place, you need to use "proxy
ARP".
How this works is: when a host or router on the local Ethernet segment
wants to send a packet to 1.0.0.3, it sends out an Ethernet level
broadcast "ARP request". If 1.0.0.3 was on the local LAN, it would
reply, saying "send IP packets for 1.0.0.3 to my Ethernet address".
Instead, you need to set up the Linux box so that _it_ answers ARP
requests for 1.0.0.3, even though that isn't its IP address. That
convinces everyone else on the lan to send 1.0.0.3 packets to the Linux
box, where the usual FreeS/WAN processing and routing take over.
% arp -i eth0 -s 1.0.0.3 -D eth0 pub
This says, if you see an ARP request on interface eth0 asking for
1.0.0.3, respond with the Ethernet address of interface eth0.
Now, as I said at the very beginning, if it is *at all* possible to
configure your client *not* to use the virtual IP address, you can avoid
this whole mess.
Sometimes you have to cope with a situation where the network interface(s) aren't all there at boot. The common example is notebooks with PCMCIA.
The key issue here is that the config setup section of the /etc/ipsec.conf configuration file lists the connection between ipsecN and hardware interfaces, in the interfaces= variable. At any time when ipsec setup start or ipsec setup restart is run this variable must correspond to the current real situation. More precisely, it must not mention any hardware interfaces which don't currently exist. The difficulty is that an ipsec setup start command is normally run at boot time so interfaces that are not up then are mis-handled.
Normally, an ipsec setup start is run at boot time. However, if the hardware situation at boot time is uncertain, one of two things must be done.
chkconfig --level 2345 ipsec offThat's for modern Red Hats or other Linuxes with chkconfig. Systems which lack this will require fiddling with symlinks in /etc/rc.d/rc?.d or the equivalent.
interfaces=in the configuration file. KLIPS and Pluto will be started, but won't do anything.
When the hardware *is* in place, IPsec has to be made aware of it. Someday there may be a nice way to do this.
Right now, the way to do it is to fix the /etc/ipsec.conf file appropriately, so interfaces reflects the new situation, and then restart the IPsec subsystem. This does break any existing IPsec connections.
If IPsec wasn't brought up at boot time, do
ipsec setup startwhile if it was, do
ipsec setup restartwhich won't be as quick.
If some of the hardware is to be taken out, before doing that, amend the configuration file so interfaces no longer includes it, and do
ipsec setup restart
Again, this breaks any existing connections.
Sometimes you might want to create a tunnel without encryption. Often this is a bad idea, even if you have some data which need not be private. See this discussion.
The IPsec protocols provide two ways to do build such tunnels:
There are several ways to handle this.
Note that if Alice and Bob want end-to-end security, they must build a tunnel end-to-end between their machines or use some other end-to-end tool such as PGP or SSL that suits their data. The only question is whether the admins build some special unencrypted tunnel for those already-encrypted packets.
This document will teach you how to install Linux FreeS/WAN. If your distribution comes with Linux FreeS/WAN, we offer tips to get you started.
To install FreeS/WAN you must:
There are three basic ways to get FreeS/WAN onto your system:
FreeS/WAN comes with these distributions.
If you're running one of these, include FreeS/WAN in the choices you make during installation, or add it later using the distribution's tools.
Your distribution may have integrated extra features, such as Andreas Steffen's X.509 patch, into FreeS/WAN. They may also use their own startup script locations or directory names.
If your FreeS/WAN came with your distribution, and it is pre-1.98, generate an RSA key pair for authentication.
As root type:
ipsec newhostkey --output /etc/ipsec.secrets --hostname xy.example.com
chmod 600 /etc/ipsec.secrets
where you replace xy.example.com with your machine's fully-qualified domain name. Generate some randomness, for example by wiggling your mouse, to speed the process.
The resulting ipsec.secrets looks like:
: RSA {
# RSA 2192 bits xy.example.com Tue Aug 20 17:42:19 2002
# for signatures only, UNSAFE FOR ENCRYPTION
#pubkey=0sAQOFppfeE3cC7wqJi...
#IN KEY 0x4200 4 1 AQOFppfeE3cC7wqJ...
# (0x4200 = auth-only host-level, 4 = IPSec, 1 = RSA)
Modulus: 0x85a697de137702ef0...
# everything after this point is secret
PrivateExponent: 0x16466ea5033e807...
Prime1: 0xdfb5003c8947b7cc88759065...
Prime2: 0x98f199b9149fde11ec956c814...
Exponent1: 0x9523557db0da7a885af90aee...
Exponent2: 0x65f6667b63153eb69db8f300dbb...
Coefficient: 0x90ad00415d3ca17bebff123413fc518...
}
# do not change the indenting of that "}"
In the actual file, the strings are much longer.
You can now start FreeS/WAN and test whether it's been successfully installed..
These instructions are for a recent Red Hat with a stock Red Hat kernel. We know that Mandrake and SUSE also produce FreeS/WAN RPMs. If you're running either, install using your distribution's tools.
Decide which functionality you need:
Check your kernel version with
uname -a
Get a kernel module which matches that version. For example:
freeswan-module-1.99_2.4.18_3-0.i386.rpm
Note: These modules will only work on the Red Hat kernel they were built for, since they are very sensitive to small changes in the kernel.
Get FreeS/WAN utilities to match. For example:
freeswan-1.99_2.4.18_3-0.i386.rpm
While you're at our ftp site, grab the RPM signing key
freeswan-rpmsign.asc
If you're running RedHat 8.x, import this key into the RPM database:
rpm --import freeswan-rpmsign.asc
For RedHat 7.x systems, you'll need to add it to your PGP keyring:
pgp -ka freeswan-rpmsign.asc
Check the signatures on both RPMs using:
rpm --checksig freeswan-module-1.99_2.4.18_3-0.i386.rpm
rpm --checksig freeswan-1.99_2.4.18_3-0.i386.rpm
You should see:
freeswan-module-1.99_2.4.18_3-0.i386.rpm: pgp md5 OK
freeswan-1.99_2.4.18_3-0.i386.rpm: pgp md5 OK
Become root:
su
Install your RPMs with:
rpm -ivh freeswan*
Now, start FreeS/WAN and test your install.
Your choices are:
Download the source tarball you've chosen, along with any patches.
While you're at our ftp site, get our RPM signing key
freeswan-sigkey.asc
and add it to your PGP keyring:
pgp -ka freeswan-sigkey.asc
Check the signature using:
pgp freeswan-1.99.tar.gz.sig freeswan-1.99.tar.gz
You should see something like:
Good signature from user "Linux FreeS/WAN Software Team (build@freeswan.org)".
Signature made 2002/06/26 21:04 GMT using 2047-bit key, key ID 46EAFCE1
As root, unpack your FreeS/WAN source into /usr/src.
su
mv freeswan-1.99.tar.gz /usr/src
cd /usr/src
tar -xzf freeswan-1.99.tar.gz
Now's the time to add any patches. The contributor may have special instructions, or you may simply use the patch command.
Change to your new FreeS/WAN directory:
cd /usr/src/freeswan-1.99
Make the FreeS/WAN module:
make oldmod
Install it:
make minstall
You can directly start FreeS/WAN and test your install.
Make FreeS/WAN using your old kernel settings:
make oldgo
Install it:
make kinstall
Reboot your system and test your install.
Bring FreeS/WAN up with:
service ipsec start
This is not necessary if you've rebooted.
To check that you have a successful install, run:
ipsec verify
You should see at least:
Checking your system to see if IPsec got installed and started correctly
Version check and ipsec on-path [OK]
Checking for KLIPS support in kernel [OK]
Checking for RSA private key (/etc/ipsec.secrets) [OK]
Checking that pluto is running [OK]
If any of these first four checks fails, see our troubleshooting guide.
There are several things on your system that might interfere with FreeS/WAN, and now's a good time to check these:
echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filtermay be necessary.
You'll need to configure FreeS/WAN for your local site. Have a look at our opportunism quickstart guide to see if that easy method is right for your needs. Or, see how to configure a network-to-network or Road Warrior style VPN.
This page will teach you how to configure a simple network-to-network link or a Road Warrior connection between two Linux FreeS/WAN boxes.
The network-to-network setup allows you to connect two office networks into one Virtual Private Network, while the Road Warrior connection secures a laptop's telecommute to work. Our examples also show the basic procedure on the Linux FreeS/WAN side where another IPsec peer is in play.
Shortcut to net-to-net.
Shortcut to Road Warrior.
To configure the network-to-network connection you must have:
For the Road Warrior you need:
For each gateway, compile the following information:
On your local Linux FreeS/WAN gateway, print your IPsec public key:
ipsec showhostkey --left
The output should look like this (with the key shortened for easy reading):
# RSA 2048 bits xy.example.com Fri Apr 26 15:01:41 2002
leftrsasigkey=0sAQOnwiBPt...
Don't have a key? See these instructions.
Get a console on the remote side:
ssh2 ab.example.com
In that window, type:
ipsec showhostkey --right
You'll see something like:
# RSA 2192 bits ab.example.com Thu May 16 15:26:20 2002
rightrsasigkey=0sAQOqH55O...
Back on the local gate, copy our template to /etc/ipsec.conf . (on Mandrake, /etc/freeswan/ipsec.conf). Substitute the information you've gathered for our example data.
conn net-to-net
left=1.2.3.4 # Local vitals
leftsubnet=42.42.42.0/24 #
leftid=@xy.example.com #
leftrsasigkey=0s1LgR7/oUM... #
leftnexthop=%defaultroute # correct in many situations
right=5.6.7.8 # Remote vitals
rightsubnet=42.42.42.1/24 #
rightid=@ab.example.com #
rightrsasigkey=0sAQOqH55O... #
rightnexthop=%defaultroute # correct in many situations
auto=add # authorizes but doesn't start this
# connection at startup
Copy conn net-to-net to the remote-side /etc/ipsec.conf. If you've made no other modifications to either ipsec.conf, simply:
scp2 ipsec.conf root@ab.example.com:/etc/ipsec.conf
Locally, type:
ipsec auto --start net-to-net
You should see:
104 "net-net" #223: STATE_MAIN_I1: initiate
106 "net-net" #223: STATE_MAIN_I2: sent MI2, expecting MR2
108 "net-net" #223: STATE_MAIN_I3: sent MI3, expecting MR3
004 "net-net" #223: STATE_MAIN_I4: ISAKMP SA established
112 "net-net" #224: STATE_QUICK_I1: initiate
004 "net-net" #224: STATE_QUICK_I2: sent QI2, IPsec SA established
The important thing is IPsec SA established. If you're unsuccessful, see our troubleshooting tips.
If you are masquerading or NATting packets on either gateway, you must now exempt the packets you wish to tunnel from this treatment. If you have a rule like:
iptables -A FORWARD -s 42.42.42.0/255.255.255.0 -j MASQ
change it to something like:
iptables -A FORWARD -s 42.42.42.0/255.255.255.0 -d ! 42.42.42.1/255.255.255.0 -j MASQ
This may be necessary on both gateways.
Sit at one of your local subnet nodes (not the gateway), and ping a subnet node on the other (again, not the gateway).
ping fileserver.toledo.example.com
While still pinging, go to the local gateway and snoop your outgoing interface, for example:
tcpdump -i ppp0
You want to see ESP (Encapsulating Security Payload) packets moving back and forth between the two gateways at the same frequency as your pings:
19:16:32.046220 1.2.3.4 > 5.6.7.8: ESP(spi=0x3be6c4dc,seq=0x3)
19:16:32.085630 5.6.7.8 > 1.2.3.4: ESP(spi=0x5fdd1cf8,seq=0x6)
If you see this, congratulations are in order! You have a tunnel which will protect any IP data from one subnet to the other, as it passes between the two gates. If not, go and troubleshoot.
Note: your new tunnel protects only net-net traffic, not gateway-gateway, or gateway-subnet. If you need this (for example, if machines on one net need to securely contact a fileserver on the IPsec gateway), you'll need to create extra connections.
Now that your connection works, name it something sensible, like:
conn winstonnet-toledonet
To have the tunnel come up on-boot, replace
auto=add
with:
auto=start
Copy these changes to the other side, for example:
scp2 ipsec.conf root@ab.example.com:/etc/ipsec.conf
Enjoy!
You'll need to know:
On your laptop, print your IPsec public key:
ipsec showhostkey --left
The output should look like this (with the key shortened for easy reading):
# RSA 2192 bits road.example.com Sun Jun 9 02:45:02 2002
leftrsasigkey=0sAQPIPN9uI...
Don't have a key? See these instructions.
Get a console on the gateway:
ssh2 xy.example.com
View the gateway's public key with:
ipsec showhostkey --right
This will yield something like
# RSA 2048 bits xy.example.com Fri Apr 26 15:01:41 2002
rightrsasigkey=0sAQOnwiBPt...
On your laptop, copy this template to /etc/ipsec.conf. (on Mandrake, /etc/freeswan/ipsec.conf). Substitute the information you've gathered for our example data.
conn road
left=%defaultroute # Picks up our dynamic IP
leftnexthop=%defaultroute #
leftid=@road.example.com # Local information
leftrsasigkey=0sAQPIPN9uI... #
right=1.2.3.4 # Remote information
rightsubnet=42.42.42.0/24 #
rightid=@xy.example.com #
rightrsasigkey=0sAQOnwiBPt... #
auto=add # authorizes but doesn't start this
# connection at startup
The template for the gateway is different. Notice how it reverses left and right, in keeping with our convention that Left is Local, Right Remote. Be sure to switch your rsasigkeys in keeping with this.
ssh2 xy.example.com
vi /etc/ipsec.conf
and add:
conn road
left=1.2.3.4 # Gateway's information
leftid=@xy.example.com #
leftsubnet=42.42.42.0/24 #
leftrsasigkey=0sAQOnwiBPt... #
rightnexthop=%defaultroute # correct in many situations
right=%any # Wildcard: we don't know the laptop's IP
rightid=@road.example.com #
rightrsasigkey=0sAQPIPN9uI... #
auto=add # authorizes but doesn't start this
# connection at startup
You must start the connection from the Road Warrior side. On your laptop, type:
ipsec auto --start net-to-net
You should see:
104 "net-net" #223: STATE_MAIN_I1: initiate 106 "road" #301: STATE_MAIN_I2: sent MI2, expecting MR2 108 "road" #301: STATE_MAIN_I3: sent MI3, expecting MR3 004 "road" #301: STATE_MAIN_I4: ISAKMP SA established 112 "road" #302: STATE_QUICK_I1: initiate 004 "road" #302: STATE_QUICK_I2: sent QI2, IPsec SA established
Look for IPsec SA established. If you're unsuccessful, see our troubleshooting tips.
If you are masquerading or NATting packets on your office gateway, you must now exempt the packets you wish to tunnel from this treatment. If you have a rule like:
iptables -A FORWARD -s 42.42.42.0/255.255.255.0 -j MASQ
change it to something like:
iptables -A FORWARD -s 42.42.42.0/255.255.255.0 -d ! 42.42.42.1/255.255.255.0 -j MASQ
From your laptop, ping a subnet node behind the remote gateway. Do not choose the gateway itself for this test.
ping ns.winston.example.com
Snoop the packets exiting the laptop, with a command like:
tcpdump -i wlan0
You have success if you see (Encapsulating Security Payload) packets travelling in both directions:
22:57:31.507992 7.7.7.7 > 1.2.3.4: ESP(spi=0x3a0cdf1e,seq=0x1a) 22:57:31.624772 1.2.3.4 > 7.7.7.7: ESP(spi=0x5fdd1d0e,seq=0x1c)
If you do, great! Traffic between your Road Warrior and the net behind your gateway is protected. If not, see our troubleshooting hints.
Your new tunnel protects only traffic addressed to the net, not to the IPsec gateway itself. If you need the latter, you'll want to make an extra tunnel..
On both ends, name your connection wisely, like:
conn mike-to-office
On the laptop only, replace
auto=add
with:
auto=start
so that you'll be connected on-boot.
Happy telecommuting!
Using the principles illustrated here, you can try variations such as:
Or, look at some of our more complex configuration examples..
This section discusses a number of issues which have three things in common:
Grouping them here lets us provide the explanations some users will need without unduly complicating the main text.
The explanations here are intended to be adequate for FreeS/WAN purposes (please comment to the users mailing list if you don't find them so), but they are not trying to be complete or definitive. If you need more information, see the references provided in each section.
Opportunistic encryption requires that the gateway systems be able to fetch public keys, and other IPsec-related information, from each other's DNS (Domain Name Service) records.
DNS is a distributed database that maps names to IP addresses and vice versa.
Much good reference material is available for DNS, including:
We give only a brief overview here, intended to help you use DNS for FreeS/WAN purposes.
Although the implementation is distributed, it is often useful to speak of DNS as if it were just two enormous tables:
Both maps can optionally contain additional data. For opportunistic encryption, we insert the data need for IPsec authentication.
A system named gateway.example.com with IP address 10.20.30.40 should have at least two DNS records, one in each map:
For both maps there is a hierarchy of DNS servers and a system of delegating authority so that, for example:
DNS zones are the units of delegation. There is a hierarchy of zones.
Returning to the example records:
gateway.example.com. IN A 10.20.30.40
40.30.20.10.in-addr.arpa. IN PTR gateway.example.com.
some syntactic details are:
The capitalised strings after IN indicate the type of record. Possible types include:
To set up for opportunistic encryption, you add some KEY and TXT records to your DNS data. Details are in our quickstart document.
DNS information is extensively cached. With no caching, a lookup by your system of "www.freeswan.org" might involve:
However, this can be a bit inefficient. For example, if you are in the Phillipines, the closest a root server is in Japan. That might send you to a .org server in the US, and then to freeswan.org in Holland. If everyone did all those lookups every time they clicked on a web link, the net would grind to a halt.
Nameservers therefore cache information they look up. When you click on another link at www.freeswan.org, your local nameserver has the IP address for that server in its cache, and no further lookups are required.
Intermediate results are also cached. If you next go to lists.freeswan.org, your nameserver can just ask the freeswan.org nameserver for that address; it does not need to query the root or .org nameservers because it has a cached address for the freeswan.org zone server.
Of course, like any cacheing mechanism, this can create problems of consistency. What if the administrator for freeswan.org changes the IP address, or the authentication key, for www.freeswan.org? If you use old information from the cache, you may get it wrong. On the other hand, you cannot afford to look up fresh information every time. Nor can you expect the freeswan.org server to notify you; that isn't in the protocols.
The solution that is in the protocols is fairly simple. Cacheable records are marked with Time To Live (TTL) information. When the time expires, the caching server discards the record. The next time someone asks for it, the server fetches a fresh copy. Of course, a server may also discard records before their TTL expires if it is running out of cache space.
This implies that there will be some delay before the new version of a changed record propagates around the net. Until the TTLs on all copies of the old record expire, some users will see it because that is what is in their cache. Other users may see the new record immediately because they don't have an old one cached.
It seems, from mailing list reports, to be moderately common for problems to crop up in which small packets pass through the IPsec tunnels just fine but larger packets fail.
These problems are caused by various devices along the way mis-handling either packet fragments or path MTU discovery.
IPsec makes packets larger by adding an ESP or AH header. This can tickle assorted bugs in fragment handling in routers and firewalls, or in path MTU discovery mechanisms, and cause a variety of symptoms which are both annoying and, often, quite hard to diagnose.
An explanation from project technical lead Henry Spencer:
The problem is IP fragmentation; more precisely, the problem is that the second, third, etc. fragments of an IP packet are often difficult for filtering mechanisms to classify. Routers cannot rely on reassembling the packet, or remembering what was in earlier fragments, because the fragments may be out of order or may even follow different routes. So any general, worst-case filtering decision pretty much has to be made on each fragment independently. (If the router knows that it is the only route to the destination, so all fragments *must* pass through it, reassembly would be possible... but most routers don't want to bother with the complications of that.) All fragments carry roughly the original IP header, but any higher-level header is (for IP purposes) just the first part of the packet data... so only the first fragment carries that. So, for example, on examining the second fragment of a TCP packet, you could tell that it's TCP, but not what port number it is destined for -- that information is in the TCP header, which appears in the first fragment only. The result of this classification difficulty is that stupid routers and over-paranoid firewalls may just throw fragments away. To get through them, you must reduce your MTU enough that fragmentation will not occur. (In some cases, they might be willing to attempt reassembly, but have very limited resources to devote to it, meaning that packets must be small and fragments few in number, leading to the same conclusion: smaller MTU.)
In addition to the problem Henry describes, you may also have trouble with path MTU discovery.
By default, FreeS/WAN uses a large MTU for the ipsec device. This avoids some problems, but may complicate others. Here's an explanation from Claudia:
Here are a couple of pieces of background information. Apologies if you
have seen these already. An excerpt from one of my old posts:
An MTU of 16260 on ipsec0 is usual. The IPSec device defaults to this
high MTU so that it does not fragment incoming packets before encryption
and encapsulation. If after IPSec processing packets are larger than 1500,
[ie. the mtu of eth0] then eth0 will fragment them.
Adding IPSec headers adds a certain number of bytes to each packet.
The MTU of the IPSec interface refers to the maximum size of the packet
before the IPSec headers are added. In some cases, people find it helpful
to set ipsec0's MTU to 1500-(IPSec header size), which IIRC is about 1430.
That way, the resulting encapsulated packets don't exceed 1500. On most
networks, packets less than 1500 will not need to be fragmented.
and... (from Henry Spencer)
The way it *ought* to work is that the MTU advertised by the ipsecN
interface should be that of the underlying hardware interface, less a
pinch for the extra headers needed.
Unfortunately, in certain situations this breaks many applications.
There is a widespread implicit assumption that the smallest MTUs are
at the ends of paths, not in the middle, and another that MTUs are
never less than 1500. A lot of code is unprepared to handle paths
where there is an "interior minimum" in the MTU, especially when it's
less than 1500. So we advertise a big MTU and just let the resulting
big packets fragment.
This usually works, but we do get bitten in cases where some intermediate
point can't handle all that fragmentation. We can't win on this one.
The MTU can be changed with an overridemtu= statement in the config setup section of ipsec.conf.5.
For a discussion of MTU issues and some possible solutions using Linux advanced routing facilities, see the Linux 2.4 Advanced Routing HOWTO.
Network Address T ranslation is a service provided by some gateway machines. Calling it NAPT (adding the word Port) would be more precise, but we will follow the widespread usage.
A gateway doing NAT rewrites the headers of packets it is forwarding, changing one or more of:
On Linux 2.4, NAT services are provided by the netfilter(8) firewall code. There are several Netfilter HowTos including one on NAT.
For older versions of Linux, this was referred to as "IP masquerade" and different tools were used. See this resource page.
Putting an IPsec gateway behind a NAT gateway is not recommended. See our firewalls document.
The most common application of NAT uses private non-routable addresses.
Often a home or small office network will have:
Of course this poses a problem since several machines cannot use one address. The best solution might be to obtain more addresses, but often this is impractical or uneconomical.
A common solution is to have:
The client machines are set up with reserved non-routable IP addresses defined in RFC 1918. The masquerading gateway, the machine with the actual link to the Internet, rewrites packet headers so that all packets going onto the Internet appear to come from one IP address, that of its Internet interface. It then gets all the replies, does some table lookups and more header rewriting, and delivers the replies to the appropriate client machines.
As far as anyone else on the Internet is concerned, the systems behind the gateway are completely hidden. Only one machine with one IP address is visible.
For IPsec on such a gateway, you can entirely ignore the NAT in:
Those can be set up exactly as they would be if your gateway had no other systems behind it.
You do, however, have to take account of the NAT in firewall rules which affect packet forwarding.
NAT to routable addresses is also possible, but is less common and may make for rather tricky routing problems. We will not discuss it here. See the Netfilter HowTos.
So far it has only one entry.
From: Poltorak Serguei <poltorak@dataforce.net>
Subject: [Users] Using FreeS/WAN
Date: Tue, 16 Oct 2001
Hello.
I'm using FreeS/WAN IPsec for half a year. I learned a lot of things about
it and I think it would be interesting for someone to see the result of my
experiments and usage of FreeS/WAN. If you find a mistake in this
file, please e-mail me. And excuse me for my english... I'm learning.. :)
I'll talk about vary simple configuration:
addresses prefix = 192.168
lan1 sgw1 .0.0/24 (Internet) sgw2 lan2
.1.0/24---[ .1.1 ; .0.1 ]===================[ .0.10 ; . 2.10 ]---.2.0/24
We need to let lan1 see lan2 across Internet like it is behind sgw1. The
same for lan2. And we need to do IPX bridge for Novel Clients and NDS
synchronization.
my config:
------------------- ipsec.conf -------------------
conn lan1-lan2
type=tunnel
compress=yes
#-------------------
left=192.168.0.1
leftsubnet=192.168.1.0/24
#-------------------
right=192.168.0.10
rightsubnet=192.168.2.0/24
#-------------------
auth=esp
authby=secret
--------------- end of ipsec.conf ----------------
ping .2.x from .1.y (y != 1)
It works?? Fine. Let's continue...
Why y != 1 ?? Because kernel of sgw1 have 2 IP addresses and it will choose
the first IP (which is used to go to Internet) .0.1 and the packet won't go
through IPsec tunnel :( But if do ping on .1.1 kernel will respond from
that address (.1.1) and the packet will be tunneled. The same problem occurred then
.2.x sends a packet to .1.2 which is down at the moment. What happens? .1.1
sends ARP requesting .1.2... after 3 tries it send to .2.x an destunreach,
but from his "natural" IP or .0.1 . So the error message won't be delivered!
It's a big problem...
Resolution... One can manipulate with ipsec0 or ipsec0:0 to solve the
problem (if ipsec0 has .1.1 kernel will send packets correctly), but there
are powerful and elegant iproute2 :) We simply need to change source address
of packet that goes to other secure lan. This is done with
ip route replace 192.168.2.0/24 via 192.168.0.10 dev ipsec0 src 192.168.1.1
Cool!! Now it works!!
The second step. We want install firewall on sgw1 and sgw2. Encryption of
traffic without security isn't a good idea. I don't use {left|right}firewall,
because I'm running firewall from init scripts.
We want IPsec data between lan1-lan2, some ICMP errors (destination
unreachable, TTL exceeded, parameter problem and source quench), replying on
pings from both lans and Internet, ipxtunnel data for IPX and of course SSH
between sgw1 and sgw2 and from/to one specified host.
I'm using ipchains. With iptables there are some changes.
---------------- rc.firewall ---------------------
#!/bin/sh
#
# Firewall for IPsec lan1-lan2
#
IPC=/sbin/ipchains
ANY=0.0.0.0/0
# left
SGW1_EXT=192.168.0.1
SGW1_INT=192.168.1.1
LAN1=192.168.1.0/24
# right
SGW2_EXT=192.168.0.10
SGW2_INT=192.168.2.10
LAN2=192.168.2.0/24
# SSH from and to this host
SSH_PEER_HOST=_SOME_HOST_
# this is for left. exchange these values for right.
MY_EXT=$SGW1_EXT
MY_INT=$SGW1_INT
PEER_EXT=$SGW2_EXT
PEER_INT=$SGW2_INT
INT_IF=eth1
EXT_IF=eth0
IPSEC_IF=ipsec0
MY_LAN=$LAN1
PEER_LAN=$LAN2
$IPC -F
$IPC -P input DENY
$IPC -P forward DENY
$IPC -P output DENY
# Loopback traffic
$IPC -A input -i lo -j ACCEPT
$IPC -A output -i lo -j ACCEPT
# for IPsec SGW1-SGW2
## IKE
$IPC -A input -p udp -s $PEER_EXT 500 -d $MY_EXT 500 -i $EXT_IF -j ACCEPT
$IPC -A output -p udp -s $MY_EXT 500 -d $PEER_EXT 500 -i $EXT_IF -j ACCEPT
## ESP
$IPC -A input -p 50 -s $PEER_EXT -d $MY_EXT -i $EXT_IF -j ACCEPT
### we don't need this line ### $IPC -A output -p 50 -s $MY_EXT -d $PEER_EXT -i $EXT_IF -j ACCEPT
## forward LAN1-LAN2
$IPC -A forward -s $MY_LAN -d $PEER_LAN -i $IPSEC_IF -j ACCEPT
$IPC -A forward -s $PEER_LAN -d $MY_LAN -i $INT_IF -j ACCEPT
$IPC -A output -s $PEER_LAN -d $MY_LAN -i $INT_IF -j ACCEPT
$IPC -A input -s $PEER_LAN -d $MY_LAN -i $IPSEC_IF -j ACCEPT
$IPC -A input -s $MY_LAN -d $PEER_LAN -i $INT_IF -j ACCEPT
$IPC -A output -s $MY_LAN -d $PEER_LAN -i $IPSEC_IF -j ACCEPT
# ICMP
#
## Dest unreachable
### from/to Internet
$IPC -A input -p icmp --icmp-type destination-unreachable -s $ANY -d $MY_EXT -i $EXT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type destination-unreachable -s $MY_EXT -d $ANY -i $EXT_IF -j ACCEPT
### from/to Lan
$IPC -A input -p icmp --icmp-type destination-unreachable -s $ANY -d $MY_INT -i $INT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type destination-unreachable -s $MY_INT -d $ANY -i $INT_IF -j ACCEPT
### from/to Peer Lan
$IPC -A input -p icmp --icmp-type destination-unreachable -s $ANY -d $MY_INT -i $IPSEC_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type destination-unreachable -s $MY_INT -d $ANY -i $IPSEC_IF -j ACCEPT
#
## Source quench
### from/to Internet
$IPC -A input -p icmp --icmp-type source-quench -s $ANY -d $MY_EXT -i $EXT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type source-quench -s $MY_EXT -d $ANY -i $EXT_IF -j ACCEPT
### from/to Lan
$IPC -A input -p icmp --icmp-type source-quench -s $ANY -d $MY_INT -i $INT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type source-quench -s $MY_INT -d $ANY -i $INT_IF -j ACCEPT
### from/to Peer Lan
$IPC -A input -p icmp --icmp-type source-quench -s $ANY -d $MY_INT -i $IPSEC_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type source-quench -s $MY_INT -d $ANY -i $IPSEC_IF -j ACCEPT
#
## Parameter problem
### from/to Internet
$IPC -A input -p icmp --icmp-type parameter-problem -s $ANY -d $MY_EXT -i $EXT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type parameter-problem -s $MY_EXT -d $ANY -i $EXT_IF -j ACCEPT
### from/to Lan
$IPC -A input -p icmp --icmp-type parameter-problem -s $ANY -d $MY_INT -i $INT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type parameter-problem -s $MY_INT -d $ANY -i $INT_IF -j ACCEPT
### from/to Peer Lan
$IPC -A input -p icmp --icmp-type parameter-problem -s $ANY -d $MY_INT -i $IPSEC_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type parameter-problem -s $MY_INT -d $ANY -i $IPSEC_IF -j ACCEPT
#
## Time To Live exceeded
### from/to Internet
$IPC -A input -p icmp --icmp-type time-exceeded -s $ANY -d $MY_EXT -i $EXT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type time-exceeded -s $MY_EXT -d $ANY -i $EXT_IF -j ACCEPT
### to Lan
$IPC -A input -p icmp --icmp-type time-exceeded -s $ANY -d $MY_INT -i $INT_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type time-exceeded -s $MY_INT -d $ANY -i $INT_IF -j ACCEPT
### to Peer Lan
$IPC -A input -p icmp --icmp-type time-exceeded -s $ANY -d $MY_INT -i $IPSEC_IF -j ACCEPT
$IPC -A output -p icmp --icmp-type time-exceeded -s $MY_INT -d $ANY -i $IPSEC_IF -j ACCEPT
# ICMP PINGs
## from Internet
$IPC -A input -p icmp -s $ANY -d $MY_EXT --icmp-type echo-request -i $EXT_IF -j ACCEPT
$IPC -A output -p icmp -s $MY_EXT -d $ANY --icmp-type echo-reply -i $EXT_IF -j ACCEPT
## from LAN
$IPC -A input -p icmp -s $ANY -d $MY_INT --icmp-type echo-request -i $INT_IF -j ACCEPT
$IPC -A output -p icmp -s $MY_INT -d $ANY --icmp-type echo-reply -i $INT_IF -j ACCEPT
## from Peer LAN
$IPC -A input -p icmp -s $ANY -d $MY_INT --icmp-type echo-request -i $IPSEC_IF -j ACCEPT
$IPC -A output -p icmp -s $MY_INT -d $ANY --icmp-type echo-reply -i $IPSEC_IF -j ACCEPT
# SSH
## from SSH_PEER_HOST
$IPC -A input -p tcp -s $SSH_PEER_HOST -d $MY_EXT 22 -i $EXT_IF -j ACCEPT
$IPC -A output -p tcp \! -y -s $MY_EXT 22 -d $SSH_PEER_HOST -i $EXT_IF -j ACCEPT
## to SSH_PEER_HOST
$IPC -A input -p tcp \! -y -s $SSH_PEER_HOST 22 -d $MY_EXT -i $EXT_IF -j ACCEPT
$IPC -A output -p tcp -s $MY_EXT -d $SSH_PEER_HOST 22 -i $EXT_IF -j ACCEPT
## from PEER
$IPC -A input -p tcp -s $PEER_EXT -d $MY_EXT 22 -i $EXT_IF -j ACCEPT
$IPC -A output -p tcp \! -y -s $MY_EXT 22 -d $PEER_EXT -i $EXT_IF -j ACCEPT
## to PEER
$IPC -A input -p tcp \! -y -s $PEER_EXT 22 -d $MY_EXT -i $EXT_IF -j ACCEPT
$IPC -A output -p tcp -s $MY_EXT -d $PEER_EXT 22 -i $EXT_IF -j ACCEPT
# ipxtunnel
$IPC -A input -p udp -s $PEER_INT 2005 -d $MY_INT 2005 -i $IPSEC_IF -j ACCEPT
$IPC -A output -p udp -s $MY_INT 2005 -d $PEER_INT 2005 -i $IPSEC_IF -j ACCEPT
---------------- end of rc.firewall ----------------------
To understand this we need to look on this scheme:
++-----------------------<----------------------------+
|| ipsec0 |
\/ |
eth0 +--------+ /---------/ yes /---------/ yes +-----------------------+
------>| INPUT |-->/ ?local? /----->/ ?IPsec? /----->| decrypt decapsulate |
eth1 +--------+ /---------/ /---------/ +-----------------------+
|| no || no
\/ \/
+----------+ +---------+ +-------+
| routing | | local | | local |
| decision | | deliver | | send |
+----------+ +---------+ +-------+
|| ||
\/ \/
+---------+ +----------+
| forward | | routing |
+---------+ | decision |
|| +----------+
|| ||
++----------------<-----------------++
||
\/
+--------+ eth0
| OUTPUT | eth1
+--------+ ipsec0
||
\/
/---------/ yes +-----------------------+
/ ?IPsec? /----->| encrypt encapsulate |
/---------/ +-----------------------+
|| no ||
|| ||
|| \/ eth0, eth1
++-----------------------++-------------->
This explain how a packet traverse TCP/IP stack in IPsec capable kernel.
FIX ME, please, if there are any errors
Test the new firewall now.
Now about IPX. I tried 3 programs for tunneling IPX: tipxd, SIB and ipxtunnel
tipxd didn't send packets.. :(
SIB and ipxtunnel worked fine :)
With ipxtunnel there was a little problem. In sources there are an error.
--------------------- in main.c ------------------------
< bytes += p.len;
---
> bytes += len;
--------------------------------------------------------
After this FIX everything goes right...
------------------- /etc/ipxtunnel.conf ----------------
port 2005
remote 192.168.101.97 2005
interface eth1
--------------- end of /etc/ipxtunnel.conf -------------
I use IPX tunnel between .1.1 and .2.10 so we don't need to encrypt nor
authenticate encapsulated IPX packets, it is done with IPsec.
If you don't wont to use iproute2 to change source IP you need to use SIB
(it is able to bind local address) or establish tunnel between .0.1 and
.0.10 (external IPs, you need to do encryption in the program, but it isn't
strong).
For now I'm using ipxtunnel.
I think that's all for the moment. If there are any error, please e-mail me:
poltorak@df.ru . It would be cool if someone puts the scheme of TCP/IP in
kernel and firewall example on FreeS/WAN's manual pages.
PoltoS
Cryptography has a long and interesting history, and has been the subject of considerable political controversy.
The classic book on the history of cryptography is David Kahn's The Codebreakers. It traces codes and codebreaking from ancient Egypt to the 20th century.
Diffie and Landau Privacy on the Line: The Politics of Wiretapping and Encryption covers the history from the First World War to the 1990s, with an emphasis on the US.
During the Second World War, the British "Ultra" project achieved one of the greatest intelligence triumphs in the history of warfare, breaking many Axis codes. One major target was the Enigma cipher machine, a German device whose users were convinced it was unbreakable. The American "Magic" project had some similar triumphs against Japanese codes.
There are many books on this period. See our bibliography for several. Two I particularly like are:
Bletchley Park, where much of the Ultra work was done, now has a museum and a web site.
The Ultra work introduced three major innovations.
So by the end of the war, Allied code-breakers were expert at large-scale mechanised code-breaking. The payoffs were enormous.
The wartime innovations were enthusiastically adopted by post-war and Cold War signals intelligence agencies. Presumably many nations now have some agency capable of sophisticated attacks on communications security, and quite a few engage in such activity on a large scale.
America's NSA, for example, is said to be both the world's largest employer of mathematicians and the world's largest purchaser of computer equipment. Such claims may be somewhat exaggerated, but beyond doubt the NSA -- and similar agencies in other countries -- have some excellent mathematicians, lots of powerful computers, sophisticated software, and the organisation and funding to apply them on a large scale. Details of the NSA budget are secret, but there are some published estimates.
Changes in the world's communications systems since WW II have provided these agencies with new targets. Cracking the codes used on an enemy's military or diplomatic communications has been common practice for centuries. Extensive use of radio in war made large-scale attacks such as Ultra possible. Modern communications make it possible to go far beyond that. Consider listening in on cell phones, or intercepting electronic mail, or tapping into the huge volumes of data on new media such as fiber optics or satellite links. None of these targets existed in 1950. All of them can be attacked today, and almost certainly are being attacked.
The Ultra story was not made public until the 1970s. Much of the recent history of codes and code-breaking has not been made public, and some of it may never be. Two important books are:
Note that these books cover only part of what is actually going on, and then only the activities of nations open and democratic enough that (some of) what they are doing can be discovered. A full picture, including:
might be really frightening.
Until quite recently, cryptography was primarily a concern of governments, especially of the military, of spies, and of diplomats. Much of it was extremely secret.
In recent years, that has changed a great deal. With computers and networking becoming ubiquitous, cryptography is now important to almost everyone. Among the developments since the 1970s:
This has led to a complex ongoing battle between various mainly government groups wanting to control the spread of crypto and various others, notably the computer industry and the cypherpunk crypto advocates, wanting to encourage widespread use.
Steven Levy has written a fine history of much of this, called Crypto: How the Code rebels Beat the Government -- Saving Privacy in the Digital Age.
The FreeS/WAN project is to a large extent an outgrowth of cypherpunk ideas. Our reasons for doing the project can be seen in these quotes from the Cypherpunk Manifesto:
Privacy is necessary for an open society in the electronic age. ...We cannot expect governments, corporations, or other large, faceless organizations to grant us privacy out of their beneficence. It is to their advantage to speak of us, and we should expect that they will speak. ...
We must defend our own privacy if we expect to have any. ...
Cypherpunks write code. We know that someone has to write software to defend privacy, and since we can't get privacy unless we all do, we're going to write it. We publish our code so that our fellow Cypherpunks may practice and play with it. Our code is free for all to use, worldwide. We don't much care if you don't approve of the software we write. We know that software can't be destroyed and that a widely dispersed system can't be shut down.
Cypherpunks deplore regulations on cryptography, for encryption is fundamentally a private act. ...
For privacy to be widespread it must be part of a social contract. People must come and together deploy these systems for the common good. ...
To quote project leader John Gilmore:
We are literally in a race between our ability to build and deploy technology, and their ability to build and deploy laws and treaties. Neither side is likely to back down or wise up until it has definitively lost the race.
If FreeS/WAN reaches its goal of making opportunistic encryption widespread so that secure communication can become the default for a large part of the net, we will have struck a major blow.
The political problem is that nearly all governments want to monitor their enemies' communications, and some want to monitor their citizens. They may be very interested in protecting some of their own communications, and often some types of business communication, but not in having everyone able to communicate securely. They therefore attempt to restrict availability of strong cryptography as much as possible.
Things various governments have tried or are trying include:
The government believes not only the governments associated with Echelon are able to intercept communication systems, but that it is an activity of the investigative authorities and intelligence services of many countries with governments of different political signature.Even if they have nothing on the scale of Echelon, most intelligence agencies and police forces certainly have some interception capability.
Of course governments are by no means the only threat to privacy and security on the net. Other threats include:
One study enumerates threats and possible responses for small and medium businesses. VPNs are a key part of the suggested strategy.
We consider privacy a human right. See the UN's Universal Declaration of Human Rights, article twelve:
No one shall be subjected to arbitrary interference with his privacy, family, home or correspondence, nor to attacks upon his honor and reputation. Everyone has the right to the protection of the law against such interference or attacks.
Our objective is to help make privacy possible on the Internet using cryptography strong enough not even those well-funded government agencies are likely to break it. If we can do that, the chances of anyone else breaking it are negliible.
Many groups are working in different ways to defend privacy on the net and elsewhere. Please consider contributing to one or more of these groups:
For more on these issues see:
There are several collections of crypto quotes on the net.
See also the bibliography and our list of web references on cryptography law and policy.
The remainder of this section includes two pieces of writing by our project leader
and discussions of:
and a section on press coverage of FreeS/WAN.
FreeS/WAN project founder John Gilmore wrote a web page about why we are doing this. The version below is slightly edited, to fit this format and to update some links. For a version without these edits, see his home page.
My project for 1996 was to secure 5% of the Internet traffic against passive wiretapping. It didn't happen in 1996, so I'm still working on it in 1997, 1998, and 1999! If we get 5% in 1999 or 2000, we can secure 20% the next year, against both active and passive attacks; and 80% the following year. Soon the whole Internet will be private and secure. The project is called S/WAN or S/Wan or Swan for Secure Wide Area Network; since it's free software, we call it FreeSwan to distinguish it from various commercial implementations. RSA came up with the term "S/WAN". Our main web site is at http://www.freeswan.org/. Want to help?
The idea is to deploy PC-based boxes that will sit between your local area network and the Internet (near your firewall or router) which opportunistically encrypt your Internet packets. Whenever you talk to a machine (like a Web site) that doesn't support encryption, your traffic goes out "in the clear" as usual. Whenever you connect to a machine that does support this kind of encryption, this box automatically encrypts all your packets, and decrypts the ones that come in. In effect, each packet gets put into an "envelope" on one side of the net, and removed from the envelope when it reaches its destination. This works for all kinds of Internet traffic, including Web access, Telnet, FTP, email, IRC, Usenet, etc.
The encryption boxes are standard PC's that use freely available Linux software that you can download over the Internet or install from a cheap CDROM.
This wasn't just my idea; lots of people have been working on it for years. The encryption protocols for these boxes are called IPSEC (IP Security). They have been developed by the IP Security Working Group of the Internet Engineering Task Force, and will be a standard part of the next major version of the Internet protocols ( IPv6). For today's (IP version 4) Internet, they are an option.
The Internet Architecture Board and Internet Engineering Steering Group have taken a strong stand that the Internet should use powerful encryption to provide security and privacy. I think these protocols are the best chance to do that, because they can be deployed very easily, without changing your hardware or software or retraining your users. They offer the best security we know how to build, using the Triple-DES, RSA, and Diffie-Hellman algorithms.
This "opportunistic encryption box" offers the "fax effect". As each person installs one for their own use, it becomes more valuable for their neighbors to install one too, because there's one more person to use it with. The software automatically notices each newly installed box, and doesn't require a network administrator to reconfigure it. Instead of "virtual private networks" we have a "REAL private network"; we add privacy to the real network instead of layering a manually-maintained virtual network on top of an insecure Internet.
The US government would like to control the deployment of IP Security with its crypto export laws. This isn't a problem for my effort, because the cryptographic work is happening outside the United States. A foreign philanthropist, and others, have donated the resources required to add these protocols to the Linux operating system. Linux is a complete, freely available operating system for IBM PC's and several kinds of workstation, which is compatible with Unix. It was written by Linus Torvalds, and is still maintained by a talented team of expert programmers working all over the world and coordinating over the Internet. Linux is distributed under the GNU Public License, which gives everyone the right to copy it, improve it, give it to their friends, sell it commercially, or do just about anything else with it, without paying anyone for the privilege.
Organizations that want to secure their network will be able to put two Ethernet cards into an IBM PC, install Linux on it from a $30 CDROM or by downloading it over the net, and plug it in between their Ethernet and their Internet link or firewall. That's all they'll have to do to encrypt their Internet traffic everywhere outside their own local area network.
Travelers will be able to run Linux on their laptops, to secure their connection back to their home network (and to everywhere else that they connect to, such as customer sites). Anyone who runs Linux on a standalone PC will also be able to secure their network connections, without changing their application software or how they operate their computer from day to day.
There will also be numerous commercially available firewalls that use this technology. RSA Data Security is coordinating the S/Wan (Secure Wide Area Network) project among more than a dozen vendors who use these protocols. There's a compatability chart that shows which vendors have tested their boxes against which other vendors to guarantee interoperatility.
Eventually it will also move into the operating systems and networking protocol stacks of major vendors. This will probably take longer, because those vendors will have to figure out what they want to do about the export controls.
My initial goal of securing 5% of the net by Christmas '96 was not met. It was an ambitious goal, and inspired me and others to work hard, but was ultimately too ambitious. The protocols were in an early stage of development, and needed a lot more protocol design before they could be implemented. As of April 1999, we have released version 1.0 of the software ( freeswan-1.0.tar.gz), which is suitable for setting up Virtual Private Networks using shared secrets for authentication. It does not yet do opportunistic encryption, or use DNSSEC for authentication; those features are coming in a future release.