From 903cdeea1a6d0c99fecc1d8aeeab65bdfbab46d7 Mon Sep 17 00:00:00 2001 From: bms Date: Wed, 11 Feb 2004 04:26:04 +0000 Subject: Initial import of RFC 2385 (TCP-MD5) digest support. This is the first of two commits; bringing in the kernel support first. This can be enabled by compiling a kernel with options TCP_SIGNATURE and FAST_IPSEC. For the uninitiated, this is a TCP option which provides for a means of authenticating TCP sessions which came into being before IPSEC. It is still relevant today, however, as it is used by many commercial router vendors, particularly with BGP, and as such has become a requirement for interconnect at many major Internet points of presence. Several parts of the TCP and IP headers, including the segment payload, are digested with MD5, including a shared secret. The PF_KEY interface is used to manage the secrets using security associations in the SADB. There is a limitation here in that as there is no way to map a TCP flow per-port back to an SPI without polluting tcpcb or using the SPD; the code to do the latter is unstable at this time. Therefore this code only supports per-host keying granularity. Whilst FAST_IPSEC is mutually exclusive with KAME IPSEC (and thus IPv6), TCP_SIGNATURE applies only to IPv4. For the vast majority of prospective users of this feature, this will not pose any problem. This implementation is output-only; that is, the option is honoured when responding to a host initiating a TCP session, but no effort is made [yet] to authenticate inbound traffic. This is, however, sufficient to interwork with Cisco equipment. Tested with a Cisco 2501 running IOS 12.0(27), and Quagga 0.96.4 with local patches. Patches for tcpdump to validate TCP-MD5 sessions are also available from me upon request. Sponsored by: sentex.net --- sys/netinet/tcp.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sys/netinet/tcp.h') diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index d958aaf..1df59b6 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -102,6 +102,8 @@ struct tcphdr { #define TCPOLEN_CC_APPA (TCPOLEN_CC+2) #define TCPOPT_CC_HDR(ccopt) \ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC) +#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */ +#define TCPOLEN_SIGNATURE 18 /* * Default maximum segment size for TCP. @@ -156,6 +158,7 @@ struct tcphdr { #define TCP_MAXSEG 0x02 /* set maximum segment size */ #define TCP_NOPUSH 0x04 /* don't push last block of write */ #define TCP_NOOPT 0x08 /* don't use TCP options */ +#define TCP_SIGNATURE_ENABLE 0x10 /* use MD5 digests (RFC2385) */ #endif #endif /* !_NETINET_TCP_H_ */ -- cgit v1.1