1 .\" $KAME: setkey.8,v 1.49 2001/05/18 05:49:51 sakane Exp $
2 .\" $FreeBSD: src/usr.sbin/setkey/setkey.8,v 1.4.2.12 2001/08/16 15:56:32 ru Exp $
4 .\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the project nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 .Nd "manually manipulate the IPsec SA/SP database"
58 adds, updates, dumps, or flushes
59 Security Association Database (SAD) entries
60 as well as Security Policy Database (SPD) entries in the kernel.
63 takes a series of operations from the standard input
75 the SPD entries are dumped.
77 Flush the SAD entries.
80 the SPD entries are flushed.
83 usually does not display dead SAD entries with
87 the dead SAD entries will be displayed as well.
88 A dead SAD entry means that
89 it has been expired but remains
90 because it is referenced by SPD entries.
92 Enable to print debugging messages for command parser,
93 without talking to kernel.
94 It is not used usually.
96 Loop forever and dump all the messages transmitted to
100 makes each timestamps unformatted.
102 Add hexadecimal dump on
106 Loop forever with short output on
110 The program will dump messages exchanged on
112 socket, including messages sent from other processes to the kernel.
115 Operations have the following grammar.
116 Note that lines starting with
117 hashmarks ('#') are treated as comment lines.
121 .Ar src Ar dst Ar protocol Ar spi
130 .Ar src Ar dst Ar protocol Ar spi
137 .Ar src Ar dst Ar protocol Ar spi
144 .Ar src Ar dst Ar protocol
147 Remove all SAD entries that match the specification.
154 Clear all SAD entries matched by the options.
161 Dumps all SAD entries matched by the options.
165 .Ar src_range Ar dst_range Ar upperspec Ar policy
172 .Ar src_range Ar dst_range Ar upperspec Fl P Ar direction
181 Clear all SPD entries.
187 Dumps all SPD entries.
191 Meta-arguments are as follows:
193 .Bl -tag -compact -width Ds
196 Source/destination of the secure communication is specified as
199 does not consult hostname-to-address for arguments
203 They must be in numeric form.
209 .Bl -tag -width Fl -compact
224 Security Parameter Index (SPI) for the SAD and the SPD.
225 It must be decimal number or hexadecimal number
226 You cannot use the set of SPI values in the range 0 through 255.
233 takes some of the following:
234 .Bl -tag -width Fl -compact
237 Specify a security protocol mode for use.
240 .Li transport , tunnel
247 Specify window size of bytes for replay prevention.
249 must be decimal number in 32-bit word.
252 is zero or not specified, replay check don't take place.
255 Specify the identifier of the policy entry in SPD.
259 .It Fl f Ar pad_option
260 defines the content of the ESP padding.
263 .Bl -tag -width random-pad -compact
265 All of the padding are zero.
267 A series of randomized values are set.
269 A series of sequential increasing numbers started from 1 are set.
272 .It Fl f Li nocyclic-seq
273 Don't allow cyclic sequence number.
277 Specify hard/soft life time duration of the SA.
282 .Bl -tag -width Fl -compact
283 .It Fl E Ar ealgo Ar key
284 Specify a encryption algorithm.
285 .It Fl A Ar aalgo Ar key
286 Specify a authentication algorithm.
290 .Ar protocol Li esp ,
291 it will be treated as ESP payload authentication algorithm.
292 .It Fl C Ar calgo Op Fl R
293 Specify compression algorithm.
296 is not specified with
298 line, the kernel will use well-known IPComp CPI
299 (compression parameter index)
300 on IPComp CPI field on packets, and
302 field will be ignored.
304 field is only for kernel internal use in this case.
305 .\"Therefore, compression protocol number will appear on IPComp CPI field.
311 field will appear on IPComp CPI field on outgoing packets.
313 field needs to be smaller than
323 .Ar protocol Li esp-old
333 .Ar protocol Li ipcomp
339 must be double-quoted character string or series of hexadecimal digits.
346 are specified in separate section.
351 These are selections of the secure communication specified as
352 IPv4/v6 address or IPv4/v6 address range, and it may accompany
353 TCP/UDP port specification.
354 This takes the following form:
357 .Ar address/prefixlen
359 .Ar address/prefixlen[port]
365 must be decimal number.
366 The square bracket around
369 They are not manpage metacharacters.
372 does not consult hostname-to-address for arguments
376 They must be in numeric form.
380 Upper-layer protocol to be used.
381 You can use one of words in
394 Also you can use the protocol number.
398 does not work against forwarding case at this moment,
399 as it requires extra reassembly at forwarding node
400 (not implemented at this moment).
401 We have many protocols in
403 but protocols except of TCP, UDP and ICMP may not be suitable to use with IPSec.
404 You have to consider and be careful to use them.
413 is the one of following:
429 .Ar protocol/mode/src-dst/level
433 You must specify the direction of its policy as
441 means the packet matching indexes will be discarded.
443 means that IPsec operation will not take place onto the packet.
445 means that IPsec operation will take place onto the packet.
462 you must specify the end-points addresses of the SA as
468 between these addresses which is used to specify the SA to use.
479 is to be one of the following:
480 .Li default , use , require
483 If the SA is not available in every level, the kernel will request
484 getting SA to the key exchange daemon.
486 means the kernel consults to the system wide default against protocol you
489 sysctl variable, when the kernel processes the packet.
491 means that the kernel use a SA if it's available,
492 otherwise the kernel keeps normal operation.
494 means SA is required whenever the kernel sends a packet matched
497 is the same to require.
498 In addition, it allows the policy to bind with the unique out-bound SA.
499 If you use the SA by manual keying,
500 you can put the decimal number as the policy identifier after
507 must be between 1 and 32767.
509 .Ar extensions Fl u .
515 are not in the syntax described in
516 .Xr ipsec_set_policy 3 .
517 There are little differences in the syntax.
519 .Xr ipsec_set_policy 3
526 The following list shows the supported algorithms.
530 are almost orthogonal.
531 Followings are the list of authentication algorithms that can be used as
539 .Bd -literal -offset indent
540 algorithm keylen (bits) comment
541 hmac-md5 128 ah: rfc2403
543 hmac-sha1 160 ah: rfc2404
544 160 ah-old: 128bit ICV (no document)
545 keyed-md5 128 ah: 96bit ICV (no document)
547 keyed-sha1 160 ah: 96bit ICV (no document)
548 160 ah-old: 128bit ICV (no document)
549 null 0 to 2048 for debugging
550 hmac-sha2-256 256 ah: 96bit ICV (no document)
551 256 ah-old: 128bit ICV (no document)
552 hmac-sha2-384 384 ah: 96bit ICV (no document)
553 384 ah-old: 128bit ICV (no document)
554 hmac-sha2-512 512 ah: 96bit ICV (no document)
555 512 ah-old: 128bit ICV (no document)
558 Followings are the list of encryption algorithms that can be used as
566 .Bd -literal -offset indent
567 algorithm keylen (bits) comment
568 des-cbc 64 esp-old: rfc1829, esp: rfc2405
570 simple 0 to 2048 rfc2410
571 blowfish-cbc 40 to 448 rfc2451
572 cast128-cbc 40 to 128 rfc2451
573 des-deriv 64 ipsec-ciph-des-derived-01 (expired)
574 3des-deriv 192 no document
575 rijndael-cbc 128/192/256 draft-ietf-ipsec-ciph-aes-cbc-00
578 Followings are the list of compression algorithms that can be used as
586 .Bd -literal -offset indent
594 add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457
595 -E des-cbc "ESP SA!!" ;
597 add 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456
598 -A hmac-sha1 "AH SA configuration!" ;
600 add 10.0.11.41 10.0.11.33 esp 0x10001
601 -E des-cbc "ESP with"
602 -A hmac-md5 "authentication!!" ;
604 get 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ;
610 spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any
611 -P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ;
616 The command exits with 0 on success, and non-zero on errors.
619 .Xr ipsec_set_policy 3 ,
626 command first appeared in WIDE Hydrangea IPv6 protocol stack kit.
627 The command was completely re-designed in June 1998.