From 997358a6c475c8886cce388ab325184a1ff733c9 Mon Sep 17 00:00:00 2001
From: Martin Willi 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 config and
+quickstart documents. 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: 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: This would still be correct even if we added nets D, E, F,
+... to the above diagram and needed twenty tunnels. 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
+9*8=72 tunnels, read the next section here. 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:: and for the Road Warrior:: Other configurations are also possible. A telecommuter might have: 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: 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: 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 20*19/2 = 190 secrets for
+ branch-to-branch communication, each known to exactly two branches.
+ Now all the branch admins have the headache of handling 20 keys, each
+ shared with exactly one other branch or with head office. 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: PSK indicates the use of a
+pre-shared 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: 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: 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: which tells it to read other files. One of those other files then might
+contain the additional data: 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: 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: A tunnel specification such as: However, this does not cover other traffic you might want to
+secure. To handle all the possibilities, you might also want these
+connection descriptions: 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: 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. Full opportunism
+allows you to initiate and receive opportunistic connections on your
+machine. The remaining instructions in this section assume
+you have first set up full opportunism on your gateway using
+these instructions.
+Both sets of instructions require mailing DNS records to your ISP. Collect
+DNS records for both the gateway (above) and the
+subnet nodes (below) before contacting your ISP. You need these so that your Opportunistic peers can:
+ On the gateway, generate a TXT record with:
+ Use your gateway address in place of 192.0.2.11. You should see (keys are trimmed for clarity throughout our example): This MUST BE the same key as in your gateway's TXT record, or nothing
+will work. In a text file, make one copy of this TXT record for each subnet
+ node: Above each entry, insert a line like this: It must include: The result will be a file of TXT records, like this: Ask your ISP to publish all the reverse DNS records you have collected.
+There may be a delay of up to 48 hours as the records propagate. Check a couple of records with commands like this one: The verify command checks for TXT records for both the
+subnet host and its gateway. You should see output like: FreeS/WAN 2.x ships with a built-in, automatically
+enabled OE connection conn packetdefault
+which applies OE, if possible, to all outbound traffic routed
+through the FreeS/WAN box.
+
+The
+ipsec.conf(5) manual
+describes this connection in detail.
+While the effect is much the same as private-or-clear,
+the implementation is different: notably, it does not use policy
+groups. You can create more complex OE configurations
+for traffic forwarded through a FreeS/WAN box, as explained in our
+policy groups document,
+or disable OE using
+these instructions. 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. As far as the Internet is concerned, your new extruded net is behind your
+buddy's gateway. You route all your packets for the Internet at large
+out his gateway, and receive return packets the same way. You route your
+local packets locally. Suppose your friend has a.b.c.0/24 and wants to give you a.b.c.240/28. The
+initial situation is: 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. 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". The tunnel description should be: If either side was doing firewalling for the extruded subnet before the
+IPsec connection is set up, you'll need to poke holes in your
+firewall to allow packets through.
+ 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. Please note that Super
+FreeS/WAN now features DHCP-over-IPsec, which is an alternate procedure
+for Virtual IP address assignment.
+
+
+ Here is a mailing list message about another way to configure for road
+warrior support: 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. 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 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 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 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: 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 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: 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: 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.
+
+For a discussion of MTU and NAT (Network Address Translation), see
+James Carter's MTU
+notes. Network Address
+Translation 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. For extensive bibliographic links, see the Collection of
+Computer Science Bibliographies See our web links for material available online. An overview, mainly concentrating on policy and strategic issues rather
+than the technical details. Both authors work for PKI vendor Entrust. The standard reference on the Domain Name
+Service and Berkeley Internet Name
+Daemon. Easily the best book for the security professional I have seen.
+Highly recommended. See the book web page. This is quite readable, but Schneier's Secrets and
+Lies might be an easier introduction. The sequel. This book has a short section on FreeS/WAN and includes Caldera Linux on
+CD. A fine book on firewalls in particular and security in general from two of
+AT&T's system adminstrators. Bellovin has also done a number of papers on
+IPsec and co-authored a paper on a large
+FreeS/WAN application. If you need to deal with the details of the network protocols, read either
+this series or the Stevens and Wright series before
+you start reading the RFCs. To conclusively demonstrate that DES is inadequate for continued use, the
+EFF built a machine for just over $200,000
+that breaks DES encryption in under five days on average, under nine in the
+worst case. The book provides details of their design and, perhaps even more
+important, discusses why they felt the project was necessary. Recommended for
+anyone interested in any of the three topics mentioned in the subtitle. See also the EFF page on
+this project and our discussion of DES insecurity. SATAN is a Security Administrator's Tool for Analysing Networks. This book
+is a tutorial in its use. A thoughtful and rather scary book. An excellent introduction and user manual for the PGP email-encryption package. PGP is a good
+package with a complex and poorly-designed user interface. This book or one
+like it is a must for anyone who has to use it at length. The book covers using PGP in Unix, PC and Macintosh environments, plus
+considerable background material on both the technical and political issues
+around cryptography. The book is now seriously out of date. It does not cover recent
+developments such as commercial versions since PGP 5, the Open PGP standard
+or GNU PG.. A standard reference. Spafford's web page has an excellent collection of crypto and security
+links. A history of codes and code-breaking from ancient Egypt to the 20th
+century. Well-written and exhaustively researched. Highly
+recommended, even though it does not have much on computer
+cryptography. Now becoming somewhat dated in places, but still a good introductory book
+and general reference. This has had a number of favorable reviews, including this
+one on Slashdot. The book has a web site. Highly recommended. A fine history of recent (about
+1970-2000) developments in the field, and the related political
+controversies. FreeS/WAN project founder and leader John Gilmore appears
+several times. The book does not cover IPsec or FreeS/WAN, but this project is very much
+another battle in the same war. See our discussion of the politics. From
+their web page: An excellent reference. Read Schneier before
+tackling this. Probably the funniest technical book ever written, this
+is a vicious but well-reasoned attack on the OSI "seven layer model" and all
+that went with it. Several chapters of it are also available as RFCs 871 to
+875. The best general treatment of computer-mediated communication we have
+seen. It naturally has much to say about the Internet, but also covers UUCP,
+Fidonet and so on. SANS is a respected organisation, this
+guide is part of a well-known series, and Ranch has previously written the
+useful Trinity
+OS guide to securing Linux, so my guess would be this is a pretty good
+book. I haven't read it yet, so I'm not certain. It can be ordered online
+from SANS. Note (Mar 1, 2002): a new edition with different editors in the works.
+Expect it this year. A standard reference on computer cryptography. For more recent essays, see
+the author's company's web site. An interesting discussion of security and privacy issues, written with
+more of an "executive overview" approach rather than a narrow focus on the
+technical issues. Highly recommended. This is worth reading even if you already understand security issues, or
+think you do. To go deeper, follow it with Anderson's Security Engineering. This is the only O'Reilly book, out of a dozen I own, that I'm
+disappointed with. It deals mainly with building VPNs with various
+proprietary tools -- PPTP, SSH, Cisco PIX, ... -- and touches only lightly
+on IPsec-based approaches. That said, it appears to deal competently with what it does cover and it
+has readable explanations of many basic VPN and security concepts. It may be
+exactly what some readers require, even if I find the emphasis
+unfortunate. Available online from Security Portal. It has fairly
+extensive coverage of IPsec. See the book's home page A novel in which cryptography and the net figure prominently.
+Highly recommended: I liked it enough I immediately went out
+and bought all the author's other books. There is also a paperback edition. Sequels are expected. If you need to deal with the details of the network protocols, read either
+this series or the Comer series before you start reading
+the RFCs. A good book, with detailed coverage of ipchains(8) firewalls and of many
+related issues.
+If you are not running RedHat, you will need man2html. This is part of the
+"man" RPM on RedHat, whose sources can be found at ftp://ftp.win.tue.nl/pub/linux-local/utils/man/.
+
+Note that the Debian package man2html
+and the one listed on Freshmeat at
+man2html will
+not work.
+ 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: Check the mailing list archive for more recent
+news. SuSE 6.3 and later versions, at least in Europe, ship with FreeS/WAN
+included. FreeS/WAN packages distributed for SuSE 7.0-7.2 were somehow
+miscompiled. You can find fixed packages on
+
+Kurt Garloff's page. Here are some notes for an earlier SuSE version. 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. A year or so later: 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: The scripts in question have been modified since this was posted. Awk
+versions should no longer be a problem. 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. These diffs are in the 0.92 and later distributions, so these should work
+out-of-the-box on Netwinder. FreeS/WAN no longer includes GMP source. One user reports success on the Mach-based
+microkernel Linux. 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: This message, from a different mailing list, may be relevant for anyone
+working with FreeS/WAN on Suns: 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. 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: 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: 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. 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.
+ See also these related documents:
+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. To configure the network-to-network connection you must have: For the Road Warrior you need: If both IPs are dynamic, your situation is a bit trickier. Your best bet
+is a variation on the Road Warrior, as described
+in this mailing list message.
+
+ For each gateway, compile the following information: On your local Linux FreeS/WAN gateway, print your IPsec public key: The output should look like this (with the key shortened for easy
+ reading): Don't have a key? Use
+ipsec newhostkey
+to create one.
+
+ Get a console on the remote side: In that window, type: You'll see something like: 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.
+"Left" and "right" should represent the machines that have FreeS/WAN installed
+on them, and "leftsubnet" and "rightsubnet" machines that are being protected.
+/32 is assumed for left/right and left/rightsubnet parameters.
+ Copy conn net-to-net to the remote-side /etc/ipsec.conf.
+If you've made no other modifications to either ipsec.conf,
+simply: Locally, type: You should see: The important thing is IPsec SA established. If you're
+unsuccessful, see our
+troubleshooting tips. If you are using IP masquerade or
+Network Address Translation (NAT)
+on either gateway,
+you must now exempt the packets you wish to tunnel from this treatment.
+For example, if you have a rule like: change it to something like: 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). While still pinging, go to the local gateway and snoop your outgoing
+interface, for example: You want to see ESP (Encapsulating Security Payload) packets moving
+back and forth between the two gateways at the same frequency as
+your pings: 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: To have the tunnel come up on-boot, replace with: Copy these changes to the other side, for example: Enjoy! You'll need to know: On your laptop, print your IPsec public key: The output should look like this (with the key shortened for easy
+ reading): Don't have a key? See
+these instructions.
+
+
+ Get a console on the gateway: View the gateway's public key with: This will yield something like 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. 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. and add: You must start the connection from the Road Warrior side. On your laptop,
+type: You should see: Look for IPsec SA established. If you're
+unsuccessful, see our
+troubleshooting tips. If you are using IP masquerade or
+Network Address Translation (NAT)
+on either gateway,
+you must now exempt the packets you wish to tunnel from this treatment.
+For example, if you have a rule like: change it to something like: From your laptop, ping a subnet node behind the remote gateway. Do not
+choose the gateway itself for this test. Snoop the packets exiting the laptop, with a command like: You have success if you see (Encapsulating Security Payload) packets
+travelling in both directions: 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: On the laptop only, replace with: so that you'll be connected on-boot. Happy telecommuting! If you're using RSA keys, as we did in this example, you can add
+as many Road Warriors as you like. The left/rightid
+parameter lets Linux FreeS/WAN distinguish between multiple Road Warrior
+peers, each with its own public key. The situation is different for shared secrets (PSK). During a
+PSK negotiation, ID information is not available at the time Pluto
+is trying to determine which secret to use, so, effectively, you can
+only define one Roadwarrior connection. All your PSK road warriors
+must therefore share one secret. Using the principles illustrated here, you can try variations such as:
+ Or, look at some of our more complex configuration examples..
+This document provides general instructions on how to cross compile
+FreeS/WAN,
+that is - compile it for another architecture (eg: StrongARM) There are a number of environment variables you can set to help facilitate
+cross compiling FreeS/WAN. All examples will are using the bash shell.
+ The following is an example of the how to set the environment variables if
+you were cross compiling using the Embedix ARM toolchain, to build for an embedded
+device like the Sharp Zaurus. Set these while you are in the FreeS/WAN directory.
+It is often simpler to put the entire list into a script (eg: cross-setup.sh), and
+then "source cross-setup.sh" or similar.
+Other configuration possibilities
+
+Some rules of thumb about configuration
+
+Tunnels are cheap
+
+ netA---gwA---gwB---netB
+ |----netC
+
+ netA and B are secured netC not.
+ netA and gwA can not access netC
+
+ 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
+
+Subnet sizes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Other network layouts
+
+ Sunset==========West------------------East=========Sunrise
+ local net untrusted net local net
+
+ telecommuter's PC or
+ traveller's laptop
+ Sunset==========West------------------East
+ corporate LAN untrusted net
+
+The Internet as a big subnet
+
+ Sunset==========West------------------East ================= firewall --- the Internet
+ home network untrusted net corporate network
+
+Wireless
+
+ West-----------------------------East == the rest of your network
+ workstation untrusted wireless net
+
+
+
+
+
+
+
+
+
+Choosing connection types
+
+Manual vs. automatic keying
+
+ ipsec manual --up name
+ ipsec auto --up name
+
+
+
+
+
+
+ Authentication methods for auto-keying
+
+
+
+
+
+
+
+
+
+ Advantages of public key methods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Using shared secrets in production
+
+Putting secrets in ipsec.secrets(5)
+
+
+
+
+ 10.0.0.1 11.0.0.1 : PSK "jxTR1lnmSjuj33n4W51uW3kTR55luUmSmnlRUuWnkjRj3UuTV4T3USSu23Uk55nWu5TkTUnjT"
+
+File security
+
+Shared secrets for road warriors
+
+ 10.0.0.1 0.0.0.0 : PSK "jxTR1lnmSjuj33n4W51uW3kTR55luUmSmnlRUuWnkjRj3UuTV4T3USSu23Uk55nWu5TkTUnjT"
+where the 0.0.0.0 means that any IP address is acceptable.
+
+Using manual keying in production
+
+
+
+
+
+
+ It is clear that you must change keys often to have any useful security.
+ The only question is how often. also=samplesep-keys
+
+include ipsec.*.conf
+
+conn samplesep-keys
+ spi=0x200
+ esp=3des-md5-96
+ espenckey=0x01234567_89abcdef_02468ace_13579bdf_12345678_9abcdef0
+ espauthkey=0x12345678_9abcdef0_2468ace0_13579bdf
+
+
+
+
+
+
+
+Creating keys with ranbits
+
+ umask 177
+ ipsec ranbits 192 > temp
+ ipsec ranbits 128 >> temp
+
+
+
+
+
+ (only 168 bits are used; parity bits are ignored)Setting up connections at boot time
+
+
+
+
+
+ Use "all" for maximum information.
+ See ipsec_klipsdebug(8) and ipsec_pluto(8) man page for other options.
+ Beware that if you set /etc/ipsec.conf to enable debug output, your
+ system's log files may get large quickly.
+ This parameter is optional and defaults to "yes" if not present.
+
+
+ For a busy and resource-laden production gateway, you likely want "no"
+ so that connections are brought up in parallel and the whole process
+ takes less time.Multiple tunnels between the same two
+gateways
+
+ 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
+
+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).
+
+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
+
+conn northgate-southgate
+ left=101.101.101.101
+ leftnexthop=101.101.101.1
+ right=202.202.202.202
+ rightnexthop=202.202.202.1
+
+One tunnel plus advanced routing
+It is also possible to use the new routing features in 2.2 and later kernels
+to avoid most needs for multple tunnels. Here is one mailing list message on
+the topic:
+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.
+
+
+
+An Opportunistic Gateway
+
+Start from full opportunism
+
+Reverse DNS TXT records for each protected machine
+
+
+
+
+ ipsec showhostkey --txt 192.0.2.11
+ ; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
+ IN TXT "X-IPsec-Server(10)=192.0.2.11" " AQOF8tZ2...+buFuFn/"
+
+ ; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
+ IN TXT "X-IPsec-Server(10)=192.0.2.11" " AQOF8tZ2...+buFuFn/"
+
+ ; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
+ IN TXT "X-IPsec-Server(10)=192.0.2.11" " AQOF8tZ2...+buFuFn/"
+
+ ; RSA 2048 bits gateway.example.com Sat Apr 15 13:53:22 2000
+ IN TXT "X-IPsec-Server(10)=192.0.2.11" " AQOF8tZ2...+buFuFn/"
+
+ 98.2.0.192.in-addr.arpa. IN PTR arthur.example.com.
+
+
+
+
+ 98.2.0.192.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)=192.0.2.11" " AQOF8tZ2...+buFuFn/"
+
+ 99.2.0.192.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)=192.0.2.11" " AQOF8tZ2...+buFuFn/"
+
+ 100.2.0.192.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)=192.0.2.11" " AQOF8tZ2...+buFuFn/"
+
+
+Publish your records
+
+...and test them
+
+ ipsec verify --host ford.example.com
+ ipsec verify --host trillian.example.com
+
+ ...
+ Looking for TXT in reverse map: 99.2.0.192.in-addr.arpa [OK]
+ ...
+ Looking for TXT in reverse map: 11.2.0.192.in-addr.arpa [OK]
+ ...
+ Looking for TXT in reverse map: 100.2.0.192.in-addr.arpa [OK]
+ ...
+ Looking for TXT in reverse map: 11.2.0.192.in-addr.arpa [OK]
+ ...
+No Configuration Needed
+
+Extruded Subnets
+
+ subnet gateway Internet
+ a.b.c.0/24 a.b.c.1 p.q.r.s
+where 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.
+
+ 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 ==========
+
+conn extruded
+ left=p.q.r.s
+ leftsubnet=0.0.0.0/0
+ right=d.e.f.g
+ rightsubnet=a.b.c.0/28
+
+Road Warrior with virtual IP address
+
+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.
+
+Dynamic Network Interfaces
+
+Basics
+
+Boot Time
+
+
+
+
+ chkconfig --level 2345 ipsec off
+ That'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.Change Time
+
+ ipsec setup start
+while if it was, do
+ ipsec setup restart
+which won't be as quick.
+
+ ipsec setup restart
+
+Unencrypted tunnels
+
+
+
+One situation in which this comes up is when otherwise some data would be
+encrypted twice. Alice wants a secure tunnel from her machine to Bob's. Since
+she's behind one security gateway and he's behind another, part of the tunnel
+that they build passes through the tunnel that their site admins have built
+between the gateways. All of Alice and Bob's messages are encrypted twice.
+
+
+
+
+
+
+ Linux FreeS/WAN background
+
+
+
+
+Some DNS background
+
+
+
+
+Forward and reverse maps
+
+
+
+
+
+
+
+Hierarchy and delegation
+
+
+
+
+
+
+ Syntax of DNS records
+
+ gateway.example.com. IN A 10.20.30.40
+ 40.30.20.10.in-addr.arpa. IN PTR gateway.example.com.
+
+
+
+
+
+
+
+Cacheing, TTL and propagation delay
+
+
+
+
+Problems with packet fragmentation
+
+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.)
+
+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.
+
+Network address translation (NAT)
+
+
+
+
+NAT to non-routable addresses
+
+
+
+
+
+
+
+
+
+
+NAT to routable addresses
+
+Bibliography for the Linux FreeS/WAN project
+
+
+Carlisle Adams and Steve Lloyd Understanding Public Key
+Infrastructure
+Macmillan 1999 ISBN 1-57870-166-x
+
+
+Albitz, Liu & Loukides DNS & BIND 3rd
+edition
+ O'Reilly 1998 ISBN 1-56592-512-2
+
+
+Ross Anderson, Security Engineering - a Guide to
+Building Dependable Distributed Systems
+Wiley, 2001, ISBN 0471389226
+
+
+Bamford The Puzzle Palace, A report on NSA, Americas's
+most Secret Agency
+Houghton Mifflin 1982 ISBN 0-395-31286-8
+
+Bamford Body of Secrets
+
+
+David Bander, Linux Security Toolkit
+IDG Books, 2000, ISBN: 0764546902
+
+
+Chapman, Zwicky & Russell, Building Internet
+Firewalls
+O'Reilly 1995 ISBN 1-56592-124-0
+
+Cheswick and Bellovin Firewalls and
+Internet Security: Repelling the Wily Hacker
+Addison-Wesley 1994 ISBN 0201633574
+
+
+Comer Internetworking with TCP/IP
+Prentice Hall
+
+
+
+
+
+
+Diffie and Landau Privacy on the Line: The
+Politics of Wiretapping and Encryption
+MIT press 1998 ISBN 0-262-04167-7 (hardcover) or 0-262-54100-9
+
+
+Doraswamy and Harkins IP Sec: The New Security
+Standard for the Internet, Intranets and Virtual Private Networks
+Prentice Hall 1999 ISBN: 0130118982
+
+ Electronic Frontier Foundation Cracking DES: Secrets of
+Encryption Research, Wiretap Politics and Chip Design
+ O'Reilly 1998 ISBN 1-56592-520-3
+
+
+Martin Freiss Protecting Networks with SATAN
+O'Reilly 1998 ISBN 1-56592-425-8
+translated from a 1996 work in German
+
+
+Gaidosch and Kunzinger A Guide to Virtual Private Networks
+Prentice Hall 1999 ISBN: 0130839647
+
+Simson Garfinkel Database Nation: the death of
+privacy in the 21st century
+O'Reilly 2000 ISBN 1-56592-653-6
+
+
+Simson Garfinkel PGP: Pretty Good Privacy
+O'Reilly 1995 ISBN 1-56592-098-8
+
+
+Garfinkel and Spafford Practical Unix
+Security
+O'Reilly 1996 ISBN 1-56592-148-8
+
+
+David Kahn The Codebreakers: the Comprehensive
+History of Secret Communications from Ancient Times to the Internet
+second edition Scribner 1996 ISBN 0684831309
+
+
+David Kahn Seizing the Enigma, The Race to Break the German U-Boat
+codes, 1939-1943
+Houghton Mifflin 1991 ISBN 0-395-42739-8
+
+Olaf Kirch Linux Network Administrator's
+Guide
+O'Reilly 1995 ISBN 1-56592-087-2
+
+
+Kolesnikov and Hatch, Building Linux Virtual
+Private Networks (VPNs)
+New Riders 2002
+
+
+Pete Loshin Big Book of IPsec RFCs
+Morgan Kaufmann 2000 ISBN: 0-12-455839-9
+
+Steven Levy Crypto: How the Code Rebels Beat the
+Government -- Saving Privacy in the Digital Age
+Penguin 2001, ISBN 0-670--85950-8
+
+
+Matyas, Anderson et al. The Global Trust
+Register
+Northgate Consultants Ltd 1998 ISBN: 0953239705
+hard cover edition MIT Press 1999 ISBN 0262511053
+
+
+ This book is a register of the fingerprints of the world's most important
+ public keys; it implements a top-level certification authority (CA) using
+ paper and ink rather than in an electronic system.
+
+Menezies, van Oorschot and Vanstone Handbook of
+Applied Cryptography
+CRC Press 1997
+ISBN 0-8493-8523-7
+
+
+Michael Padlipsky Elements of Networking Style
+Prentice-Hall 1985 ISBN 0-13-268111-0 or 0-13-268129-3
+
+
+John S. Quarterman The Matrix: Computer Networks
+and Conferencing Systems Worldwide
+Digital Press 1990 ISBN 155558-033-5
+Prentice-Hall ISBN 0-13-565607-9
+
+
+David Ranch Securing Linux Step by Step
+SANS Institute, 1999
+
+
+Bruce Schneier Applied Cryptography, Second
+Edition
+John Wiley & Sons, 1996
+ISBN 0-471-12845-7 hardcover
+ISBN 0-471-11709-9 paperback
+
+
+Bruce Schneier Secrets and Lies
+Wiley 2000, ISBN 0-471-25311-1
+
+
+Scott, Wolfe and Irwin Virtual Private
+Networks
+2nd edition, O'Reilly 1999 ISBN: 1-56592-529-7
+
+
+Kurt Seifried Linux Administrator's Security
+Guide
+
+
+Richard E Smith Internet Cryptography
+ISBN 0-201-92480-3, Addison Wesley, 1997
+
+
+Neal Stephenson Cryptonomicon
+Hardcover ISBN -380-97346-4, Avon, 1999.
+
+
+Stevens and Wright TCP/IP Illustrated
+Addison-Wesley
+
+
+
+
+Rubini Linux Device Drivers
+O'Reilly & Associates, Inc. 1998 ISBN 1-56592-292-1
+
+Robert Zeigler Linux Firewalls
+Newriders Publishing, 2000 ISBN 0-7537-0900-9
+
+Tools used to build FreeSWAN releases
+
+man2html
+
+Linux FreeS/WAN Compatibility Guide
+
+Implemented parts of the IPsec Specification
+
+In Linux FreeS/WAN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Deliberately omitted
+We do not implement everything in the RFCs because some of those things are
+insecure. See our discussions of avoiding bogus
+security.
+
+
+
+
+
+
+
+Not (yet) in Linux FreeS/WAN
+
+
+
+
+
+
+ Our PF-Key implementation
+
+PF-Key portability
+
+Kernels other than the latest 2.2.x and 2.4.y
+
+2.0.x kernels
+
+2.2 and 2.4 kernels
+
+
+
+
+ ran on some development kernels, 2.3 or 2.4-testIntel Linux distributions other than Redhat
+
+Redhat 7.0
+
+
+
+
+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.
+
+SuSE Linux
+
+SuSE Linux 5.3
+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)....
+
+Slackware
+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.
+
+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.
+
+Debian
+
+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.
+
+Caldera
+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
+
+CPUs other than Intel
+
+Corel Netwinder (StrongARM CPU)
+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. . . .
+
+Yellow Dog Linux on Power PC
+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.
+
+Mklinux
+
+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.
+
+Alpha 64-bit processors
+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.
+
+Sun SPARC processors
+
+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.
+
+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.
+
+MIPS processors
+
+Transmeta Crusoe
+
+Motorola Coldfire
+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.
+
+Multiprocessor machines
+
+Support for crypto hardware
+
+
+
+
+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
+
+ ... 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.
+
+IP version 6 (IPng)
+
+IPv6 background
+
+
+
+
+
+
+ How to configure FreeS/WAN
+
+
+
+
+Shortcut to Road Warrior.
+Requirements
+
+
+
+
+
+
+Net-to-Net connection
+
+
+Gather information
+
+
+
+
+
+
It does not need to be within a domain that you own. It can be a made-up
+name.Get your leftrsasigkey
+ ipsec showhostkey --left
+ # RSA 2048 bits xy.example.com Fri Apr 26 15:01:41 2002
+ leftrsasigkey=0sAQOnwiBPt...
+
+...and your rightrsasigkey
+ ssh2 ab.example.com
+ ipsec showhostkey --right
+ # RSA 2192 bits ab.example.com Thu May 16 15:26:20 2002
+ rightrsasigkey=0sAQOqH55O...
+
+Edit /etc/ipsec.conf
+
+conn net-to-net
+ left=192.0.2.2 # Local vitals
+ leftsubnet=192.0.2.128/29 #
+ leftid=@xy.example.com #
+ leftrsasigkey=0s1LgR7/oUM... #
+ leftnexthop=%defaultroute # correct in many situations
+ right=192.0.2.9 # Remote vitals
+ rightsubnet=10.0.0.0/24 #
+ rightid=@ab.example.com #
+ rightrsasigkey=0sAQOqH55O... #
+ rightnexthop=%defaultroute # correct in many situations
+ auto=add # authorizes but doesn't start this
+ # connection at startup
+
+ scp2 ipsec.conf root@ab.example.com:/etc/ipsec.conf
+
+Start your connection
+
+ ipsec auto --up net-to-net
+
+ 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
+
+Do not MASQ or NAT packets to be tunneled
+
+iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j MASQUERADE
+
+
+iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -d \! 192.0.2.128/29 -j MASQUERADE
+
+Test your connection
+
+ ping fileserver.toledo.example.com
+
+ tcpdump -i ppp0
+ 19:16:32.046220 192.0.2.2 > 192.0.2.9: ESP(spi=0x3be6c4dc,seq=0x3)
+ 19:16:32.085630 192.0.2.9 > 192.0.2.2: ESP(spi=0x5fdd1cf8,seq=0x6)
+
+Finishing touches
+
+conn winstonnet-toledonet
+ auto=add
+ auto=start
+ scp2 ipsec.conf root@ab.example.com:/etc/ipsec.conf
+Road Warrior Configuration
+
+Gather information
+
+
+
+
+
It does not need to be within a domain that you own. It can be a made-up
+name.Get your leftrsasigkey...
+ ipsec showhostkey --left
+ # RSA 2192 bits road.example.com Sun Jun 9 02:45:02 2002
+ leftrsasigkey=0sAQPIPN9uI...
+
+...and your rightrsasigkey
+ ssh2 xy.example.com
+ ipsec showhostkey --right
+ # RSA 2048 bits xy.example.com Fri Apr 26 15:01:41 2002
+ rightrsasigkey=0sAQOnwiBPt...
+
+
+Customize /etc/ipsec.conf
+
+conn road
+ left=%defaultroute # Picks up our dynamic IP
+ leftnexthop=%defaultroute #
+ leftid=@road.example.com # Local information
+ leftrsasigkey=0sAQPIPN9uI... #
+ right=192.0.2.10 # Remote information
+ rightsubnet=10.0.0.0/24 #
+ rightid=@xy.example.com #
+ rightrsasigkey=0sAQOnwiBPt... #
+ auto=add # authorizes but doesn't start this
+ # connection at startup
+
+ ssh2 xy.example.com
+ vi /etc/ipsec.conf
+
+conn road
+ left=192.0.2.2 # Gateway's information
+ leftid=@xy.example.com #
+ leftsubnet=192.0.2.128/29 #
+ 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
+
+
+
+Start your connection
+
+ ipsec auto --start net-to-net
+
+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
+
+Do not MASQ or NAT packets to be tunneled
+
+iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j MASQUERADE
+
+
+iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -d \! 192.0.2.128/29 -j MASQUERADE
+
+
+Test your connection
+
+ ping ns.winston.example.com
+
+ tcpdump -i wlan0
+ 19:16:32.046220 192.0.2.2 > 192.0.2.9: ESP(spi=0x3be6c4dc,seq=0x3)
+ 19:16:32.085630 192.0.2.9 > 192.0.2.2: ESP(spi=0x5fdd1cf8,seq=0x6)
+
+
+Finishing touches
+
+conn mike-to-office
+ auto=add
+ auto=start
+Multiple Road Warriors
+
+What next?
+
+
+
+Linux FreeS/WAN Cross Compiling Guide
+
+Overview
+
+
+
+Setting up your Environment
+Enviroment Variables
+
+export ARCH=arm
+export CC=/opt/Embedix/tools/bin/arm-linux-gcc
+export LD=/opt/Embedix/tools/bin/arm-linux-ld
+export RANLIB=/opt/Embedix/tools/bin/arm-linux-ranlib
+export AR=/opt/Embedix/tools/bin/arm-linux-ar
+export AS=/opt/Embedix/tools/bin/arm-linux-as
+export STRIP=/opt/Embedix/tools/bin/arm-linux-strip
+export KERNELSRC=/zaurus/kernel-2.4.6
+export LD_LIBRARY_PATH=/opt/Embedix/tools/lib/gcc-lib/arm-linux/2.95.2/
+export PATH=$PATH:/opt/Embedix/tools/bin
+export DESTDIR=/zaurus/binaries
+
+In the example above, we setup all of the usual gcc + bin-utils programs,
+as well as setting the LD_LIBRARY_PATH to our cross-compiled system libraries,
+and DESTDIR to our output directory.
+
Place a copy of the kernel source, setup for your target device somewhere on +your filesystem and set KERNELSRC= to this directory. You will need to prepare +your kernel source treefirst, by running "make menuconfig && make dep && make +modules". Once this is done, you can move on to building FreeS/WAN
+ +There are two parts to building FreeS/WAN - the userland programs and utilities, +and the ipsec.o kernel module. Each can be built seperatly, making debugging the +build process simpler. +
+Step 1 is to run "make programs". This will build the required libs +(libfreeswan.a) as well as all of the userland tools (pluto, whack, etc...). +Provided your environment variables are set correctly, you should see the output +using your specified gcc (arm-linux-gcc for our example), ld, as, ar and +ranlib.
+If this completes successfully, you can run "make install" to install a copy of +all of the binaries, man pages and other documentation to DESTDIR.
+Step 2 is to build the ipsec.o module. This is done with "make oldmod", which +should change into the KERNELSRC directory and then compile and link the required +files to generate an ipsec.o file. If this is successful, you will end up with an +ipsec.o file in your FreeS/WAN directory, under linux/net/ipsec/.
+Remember to install this to /lib/modules/$kernelversion/kernel/net/ipsec/ on +your target machine.
+ + + +Here is a list of common problems/errors you may run into when cross compiling +FreeS/WAN.
+
+
TOC |
|
+This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026.
++Internet-Drafts are working documents of the Internet Engineering +Task Force (IETF), its areas, and its working groups. +Note that other groups may also distribute working documents as +Internet-Drafts.
++Internet-Drafts are draft documents valid for a maximum of six months +and may be updated, replaced, or obsoleted by other documents at any time. +It is inappropriate to use Internet-Drafts as reference material or to cite +them other than as "work in progress."
++The list of current Internet-Drafts can be accessed at +http://www.ietf.org/ietf/1id-abstracts.txt.
++The list of Internet-Draft Shadow Directories can be accessed at +http://www.ietf.org/shadow.html.
++This Internet-Draft will expire on November 19, 2003.
+ ++Copyright (C) The Internet Society (2003). All Rights Reserved.
+ ++This document describes opportunistic encryption (OE) using the Internet Key +Exchange (IKE) and IPsec. +Each system administrator adds new +resource records to his or her Domain Name System (DNS) to support +opportunistic encryption. The objective is to allow encryption for secure communication without +any pre-arrangement specific to the pair of systems involved. + +
++DNS is used to distribute the public keys of each +system involved. This is resistant to passive attacks. The use of DNS +Security (DNSSEC) secures this system against active attackers as well. + +
++As a result, the administrative overhead is reduced +from the square of the number of systems to a linear dependence, and it becomes +possible to make secure communication the default even +when the partner is not known in advance. + +
++This document is offered up as an Informational RFC. + +
TOC |
TOC |
+The objective of opportunistic encryption is to allow encryption without +any pre-arrangement specific to the pair of systems involved. Each +system administrator adds +public key information to DNS records to support opportunistic +encryption and then enables this feature in the nodes' IPsec stack. +Once this is done, any two such nodes can communicate securely. + +
++This document describes opportunistic encryption as designed and +mostly implemented by the Linux FreeS/WAN project. +For project information, see http://www.freeswan.org. + +
++The Internet Architecture Board (IAB) and Internet Engineering +Steering Group (IESG) have taken a strong stand that the Internet +should use powerful encryption to provide security and +privacy [4]. +The Linux FreeS/WAN project attempts to provide a practical means to implement this policy. + +
++The project uses the IPsec, ISAKMP/IKE, DNS and DNSSEC +protocols because they are +standardized, widely available and can often be deployed very easily +without changing hardware or software or retraining users. + +
++The extensions to support opportunistic encryption are simple. No +changes to any on-the-wire formats are needed. The only changes are to +the policy decision making system. This means that opportunistic +encryption can be implemented with very minimal changes to an existing +IPsec implementation. + +
++Opportunistic encryption creates a "fax effect". The proliferation +of the fax machine was possible because it did not require that everyone +buy one overnight. Instead, as each person installed one, the value +of having one increased - as there were more people that could receive faxes. +Once opportunistic encryption is installed it +automatically recognizes +other boxes using opportunistic encryption, without any further configuration +by the network +administrator. So, as opportunistic encryption software is installed on more +boxes, its value +as a tool increases. + +
++This document describes the infrastructure to permit deployment of +Opportunistic Encryption. + +
++The term S/WAN is a trademark of RSA Data Systems, and is used with permission +by this project. + +
++ To aid in understanding the relationship between security processing and IPsec + we divide network traffic into four categories: + +
+
- * Deny:
+- networks to which traffic is always forbidden. +
+- * Permit:
+- networks to which traffic in the clear is permitted. +
+- * Opportunistic tunnel:
+- networks to which traffic is encrypted if possible, but otherwise is in the clear + or fails depending on the default policy in place. + +
+- * Configured tunnel:
+- networks to which traffic must be encrypted, and traffic in the clear is never permitted. +
+
+
++Traditional firewall devices handle the first two categories. No authentication is required. +The permit policy is currently the default on the Internet. + +
++This document describes the third category - opportunistic tunnel, which is +proposed as the new default for the Internet. + +
++ Category four, encrypt traffic or drop it, requires authentication of the + end points. As the number of end points is typically bounded and is typically + under a single authority, arranging for distribution of + authentication material, while difficult, does not require any new + technology. The mechanism described here provides an additional way to + distribute the authentication materials, that of a public key method that does not + require deployment of an X.509 based infrastructure. + +
++Current Virtual Private Networks can often be replaced by an "OE paranoid" +policy as described herein. + +
++ Opportunistic encryption creates tunnels between nodes that + are essentially strangers. This is done without any prior bilateral + arrangement. + There is, therefore, the difficult question of how one knows to whom one is + talking. + +
++ One possible answer is that since no useful + authentication can be done, none should be tried. This mode of operation is + named "anonymous encryption". An active man-in-the-middle attack can be + used to thwart the privacy of this type of communication. + Without peer authentication, there is no way to prevent this kind of attack. + +
++Although a useful mode, anonymous encryption is not the goal of this +project. Simpler methods are available that can achieve anonymous +encryption only, but authentication of the peer is a desireable goal. +The latter is achieved through key distribution in DNS, leveraging upon +the authentication of the DNS in DNSSEC. + +
++ Peers are, therefore, authenticated with DNSSEC when available. Local policy +determines how much trust to extend when DNSSEC is not available. + +
++ However, an essential premise of building private connections with + strangers is that datagrams received through opportunistic tunnels + are no more special than datagrams that arrive in the clear. + Unlike in a VPN, these datagrams should not be given any special + exceptions when it comes to auditing, further authentication or + firewalling. + +
++ When initiating outbound opportunistic encryption, local + configuration determines what happens if tunnel setup fails. It may be that + the packet goes out in the clear, or it may be dropped. + +
++ The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, + SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when they appear in this + document, are to be interpreted as described in [5] +
+ TOC |
The following network diagram is used in the rest of + this document as the canonical diagram: +
+ [Q] [R] + . . AS2 + [A]----+----[SG-A].......+....+.......[SG-B]-------[B] + | ...... + AS1 | ..PI.. + | ...... + [D]----+----[SG-D].......+....+.......[C] AS3 + + ++ +
+
Reference Network Diagram |
+ In this diagram, there are four end-nodes: A, B, C and D. + There are three gateways, SG-A, SG-B, SG-D. A, D, SG-A and SG-D are part + of the same administrative authority, AS1. SG-A and SG-D are on two different exit + paths from organization 1. SG-B/B is an independent organization, AS2. + Nodes Q and R are nodes on the Internet. PI is the Public + Internet ("The Wild"). + +
++ The following terminology is used in this document: + +
++
- Security gateway:
+- a system that performs IPsec tunnel + mode encapsulation/decapsulation. [SG-x] in the diagram. +
+- Alice:
+- node [A] in the diagram. When an IP address is needed, this is 192.1.0.65. +
+- Bob:
+- node [B] in the diagram. When an IP address is needed, this is 192.2.0.66. +
+- Carol:
+- node [C] in the diagram. When an IP address is needed, this is 192.1.1.67. +
+- Dave:
+- node [D] in the diagram. When an IP address is needed, this is 192.3.0.68. +
+- SG-A:
+- Alice's security gateway. Internally it is 192.1.0.1, externally it is 192.1.1.4. +
+- SG-B:
+- Bob's security gateway. Internally it is 192.2.0.1, externally it is 192.1.1.5. +
+- SG-D:
+- Dave's security gateway. Also Alice's backup security gateway. Internally it is 192.3.0.1, externally it is 192.1.1.6. +
+- -
+- A single dash represents clear-text datagrams. +
+- =
+- An equals sign represents phase 2 (IPsec) cipher-text + datagrams. +
+- ~
+- A single tilde represents clear-text phase 1 datagrams. +
+- #
+- A hash sign represents phase 1 (IKE) cipher-text + datagrams. +
+- .
+- A period represents an untrusted network of unknown + type. +
+- Configured tunnel:
+- a tunnel that + is directly and deliberately hand configured on participating gateways. + Configured tunnels are typically given a higher level of + trust than opportunistic tunnels. +
+- Road warrior tunnel:
+- a configured tunnel connecting one + node with a fixed IP address and one node with a variable IP address. + A road warrior (RW) connection must be initiated by the + variable node, since the fixed node cannot know the + current address for the road warrior. +
+- Anonymous encryption:
+- + the process of encrypting a session without any knowledge of who the + other parties are. No authentication of identities is done. +
+- Opportunistic encryption:
+- + the process of encrypting a session with authenticated knowledge of + who the other parties are. +
+- Lifetime:
+- + the period in seconds (bytes or datagrams) for which a security + association will remain alive before needing to be re-keyed. +
+- Lifespan:
+- + the effective time for which a security association remains useful. A + security association with a lifespan shorter than its lifetime would + be removed when no longer needed. A security association with a + lifespan longer than its lifetime would need to be re-keyed one or + more times. +
+- Phase 1 SA:
+- an ISAKMP/IKE security association sometimes + referred to as a keying channel. +
+- Phase 2 SA:
+- an IPsec security association. +
+- Tunnel:
+- another term for a set of phase 2 SA (one in each direction). +
+- NAT:
+- Network Address Translation + (see [20]). +
+- NAPT:
+- Network Address and Port Translation + (see [20]). +
+- AS:
+- an autonomous system (AS) is a group of systems (a network) that + are under the administrative control of a single organization. +
+- Default-free zone:
+- + a set of routers that maintain a complete set of routes to + all currently reachable destinations. Having such a list, these routers + never make use of a default route. A datagram with a destination address + not matching any route will be dropped by such a router. + +
+
+The opportunistic encryption security gateway (OE gateway) is a regular +gateway node as described in [2] section 2.4 and +[3] with the additional capabilities described here and +in [7]. +The algorithm described here provides a way to determine, for each datagram, +whether or not to encrypt and tunnel the datagram. Two important things +that must be determined are whether or not to encrypt and tunnel and, if +so, the destination address or name of the tunnel end point which should be used. + +
++The OE gateway determines whether or not to create a tunnel based on +the destination address of each packet. Upon receiving a packet with a destination +address not recently seen, the OE gateway performs a lookup in DNS for an +authorization resource record (see Use of TXT delegation record). The record is located using +the IP address to perform a search in the in-addr.arpa (IPv4) or ip6.arpa +(IPv6) maps. If an authorization record is found, the OE gateway +interprets this as a request for a tunnel to be formed. + +
++The authorization resource record also provides the address or name of the tunnel +end point which should be used. + +
++The record may also provide the public RSA key of the tunnel end point +itself. This is provided for efficiency only. If the public RSA key is not +present, the OE gateway performs a second lookup to find a KEY +resource record for the end point address or name. + +
++Origin and integrity protection of the resource records is provided by +DNSSEC ([16]). Restriction on unauthenticated TXT delegation records +documents an optional restriction on the tunnel end point if DNSSEC signatures +are not available for the relevant records. + +
++The OE gateway maintains a cache, in the forwarding plane, of +source/destination pairs for which opportunistic encryption has been +attempted. This cache maintains a record of whether or not OE was +successful so that subsequent datagrams can be forwarded properly +without additional delay. + +
++Successful negotiation of OE instantiates a new security association. +Failure to negotiate OE results in creation of a +forwarding policy entry either to drop or transmit in the clear future +datagrams. This negative cache is necessary to avoid the possibly lengthy process of repeatedly looking +up the same information. + +
++The cache is timed out periodically, as described in Renewal and teardown. +This removes entries that are no longer +being used and permits the discovery of changes in authorization policy. + +
+ TOC |
+The OE gateway is modeled to have a forwarding plane and a control +plane. A control channel, such as PF_KEY, connects the two planes. +(See [6].) +The forwarding plane performs per datagram operations. The control plane +contains a keying +daemon, such as ISAKMP/IKE, and performs all authorization, peer authentication and +key derivation functions. + +
++Let the OE gateway maintain a collection of objects -- a superset of the +security policy database (SPD) specified in [7]. For +each combination of source and destination address, an SPD +object exists in one of five following states. +Prior to forwarding each datagram, the +responder uses the source and destination addresses to pick an entry from the SPD. +The SPD then determines if and how the packet is forwarded. + +
++If the responder does not find an entry, then this policy applies. +The responder creates an entry with an initial state of "hold policy" and requests +keying material from the keying daemon. The responder does not forward the datagram, +rather it attaches the datagram to the SPD entry as the "first" datagram and retains it +for eventual transmission in a new state. + + +
++The responder requests keying material. If the interface to the keying +system is lossy (PF_KEY, for instance, can be), the implementation +SHOULD include a mechanism to retransmit the +keying request at a rate limited to less than 1 request per second. +The responder does not forward the datagram. It attaches the +datagram to the SPD entry as the "last" datagram where it is retained +for eventual transmission. If there is +a datagram already so stored, then that already stored datagram is discarded. + +
++Because the "first" datagram is probably a TCP SYN packet, the +responder retains the "first" datagram in an attempt to avoid waiting for a +TCP retransmit. The responder retains the "last" +datagram in deference to streaming protocols that find it useful to know +how much data has been lost. These are recommendations to +decrease latency. There are no operational requirements for this. + +
++The responder forwards the datagram using the normal forwarding table. +The responder enters this state only by command from the keying daemon, +and upon entering this state, also forwards the "first" and "last" datagrams. + +
++The responder discards the datagram. The responder enters this state only by +command +from the keying daemon, and upon entering this state, discards the "first" +and "last" datagrams. +Local administration decides if further datagrams cause ICMP messages +to be generated (i.e. ICMP Destination Unreachable, Communication +Administratively Prohibited. type=3, code=13). + +
++The responder encrypts the datagram using the indicated security association database +(SAD) entry. The responder enters this state only by command from the keying daemon, and upon entering +this state, releases and forwards the "first" and "last" datagrams using the +new encrypt policy. + +
++If the associated SAD entry expires because of byte, packet or time limits, then +the entry returns to the Hold policy, and an expire message is sent to the keying daemon. + +
++All states may be created directly by the keying daemon while acting as a +responder. + +
++Let the keying daemon maintain a collection of objects. Let them be +called "connections" or "conn"s. There are two categories of +connection objects: classes and instances. A class represents an +abstract policy - what could be. An instance represents an actual connection - +what is implemented at the time. + +
++Let there be two further subtypes of connections: keying channels (Phase +1 SAs) and data channels (Phase 2 SAs). Each data channel object may have +a corresponding SPD and SAD entry maintained by the datagram state machine. + +
++For the purposes of opportunistic encryption, there MUST, at least, be +connection classes known as "deny", "always-clear-text", "OE-permissive", and +"OE-paranoid". +The latter two connection classes define a set of source and/or destination +addresses for which opportunistic encryption will be attempted. The administrator MAY set policy +options in a number of additional places. An implementation MAY create additional connection classes to further refine +these policies. + +
++The simplest system may need only the "OE-permissive" connection, and would +list its own (single) IP address as the source address of this policy and +the wild-card address 0.0.0.0/0 as the destination IPv4 address. That is, the +simplest policy is to try opportunistic encryption with all destinations. + +
++The distinction between permissive and paranoid OE use will become clear +in the state transition differences. In general a permissive OE will, on +failure, install a pass-through policy, while a paranoid OE will, on failure, +install a drop policy. + +
++In this description of the keying machine's state transitions, the states +associated with the keying system itself are omitted because they are best documented in the keying system +([8], +[9] and [10] for ISAKMP/IKE), +and the details are keying system specific. Opportunistic encryption is not +dependent upon any specific keying protocol, but this document does provide +requirements for those using ISAKMP/IKE to assure that implementations inter-operate. + +
++The state transitions that may be involved in communicating with the +forwarding plane are omitted. PF_KEY and similar protocols have their own +set of states required for message sends and completion notifications. + +
++Finally, the retransmits and recursive lookups that are normal for DNS are +not included in this description of the state machine. + +
++There is no connection instance for a given source/destination address pair. +Upon receipt of a request for keying material for this +source/destination pair, the initiator searches through the connection classes to +determine the most appropriate policy. Upon determining an appropriate +connection class, an instance object is created of that type. +Both of the OE types result in a potential OE connection. + +
+Failure to find an appropriate connection class results in an +administrator defined default. + +
++In each case, when the initiator finds an appropriate class for the new flow, +an instance connection is made of the class which matched. + +
++The non-existent connection makes a transition to this state when an +always-clear-text class is instantiated, or when an OE-permissive +connection fails. During the transition, the initiator creates a pass-through +policy object in the forwarding plane for the appropriate flow. + +
++Timing out is the only way to leave this state +(see Expiring connection). + +
++The empty connection makes a transition to this state when a +deny class is instantiated, or when an OE-paranoid connection fails. +During the transition, the initiator creates a deny policy object in the forwarding plane +for the appropriate flow. + +
++Timing out is the only way to leave this state +(see Expiring connection). + +
++The empty connection makes a transition to this state when one of either OE class is instantiated. +During the transition to this state, the initiator creates a hold policy object in the +forwarding plane for the appropriate flow. + +
++In addition, when making a transition into this state, DNS lookup is done in +the reverse-map for a TXT delegation resource record (see Use of TXT delegation record). +The lookup key is the destination address of the flow. + +
++There are three ways to exit this state: + +
+
++Based upon the results of the DNS lookup, the potential OE connection makes a +transition to the pending OE connection state. The conditions for a +successful DNS look are: + +
+ +Note that if the initiator does not find the public key +present in the TXT delegation record, then the public key must +be looked up as a sub-state. Only successful completion of all the +DNS lookups is considered a success. + +
++If DNS lookup does not find a resource record or DNS times out, then the +initiator considers the receiver not OE capable. If this is an OE-paranoid instance, +then the potential OE connection makes a transition to the deny connection state. +If this is an OE-permissive instance, then the potential OE connection makes a transition to the +clear-text connection state. + +
++If the initiator finds a resource record but it is not properly formatted, or +if DNSSEC is +enabled and reports a failure to authenticate, then the potential OE +connection should make a +transition to the deny connection state. This action SHOULD be logged. If the +administrator wishes to override this transition between states, then an +always-clear class can be installed for this flow. An implementation MAY make +this situation a new class. + +
++An implementation SHOULD also provide an additional administrative control +on delegation records and DNSSEC. This control would apply to delegation +records (the TXT records in the reverse-map) that are not protected by +DNSSEC. +Records of this type are only permitted to delegate to their own address as +a gateway. When this option is enabled, an active attack on DNS will be +unable to redirect packets to other than the original destination. + +
++The potential OE connection makes a transition to this state when +the initiator determines that all the information required from the DNS lookup is present. +Upon entering this state, the initiator attempts to initiate keying to the gateway +provided. + +
++Exit from this state occurs either with a successfully created IPsec SA, or +with a failure of some kind. Successful SA creation results in a transition +to the key connection state. + +
++Three failures have caused significant problems. They are clearly not the +only possible failures from keying. + +
++Note that if there are multiple gateways available in the TXT delegation +records, then a failure can only be declared after all have been +tried. Further, creation of a phase 1 SA does not constitute success. A set +of phase 2 SAs (a tunnel) is considered success. + +
++The first failure occurs when an ICMP port unreachable is consistently received +without any other communication, or when there is silence from the remote +end. This usually means that either the gateway is not alive, or the +keying daemon is not functional. For an OE-permissive connection, the initiator makes a transition +to the clear-text connection but with a low lifespan. For an OE-pessimistic connection, +the initiator makes a transition to the deny connection again with a low lifespan. The lifespan in both +cases is kept low because the remote gateway may +be in the process of rebooting or be otherwise temporarily unavailable. + +
++The length of time to wait for the remote keying daemon to wake up is +a matter of some debate. If there is a routing failure, 5 minutes is usually long enough for the network to +re-converge. Many systems can reboot in that amount of +time as well. However, 5 minutes is far too long for most users to wait to +hear that they can not connect using OE. Implementations SHOULD make this a +tunable parameter. + +
++The second failure occurs after a phase 1 SA has been created, but there is +either no response to the phase 2 proposal, or the initiator receives a +negative notify (the notify must be +authenticated). The remote gateway is not prepared to do OE at this time. +As before, the initiator makes a transition to the clear-text or the deny +connection based upon connection class, but this +time with a normal lifespan. + +
++The third failure occurs when there is signature failure while authenticating +the remote gateway. This can occur when there has been a +key roll-over, but DNS has not caught up. In this case again, the initiator makes a +transition to the clear-text or the deny connection based +upon the connection class. However, the lifespan depends upon the remaining +time to live in the DNS. (Note that DNSSEC signed resource records have a different +expiry time than non-signed records.) + +
++The pending OE connection makes a transition to this state when +session keying material (the phase 2 SAs) is derived. The initiator creates an encrypt +policy in the forwarding plane for this flow. + +
++There are three ways to exit this state. The first is by receipt of an +authenticated delete message (via the keying channel) from the peer. This is +normal teardown and results in a transition to the expired connection state. + +
++The second exit is by expiry of the forwarding plane keying material. This +starts a re-key operation with a transition back to pending OE +connection. In general, the soft expiry occurs with sufficient time left +to continue to use the keys. A re-key can fail, which may +result in the connection failing to clear-text or deny as +appropriate. In the event of a failure, the forwarding plane +policy does not change until the phase 2 SA (IPsec SA) reaches its +hard expiry. + +
++The third exit is in response to a negotiation from a remote +gateway. If the forwarding plane signals the control plane that it has received an +unknown SPI from the remote gateway, or an ICMP is received from the remote gateway +indicating an unknown SPI, the initiator should consider that +the remote gateway has rebooted or restarted. Since these +indications are easily forged, the implementation must +exercise care. The initiator should make a cautious +(rate-limited) attempt to re-key the connection. + +
++The initiator will periodically place each of the deny, clear-text, and keyed +connections into this +sub-state. See Renewal and teardown for more details of how often this +occurs. +The initiator queries the forwarding plane for last use time of the +appropriate +policy. If the last use time is relatively recent, then the connection +returns to the +previous deny, clear-text or keyed connection state. If not, then the +connection enters +the expired connection state. + +
++The DNS query and answer that lead to the expiring connection state are also +examined. The DNS query may become stale. (A negative, i.e. no such record, answer +is valid for the period of time given by the MINIMUM field in an attached SOA +record. See [12] section 4.3.4.) +If the DNS query is stale, then a new query is made. If the results change, then the connection +makes a transition to a new state as described in potential OE connection state. + +
++Note that when considering how stale a connection is, both outgoing SPD and +incoming SAD must be queried as some flows may be unidirectional for some time. + +
++Also note that the policy at the forwarding plane is not updated unless there +is a conclusion that there should be a change. + +
++Entry to this state occurs when no datagrams have been forwarded recently via the +appropriate SPD and SAD objects. The objects in the forwarding plane are +removed (logging any final byte and packet counts if appropriate) and the +connection instance in the keying plane is deleted. + +
++The initiator sends an ISAKMP/IKE delete to clean up the phase 2 SAs as described in +Renewal and teardown. + +
++Whether or not to delete the phase 1 SAs +at this time is left as a local implementation issue. Implementations +that do delete the phase 1 SAs MUST send authenticated delete messages to +indicate that they are doing so. There is an advantage to keeping +the phase 1 SAs until they expire - they may prove useful again in the +near future. + +
++The responder has a set of objects identical to those of the initiator. + +
++The responder receives an invitation to create a keying channel from an initiator. + +
++Upon entering this state, the responder starts a DNS lookup for a KEY record for the +initiator. +The responder looks in the reverse-map for a KEY record for the initiator if the +initiator has offered an ID_IPV4_ADDR, and in the forward map if the +initiator has offered an ID_FQDN type. (See [8] section +4.6.2.1.) + +
++The responder exits this state upon successful receipt of a KEY from DNS, and use of the key +to verify the signature of the initiator. + +
++Successful authentication of the peer results in a transition to the +authenticated OE Peer state. + +
++Note that the unauthenticated OE peer state generally occurs in the middle of the key negotiation +protocol. It is really a form of pseudo-state. + +
++The peer will eventually propose one or more phase 2 SAs. The responder uses the source and +destination address in the proposal to +finish instantiating the connection state +using the connection class table. +The responder MUST search for an identical connection object at this point. + +
++If an identical connection is found, then the responder deletes the old instance, +and the new object makes a transition to the pending OE connection state. This means +that new ISAKMP connections with a given peer will always use the latest +instance, which is the correct one if the peer has rebooted in the interim. + +
++If an identical connection is not found, then the responder makes the transition according to the +rules given for the initiator. + +
++Note that if the initiator is in OE-paranoid mode and the responder is in +either always-clear-text or deny, then no communication is possible according +to policy. An implementation is permitted to create new types of policies +such as "accept OE but do not initiate it". This is a local matter. + +
++A potentially unlimited number of tunnels may exist. In practice, only a few +tunnels are used during a period of time. Unused tunnels MUST, therefore, be +torn down. Detecting when tunnels are no longer in use is the subject of this section. + +
++There are two methods for removing tunnels: explicit deletion or expiry. + +
++Explicit deletion requires an IKE delete message. As the deletes +MUST be authenticated, both ends of the tunnel must maintain the +key channel (phase 1 ISAKMP SA). An implementation which refuses to either maintain or +recreate the keying channel SA will be unable to use this method. + +
++The tunnel expiry method, simply allows the IKE daemon to +expire normally without attempting to re-key it. + +
++Regardless of which method is used to remove tunnels, the implementation requires +a method to determine if the tunnel is still in use. The specifics are a +local matter, but the FreeS/WAN project uses the following criteria. These +criteria are currently implemented in the key management daemon, but could +also be implemented at the SPD layer using an idle timer. + +
++Set a short initial (soft) lifespan of 1 minute since many net flows last +only a few seconds. + +
++At the end of the lifespan, check to see if the tunnel was used by +traffic in either direction during the last 30 seconds. If so, assign a +longer tentative lifespan of 20 minutes after which, look again. If the +tunnel is not in use, then close the tunnel. + +
++The expiring state in the key management +system (see Expiring connection) implements these timeouts. +The timer above may be in the forwarding plane, +but then it must be re-settable. + +
++The tentative lifespan is independent of re-keying; it is just the time when +the tunnel's future is next considered. +(The term lifespan is used here rather than lifetime for this reason.) +Unlike re-keying, this tunnel use check is not costly and should happen +reasonably frequently. + +
++A multi-step back-off algorithm is not considered worth the effort here. + +
++If the security gateway and the client host are the +same and not a Bump-in-the-Stack or Bump-in-the-Wire implementation, tunnel +teardown decisions MAY pay attention to TCP connection status as reported +by the local TCP layer. A still-open TCP connection is almost a guarantee that more traffic is +expected. Closing of the only TCP connection through a tunnel is a +strong hint that no more traffic is expected. + +
++Teardown should always be coordinated between the two ends of the tunnel by +interpreting and sending delete notifications. There is a +detailed sub-state in the expired connection state of the key manager that +relates to retransmits of the delete notifications, but this is considered to +be a keying system detail. + +
++On receiving a delete for the outbound SAs of a tunnel (or some subset of +them), tear down the inbound ones also and notify the remote end with a +delete. If the local system receives a delete for a tunnel which is no longer in +existence, then two delete messages have crossed paths. Ignore the delete. +The operation has already been completed. Do not generate any messages in this +situation. + +
++Tunnels are to be considered as bidirectional entities, even though the +low-level protocols don't treat them this way. + +
++When the deletion is initiated locally, rather than as a +response to a received delete, send a delete for (all) the +inbound SAs of a tunnel. If the local system does not receive a responding delete +for the outbound SAs, try re-sending the original +delete. Three tries spaced 10 seconds apart seems a reasonable +level of effort. A failure of the other end to respond after 3 attempts, +indicates that the possibility of further communication is unlikely. Remove the outgoing SAs. +(The remote system may be a mobile node that is no longer present or powered on.) + +
++After re-keying, transmission should switch to using the new +outgoing SAs (ISAKMP or IPsec) immediately, and the old leftover +outgoing SAs should be cleared out promptly (delete should be sent +for the outgoing SAs) rather than waiting for them to expire. This +reduces clutter and minimizes confusion for the operator doing diagnostics. + +
+ TOC |
+ The IKE wire protocol needs no modifications. The major changes are + implementation issues relating to how the proposals are interpreted, and from + whom they may come. + +
++ As opportunistic encryption is designed to be useful between peers without + prior operator configuration, an IKE daemon must be prepared to negotiate + phase 1 SAs with any node. This may require a large amount of resources to + maintain cookie state, as well as large amounts of entropy for nonces, + cookies and so on. + +
++ The major changes to support opportunistic encryption are at the IKE daemon + level. These changes relate to handling of key acquisition requests, lookup + of public keys and TXT records, and interactions with firewalls and other + security facilities that may be co-resident on the same gateway. + +
++ In a typical configured tunnel, the address of SG-B is provided + via configuration. Furthermore, the mapping of an SPD entry to a gateway is + typically a 1:1 mapping. When the 0.0.0.0/0 SPD entry technique is used, then + the mapping to a gateway is determined by the reverse DNS records. + +
++ The need to do a DNS lookup and wait for a reply will typically introduce a + new state and a new event source (DNS replies) to IKE. Although a +synchronous DNS request can be implemented for proof of concept, experience +is that it can cause very high latencies when a queue of queries must +all timeout in series. + +
++ Use of an asynchronous DNS lookup will also permit overlap of DNS lookups with + some of the protocol steps. + +
++ SG-A will have to establish its identity. Use an + IPv4 ID in phase 1. + +
+There are many situations where the administrator of SG-A may not be + able to control the reverse DNS records for SG-A's public IP address. + Typical situations include dialup connections and most residential-type broadband Internet access + (ADSL, cable-modem) connections. In these situations, a fully qualified domain + name that is under the control of SG-A's administrator may be used + when acting as an initiator only. + The FQDN ID should be used in phase 1. See Use of FQDN IDs + for more details and restrictions. + +
++ Upon receipt of a phase 1 SA proposal with either an IPv4 (IPv6) ID or + an FQDN ID, an IKE daemon needs to examine local caches and + configuration files to determine if this is part of a configured tunnel. + If no configured tunnels are found, then the implementation should attempt to retrieve + a KEY record from the reverse DNS in the case of an IPv4/IPv6 ID, or + from the forward DNS in the case of FQDN ID. + +
++ It is reasonable that if other non-local sources of policy are used + (COPS, LDAP), they be consulted concurrently but some + clear ordering of policy be provided. Note that due to variances in + latency, implementations must wait for positive or negative replies from all sources + of policy before making any decisions. + +
++ The implementation described (1.98) neither uses DNSSEC directly to + explicitly verify the authenticity of zone information, nor uses the NXT + records to provide authentication of the absence of a TXT or KEY + record. Rather, this implementation uses a trusted path to a DNSSEC + capable caching resolver. + +
++ To distinguish between an authenticated and an unauthenticated DNS + resource record, a stub resolver capable of returning DNSSEC + information MUST be used. + +
++ Main mode MUST be used. + +
++ The initiator MUST offer at least one proposal using some combination + of: 3DES, HMAC-MD5 or HMAC-SHA1, DH group 2 or 5. Group 5 SHOULD be + proposed first. + [11] +
++ The initiator MAY offer additional proposals, but the cipher MUST not + be weaker than 3DES. The initiator SHOULD limit the number of proposals + such that the IKE datagrams do not need to be fragmented. + +
++ The responder MUST accept one of the proposals. If any configuration + of the responder is required then the responder is not acting in an + opportunistic way. + +
++ SG-A SHOULD use an ID_IPV4_ADDR (ID_IPV6_ADDR for IPv6) of the external + interface of SG-A for phase 1. (There is an exception, see Use of FQDN IDs.) The authentication method MUST be RSA public key signatures. + The RSA key for SG-A SHOULD be placed into a DNS KEY record in + the reverse space of SG-A (i.e. using in-addr.arpa). + +
++ SG-A MUST propose a tunnel between Alice and Bob, using 3DES-CBC + mode, MD5 or SHA1 authentication. Perfect Forward Secrecy MUST be specified. + +
++ Tunnel mode MUST be used. + +
++ Identities MUST be ID_IPV4_ADDR_SUBNET with the mask being /32. + +
++ Authorization for SG-A to act on Alice's behalf is determined by + looking for a TXT record in the reverse-map at Alice's address. + +
++ Compression SHOULD NOT be mandatory. It may be offered as an option. + +
+ TOC |
+ In order to establish their own identities, SG-A and SG-B SHOULD publish + their public keys in their reverse DNS via + DNSSEC's KEY record. + See section 3 of RFC 2535[16]. + +
++
For example: +
+KEY 0x4200 4 1 AQNJjkKlIk9...nYyUkKK8 ++ +
+
- 0x4200:
+- The flag bits, indicating that this key is prohibited + for confidentiality use (it authenticates the peer only, a separate + Diffie-Hellman exchange is used for + confidentiality), and that this key is associated with the non-zone entity + whose name is the RR owner name. No other flags are set. +
+- 4:
+- This indicates that this key is for use by IPsec. +
+- 1:
+- An RSA key is present. +
+- AQNJjkKlIk9...nYyUkKK8:
+- The public key of the host as described in [17]. +
+
+
+Use of several KEY records allows for key rollover. The SIG Payload in + IKE phase 1 SHOULD be accepted if the public key given by any KEY RR + validates it. + +
++Alice publishes a TXT record to provide authorization for SG-A to act on +Alice's behalf. + +Bob publishes a TXT record to provide authorization for SG-B to act on Bob's +behalf. + +These records are located in the reverse DNS (in-addr.arpa) for their +respective IP addresses. The reverse DNS SHOULD be secured by DNSSEC, when +it is deployed. DNSSEC is required to defend against active attacks. + +
++ If Alice's address is P.Q.R.S, then she can authorize another node to + act on her behalf by publishing records at: +
++S.R.Q.P.in-addr.arpa ++
+ +
+
+ The contents of the resource record are expected to be a string that
+ uses the following syntax, as suggested in [15].
+ (Note that the reply to query may include other TXT resource
+ records used by other applications.)
+
+
+X-IPsec-Server(P)=A.B.C.D KEY ++
+
Format of reverse delegation record |
+
- P:
+- Specifies a precedence for this record. This is + similar to MX record preferences. Lower numbers have stronger + preference. + +
+- A.B.C.D:
+- Specifies the IP address of the Security Gateway + for this client machine. + +
+- KEY:
+- Is the encoded RSA Public key of the Security + Gateway. The key is provided here to avoid a second DNS lookup. If this + field is absent, then a KEY resource record should be looked up in the + reverse-map of A.B.C.D. The key is transmitted in base64 format. + +
+
+
+ The pieces of the record are separated by any whitespace + (space, tab, newline, carriage return). An ASCII space SHOULD + be used. + +
+
+ In the case where Alice is located at a public address behind a
+ security gateway that has no fixed address (or no control over its
+ reverse-map), then Alice may delegate to a public key by domain name.
+
+
+X-IPsec-Server(P)=@FQDN KEY ++
+
Format of reverse delegation record (FQDN version) |
+
- P:
+- Is as above. + +
+- FQDN:
+- Specifies the FQDN that the Security Gateway + will identify itself with. + +
+- KEY:
+- Is the encoded RSA Public key of the Security + Gateway. +
+
+
+ If there is more than one such TXT record with strongest (lowest + numbered) precedence, one Security Gateway is picked arbitrarily from + those specified in the strongest-preference records. + +
++ When packed into transport format, TXT records which are longer than 255 + characters are divided into smaller <character-strings>. + (See [13] section 3.3 and 3.3.14.) These MUST + be reassembled into a single string for processing. + Whitespace characters in the base64 encoding are to be ignored. + +
++ It has been suggested to use the KEY, OPT, CERT, or KX records + instead of a TXT record. None is satisfactory. + +
+The KEY RR has a protocol field which could be used to indicate a new protocol, +and an algorithm field which could be used to + indicate different contents in the key data. However, the KEY record + is clearly not intended for storing what are really authorizations, + it is just for identities. Other uses have been discouraged. + +
+OPT resource records, as defined in [14] are not + intended to be used for storage of information. They are not to be loaded, + cached or forwarded. They are, therefore, inappropriate for use here. + +
++ CERT records [18] can encode almost any set of + information. A custom type code could be used permitting any suitable + encoding to be stored, not just X.509. According to + the RFC, the certificate RRs are to be signed internally which may add undesirable +and unnecessary bulk. Larger DNS records may require TCP instead of UDP transfers. + +
++ At the time of protocol design, the CERT RR was not widely deployed and + could not be counted upon. Use of CERT records will be investigated, + and may be proposed in a future revision of this document. + +
++ KX records are ideally suited for use instead of TXT records, but had not been deployed at + the time of implementation. + +
++ Unfortunately, not every administrator has control over the contents + of the reverse-map. Where the initiator (SG-A) has no suitable reverse-map, the + authorization record present in the reverse-map of Alice may refer to a + FQDN instead of an IP address. + +
++ In this case, the client's TXT record gives the fully qualified domain + name (FQDN) in place of its security gateway's IP address. + The initiator should use the ID_FQDN ID-payload in phase 1. + A forward lookup for a KEY record on the FQDN must yield the + initiator's public key. + +
++ This method can also be used when the external address of SG-A is + dynamic. + +
++ If SG-A is acting on behalf of Alice, then Alice must still delegate + authority for SG-A to do so in her reverse-map. When Alice and SG-A + are one and the same (i.e. Alice is acting as an end-node) then there + is no need for this when initiating only. +
+However, Alice must still delegate to herself if she wishes others to + initiate OE to her. See Format of reverse delegation record (FQDN version). + +
++Good cryptographic hygiene says that one should replace public/private key pairs +periodically. Some administrators may wish to do this as often as daily. Typical DNS +propagation delays are determined by the SOA Resource Record MINIMUM +parameter, which controls how long DNS replies may be cached. For reasonable +operation of DNS servers, administrators usually want this value to be at least several +hours, sometimes as a long as a day. This presents a problem - a new key MUST +not be used prior to it propagating through DNS. + +
++This problem is dealt with by having the Security Gateway generate a new +public/private key pair at least MINIMUM seconds in advance of using it. It +then adds this key to the DNS (both as a second KEY record and in additional TXT +delegation records) at key generation time. Note: only one key is allowed in +each TXT record. + +
++When authenticating, all gateways MUST have available all public keys +that are found in DNS for this entity. This permits the authenticating end +to check both the key for "today" and the key for "tomorrow". Note that it is +the end which is creating the signature (possesses the private key) that +determines which key is to be used. + +
+ TOC |
+ There are no fundamentally new issues for implementing opportunistic encryption + in the presence of network address translation. Rather there are + only the regular IPsec issues with NAT traversal. + +
++ There are several situations to consider for NAT. + +
++ If SG-A is also performing network address translation on + behalf of Alice, then the packet should be translated prior to + being subjected to opportunistic encryption. This is in contrast to + typically configured tunnels which often exist to bridge islands of + private network address space. SG-A will use the translated source + address for phase 2, and so SG-B will look up that address to + confirm SG-A's authorization. + +
+In the case of NAT (1:1), the address space into which the + translation is done MUST be globally unique, and control over the + reverse-map is assumed. + Placing of TXT records is possible. + +
+In the case of NAPT (m:1), the address will be SG-A. The ability to get + KEY and TXT records in place will again depend upon whether or not + there is administrative control over the reverse-map. This is + identical to situations involving a single host acting on behalf of + itself. + + FQDN style can be used to get around a lack of a reverse-map for + initiators only. + +
++ If there is a NAT or NAPT between SG-A and SG-B, then normal IPsec + NAT traversal rules apply. In addition to the transport problem + which may be solved by other mechanisms, there + is the issue of what phase 1 and phase 2 IDs to use. While FQDN could + be used during phase 1 for SG-A, there is no appropriate ID for phase 2 + that permits SG-B to determine that SG-A is in fact authorized to speak for Alice. + +
++ If Bob is behind a NAT (perhaps SG-B), then there is, in fact, no way for + Alice to address a packet to Bob. Not only is opportunistic encryption + impossible, but it is also impossible for Alice to initiate any + communication to Bob. It may be possible for Bob to initiate in such + a situation. This creates an asymmetry, but this is common for + NAPT. + +
+ TOC |
+ When Alice and SG-A are components of the same system, they are + considered to be a host implementation. The packet sequence scenario remains unchanged. + +
++ Components marked Alice are the upper layers (TCP, UDP, the + application), and SG-A is the IP layer. + +
++ Note that tunnel mode is still required. + +
++ As Alice and SG-A are acting on behalf of themselves, no TXT based delegation + record is necessary for Alice to initiate. She can rely on FQDN in a + forward map. This is particularly attractive to mobile nodes such as + notebook computers at conferences. + To respond, Alice/SG-A will still need an entry in Alice's reverse-map. + +
+ TOC |
+If there are multiple paths between Alice and Bob (as illustrated in +the diagram with SG-D), then additional DNS records are required to establish +authorization. + +
++In Reference Network Diagram, Alice has two ways to +exit her network: SG-A and SG-D. Previously SG-D has been ignored. Postulate +that there are routers between Alice and her set of security gateways +(denoted by the + signs and the marking of an autonomous system number for +Alice's network). Datagrams may, therefore, travel to either SG-A or SG-D en +route to Bob. + +
++As long as all network connections are in good order, it does not matter how +datagrams exit Alice's network. When they reach either security gateway, the +security gateway will find the TXT delegation record in Bob's reverse-map, +and establish an SA with SG-B. + +
+
+SG-B has no problem establishing that either of SG-A or SG-D may speak for
+Alice, because Alice has published two equally weighted TXT delegation records:
+
+X-IPsec-Server(10)=192.1.1.5 AQMM...3s1Q== +X-IPsec-Server(10)=192.1.1.6 AAJN...j8r9== ++
+
Multiple gateway delegation example for Alice |
+Alice's routers can now do any kind of load sharing needed. Both SG-A and SG-D send datagrams addressed to Bob through +their tunnel to SG-B. + +
++Alice's use of non-equal weight delegation records to show preference of one gateway over another, has relevance only when SG-B +is initiating to Alice. + +
++If the precedences are the same, then SG-B has a more difficult time. It +must decide which of the two tunnels to use. SG-B has no information about +which link is less loaded, nor which security gateway has more cryptographic +resources available. SG-B, in fact, has no knowledge of whether both gateways +are even reachable. + +
++The Public Internet's default-free zone may well know a good route to Alice, +but the datagrams that SG-B creates must be addressed to either SG-A or SG-D; +they can not be addressed to Alice directly. + +
++SG-B may make a number of choices: + +
+
++Local policy determines which choice SG-B makes. Note that even if SG-B has perfect +knowledge about the reachability of SG-A and SG-D, Alice may not be reachable +from either of these security gateways because of internal reachability +issues. + +
++FreeS/WAN implements option 5. Implementing a different option is +being considered. The multi-homing aspects of OE are not well developed and may +be the subject of a future document. + +
+ TOC |
+ If a DNS server fails to respond, local policy decides + whether or not to permit communication in the clear as embodied in + the connection classes in Keying state machine - initiator. + It is easy to mount a denial of service attack on the DNS server + responsible for a particular network's reverse-map. + Such an attack may cause all communication with that network to go in + the clear if the policy is permissive, or fail completely + if the policy is paranoid. Please note that this is an active attack. + +
++ There are still many networks + that do not have properly configured reverse-maps. Further, if the policy is not to communicate, + the above denial of service attack isolates the target network. Therefore, the decision of whether +or not to permit communication in the clear MUST be a matter of local policy. + +
++ DNS records claim that opportunistic encryption should + occur, but the target gateway either does not respond on port 500, or + refuses the proposal. This may be because of a crash or reboot, a + faulty configuration, or a firewall filtering port 500. + +
++ The receipt of ICMP port, host or network unreachable + messages indicates a potential problem, but MUST NOT cause communication + to fail + immediately. ICMP messages are easily forged by attackers. If such a + forgery caused immediate failure, then an active attacker could easily + prevent any + encryption from ever occurring, possibly preventing all communication. + +
++ In these situations a clear log should be produced + and local policy should dictate if communication is then + permitted in the clear. + +
++Tunnels sometimes go down because the remote end crashes, +disconnects, or has a network link break. In general there is no +notification of this. Even in the event of a crash and successful reboot, +other SGs don't hear about it unless the rebooted SG has specific +reason to talk to them immediately. Over-quick response to temporary +network outages is undesirable. Note that a tunnel can be torn +down and then re-established without any effect visible to the user +except a pause in traffic. On the other hand, if one end reboots, +the other end can't get datagrams to it at all (except via +IKE) until the situation is noticed. So a bias toward quick +response is appropriate even at the cost of occasional +false alarms. + +
++A mechanism for recovery after reboot is a topic of current research and is not specified in this +document. + +
++A deliberate shutdown should include an attempt, using deletes, to notify all other SGs +currently connected by phase 1 SAs that communication is +about to fail. Again, a remote SG will assume this is a teardown. Attempts by the +remote SGs to negotiate new tunnels as replacements should be ignored. When possible, +SGs should attempt to preserve information about currently-connected SGs in non-volatile storage, so +that after a crash, an Initial-Contact can be sent to previous partners to +indicate loss of all previously established connections. + +
+ TOC |
+ The method of obtaining information by reverse DNS lookup causes + problems for people who cannot control their reverse DNS + bindings. This is an unresolved problem in this version, and is out + of scope. + +
+ TOC |
+Two example scenarios follow. In the first example GW-A +(Gateway A) and GW-B (Gateway B) have always-clear-text policies, and in the second example they have an OE +policy. + +
+ Alice SG-A DNS SG-B Bob + (1) + ------(2)--------------> + <-----(3)--------------- + (4)----(5)-----> + ----------(6)------> + ------(7)-----> + <------(8)------ + <----------(9)------ + <----(10)----- + (11)-----------> + ----------(12)-----> + --------------> + <--------------- + <------------------- + <------------- ++
Timing of regular transaction |
+Alice wants to communicate with Bob. Perhaps she wants to retrieve a +web page from Bob's web server. In the absence of opportunistic +encryptors, the following events occur: + +
+
- (1)
+- Human or application 'clicks' with a name. +
+- (2)
+- Application looks up name in DNS to get IP address. +
+- (3)
+- Resolver returns A record to application. +
+- (4)
+- Application starts a TCP session or UDP session and OS sends datagram. +
+- (5)
+- Datagram is seen at first gateway from Alice (SG-A). (SG-A +makes a transition through Empty connection to always-clear connection and +instantiates a pass-through policy at the forwarding plane.) +
+- (6)
+- Datagram is seen at last gateway before Bob (SG-B). +
+- (7)
+- First datagram from Alice is seen by Bob. +
+- (8)
+- First return datagram is sent by Bob. +
+- (9)
+- Datagram is seen at Bob's gateway. (SG-B makes a transition through +Empty connection to always-clear connection and instantiates a pass-through +policy at the forwarding plane.) +
+- (10)
+- Datagram is seen at Alice's gateway. +
+- (11)
+- OS hands datagram to application. Alice sends another datagram. +
+- (12)
+- A second datagram traverses the Internet. +
+
+
+
+In the presence of properly configured opportunistic encryptors, the
+event list is extended.
+
+
+ Alice SG-A DNS SG-B Bob + (1) + ------(2)--------------> + <-----(3)--------------- + (4)----(5)----->+ + ----(5B)-> + <---(5C)-- + ~~~~~~~~~~~~~(5D)~~~> + <~~~~~~~~~~~~(5E1)~~~ + ~~~~~~~~~~~~~(5E2)~~> + <~~~~~~~~~~~~(5E3)~~~ + #############(5E4)##> + <############(5E5)### + <----(5F1)-- + -----(5F2)-> + #############(5G1)##> + <----(5H1)-- + -----(5H2)-> + <############(5G2)### + #############(5G3)##> + ============(6)====> + ------(7)-----> + <------(8)------ + <==========(9)====== + <-----(10)---- + (11)-----------> + ==========(12)=====> + --------------> + <--------------- + <=================== + <------------- ++
+
Timing of opportunistic encryption transaction |
+
- (1)
+- Human or application clicks with a name. +
+- (2)
+- Application initiates DNS mapping. +
+- (3)
+- Resolver returns A record to application. +
+- (4)
+- Application starts a TCP session or UDP. +
+- (5)
+- SG-A (host or SG) sees datagram to target, and buffers it. +
+- (5B)
+- SG-A asks DNS for TXT record. +
+- (5C)
+- DNS returns TXT record(s). +
+- (5D)
+- Initial IKE Main Mode Packet goes out. +
+- (5E)
+- IKE ISAKMP phase 1 succeeds. +
+- (5F)
+- SG-B asks DNS for TXT record to prove SG-A is an agent for Alice. +
+- (5G)
+- IKE phase 2 negotiation. +
+- (5H)
+- DNS lookup by responder (SG-B). +
+- (6)
+- Buffered datagram is sent by SG-A. +
+- (7)
+- Datagram is received by SG-B, decrypted, and sent to Bob. +
+- (8)
+- Bob replies, and datagram is seen by SG-B. +
+- (9)
+- SG-B already has tunnel up with SG-A, and uses it. +
+- (10)
+- SG-A decrypts datagram and gives it to Alice. +
+- (11)
+- Alice receives datagram. Sends new packet to Bob. +
+- (12)
+- SG-A gets second datagram, sees that tunnel is up, and uses it. +
+
+
++ For the purposes of this section, we will describe only the changes that + occur between Timing of regular transaction and + Timing of opportunistic encryption transaction. This corresponds to time points 5, 6, 7, 9 and 10 on the list above. + +
++ At point (5), SG-A intercepts the datagram because this source/destination pair lacks a policy +(the non-existent policy state). SG-A creates a hold policy, and buffers the datagram. SG-A requests keys from the keying daemon. + +
++ SG-A's IKE daemon, having looked up the source/destination pair in the connection + class list, creates a new Potential OE connection instance. SG-A starts DNS + queries. + +
++ DNS returns properly formed TXT delegation records, and SG-A's IKE daemon + causes this instance to make a transition from Potential OE connection to Pending OE + connection. + +
+
+ Using the example above, the returned record might contain:
+
+
+X-IPsec-Server(10)=192.1.1.5 AQMM...3s1Q== ++
+
Example of reverse delegation record for Bob |
Upon entering Pending OE connection, SG-A sends the initial ISAKMP + message with proposals. See Phase 1 parameters. + +
++ SG-B receives the message. A new connection instance is created in the + unauthenticated OE peer state. + +
++ SG-A sends a Diffie-Hellman exponent. This is an internal state of the + keying daemon. + +
++ SG-B responds with a Diffie-Hellman exponent. This is an internal state of the + keying protocol. + +
++ SG-A uses the phase 1 SA to send its identity under encryption. + The choice of identity is discussed in Phase 1 parameters. + This is an internal state of the keying protocol. + +
++ SG-B asks DNS for the public key of the initiator. + DNS looks for a KEY record by IP address in the reverse-map. + That is, a KEY resource record is queried for 4.1.1.192.in-addr.arpa + (recall that SG-A's external address is 192.1.1.4). + SG-B uses the resulting public key to authenticate the initiator. See Use of KEY record for further details. + +
++Upon successfully authenticating the peer, the connection instance makes a +transition to authenticated OE peer on SG-B. + +
++The format of the TXT record returned is described in +Use of TXT delegation record. + +
++ SG-B sends its ID along with authentication material. This is an internal + state for the keying protocol. + +
++ Having established mutually agreeable authentications (via KEY) and + authorizations (via TXT), SG-A proposes to create an IPsec tunnel for + datagrams transiting from Alice to Bob. This tunnel is established only for + the Alice/Bob combination, not for any subnets that may be behind SG-A and SG-B. + +
++ While the identity of SG-A has been established, its authority to + speak for Alice has not yet been confirmed. SG-B does a reverse + lookup on Alice's address for a TXT record. + +
+Upon receiving this specific proposal, SG-B's connection instance + makes a transition into the potential OE connection state. SG-B may already have an + instance, and the check is made as described above. +
++ The returned key and IP address should match that of SG-A. + +
++ Should additional communication occur between, for instance, Dave and Bob using + SG-A and SG-B, a new tunnel (phase 2 SA) would be established. The phase 1 SA + may be reusable. + +
+SG-A, having successfully keyed the tunnel, now makes a transition from + Pending OE connection to Keyed OE connection. + +
+The responder MUST setup the inbound IPsec SAs before sending its reply. +
++ The initiator agrees with the responder's choice and sets up the tunnel. + The initiator sets up the inbound and outbound IPsec SAs. + +
++ The proper authorization returned with keys prompts SG-B to make a transition + to the keyed OE connection state. + +
+Upon receipt of this message, the responder may now setup the outbound + IPsec SAs. +
++ SG-A sends the datagram saved at step (5) through the newly created + tunnel to SG-B, where it gets decrypted and forwarded. + Bob receives it at (7) and replies at (8). + +
++ At (9), SG-B has already established an SPD entry mapping Bob->Alice via a + tunnel, so this tunnel is simply applied. The datagram is encrypted to SG-A, + decrypted by SG-A and passed to Alice at (10). + +
+ TOC |
+ Configured tunnels are those which are setup using bilateral mechanisms: exchanging +public keys (raw RSA, DSA, PKIX), pre-shared secrets, or by referencing keys that +are in known places (distinguished name from LDAP, DNS). These keys are then used to +configure a specific tunnel. + +
++A pre-configured tunnel may be on all the time, or may be keyed only when needed. +The end points of the tunnel are not necessarily static: many mobile +applications (road warrior) are considered to be configured tunnels. + +
++The primary characteristic is that configured tunnels are assigned specific +security properties. They may be trusted in different ways relating to exceptions to +firewall rules, exceptions to NAT processing, and to bandwidth or other quality of service restrictions. + +
++Opportunistic tunnels are not inherently trusted in any strong way. They are +created without prior arrangement. As the two parties are strangers, there +MUST be no confusion of datagrams that arrive from opportunistic peers and +those that arrive from configured tunnels. A security gateway MUST take care +that an opportunistic peer can not impersonate a configured peer. + +
++Ingress filtering MUST be used to make sure that only datagrams authorized by +negotiation (and the concomitant authentication and authorization) are +accepted from a tunnel. This is to prevent one peer from impersonating another. + +
++An implementation suggestion is to treat opportunistic tunnel +datagrams as if they arrive on a logical interface distinct from other +configured tunnels. As the number of opportunistic tunnels that may be +created automatically on a system is potentially very high, careful attention +to scaling should be taken into account. + +
++As with any IKE negotiation, opportunistic encryption cannot be secure +without authentication. Opportunistic encryption relies on DNS for its +authentication information and, therefore, cannot be fully secure without +a secure DNS. Without secure DNS, opportunistic encryption can protect against passive +eavesdropping but not against active man-in-the-middle attacks. + +
++ Typical usage of per datagram access control lists is to implement various +kinds of security gateways. These are typically called "firewalls". + +
++ Typical usage of a virtual private network (VPN) within a firewall is to +bypass all or part of the access controls between two networks. Additional +trust (as outlined in the previous section) is given to datagrams that arrive +in the VPN. + +
++ Datagrams that arrive via opportunistically configured tunnels MUST not be +trusted. Any security policy that would apply to a datagram arriving in the +clear SHOULD also be applied to datagrams arriving opportunistically. + +
++ There are several different forms of denial of service that an implementor + should concern themselves with. Most of these problems are shared with + security gateways that have large numbers of mobile peers (road warriors). + +
++ The design of ISAKMP/IKE, and its use of cookies, defend against many kinds + of denial of service. Opportunism changes the assumption that if the phase 1 (ISAKMP) + SA is authenticated, that it was worthwhile creating. Because the gateway will communicate with any machine, it is + possible to form phase 1 SAs with any machine on the Internet. + +
+ TOC |
+ There are no known numbers which IANA will need to manage. + +
+ TOC |
+ Substantive portions of this document are based upon previous work by + Henry Spencer. + +
++ Thanks to Tero Kivinen, Sandy Harris, Wes Hardarker, Robert Moskowitz, + Jakob Schlyter, Bill Sommerfeld, John Gilmore and John Denker for their + comments and constructive criticism. + +
++ Sandra Hoffman and Bill Dickie did the detailed proof reading and editing. + +
+ TOC |
TOC |
+ | Michael C. Richardson |
+ | Sandelman Software Works |
+ | 470 Dawson Avenue |
+ | Ottawa, ON K1Z 5V7 |
+ | CA |
EMail: | +mcr@sandelman.ottawa.on.ca |
URI: | +http://www.sandelman.ottawa.on.ca/ |
+ | D. Hugh Redelmeier |
+ | Mimosa |
+ | Toronto, ON |
+ | CA |
EMail: | +hugh@mimosa.com |
TOC |
+Copyright (C) The Internet Society (2003). All Rights Reserved.
++This document and translations of it may be copied and furnished to +others, and derivative works that comment on or otherwise explain it +or assist in its implementation may be prepared, copied, published and +distributed, in whole or in part, without restriction of any kind, +provided that the above copyright notice and this paragraph are +included on all such copies and derivative works. However, this +document itself may not be modified in any way, such as by removing +the copyright notice or references to the Internet Society or other +Internet organizations, except as needed for the purpose of +developing Internet standards in which case the procedures for +copyrights defined in the Internet Standards process must be +followed, or as required to translate it into languages other than +English.
++The limited permissions granted above are perpetual and will not be +revoked by the Internet Society or its successors or assigns.
++This document and the information contained herein is provided on an +"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING +TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION +HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
++Funding for the RFC Editor function is currently provided by the +Internet Society.
+ diff --git a/doc/src/draft-richardson-ipsec-opportunistic.xml b/doc/src/draft-richardson-ipsec-opportunistic.xml new file mode 100644 index 000000000..d587df693 --- /dev/null +++ b/doc/src/draft-richardson-ipsec-opportunistic.xml @@ -0,0 +1,2519 @@ + + + + + +K1Z 5V7
+ 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.
+ +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.
+FreeS/WAN developers, volunteers and users can often be found there. +Be patient and be +prepared to provide lots of information to support your question.
+ +If your question was really interesting, and you found an answer, +please share that with the class by posting to the +users mailing list. That way others with the +same problem can find your answer in the archives.
+See the next several questions.
+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.
+ +We try to do a release approximately every six to eight weeks. +
+ +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.
+ +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.
+ +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 the +List In Brief.
+ +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.
+ ++ Yes, FreeSwan works fine, though some network drivers have problems + with jumbo sized ethernet frames. If you used interfaces=%defaultroute + you do not need to change anything, but if you specified an interface + (eg eth0) then remember you must change that to reflect the VLAN + interface (eg eth0.2 for VLAN ID 2). +
++ The "eepro100" module is known to be broken, use the e100 driver + for those cards instead (included in 2.4 as 'alternative driver' for + the Intel EtherExpressPro/100. +
++ You do not need to change any MTU setting (those are workarounds + that are only needed for buggy drivers) +
+ +This FAQ contributed by Paul Wouters.
+ +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.
+ +Absolutely. See this FreeS/WAN-FreeS/WAN +configuration example. +If only one site is using FreeS/WAN, there may be a relevant HOWTO on our +interop page. +
+ +Yes. We call the remote users "Road Warriors". Check out our +FreeS/WAN-FreeS/WAN +Road Warrior Configuration Example.
+ +If your Road Warrior is a Windows or Mac PC, you may need to +install an IPsec implementation on that machine. +Our interop page lists many available brands, +and features links to several HOWTOs. + + +
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. See also the +WaveSEC site.
+ +Vanilla FreeS/WAN does not support X.509, but Andreas Steffen +and others have provided a popular, well-supported X.509 patch.
+ ++Linux FreeS/WAN features +Opportunistic Encryption, an alternative +Public Key Infrastructure based on Secure DNS. +
+ +Andreas Steffen's X.509 patch (v. 1.42+) supports Smart Cards. The patch +does not ship with vanilla FreeS/WAN, but will be incorporated into +Super FreeS/WAN +2.01+. The patch implements the PCKS#15 +Cryptographic Token Information Format Standard, using the OpenSC smartcard +library functions.
+ +Older news:
+ +A user-supported patch to FreeS/WAN 1.3, for smart card style +authentication, is available on +Bastiaan's site. +It supports skeyid and ibutton. +This patch is not part of Super FreeS/WAN.
+ +For a while progress on this front was impeded by a lack of standard. +The IETF working group +has now nearly completed its recommended solution to the problem; meanwhile +several vendors have implemented various things.
+ + + +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.
+ + +Vanilla FreeS/WAN does not, but thanks to Mathieu Lafon and +Arkoon Network Security, there's a patch to support this.
+ +The NAT traversal patch has some issues with PSKs, so you may wish to +authenticate with RSA keys, or X.509 (requires a patch which is also +included in Super FreeS/WAN). Doing the latter also has +advantages when dealing with large numbers of clients who may be behind NAT; +instead of having to make an individual Roadwarrior connection for each +virtual IP, you can use the "rightsubnetwithin" parameter to specify a range. +See +these +rightsubnetwithin instructions. +
+ + +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, so long as you pay attention to the selection rule, +which can be summarized "the most specific +connection wins". We describe the rule in our +policy groups document, +and provide a more technical explanation in +man ipsec.conf. +
+ +A good guideline: If you have a regular connection defined in +ipsec.conf, ensure that a subset of that connection +is not listed in a less restrictive policy group. Otherwise, +FreeS/WAN will use the subset, with its more specific source/destination +pair.
+ +Here's an example. Suppose you are the system administrator at 192.0.2.2. +You have this connection in ipsec.conf: +ipsec.conf: + +
conn net-to-net + left=192.0.2.2 # you are here + right=192.0.2.8 + rightsubnet=192.0.2.96/27 + .... ++ +
If you then place a host or net within rightsubnet, +(let's say 192.0.2.98) in private-or-clear, you may find +that 192.0.2.2 at times communicates in the +clear with 192.0.2.98. That's consistent with the rule, but may be +contrary to your expectations.
+ +On the other hand, it's safe to put a larger subnet in a less +restrictive policy group file. If private-or-clear +contains 192.0.2.0/24, then the more specific net-to-net +connection is used for any communication to 192.0.2.96/27. The +more general policy applies only to communication with hosts or subnets in +192.0.2.0/24 without a more specific policy or connection.
+ + +Yes. Use these +instructions.
+ + + +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 ipsec auto --replace +<conn_name> which re-reads data for a named connection.
+ +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.
+ +It is also possible using pre-shared key authentication, +though we don't recommend this; 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.
+ +Yes, but avoid it if possible.
+ +You can have multiple Road Warriors using shared secret authentication +only if they all use the same secret. You must also +set:
+ +
uniqueids=no+ +
in the connection definition.
+ + +Why it's less secure:
+This is a designed-in limitation of the IKE key negotiation protocol, not a problem with +our implementation.
+ +We very strongly recommend that you avoid using shared secret +authentication for multiple Road Warriors. Use RSA authentication +instead.
+ +The longer story: 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.
+ +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.
+ +Even with the TOS hidden, you can still:
+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.+ +
Yes. Normally this is not necessary, but it is useful in a few special +cases. For example, if you must route non-IP packets such as IPX, you +will need to use a tunneling protocol that can route these packets. IPsec +can be layered around it for extra security. Another example: you +can provide failover protection for high availability (HA) environments by +combining IPsec with other tools. Ken Bantoft describes one such setup in +Using FreeS/WAN with Linux-HA, GRE, +OSPF and BGP for enterprise grade VPN solutions.
+ +GRE over IPsec is covered as part of +that document. + +Here are links to other GRE resources. + +Jacco de Leuw has created +this page on L2TP over IPsec +with instructions for FreeS/WAN and several other brands of IPsec software. +
+ +Please let us know of other useful links via the +mailing lists. + + +
Your local PC needs to know how to translate NetBIOS names to IP addresses. +It may do this either via a local LMHOSTS file, or using a local or remote +WINS server. The WINS server is preferable since it provides a centralized +source of the information to the entire network. To use a WINS server over +the VPN +(or any IP-based network), you must enable "NetBIOS over TCP".
+ +Samba can emulate a WINS server +on Linux.
+ ++See also several discussions in our +September +2002 Users archives
+ + +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 = 192.0.2.8 + | + + ~ internet ~ + + | + eth0 = 192.0.2.11 + gate2 + eth1 = x.y.z.1 + | + subnet x.y.z.0/24+ +
and the connection description:
+conn abc-xyz + left=192.0.2.8 + leftsubnet=a.b.c.0/24 + right=192.0.2.11 + 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).
+ + +When an underlying connection (eg. ppp) goes down, FreeS/WAN will not +recover properly without a little help. Here are the symptoms that FreeS/WAN +user Michael Carmody noticed: +
+> After about 24 hours the freeswan connection takes over the default route. +> +> i.e instead of deafult gateway pointing to the router via eth0, it becomes a +> pointer to the router via ipsec0. + +> All internet access is then lost as all replies (and not just the link I +> wanted) are routed out ipsec0 and the router doesn't respond to the ipsec +> traffic. ++ +
If you're using a +FreeS/WAN 2.x/KLIPS system, simply re-attach the IPsec virtual +interface with ipsec tnconfig command such as:
+ipsec tnconfig --attach --virtual ipsec0 --physical ppp0+
In your command, name the physical and virtual interfaces as they +appear paired on your system during regular uptime. For a system with several +physical/virtual interface pairs on flaky links, you'll need more than +one such command. +If you're using FreeS/WAN 1.x, you must restart FreeS/WAN, which is more time +consuming.
+ ++Here +is a script which can help to automate the process of FreeS/WAN restart at +need. +It could easily be adapted to use tnconfig instead.
+ +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 +apt-get install gmp2.
+ +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 Quick 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.
+ +Your tunnel has no IP address which matches the IP +address of any of the available IPsec interfaces. Either you've +misconfigured the connection, or you need to define an appropriate +IPsec interface connection. interfaces=%defaultroute works +in many cases.
+ +A longer story: 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.
+ +This message can appear when you've upgraded an X.509-enabled +Linux FreeS/WAN with a vanilla Linux FreeS/WAN. To use your X.509 configs +you will need to overwrite the new install with +Super FreeS/WAN, or add the +X.509 patch by hand. +
+ +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+ +