History log of /freebsd-current/sbin/setkey/setkey.8
Revision Date Author Comments
# b287f26c 10-Jan-2024 Yi-Chen Li <calvin0205@gapp.nthu.edu.tw>

setkey(8): Grammar fix: a FQDN -> an FQDN

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1024


# 224fc33f 30-Oct-2023 Konstantin Belousov <kib@FreeBSD.org>

setkey(8): make the policy specification more readable

by applying markup and highlighting the semantical blocks.

Sponsored by: NVidia networking
MFC after: 1 week


# fa9896e0 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line nroff pattern

Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/


# cf85818e 27-May-2023 Konstantin Belousov <kib@FreeBSD.org>

setkey(8): document NAT-T and NAT-T MTU extensions syntax

Reviewed by: ae
Discussed with: bz
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40300


# 3cb80822 02-Apr-2023 Konstantin Belousov <kib@FreeBSD.org>

setkey(8): add -e option to take script from the command line

Reviewed by: ae
Sponsored by: Nvidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39393


# 9f8f3a8e 18-Oct-2022 Kristof Provost <kp@FreeBSD.org>

ipsec: add support for CHACHA20POLY1305

Based on a patch by ae@.

Reviewed by: gbe (man page), pauamma (man page)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37180


# 06bfd0b9 13-Sep-2022 Bram Ton <bram@cbbg.nl>

setkey.8: Improve direction descriptions

Be more precise in the definition of policy directions
and policy levels.

PR: 250177
Reported by: Bram Ton <bram at cbbg dot nl>
Reviewed by: gbe, ae
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26719


# 8b55a471 14-Aug-2022 Jens Schweikhardt <schweikh@FreeBSD.org>

Indicate that racoon.8 is in ports/security/ipsec-tools.


# e6dede14 27-Apr-2022 John Baldwin <jhb@FreeBSD.org>

setkey(8): Clarify language around AEAD ciphers.

AEAD ciphers for IPsec combine both encryption and authentication. As
such, ESP configurations using an AEAD cipher should not use a
seperate authentication algorithm via -A. However, this was not
apparent from the setkey manpage and 12.x and earlier did not perform
sufficient argument validation permitting users to pair an explicit -A
such as SHA256-HMAC with AES-GCM. (The result was a non-standard
combination of AES-CTR with the specified MAC, but with the wrong
initial block counter (and thus different keystream) compared to using
AES-CTR as the cipher.)

Attempt to clarify this in the manpage by explicitly calling out AEAD
ciphers (currently only AES-GCM) and noting that AEAD ciphers should
not use -A.

While here, explicitly note which authentication algorithms can be
used with esp vs esp-old. Also add subsection headings for the
different algorithm lists and tidy some language.

I did not convert the tables to column lists (Bl -column) though that
would probably be more correct than using literal blocks (Bd
-literal).

PR: 263379
Reviewed by: Pau Amma <pauamma@gundo.com>, markj
Differential Revision: https://reviews.freebsd.org/D34947


# 179a53bb 05-Feb-2022 Wolfram Schneider <wosch@FreeBSD.org>

update external URL


# 00a4311a 04-Jun-2020 John Baldwin <jhb@FreeBSD.org>

Refer to AES-CBC as "aes-cbc" rather than "rijndael-cbc" for IPsec.

At this point, AES is the more common name for Rijndael128. setkey(8)
will still accept the old name, and old constants remain for
compatiblity.

Reviewed by: cem, bcr (manpages)
MFC after: 2 weeks
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24964


# af5b6f81 04-May-2020 John Baldwin <jhb@FreeBSD.org>

Add RFC reference for AES-CTR with IPsec.

MFC after: 1 week
Sponsored by: Chelsio Communications


# 16aabb76 01-May-2020 John Baldwin <jhb@FreeBSD.org>

Remove support for IPsec algorithms deprecated in r348205 and r360202.

Examples of depecrated algorithms in manual pages and sample configs
are updated where relevant. I removed the one example of combining
ESP and AH (vs using a cipher and auth in ESP) as RFC 8221 says this
combination is NOT RECOMMENDED.

Specifically, this removes support for the following ciphers:
- des-cbc
- 3des-cbc
- blowfish-cbc
- cast128-cbc
- des-deriv
- des-32iv
- camellia-cbc

This also removes support for the following authentication algorithms:
- hmac-md5
- keyed-md5
- keyed-sha1
- hmac-ripemd160

Reviewed by: cem, gnn (older verisons)
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24342


# 23852d5c 09-Apr-2017 Benedict Reuschling <bcr@FreeBSD.org>

Make setkey(8) more clear about anti-replay window size option semantics.

PR: 172913
Submitted by: john@saltant.com
Reviewed by: ae@
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10304


# 1bbe19e6 04-Apr-2017 Andrey V. Elsukov <ae@FreeBSD.org>

Use unique SPI.

MFC after: 1 week


# b72ff4a1 04-Apr-2017 Andrey V. Elsukov <ae@FreeBSD.org>

In the example section show that TCP-MD5 connection needs SA for both
directions.

Submitted by: Mike Tancsa <mike at sentex net>
MFC after: 1 week


# 22986c67 06-Mar-2017 Andrey V. Elsukov <ae@FreeBSD.org>

Introduce the concept of IPsec security policies scope.

Currently are defined three scopes: global, ifnet, and pcb.
Generic security policies that IKE daemon can add via PF_KEY interface
or an administrator creates with setkey(8) utility have GLOBAL scope.
Such policies can be applied by the kernel to outgoing packets and checked
agains inbound packets after IPsec processing.
Security policies created by if_ipsec(4) interfaces have IFNET scope.
Such policies are applied to packets that are passed through if_ipsec(4)
interface.
And security policies created by application using setsockopt()
IP_IPSEC_POLICY option have PCB scope. Such policies are applied to
packets related to specific socket. Currently there is no way to list
PCB policies via setkey(8) utility.

Modify setkey(8) and libipsec(3) to be able distinguish the scope of
security policies in the `setkey -DP` listing. Add two optional flags:
'-t' to list only policies related to virtual *tunneling* interfaces,
i.e. policies with IFNET scope, and '-g' to list only policies with GLOBAL
scope. By default policies from all scopes are listed.

To implement this PF_KEY's sadb_x_policy structure was modified.
sadb_x_policy_reserved field is used to pass the policy scope from the
kernel to userland. SADB_SPDDUMP message extended to support filtering
by scope: sadb_msg_satype field is used to specify bit mask of requested
scopes.

For IFNET policies the sadb_x_policy_priority field of struct sadb_x_policy
is used to pass if_ipsec's interface if_index to the userland. For GLOBAL
policies sadb_x_policy_priority is used only to manage order of security
policies in the SPDB. For IFNET policies it is not used, so it can be used
to keep if_index.

After this change the output of `setkey -DP` now looks like:
# setkey -DPt
0.0.0.0/0[any] 0.0.0.0/0[any] any
in ipsec
esp/tunnel/87.250.242.144-87.250.242.145/unique:145
spid=7 seq=3 pid=58025 scope=ifnet ifname=ipsec0
refcnt=1
# setkey -DPg
::/0 ::/0 icmp6 135,0
out none
spid=5 seq=1 pid=872 scope=global
refcnt=1

No objection from: #network
Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D9805


# db881946 27-Feb-2017 Andrey V. Elsukov <ae@FreeBSD.org>

Document that the size of AH ICV for HMAC-SHA2-NNN should be half of
NNN bits as described in RFC4868.

PR: 215978


# fcf59617 06-Feb-2017 Andrey V. Elsukov <ae@FreeBSD.org>

Merge projects/ipsec into head/.

Small summary
-------------

o Almost all IPsec releated code was moved into sys/netipsec.
o New kernel modules added: ipsec.ko and tcpmd5.ko. New kernel
option IPSEC_SUPPORT added. It enables support for loading
and unloading of ipsec.ko and tcpmd5.ko kernel modules.
o IPSEC_NAT_T option was removed. Now NAT-T support is enabled by
default. The UDP_ENCAP_ESPINUDP_NON_IKE encapsulation type
support was removed. Added TCP/UDP checksum handling for
inbound packets that were decapsulated by transport mode SAs.
setkey(8) modified to show run-time NAT-T configuration of SA.
o New network pseudo interface if_ipsec(4) added. For now it is
build as part of ipsec.ko module (or with IPSEC kernel).
It implements IPsec virtual tunnels to create route-based VPNs.
o The network stack now invokes IPsec functions using special
methods. The only one header file <netipsec/ipsec_support.h>
should be included to declare all the needed things to work
with IPsec.
o All IPsec protocols handlers (ESP/AH/IPCOMP protosw) were removed.
Now these protocols are handled directly via IPsec methods.
o TCP_SIGNATURE support was reworked to be more close to RFC.
o PF_KEY SADB was reworked:
- now all security associations stored in the single SPI namespace,
and all SAs MUST have unique SPI.
- several hash tables added to speed up lookups in SADB.
- SADB now uses rmlock to protect access, and concurrent threads
can do SA lookups in the same time.
- many PF_KEY message handlers were reworked to reflect changes
in SADB.
- SADB_UPDATE message was extended to support new PF_KEY headers:
SADB_X_EXT_NEW_ADDRESS_SRC and SADB_X_EXT_NEW_ADDRESS_DST. They
can be used by IKE daemon to change SA addresses.
o ipsecrequest and secpolicy structures were cardinally changed to
avoid locking protection for ipsecrequest. Now we support
only limited number (4) of bundled SAs, but they are supported
for both INET and INET6.
o INPCB security policy cache was introduced. Each PCB now caches
used security policies to avoid SP lookup for each packet.
o For inbound security policies added the mode, when the kernel does
check for full history of applied IPsec transforms.
o References counting rules for security policies and security
associations were changed. The proper SA locking added into xform
code.
o xform code was also changed. Now it is possible to unregister xforms.
tdb_xxx structures were changed and renamed to reflect changes in
SADB/SPDB, and changed rules for locking and refcounting.

Reviewed by: gnn, wblock
Obtained from: Yandex LLC
Relnotes: yes
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D9352


# 032a05d5 02-Oct-2016 Sevan Janiyan <sevan@FreeBSD.org>

setkey appeared in FreeBSD 4.0

PR: 212551
Approved by: bcr (mentor)
MFC after: 4 days
Differential Revision: https://reviews.freebsd.org/D8105


# 2deb3754 31-Jul-2015 George V. Neville-Neil <gnn@FreeBSD.org>

Summary: Remove unsupported 3des-deriv encryption algorithm from documentation.


# 7c160e33 03-Jul-2015 George V. Neville-Neil <gnn@FreeBSD.org>

Update the date on the manual page.

Noticed by: bz


# 987de844 03-Jul-2015 George V. Neville-Neil <gnn@FreeBSD.org>

New AES modes for IPSec, user space components.
Update setkey and libipsec to understand aes-gcm-16 as an
encryption method.

A partial commit of the work in review D2936.

Submitted by: eri
Reviewed by: jmg
MFC after: 2 weeks
Sponsored by: Rubicon Communications (Netgate)


# c14beb68 25-Jul-2014 Warren Block <wblock@FreeBSD.org>

Fix spelling of Camellia algorithm. While here, replace blank lines
between examples with actual .Pp breaks.

PR: 192067
Submitted by: dmitry2004@yandex.ru
MFC after: 1 week


# 7cb0189d 16-Dec-2012 Eitan Adler <eadler@FreeBSD.org>

Minor wording improvments to some manual pages

Approved by: bcr (mentor)
Obtained from: DragonflyBSD (a5294ca835317c68c919ab43936da4f05ab6e926)
MFC after: 3 days


# 29e758c2 03-Jun-2012 Joel Dahl <joel@FreeBSD.org>

Minor mdoc improvements.


# 35471bf8 13-May-2012 Joel Dahl <joel@FreeBSD.org>

Minor mdoc nits.


# 46355096 26-Mar-2012 Joel Dahl <joel@FreeBSD.org>

mdoc: correct .Bd/.Bl arguments.

Reviewed by: brueffer


# 091eeb48 25-Mar-2012 Joel Dahl <joel@FreeBSD.org>

Remove superfluous paragraph macro.


# b2e52ced 02-Jun-2011 Ulrich Spörlein <uqs@FreeBSD.org>

mdoc: fix markup


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 7cc1fde0 18-Oct-2010 Ulrich Spörlein <uqs@FreeBSD.org>

mdoc: drop even more redundant .Pp calls

No change in rendered output, less mandoc lint warnings.

Tool provided by: Nobuyuki Koganemaru n-kogane at syd.odn.ne.jp


# f81dc89a 20-Apr-2010 Maxim Konovalov <maxim@FreeBSD.org>

MFC r205672: fix typo.


# 16d1ba4f 25-Mar-2010 Maxim Konovalov <maxim@FreeBSD.org>

o Fix typo.

PR: docs/145031
Submitted by: olgeni
MFC after: 1 week


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# aa4a335b 15-Jan-2010 Ruslan Ermilov <ru@FreeBSD.org>

Use the newly brought %U macro.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 19d35886 28-Sep-2008 Maxim Konovalov <maxim@FreeBSD.org>

o Add missed dot.


# 559d3390 09-May-2007 George V. Neville-Neil <gnn@FreeBSD.org>

Integrate the Camellia Block Cipher. For more information see RFC 4132
and its bibliography.

Submitted by: Tomoyuki Okazaki <okazaki at kick dot gr dot jp>
MFC after: 1 month


# 8266d476 18-Sep-2006 Ruslan Ermilov <ru@FreeBSD.org>

Markup fixes.


# 4c4090f5 13-May-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Include other AES key lengths in the comment.


# fb170c44 08-Jan-2006 George V. Neville-Neil <gnn@FreeBSD.org>

Langauge fixes required to disambiguate some statements.

Explain the examples.


# 6b806d21 09-Feb-2005 Ruslan Ermilov <ru@FreeBSD.org>

Fixed the misplaced $FreeBSD$.


# a866e170 17-Jan-2005 Ruslan Ermilov <ru@FreeBSD.org>

Added the EXIT STATUS section where appropriate.


# 62890a39 14-Jan-2005 Ruslan Ermilov <ru@FreeBSD.org>

Fixed display type.


# 6992e2a5 05-Jun-2004 Ruslan Ermilov <ru@FreeBSD.org>

Reapply traditionally lost fixes, fixed some more.
This manpage needs an English clenup.


# 1922fd12 10-Feb-2004 Bruce M Simpson <bms@FreeBSD.org>

Initial import of RFC 2385 (TCP-MD5) digest support.

This is the second of two commits; bring in the userland support to finish.

Teach libipsec and setkey about the tcp-md5 class of security associations,
thus allowing administrators to add per-host keys to the SADB for use by
the tcpsignature_compute() function.

Document that a single SPI must be used until such time as the code which
adds support to the SPD to specify flows for tcp-md5 treatment is suitable
for production.

Sponsored by: sentex.net


# db540018 10-Nov-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

enable aes-xcbc-mac and aes-ctr, again.


# cf43a054 05-Nov-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

- do hexdump on send. set length field properly
- check for encryption/authentication key together with algorithm.
- warned if a deprecated encryption algorithm (that includes "simple")
is specified.
- changed the syntax how to define a policy of a ICMPv6 type and/or a
code, like spdadd ::/0 ::/0 icmp6 134,0 -P out none;
- random cleanup in parser.
- use yyfatal, or return -1 after yyerror.
- deal with strdup() failure.
- permit scope notation in policy string (-P
esp/tunnel/foo%scope-bar%scope/use)
- simplify /prefix and [port].
- g/c some unused symbols.

Obtained from: KAME


# b42ac57f 13-Oct-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

- support AES counter mode for ESP.
- use size_t as return type of schedlen(), as there's no error
check needed.
- clear key schedule buffer before freeing.

Obtained from: KAME


# c65ee7c7 12-Oct-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

- support AES XCBC MAC for AH
- correct SADB_X_AALG_RIPEMD160HMAC to 8

Obtained from: KAME


# 492528c0 12-Oct-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

- RIPEMD160 support
- pass size arg to ah->result (avoid assuming result buffer size)

Obtained from: KAME


# 9d5abbdd 01-Jan-2003 Jens Schweikhardt <schweikh@FreeBSD.org>

Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.


# 57bd0fc6 26-Dec-2002 Jens Schweikhardt <schweikh@FreeBSD.org>

english(4) police.


# 05ad4a57 27-Jul-2002 Bill Fenner <fenner@FreeBSD.org>

Fix spacing for -P (policy) examples.


# a9b45e74 23-Jul-2002 Marc Fonvieille <blackend@FreeBSD.org>

s/IPSEC/IPsec according to RFCs

PR: in part docs/38668
Reviewed by: charnier
MFC after: 10 days


# 490d5836 14-Jul-2002 Philippe Charnier <charnier@FreeBSD.org>

The .Nm utility


# 57e4378b 10-Aug-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: protect trailing full stops of abbreviations
with a trailing zero-width space: `e.g.\&'.


# 42abf713 08-Aug-2001 Sheldon Hearn <sheldonh@FreeBSD.org>

can not -> cannot


# c4d9468e 07-Aug-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police:

Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.


# f247324d 15-Jul-2001 Dima Dorfman <dd@FreeBSD.org>

Remove whitespace at EOL.


# 5521ff5a 06-Jul-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2).


# 33841545 10-Jun-2001 Hajimu UMEMOTO <ume@FreeBSD.org>

Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

TODO:
- The definitions of SADB_* in sys/net/pfkeyv2.h are still different
from RFC2407/IANA assignment because of binary compatibility
issue. It should be fixed under 5-CURRENT.
- ip6po_m member of struct ip6_pktopts is no longer used. But, it
is still there because of binary compatibility issue. It should
be removed under 5-CURRENT.

Reviewed by: itojun
Obtained from: KAME
MFC after: 3 weeks


# f1b1c5da 17-May-2001 Brian Somers <brian@FreeBSD.org>

Allow ``ip4'' as an ``upperspec'' value, and update the man
page with *all* the permissible values.

This should really be spelt ipencap (as /etc/protocols does),
but a precedent has already been set by the ipproto array in
setkey.c.

It would be nice if /etc/protocols was parsed for the upperspec
field, but I don't do yacc/lex...

This change allows policies that only encrypt the encapsulated
packets passing between the endpoints of a gif tunnel. Setting
such a policy means that you can still talk directly (and
unencrypted) between the public IP numbers with (say) ssh.

MFC after: 1 week


# eb083802 18-Apr-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: normalize .Nd.


# 610a5778 01-Feb-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: split punctuation characters + misc fixes.


# 059b1593 01-Jan-2001 Ben Smithurst <ben@FreeBSD.org>

Minor layout fixes.

PR: 24004
Submitted by: Jimmy Olgeni <olgeni@uli.it>


# e97407b4 20-Nov-2000 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: use the new features of the Nm macro.


# 3c62e87a 04-Jul-2000 Jun-ichiro itojun Hagino <itojun@FreeBSD.org>

synchronize with latest kame tree.

behavior change: policy syntax was changed. you may need to update your
setkey(8) configuration files.


# ec2f949e 15-May-2000 Tim Vanderhoek <hoek@FreeBSD.org>

Typo: "ealgo" -> "aalgo"

PR: docs/18547 (OKAZAKI Tetsurou <okazaki@be.to>)


# 41d34b5f 06-May-2000 Alexey Zelkin <phantom@FreeBSD.org>

Fix typo

Noticed by: hoek


# 4a737e97 01-May-2000 Alexey Zelkin <phantom@FreeBSD.org>

. clear `.Os' macro value since this tool is not KAME only anymore
. add integration note


# f9b3ac8d 12-Mar-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Add missing end of semi colon of an example setkey command.

Submitted by: kuriyama


# 17deb182 12-Mar-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Typo fix. s/SAD/SPD/.

Specified by: jdp


# f2e366a1 01-Mar-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


# 9a4365d0 05-Jan-2000 Yoshinobu Inoue <shin@FreeBSD.org>

libipsec and IPsec related apps. (and some KAME related man pages)

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project