xref: /freebsd/sbin/setkey/setkey.8 (revision 6992e2a56ef1972ea11d015a64eb49a26dc9711b)
1cf43a054SHajimu UMEMOTO.\"	$KAME: setkey.8,v 1.89 2003/09/07 22:17:41 itojun Exp $
23c62e87aSJun-ichiro itojun Hagino.\"	$FreeBSD$
33c62e87aSJun-ichiro itojun Hagino.\"
49a4365d0SYoshinobu Inoue.\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
59a4365d0SYoshinobu Inoue.\" All rights reserved.
69a4365d0SYoshinobu Inoue.\"
79a4365d0SYoshinobu Inoue.\" Redistribution and use in source and binary forms, with or without
89a4365d0SYoshinobu Inoue.\" modification, are permitted provided that the following conditions
99a4365d0SYoshinobu Inoue.\" are met:
109a4365d0SYoshinobu Inoue.\" 1. Redistributions of source code must retain the above copyright
119a4365d0SYoshinobu Inoue.\"    notice, this list of conditions and the following disclaimer.
129a4365d0SYoshinobu Inoue.\" 2. Redistributions in binary form must reproduce the above copyright
139a4365d0SYoshinobu Inoue.\"    notice, this list of conditions and the following disclaimer in the
149a4365d0SYoshinobu Inoue.\"    documentation and/or other materials provided with the distribution.
159a4365d0SYoshinobu Inoue.\" 3. Neither the name of the project nor the names of its contributors
169a4365d0SYoshinobu Inoue.\"    may be used to endorse or promote products derived from this software
179a4365d0SYoshinobu Inoue.\"    without specific prior written permission.
189a4365d0SYoshinobu Inoue.\"
199a4365d0SYoshinobu Inoue.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
209a4365d0SYoshinobu Inoue.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
219a4365d0SYoshinobu Inoue.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229a4365d0SYoshinobu Inoue.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
239a4365d0SYoshinobu Inoue.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249a4365d0SYoshinobu Inoue.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
259a4365d0SYoshinobu Inoue.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
269a4365d0SYoshinobu Inoue.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
279a4365d0SYoshinobu Inoue.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
289a4365d0SYoshinobu Inoue.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
299a4365d0SYoshinobu Inoue.\" SUCH DAMAGE.
309a4365d0SYoshinobu Inoue.\"
3133841545SHajimu UMEMOTO.Dd November 20, 2000
329a4365d0SYoshinobu Inoue.Dt SETKEY 8
3333841545SHajimu UMEMOTO.Os
343c62e87aSJun-ichiro itojun Hagino.\"
359a4365d0SYoshinobu Inoue.Sh NAME
369a4365d0SYoshinobu Inoue.Nm setkey
376992e2a5SRuslan Ermilov.Nd "manually manipulate the IPsec SA/SP database"
383c62e87aSJun-ichiro itojun Hagino.\"
399a4365d0SYoshinobu Inoue.Sh SYNOPSIS
40e97407b4SRuslan Ermilov.Nm
41cf43a054SHajimu UMEMOTO.Op Fl v
429a4365d0SYoshinobu Inoue.Fl c
43e97407b4SRuslan Ermilov.Nm
44cf43a054SHajimu UMEMOTO.Op Fl v
459a4365d0SYoshinobu Inoue.Fl f Ar filename
46e97407b4SRuslan Ermilov.Nm
47cf43a054SHajimu UMEMOTO.Op Fl aPlv
489a4365d0SYoshinobu Inoue.Fl D
49e97407b4SRuslan Ermilov.Nm
50cf43a054SHajimu UMEMOTO.Op Fl Pv
519a4365d0SYoshinobu Inoue.Fl F
52e97407b4SRuslan Ermilov.Nm
539a4365d0SYoshinobu Inoue.Op Fl h
549a4365d0SYoshinobu Inoue.Fl x
559a4365d0SYoshinobu Inoue.\"
569a4365d0SYoshinobu Inoue.Sh DESCRIPTION
57490d5836SPhilippe CharnierThe
589a4365d0SYoshinobu Inoue.Nm
596992e2a5SRuslan Ermilovutility adds, updates, dumps, or flushes
603c62e87aSJun-ichiro itojun HaginoSecurity Association Database (SAD) entries
613c62e87aSJun-ichiro itojun Haginoas well as Security Policy Database (SPD) entries in the kernel.
629a4365d0SYoshinobu Inoue.Pp
63490d5836SPhilippe CharnierThe
649a4365d0SYoshinobu Inoue.Nm
656992e2a5SRuslan Ermilovutility takes a series of operations from the standard input
666992e2a5SRuslan Ermilov(if invoked with
676992e2a5SRuslan Ermilov.Fl c )
683c62e87aSJun-ichiro itojun Haginoor the file named
699a4365d0SYoshinobu Inoue.Ar filename
706992e2a5SRuslan Ermilov(if invoked with
716992e2a5SRuslan Ermilov.Fl f Ar filename ) .
726992e2a5SRuslan Ermilov.Bl -tag -width indent
739a4365d0SYoshinobu Inoue.It Fl D
749a4365d0SYoshinobu InoueDump the SAD entries.
759a4365d0SYoshinobu InoueIf with
769a4365d0SYoshinobu Inoue.Fl P ,
779a4365d0SYoshinobu Inouethe SPD entries are dumped.
789a4365d0SYoshinobu Inoue.It Fl F
793c62e87aSJun-ichiro itojun HaginoFlush the SAD entries.
809a4365d0SYoshinobu InoueIf with
819a4365d0SYoshinobu Inoue.Fl P ,
823c62e87aSJun-ichiro itojun Haginothe SPD entries are flushed.
839a4365d0SYoshinobu Inoue.It Fl a
846992e2a5SRuslan ErmilovThe
85cf43a054SHajimu UMEMOTO.Nm
866992e2a5SRuslan Ermilovutility
87cf43a054SHajimu UMEMOTOusually does not display dead SAD entries with
889a4365d0SYoshinobu Inoue.Fl D .
893c62e87aSJun-ichiro itojun HaginoIf with
909a4365d0SYoshinobu Inoue.Fl a ,
913c62e87aSJun-ichiro itojun Haginothe dead SAD entries will be displayed as well.
923c62e87aSJun-ichiro itojun HaginoA dead SAD entry means that
93cf43a054SHajimu UMEMOTOit has been expired but remains in the system
94cf43a054SHajimu UMEMOTObecause it is referenced by some SPD entries.
959a4365d0SYoshinobu Inoue.It Fl h
969a4365d0SYoshinobu InoueAdd hexadecimal dump on
979a4365d0SYoshinobu Inoue.Fl x
98f2e366a1SSheldon Hearnmode.
999a4365d0SYoshinobu Inoue.It Fl l
1009a4365d0SYoshinobu InoueLoop forever with short output on
1019a4365d0SYoshinobu Inoue.Fl D .
1029a4365d0SYoshinobu Inoue.It Fl v
1039a4365d0SYoshinobu InoueBe verbose.
10433841545SHajimu UMEMOTOThe program will dump messages exchanged on
1059a4365d0SYoshinobu Inoue.Dv PF_KEY
10633841545SHajimu UMEMOTOsocket, including messages sent from other processes to the kernel.
107cf43a054SHajimu UMEMOTO.It Fl x
108cf43a054SHajimu UMEMOTOLoop forever and dump all the messages transmitted to
109cf43a054SHajimu UMEMOTO.Dv PF_KEY
110cf43a054SHajimu UMEMOTOsocket.
111cf43a054SHajimu UMEMOTO.Fl xx
112cf43a054SHajimu UMEMOTOmakes each timestamps unformatted.
1139a4365d0SYoshinobu Inoue.El
114cf43a054SHajimu UMEMOTO.Ss Configuration syntax
115cf43a054SHajimu UMEMOTOWith
116cf43a054SHajimu UMEMOTO.Fl c
117cf43a054SHajimu UMEMOTOor
118cf43a054SHajimu UMEMOTO.Fl f
119cf43a054SHajimu UMEMOTOon the command line,
120cf43a054SHajimu UMEMOTO.Nm
121cf43a054SHajimu UMEMOTOaccepts the following configuration syntax.
1226992e2a5SRuslan ErmilovLines starting with hash signs
1236992e2a5SRuslan Ermilov.Pq Ql #
1246992e2a5SRuslan Ermilovare treated as comment lines.
1256992e2a5SRuslan Ermilov.Bl -tag -width indent
1269a4365d0SYoshinobu Inoue.It Xo
1279a4365d0SYoshinobu Inoue.Li add
128cf43a054SHajimu UMEMOTO.Op Fl 46n
1299a4365d0SYoshinobu Inoue.Ar src Ar dst Ar protocol Ar spi
1309a4365d0SYoshinobu Inoue.Op Ar extensions
1319a4365d0SYoshinobu Inoue.Ar algorithm ...
1329a4365d0SYoshinobu Inoue.Li ;
1339a4365d0SYoshinobu Inoue.Xc
1343c62e87aSJun-ichiro itojun HaginoAdd an SAD entry.
135cf43a054SHajimu UMEMOTO.Li add
136cf43a054SHajimu UMEMOTOcan fail with multiple reasons,
137cf43a054SHajimu UMEMOTOincluding when the key length does not match the specified algorithm.
1389a4365d0SYoshinobu Inoue.\"
1399a4365d0SYoshinobu Inoue.It Xo
1409a4365d0SYoshinobu Inoue.Li get
141cf43a054SHajimu UMEMOTO.Op Fl 46n
1429a4365d0SYoshinobu Inoue.Ar src Ar dst Ar protocol Ar spi
1439a4365d0SYoshinobu Inoue.Li ;
1449a4365d0SYoshinobu Inoue.Xc
1453c62e87aSJun-ichiro itojun HaginoShow an SAD entry.
1469a4365d0SYoshinobu Inoue.\"
1479a4365d0SYoshinobu Inoue.It Xo
1489a4365d0SYoshinobu Inoue.Li delete
149cf43a054SHajimu UMEMOTO.Op Fl 46n
1509a4365d0SYoshinobu Inoue.Ar src Ar dst Ar protocol Ar spi
1519a4365d0SYoshinobu Inoue.Li ;
1529a4365d0SYoshinobu Inoue.Xc
1533c62e87aSJun-ichiro itojun HaginoRemove an SAD entry.
1549a4365d0SYoshinobu Inoue.\"
1559a4365d0SYoshinobu Inoue.It Xo
15633841545SHajimu UMEMOTO.Li deleteall
157cf43a054SHajimu UMEMOTO.Op Fl 46n
15833841545SHajimu UMEMOTO.Ar src Ar dst Ar protocol
15933841545SHajimu UMEMOTO.Li ;
16033841545SHajimu UMEMOTO.Xc
16133841545SHajimu UMEMOTORemove all SAD entries that match the specification.
16233841545SHajimu UMEMOTO.\"
16333841545SHajimu UMEMOTO.It Xo
1649a4365d0SYoshinobu Inoue.Li flush
1659a4365d0SYoshinobu Inoue.Op Ar protocol
1669a4365d0SYoshinobu Inoue.Li ;
1679a4365d0SYoshinobu Inoue.Xc
1683c62e87aSJun-ichiro itojun HaginoClear all SAD entries matched by the options.
169cf43a054SHajimu UMEMOTO.Fl F
170cf43a054SHajimu UMEMOTOon the command line achieves the same functionality.
1719a4365d0SYoshinobu Inoue.\"
1729a4365d0SYoshinobu Inoue.It Xo
1739a4365d0SYoshinobu Inoue.Li dump
1749a4365d0SYoshinobu Inoue.Op Ar protocol
1759a4365d0SYoshinobu Inoue.Li ;
1769a4365d0SYoshinobu Inoue.Xc
1773c62e87aSJun-ichiro itojun HaginoDumps all SAD entries matched by the options.
178cf43a054SHajimu UMEMOTO.Fl D
179cf43a054SHajimu UMEMOTOon the command line achieves the same functionality.
1809a4365d0SYoshinobu Inoue.\"
1819a4365d0SYoshinobu Inoue.It Xo
1829a4365d0SYoshinobu Inoue.Li spdadd
183cf43a054SHajimu UMEMOTO.Op Fl 46n
1849a4365d0SYoshinobu Inoue.Ar src_range Ar dst_range Ar upperspec Ar policy
1859a4365d0SYoshinobu Inoue.Li ;
1869a4365d0SYoshinobu Inoue.Xc
1873c62e87aSJun-ichiro itojun HaginoAdd an SPD entry.
1889a4365d0SYoshinobu Inoue.\"
1899a4365d0SYoshinobu Inoue.It Xo
1909a4365d0SYoshinobu Inoue.Li spddelete
191cf43a054SHajimu UMEMOTO.Op Fl 46n
1923c62e87aSJun-ichiro itojun Hagino.Ar src_range Ar dst_range Ar upperspec Fl P Ar direction
1939a4365d0SYoshinobu Inoue.Li ;
1949a4365d0SYoshinobu Inoue.Xc
1953c62e87aSJun-ichiro itojun HaginoDelete an SPD entry.
1969a4365d0SYoshinobu Inoue.\"
1979a4365d0SYoshinobu Inoue.It Xo
1989a4365d0SYoshinobu Inoue.Li spdflush
1999a4365d0SYoshinobu Inoue.Li ;
2009a4365d0SYoshinobu Inoue.Xc
2019a4365d0SYoshinobu InoueClear all SPD entries.
202cf43a054SHajimu UMEMOTO.Fl FP
203cf43a054SHajimu UMEMOTOon the command line achieves the same functionality.
2049a4365d0SYoshinobu Inoue.\"
2059a4365d0SYoshinobu Inoue.It Xo
2069a4365d0SYoshinobu Inoue.Li spddump
2079a4365d0SYoshinobu Inoue.Li ;
2089a4365d0SYoshinobu Inoue.Xc
20917deb182SYoshinobu InoueDumps all SPD entries.
210cf43a054SHajimu UMEMOTO.Fl DP
211cf43a054SHajimu UMEMOTOon the command line achieves the same functionality.
2129a4365d0SYoshinobu Inoue.El
2139a4365d0SYoshinobu Inoue.\"
2149a4365d0SYoshinobu Inoue.Pp
2159a4365d0SYoshinobu InoueMeta-arguments are as follows:
216059b1593SBen Smithurst.Pp
2176992e2a5SRuslan Ermilov.Bl -tag -compact -width indent
2189a4365d0SYoshinobu Inoue.It Ar src
2199a4365d0SYoshinobu Inoue.It Ar dst
2209a4365d0SYoshinobu InoueSource/destination of the secure communication is specified as
2219a4365d0SYoshinobu InoueIPv4/v6 address.
2226992e2a5SRuslan ErmilovThe
2239a4365d0SYoshinobu Inoue.Nm
2246992e2a5SRuslan Ermilovutility
225cf43a054SHajimu UMEMOTOcan resolve a FQDN into numeric addresses.
226cf43a054SHajimu UMEMOTOIf the FQDN resolves into multiple addresses,
227cf43a054SHajimu UMEMOTO.Nm
228cf43a054SHajimu UMEMOTOwill install multiple SAD/SPD entries into the kernel
229cf43a054SHajimu UMEMOTOby trying all possible combinations.
230cf43a054SHajimu UMEMOTO.Fl 4 ,
231cf43a054SHajimu UMEMOTO.Fl 6
2329a4365d0SYoshinobu Inoueand
233cf43a054SHajimu UMEMOTO.Fl n
234cf43a054SHajimu UMEMOTOrestricts the address resolution of FQDN in certain ways.
235cf43a054SHajimu UMEMOTO.Fl 4
236cf43a054SHajimu UMEMOTOand
237cf43a054SHajimu UMEMOTO.Fl 6
238cf43a054SHajimu UMEMOTOrestrict results into IPv4/v6 addresses only, respectively.
239cf43a054SHajimu UMEMOTO.Fl n
240cf43a054SHajimu UMEMOTOavoids FQDN resolution and requires addresses to be numeric addresses.
2419a4365d0SYoshinobu Inoue.\"
2429a4365d0SYoshinobu Inoue.Pp
2439a4365d0SYoshinobu Inoue.It Ar protocol
2449a4365d0SYoshinobu Inoue.Ar protocol
2459a4365d0SYoshinobu Inoueis one of following:
2469a4365d0SYoshinobu Inoue.Bl -tag -width Fl -compact
2479a4365d0SYoshinobu Inoue.It Li esp
248cf43a054SHajimu UMEMOTOESP based on rfc2406
2499a4365d0SYoshinobu Inoue.It Li esp-old
2509a4365d0SYoshinobu InoueESP based on rfc1827
2519a4365d0SYoshinobu Inoue.It Li ah
2529a4365d0SYoshinobu InoueAH based on rfc2402
2539a4365d0SYoshinobu Inoue.It Li ah-old
2549a4365d0SYoshinobu InoueAH based on rfc1826
2559a4365d0SYoshinobu Inoue.It Li ipcomp
256cf43a054SHajimu UMEMOTOIPComp
2571922fd12SBruce M Simpson.It Li tcp
2581922fd12SBruce M SimpsonTCP-MD5 based on rfc2385
2599a4365d0SYoshinobu Inoue.El
2609a4365d0SYoshinobu Inoue.\"
2619a4365d0SYoshinobu Inoue.Pp
2629a4365d0SYoshinobu Inoue.It Ar spi
263cf43a054SHajimu UMEMOTOSecurity Parameter Index
2646992e2a5SRuslan Ermilov(SPI)
265cf43a054SHajimu UMEMOTOfor the SAD and the SPD.
266cf43a054SHajimu UMEMOTO.Ar spi
267cf43a054SHajimu UMEMOTOmust be a decimal number, or a hexadecimal number with
2686992e2a5SRuslan Ermilov.Ql 0x
269cf43a054SHajimu UMEMOTOprefix.
270cf43a054SHajimu UMEMOTOSPI values between 0 and 255 are reserved for future use by IANA
271cf43a054SHajimu UMEMOTOand they cannot be used.
2721922fd12SBruce M SimpsonTCP-MD5 associations must use 0x1000 and therefore only have per-host
2731922fd12SBruce M Simpsongranularity at this time.
2749a4365d0SYoshinobu Inoue.\"
2759a4365d0SYoshinobu Inoue.Pp
2769a4365d0SYoshinobu Inoue.It Ar extensions
277cf43a054SHajimu UMEMOTOtake some of the following:
2789a4365d0SYoshinobu Inoue.Bl -tag -width Fl -compact
2793c62e87aSJun-ichiro itojun Hagino.\"
2809a4365d0SYoshinobu Inoue.It Fl m Ar mode
2813c62e87aSJun-ichiro itojun HaginoSpecify a security protocol mode for use.
2829a4365d0SYoshinobu Inoue.Ar mode
2839a4365d0SYoshinobu Inoueis one of following:
2849a4365d0SYoshinobu Inoue.Li transport , tunnel
2859a4365d0SYoshinobu Inoueor
2869a4365d0SYoshinobu Inoue.Li any .
2873c62e87aSJun-ichiro itojun HaginoThe default value is
2883c62e87aSJun-ichiro itojun Hagino.Li any .
2893c62e87aSJun-ichiro itojun Hagino.\"
2909a4365d0SYoshinobu Inoue.It Fl r Ar size
2919a4365d0SYoshinobu InoueSpecify window size of bytes for replay prevention.
2929a4365d0SYoshinobu Inoue.Ar size
29333841545SHajimu UMEMOTOmust be decimal number in 32-bit word.
29433841545SHajimu UMEMOTOIf
2959a4365d0SYoshinobu Inoue.Ar size
2966992e2a5SRuslan Ermilovis zero or not specified, replay check does not take place.
2973c62e87aSJun-ichiro itojun Hagino.\"
2983c62e87aSJun-ichiro itojun Hagino.It Fl u Ar id
29933841545SHajimu UMEMOTOSpecify the identifier of the policy entry in SPD.
30033841545SHajimu UMEMOTOSee
30133841545SHajimu UMEMOTO.Ar policy .
3023c62e87aSJun-ichiro itojun Hagino.\"
3039a4365d0SYoshinobu Inoue.It Fl f Ar pad_option
30433841545SHajimu UMEMOTOdefines the content of the ESP padding.
3059a4365d0SYoshinobu Inoue.Ar pad_option
3069a4365d0SYoshinobu Inoueis one of following:
30733841545SHajimu UMEMOTO.Bl -tag -width random-pad -compact
30833841545SHajimu UMEMOTO.It Li zero-pad
30933841545SHajimu UMEMOTOAll of the padding are zero.
31033841545SHajimu UMEMOTO.It Li random-pad
31133841545SHajimu UMEMOTOA series of randomized values are set.
31233841545SHajimu UMEMOTO.It Li seq-pad
31333841545SHajimu UMEMOTOA series of sequential increasing numbers started from 1 are set.
31433841545SHajimu UMEMOTO.El
3153c62e87aSJun-ichiro itojun Hagino.\"
3163c62e87aSJun-ichiro itojun Hagino.It Fl f Li nocyclic-seq
3176992e2a5SRuslan ErmilovDo not allow cyclic sequence number.
3183c62e87aSJun-ichiro itojun Hagino.\"
3199a4365d0SYoshinobu Inoue.It Fl lh Ar time
3209a4365d0SYoshinobu Inoue.It Fl ls Ar time
32133841545SHajimu UMEMOTOSpecify hard/soft life time duration of the SA.
3229a4365d0SYoshinobu Inoue.El
3239a4365d0SYoshinobu Inoue.\"
3249a4365d0SYoshinobu Inoue.Pp
3259a4365d0SYoshinobu Inoue.It Ar algorithm
3269a4365d0SYoshinobu Inoue.Bl -tag -width Fl -compact
3279a4365d0SYoshinobu Inoue.It Fl E Ar ealgo Ar key
328cf43a054SHajimu UMEMOTOSpecify an encryption algorithm
329cf43a054SHajimu UMEMOTO.Ar ealgo
330cf43a054SHajimu UMEMOTOfor ESP.
331cf43a054SHajimu UMEMOTO.It Xo
332cf43a054SHajimu UMEMOTO.Fl E Ar ealgo Ar key
333cf43a054SHajimu UMEMOTO.Fl A Ar aalgo Ar key
334cf43a054SHajimu UMEMOTO.Xc
335cf43a054SHajimu UMEMOTOSpecify a encryption algorithm
336cf43a054SHajimu UMEMOTO.Ar ealgo ,
337cf43a054SHajimu UMEMOTOas well as a payload authentication algorithm
338cf43a054SHajimu UMEMOTO.Ar aalgo ,
339cf43a054SHajimu UMEMOTOfor ESP.
340ec2f949eSTim Vanderhoek.It Fl A Ar aalgo Ar key
341cf43a054SHajimu UMEMOTOSpecify an authentication algorithm for AH.
3429a4365d0SYoshinobu Inoue.It Fl C Ar calgo Op Fl R
343cf43a054SHajimu UMEMOTOSpecify a compression algorithm for IPComp.
3449a4365d0SYoshinobu InoueIf
3459a4365d0SYoshinobu Inoue.Fl R
346cf43a054SHajimu UMEMOTOis specified,
3479a4365d0SYoshinobu Inoue.Ar spi
348cf43a054SHajimu UMEMOTOfield value will be used as the IPComp CPI
3496992e2a5SRuslan Ermilov(compression parameter index)
350cf43a054SHajimu UMEMOTOon wire as is.
3519a4365d0SYoshinobu InoueIf
3529a4365d0SYoshinobu Inoue.Fl R
353cf43a054SHajimu UMEMOTOis not specified,
354cf43a054SHajimu UMEMOTOthe kernel will use well-known CPI on wire, and
3559a4365d0SYoshinobu Inoue.Ar spi
356cf43a054SHajimu UMEMOTOfield will be used only as an index for kernel internal usage.
3579a4365d0SYoshinobu Inoue.El
3589a4365d0SYoshinobu Inoue.Pp
3599a4365d0SYoshinobu Inoue.Ar key
360cf43a054SHajimu UMEMOTOmust be double-quoted character string, or a series of hexadecimal digits
361cf43a054SHajimu UMEMOTOpreceded by
3626992e2a5SRuslan Ermilov.Ql 0x .
3639a4365d0SYoshinobu Inoue.Pp
3649a4365d0SYoshinobu InouePossible values for
3659a4365d0SYoshinobu Inoue.Ar ealgo ,
3669a4365d0SYoshinobu Inoue.Ar aalgo
3679a4365d0SYoshinobu Inoueand
3689a4365d0SYoshinobu Inoue.Ar calgo
3699a4365d0SYoshinobu Inoueare specified in separate section.
3709a4365d0SYoshinobu Inoue.\"
371059b1593SBen Smithurst.Pp
3729a4365d0SYoshinobu Inoue.It Ar src_range
3739a4365d0SYoshinobu Inoue.It Ar dst_range
3743c62e87aSJun-ichiro itojun HaginoThese are selections of the secure communication specified as
3759a4365d0SYoshinobu InoueIPv4/v6 address or IPv4/v6 address range, and it may accompany
3769a4365d0SYoshinobu InoueTCP/UDP port specification.
3779a4365d0SYoshinobu InoueThis takes the following form:
3789a4365d0SYoshinobu Inoue.Bd -literal -offset
3799a4365d0SYoshinobu Inoue.Ar address
3809a4365d0SYoshinobu Inoue.Ar address/prefixlen
3819a4365d0SYoshinobu Inoue.Ar address[port]
3829a4365d0SYoshinobu Inoue.Ar address/prefixlen[port]
3839a4365d0SYoshinobu Inoue.Ed
3849a4365d0SYoshinobu Inoue.Pp
3859a4365d0SYoshinobu Inoue.Ar prefixlen
3869a4365d0SYoshinobu Inoueand
3879a4365d0SYoshinobu Inoue.Ar port
3889a4365d0SYoshinobu Inouemust be decimal number.
3899a4365d0SYoshinobu InoueThe square bracket around
3909a4365d0SYoshinobu Inoue.Ar port
3919a4365d0SYoshinobu Inoueis really necessary.
3929a4365d0SYoshinobu InoueThey are not manpage metacharacters.
393cf43a054SHajimu UMEMOTOFor FQDN resolution, the rules applicable to
3949a4365d0SYoshinobu Inoue.Ar src
3959a4365d0SYoshinobu Inoueand
396cf43a054SHajimu UMEMOTO.Ar dst
397cf43a054SHajimu UMEMOTOapply here as well.
3989a4365d0SYoshinobu Inoue.\"
399059b1593SBen Smithurst.Pp
4009a4365d0SYoshinobu Inoue.It Ar upperspec
4019a4365d0SYoshinobu InoueUpper-layer protocol to be used.
40233841545SHajimu UMEMOTOYou can use one of words in
40333841545SHajimu UMEMOTO.Pa /etc/protocols
40433841545SHajimu UMEMOTOas
40533841545SHajimu UMEMOTO.Ar upperspec .
40633841545SHajimu UMEMOTOOr
407f1b1c5daSBrian Somers.Li icmp6 ,
408f1b1c5daSBrian Somers.Li ip4 ,
4099a4365d0SYoshinobu Inoueand
4109a4365d0SYoshinobu Inoue.Li any
4119a4365d0SYoshinobu Inouecan be specified.
4129a4365d0SYoshinobu Inoue.Li any
4139a4365d0SYoshinobu Inouestands for
4149a4365d0SYoshinobu Inoue.Dq any protocol .
41533841545SHajimu UMEMOTOAlso you can use the protocol number.
416cf43a054SHajimu UMEMOTOYou can specify a type and/or a code of ICMPv6 when
4176992e2a5SRuslan Ermilovupper-layer protocol is ICMPv6.
4186992e2a5SRuslan ErmilovThe specification can be placed after
419cf43a054SHajimu UMEMOTO.Li icmp6 .
420cf43a054SHajimu UMEMOTOA type is separated with a code by single comma.
421cf43a054SHajimu UMEMOTOA code must be specified anytime.
422cf43a054SHajimu UMEMOTOWhen a zero is specified, the kernel deals with it as a wildcard.
423cf43a054SHajimu UMEMOTONote that the kernel cannot distinguish a wildcard from that a type
424cf43a054SHajimu UMEMOTOof ICMPv6 is zero.
4256992e2a5SRuslan ErmilovFor example, the following means the policy does not require IPsec
4266992e2a5SRuslan Ermilovfor any inbound Neighbor Solicitation:
4276992e2a5SRuslan Ermilov.Pp
4286992e2a5SRuslan Ermilov.Dl "spdadd ::/0 ::/0 icmp6 135,0 -P in none;"
4299a4365d0SYoshinobu Inoue.Pp
4309a4365d0SYoshinobu InoueNOTE:
4319a4365d0SYoshinobu Inoue.Ar upperspec
4329a4365d0SYoshinobu Inouedoes not work against forwarding case at this moment,
4339a4365d0SYoshinobu Inoueas it requires extra reassembly at forwarding node
4346992e2a5SRuslan Ermilov(not implemented at this moment).
43533841545SHajimu UMEMOTOWe have many protocols in
43633841545SHajimu UMEMOTO.Pa /etc/protocols ,
437a9b45e74SMarc Fonvieillebut protocols except of TCP, UDP and ICMP may not be suitable to use with IPsec.
43833841545SHajimu UMEMOTOYou have to consider and be careful to use them.
4399a4365d0SYoshinobu Inoue.\"
440059b1593SBen Smithurst.Pp
4419a4365d0SYoshinobu Inoue.It Ar policy
4429a4365d0SYoshinobu Inoue.Ar policy
443cf43a054SHajimu UMEMOTOis the one of the following three formats:
4446992e2a5SRuslan Ermilov.Bd -ragged -offset indent
445cf43a054SHajimu UMEMOTO.It Fl P Ar direction Li discard
446cf43a054SHajimu UMEMOTO.It Fl P Ar direction Li none
447cf43a054SHajimu UMEMOTO.It Xo Fl P Ar direction Li ipsec
448cf43a054SHajimu UMEMOTO.Ar protocol/mode/src-dst/level Op ...
44933841545SHajimu UMEMOTO.Xc
45033841545SHajimu UMEMOTO.Ed
4519a4365d0SYoshinobu Inoue.Pp
4529a4365d0SYoshinobu InoueYou must specify the direction of its policy as
4539a4365d0SYoshinobu Inoue.Ar direction .
4549a4365d0SYoshinobu InoueEither
4559a4365d0SYoshinobu Inoue.Li out
4569a4365d0SYoshinobu Inoueor
4579a4365d0SYoshinobu Inoue.Li in
4589a4365d0SYoshinobu Inoueare used.
4599a4365d0SYoshinobu Inoue.Li discard
4609a4365d0SYoshinobu Inouemeans the packet matching indexes will be discarded.
4619a4365d0SYoshinobu Inoue.Li none
4629a4365d0SYoshinobu Inouemeans that IPsec operation will not take place onto the packet.
4639a4365d0SYoshinobu Inoue.Li ipsec
4649a4365d0SYoshinobu Inouemeans that IPsec operation will take place onto the packet.
465cf43a054SHajimu UMEMOTOThe part of
466cf43a054SHajimu UMEMOTO.Ar protocol/mode/src-dst/level
467cf43a054SHajimu UMEMOTOspecifies the rule how to process the packet.
4689a4365d0SYoshinobu InoueEither
4699a4365d0SYoshinobu Inoue.Li ah ,
4709a4365d0SYoshinobu Inoue.Li esp
4719a4365d0SYoshinobu Inoueor
4729a4365d0SYoshinobu Inoue.Li ipcomp
4739a4365d0SYoshinobu Inoueis to be set as
4749a4365d0SYoshinobu Inoue.Ar protocol .
4759a4365d0SYoshinobu Inoue.Ar mode
4769a4365d0SYoshinobu Inoueis either
4779a4365d0SYoshinobu Inoue.Li transport
4789a4365d0SYoshinobu Inoueor
4799a4365d0SYoshinobu Inoue.Li tunnel .
48033841545SHajimu UMEMOTOIf
48133841545SHajimu UMEMOTO.Ar mode
48233841545SHajimu UMEMOTOis
48333841545SHajimu UMEMOTO.Li tunnel ,
48433841545SHajimu UMEMOTOyou must specify the end-points addresses of the SA as
4859a4365d0SYoshinobu Inoue.Ar src
4869a4365d0SYoshinobu Inoueand
4879a4365d0SYoshinobu Inoue.Ar dst
4889a4365d0SYoshinobu Inouewith
4899a4365d0SYoshinobu Inoue.Sq -
4909a4365d0SYoshinobu Inouebetween these addresses which is used to specify the SA to use.
49133841545SHajimu UMEMOTOIf
49233841545SHajimu UMEMOTO.Ar mode
49333841545SHajimu UMEMOTOis
49433841545SHajimu UMEMOTO.Li transport ,
49533841545SHajimu UMEMOTOboth
49633841545SHajimu UMEMOTO.Ar src
49733841545SHajimu UMEMOTOand
49833841545SHajimu UMEMOTO.Ar dst
49957bd0fc6SJens Schweikhardtcan be omitted.
5009a4365d0SYoshinobu Inoue.Ar level
5019a4365d0SYoshinobu Inoueis to be one of the following:
50233841545SHajimu UMEMOTO.Li default , use , require
5039a4365d0SYoshinobu Inoueor
50433841545SHajimu UMEMOTO.Li unique .
50533841545SHajimu UMEMOTOIf the SA is not available in every level, the kernel will request
50633841545SHajimu UMEMOTOgetting SA to the key exchange daemon.
5079a4365d0SYoshinobu Inoue.Li default
5083c62e87aSJun-ichiro itojun Haginomeans the kernel consults to the system wide default against protocol you
5096992e2a5SRuslan Ermilovspecified, e.g.,
5109a4365d0SYoshinobu Inoue.Li esp_trans_deflev
5113c62e87aSJun-ichiro itojun Haginosysctl variable, when the kernel processes the packet.
5129a4365d0SYoshinobu Inoue.Li use
5136992e2a5SRuslan Ermilovmeans that the kernel use a SA if it is available,
5143c62e87aSJun-ichiro itojun Haginootherwise the kernel keeps normal operation.
5159a4365d0SYoshinobu Inoue.Li require
51633841545SHajimu UMEMOTOmeans SA is required whenever the kernel sends a packet matched
51733841545SHajimu UMEMOTOwith the policy.
51833841545SHajimu UMEMOTO.Li unique
51933841545SHajimu UMEMOTOis the same to require.
52033841545SHajimu UMEMOTOIn addition, it allows the policy to bind with the unique out-bound SA.
521cf43a054SHajimu UMEMOTOYou just specify the policy level
522cf43a054SHajimu UMEMOTO.Li unique ,
523cf43a054SHajimu UMEMOTO.Xr racoon 8
524cf43a054SHajimu UMEMOTOwill configure the SA for the policy.
525cf43a054SHajimu UMEMOTOIf you configure the SA by manual keying for that policy,
52633841545SHajimu UMEMOTOyou can put the decimal number as the policy identifier after
52733841545SHajimu UMEMOTO.Li unique
52833841545SHajimu UMEMOTOseparated by colon
5296992e2a5SRuslan Ermilov.Ql :\&
53033841545SHajimu UMEMOTOlike the following;
53133841545SHajimu UMEMOTO.Li unique:number .
5326992e2a5SRuslan ErmilovIn order to bind this policy to the SA,
53333841545SHajimu UMEMOTO.Li number
53433841545SHajimu UMEMOTOmust be between 1 and 32767.
53533841545SHajimu UMEMOTOIt corresponds to
536cf43a054SHajimu UMEMOTO.Ar extensions Fl u
537cf43a054SHajimu UMEMOTOof the manual SA configuration.
538cf43a054SHajimu UMEMOTOWhen you want to use SA bundle, you can define multiple rules.
539cf43a054SHajimu UMEMOTOFor example, if an IP header was followed by AH header followed by ESP header
540cf43a054SHajimu UMEMOTOfollowed by an upper layer protocol header, the rule
541cf43a054SHajimu UMEMOTOwould be:
542cf43a054SHajimu UMEMOTO.Dl esp/transport//require ah/transport//require ;
543cf43a054SHajimu UMEMOTOThe rule order is very important.
54433841545SHajimu UMEMOTO.Pp
5459a4365d0SYoshinobu InoueNote that
5469a4365d0SYoshinobu Inoue.Dq Li discard
5479a4365d0SYoshinobu Inoueand
5489a4365d0SYoshinobu Inoue.Dq Li none
5499a4365d0SYoshinobu Inoueare not in the syntax described in
5509a4365d0SYoshinobu Inoue.Xr ipsec_set_policy 3 .
5519a4365d0SYoshinobu InoueThere are little differences in the syntax.
5529a4365d0SYoshinobu InoueSee
5539a4365d0SYoshinobu Inoue.Xr ipsec_set_policy 3
5549a4365d0SYoshinobu Inouefor detail.
5559a4365d0SYoshinobu Inoue.Pp
5569a4365d0SYoshinobu Inoue.El
5579a4365d0SYoshinobu Inoue.Pp
5589a4365d0SYoshinobu Inoue.\"
5599a4365d0SYoshinobu Inoue.Sh ALGORITHMS
5609a4365d0SYoshinobu InoueThe following list shows the supported algorithms.
5619a4365d0SYoshinobu Inoue.Sy protocol
5629a4365d0SYoshinobu Inoueand
5639a4365d0SYoshinobu Inoue.Sy algorithm
5649a4365d0SYoshinobu Inoueare almost orthogonal.
5653c62e87aSJun-ichiro itojun HaginoFollowings are the list of authentication algorithms that can be used as
5669a4365d0SYoshinobu Inoue.Ar aalgo
5679a4365d0SYoshinobu Inouein
5689a4365d0SYoshinobu Inoue.Fl A Ar aalgo
5699a4365d0SYoshinobu Inoueof
5709a4365d0SYoshinobu Inoue.Ar protocol
5719a4365d0SYoshinobu Inoueparameter:
5729a4365d0SYoshinobu Inoue.Pp
5739a4365d0SYoshinobu Inoue.Bd -literal -offset indent
5749a4365d0SYoshinobu Inouealgorithm	keylen (bits)	comment
5759a4365d0SYoshinobu Inouehmac-md5	128		ah: rfc2403
5769a4365d0SYoshinobu Inoue		128		ah-old: rfc2085
5779a4365d0SYoshinobu Inouehmac-sha1	160		ah: rfc2404
5789a4365d0SYoshinobu Inoue		160		ah-old: 128bit ICV (no document)
5799a4365d0SYoshinobu Inouekeyed-md5	128		ah: 96bit ICV (no document)
5809a4365d0SYoshinobu Inoue		128		ah-old: rfc1828
5819a4365d0SYoshinobu Inouekeyed-sha1	160		ah: 96bit ICV (no document)
5829a4365d0SYoshinobu Inoue		160		ah-old: 128bit ICV (no document)
5839a4365d0SYoshinobu Inouenull		0 to 2048	for debugging
584cf43a054SHajimu UMEMOTOhmac-sha2-256	256		ah: 96bit ICV
585cf43a054SHajimu UMEMOTO				(draft-ietf-ipsec-ciph-sha-256-00)
58633841545SHajimu UMEMOTO		256		ah-old: 128bit ICV (no document)
58733841545SHajimu UMEMOTOhmac-sha2-384	384		ah: 96bit ICV (no document)
58833841545SHajimu UMEMOTO		384		ah-old: 128bit ICV (no document)
58933841545SHajimu UMEMOTOhmac-sha2-512	512		ah: 96bit ICV (no document)
59033841545SHajimu UMEMOTO		512		ah-old: 128bit ICV (no document)
591492528c0SHajimu UMEMOTOhmac-ripemd160	160		ah: 96bit ICV (RFC2857)
592492528c0SHajimu UMEMOTO				ah-old: 128bit ICV (no document)
593db540018SHajimu UMEMOTOaes-xcbc-mac	128		ah: 96bit ICV (RFC3566)
594db540018SHajimu UMEMOTO		128		ah-old: 128bit ICV (no document)
5951922fd12SBruce M Simpsontcp-md5		8 to 640	tcp: rfc2385
5969a4365d0SYoshinobu Inoue.Ed
5979a4365d0SYoshinobu Inoue.Pp
5983c62e87aSJun-ichiro itojun HaginoFollowings are the list of encryption algorithms that can be used as
5999a4365d0SYoshinobu Inoue.Ar ealgo
6009a4365d0SYoshinobu Inouein
6019a4365d0SYoshinobu Inoue.Fl E Ar ealgo
6029a4365d0SYoshinobu Inoueof
6039a4365d0SYoshinobu Inoue.Ar protocol
6049a4365d0SYoshinobu Inoueparameter:
6059a4365d0SYoshinobu Inoue.Pp
6069a4365d0SYoshinobu Inoue.Bd -literal -offset indent
6079a4365d0SYoshinobu Inouealgorithm	keylen (bits)	comment
6089a4365d0SYoshinobu Inouedes-cbc		64		esp-old: rfc1829, esp: rfc2405
6099a4365d0SYoshinobu Inoue3des-cbc	192		rfc2451
610cf43a054SHajimu UMEMOTOnull		0 to 2048	rfc2410
6119a4365d0SYoshinobu Inoueblowfish-cbc	40 to 448	rfc2451
6129a4365d0SYoshinobu Inouecast128-cbc	40 to 128	rfc2451
613cf43a054SHajimu UMEMOTOdes-deriv	64		ipsec-ciph-des-derived-01
6149a4365d0SYoshinobu Inoue3des-deriv	192		no document
615cf43a054SHajimu UMEMOTOrijndael-cbc	128/192/256	rfc3602
616db540018SHajimu UMEMOTOaes-ctr		160/224/288	draft-ietf-ipsec-ciph-aes-ctr-03
6179a4365d0SYoshinobu Inoue.Ed
6189a4365d0SYoshinobu Inoue.Pp
619b42ac57fSHajimu UMEMOTONote that the first 128 bits of a key for
620b42ac57fSHajimu UMEMOTO.Li aes-ctr
621b42ac57fSHajimu UMEMOTOwill be used as AES key, and remaining 32 bits will be used as nonce.
622b42ac57fSHajimu UMEMOTO.Pp
6233c62e87aSJun-ichiro itojun HaginoFollowings are the list of compression algorithms that can be used as
6249a4365d0SYoshinobu Inoue.Ar calgo
6259a4365d0SYoshinobu Inouein
6269a4365d0SYoshinobu Inoue.Fl C Ar calgo
6279a4365d0SYoshinobu Inoueof
6289a4365d0SYoshinobu Inoue.Ar protocol
6299a4365d0SYoshinobu Inoueparameter:
6309a4365d0SYoshinobu Inoue.Pp
6319a4365d0SYoshinobu Inoue.Bd -literal -offset indent
6329a4365d0SYoshinobu Inouealgorithm	comment
6339a4365d0SYoshinobu Inouedeflate		rfc2394
6349a4365d0SYoshinobu Inoue.Ed
6359a4365d0SYoshinobu Inoue.\"
6366992e2a5SRuslan Ermilov.Sh DIAGNOSTICS
6376992e2a5SRuslan Ermilov.Ex -std
638cf43a054SHajimu UMEMOTO.\"
6399a4365d0SYoshinobu Inoue.Sh EXAMPLES
6409a4365d0SYoshinobu Inoue.Bd -literal -offset
6419a4365d0SYoshinobu Inoueadd 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457
642cf43a054SHajimu UMEMOTO	-E des-cbc 0x3ffe05014819ffff ;
6439a4365d0SYoshinobu Inoue
644cf43a054SHajimu UMEMOTOadd -6 myhost.example.com yourhost.example.com ah 123456
6459a4365d0SYoshinobu Inoue	-A hmac-sha1 "AH SA configuration!" ;
6469a4365d0SYoshinobu Inoue
6479a4365d0SYoshinobu Inoueadd 10.0.11.41 10.0.11.33 esp 0x10001
648cf43a054SHajimu UMEMOTO	-E des-cbc 0x3ffe05014819ffff
6499a4365d0SYoshinobu Inoue	-A hmac-md5 "authentication!!" ;
6509a4365d0SYoshinobu Inoue
6519a4365d0SYoshinobu Inoueget 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ;
6529a4365d0SYoshinobu Inoue
6539a4365d0SYoshinobu Inoueflush ;
6549a4365d0SYoshinobu Inoue
6559a4365d0SYoshinobu Inouedump esp ;
6569a4365d0SYoshinobu Inoue
6579a4365d0SYoshinobu Inouespdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any
6589a4365d0SYoshinobu Inoue	-P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ;
6599a4365d0SYoshinobu Inoue
6601922fd12SBruce M Simpsonadd 10.1.10.34 10.1.10.36 tcp 0x1000 -A tcp-md5 "TCP-MD5 BGP secret" ;
6611922fd12SBruce M Simpson
6629a4365d0SYoshinobu Inoue.Ed
6639a4365d0SYoshinobu Inoue.\"
6649a4365d0SYoshinobu Inoue.Sh SEE ALSO
6659a4365d0SYoshinobu Inoue.Xr ipsec_set_policy 3 ,
6665521ff5aSRuslan Ermilov.Xr racoon 8 ,
6675521ff5aSRuslan Ermilov.Xr sysctl 8
668cf43a054SHajimu UMEMOTO.Rs
669cf43a054SHajimu UMEMOTO.%T "Changed manual key configuration for IPsec"
670cf43a054SHajimu UMEMOTO.%O "http://www.kame.net/newsletter/19991007/"
671cf43a054SHajimu UMEMOTO.%D "October 1999"
672cf43a054SHajimu UMEMOTO.Re
6739a4365d0SYoshinobu Inoue.\"
6749a4365d0SYoshinobu Inoue.Sh HISTORY
6759a4365d0SYoshinobu InoueThe
6769a4365d0SYoshinobu Inoue.Nm
6776992e2a5SRuslan Ermilovutility first appeared in WIDE Hydrangea IPv6 protocol stack kit.
6786992e2a5SRuslan ErmilovThe utility was completely re-designed in June 1998.
6793c62e87aSJun-ichiro itojun Hagino.\"
680cf43a054SHajimu UMEMOTO.Sh BUGS
6816992e2a5SRuslan ErmilovThe
682cf43a054SHajimu UMEMOTO.Nm
6836992e2a5SRuslan Ermilovutility
684cf43a054SHajimu UMEMOTOshould report and handle syntax errors better.
685cf43a054SHajimu UMEMOTO.Pp
686cf43a054SHajimu UMEMOTOFor IPsec gateway configuration,
687cf43a054SHajimu UMEMOTO.Ar src_range
688cf43a054SHajimu UMEMOTOand
689cf43a054SHajimu UMEMOTO.Ar dst_range
690cf43a054SHajimu UMEMOTOwith TCP/UDP port number do not work, as the gateway does not reassemble
691cf43a054SHajimu UMEMOTOpackets
6926992e2a5SRuslan Ermilov(cannot inspect upper-layer headers).
693