|
NAMEipsec —
Internet Protocol Security protocol
SYNOPSISoptions IPSEC
options IPSEC_SUPPORT
device crypto
DESCRIPTIONipsec is a security protocol implemented within the
Internet Protocol layer of the networking stack. ipsec
is defined for both IPv4 and IPv6
(inet(4)
and
inet6(4)).
ipsec is a set of protocols, ESP (for Encapsulating
Security Payload) AH (for Authentication Header), and IPComp (for IP Payload
Compression Protocol) that provide security services for IP datagrams. AH both
authenticates and guarantees the integrity of an IP packet by attaching a
cryptographic checksum computed using one-way hash functions. ESP, in
addition, prevents unauthorized parties from reading the payload of an IP
packet by also encrypting it. IPComp tries to increase communication
performance by compressing IP payload, thus reducing the amount of data sent.
This will help nodes on slow links but with enough computing power.
ipsec operates in one of two modes: transport mode or
tunnel mode. Transport mode is used to protect peer-to-peer communication
between end nodes. Tunnel mode encapsulates IP packets within other IP packets
and is designed for security gateways such as VPN endpoints.
System configuration requires the crypto(4) subsystem. The packets can be passed to a virtual enc(4) interface, to perform packet filtering before outbound encryption and after decapsulation inbound. To properly filter on the inner packets of an
Kernel interfaceipsec is controlled by a key management and policy
engine, that reside in the operating system kernel. Key management is the
process of associating keys with security associations, also know as SAs.
Policy management dictates when new security associations created or
destroyed.
The key management engine can be accessed from userland by using
The policy engine is controlled by an extension to the
The kernel code does not implement a dynamic encryption key
exchange protocol such as IKE (Internet Key Exchange). Key exchange
protocols are beyond what is necessary in the kernel and should be
implemented as daemon processes which call the
Policy managementIPsec policies can be managed in one of two ways, either by configuring per-socket policies using the setsockopt(2) system calls, or by configuring kernel level packet filter-based policies using thePF_KEY interface, via the
setkey(8)
you can define IPsec policies against packets using rules similar to packet
filtering rules. Refer to
setkey(8)
on how to use it.
Depending on the socket's address family, IPPROTO_IP or IPPROTO_IPV6 transport level and IP_IPSEC_POLICY or IPV6_IPSEC_POLICY socket options may be used to configure per-socket security policies. A properly-formed IPsec policy specification structure can be created using ipsec_set_policy(3) function and used as socket option value for the setsockopt(2) call. When setting policies using the
setkey(8)
command, the “
If the kernel does not find a matching, system wide, policy then
the default value is applied. The system wide default policy is specified by
the following
sysctl(8)
variables.
Miscellaneous sysctl variablesWhen theipsec protocols are configured for use, all
protocols are included in the system. To selectively enable/disable protocols,
use
sysctl(8).
In addition the following variables are accessible via sysctl(8), for tweaking the kernel's IPsec behavior:
The variables are interpreted as follows:
Variables under the PROTOCOLSTheipsec protocol acts as a plug-in to the
inet(4) and
inet6(4)
protocols and therefore supports most of the protocols defined upon those
IP-layer protocols. The
icmp(4) and
icmp6(4)
protocols may behave differently with ipsec because
ipsec can prevent
icmp(4) or
icmp6(4)
routines from looking into the IP payload.
SEE ALSOioctl(2), socket(2), ipsec_set_policy(3), crypto(4), enc(4), if_ipsec(4), icmp6(4), intro(4), ip6(4), setkey(8), sysctl(8)S. Kent and R. Atkinson, IP Authentication Header, RFC 2404. S. Kent and R. Atkinson, IP Encapsulating Security Payload (ESP), RFC 2406. STANDARDSDaniel L. McDonald, Craig Metz, and Bao G. Phan, PF_KEY Key Management API, Version 2, RFC, 2367.D. L. McDonald, A Simple IP Security API Extension to BSD Sockets, internet draft, draft-mcdonald-simple-ipsec-api-03.txt, work in progress material. HISTORYThe originalipsec implementation appeared in the
WIDE/KAME IPv6/IPsec stack.
For FreeBSD 5.0 a fully locked IPsec implementation called fast_ipsec was brought in. The protocols drew heavily on the OpenBSD implementation of the IPsec protocols. The policy management code was derived from the KAME implementation found in their IPsec protocols. The fast_ipsec implementation lacked ip6(4) support but made use of the crypto(4) subsystem. For FreeBSD 7.0
ip6(4)
support was added to fast_ipsec. After this the old KAME IPsec
implementation was dropped and fast_ipsec became what now is the only
BUGSThere is no single standard for the policy engine API, so the policy engine API described herein is just for this implementation.AH and tunnel mode encapsulation may not work as you might expect.
If you configure inbound “require” policy with an AH tunnel or
any IPsec encapsulating policy with AH (like
“ When a large database of security associations or policies is
present in the kernel the The IPcomp protocol may occasionally error because of zlib(3) problems. This documentation needs more review.
Visit the GSP FreeBSD Man Page Interface. |