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.15 2003/03/12 22:08:15 trhodes Exp $
3 .\" $DragonFly: src/usr.sbin/setkey/setkey.8,v 1.7 2008/08/10 21:29:17 hasso Exp $
5 .\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the project nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .Nd "manually manipulate the IPsec SA/SP database"
60 utility adds, updates, dumps, or flushes
61 Security Association Database (SAD) entries
62 as well as Security Policy Database (SPD) entries in the kernel.
66 utility takes a series of operations from the standard input
78 the SPD entries are dumped.
80 Flush the SAD entries.
83 the SPD entries are flushed.
85 Dead SAD entries are usually not displayed with
89 the dead SAD entries will be displayed as well.
90 A dead SAD entry means that
91 it has been expired but remains
92 because it is referenced by SPD entries.
94 Enable to print debugging messages for command parser,
95 without talking to kernel.
96 It is not used usually.
98 Loop forever and dump all the messages transmitted to
102 makes each timestamps unformatted.
104 Add hexadecimal dump on
108 Loop forever with short output on
112 The program will dump messages exchanged on
114 socket, including messages sent from other processes to the kernel.
117 Operations have the following grammar.
118 Note that lines starting with
119 hashmarks ('#') are treated as comment lines.
123 .Ar src Ar dst Ar protocol Ar spi
132 .Ar src Ar dst Ar protocol Ar spi
139 .Ar src Ar dst Ar protocol Ar spi
146 .Ar src Ar dst Ar protocol
149 Remove all SAD entries that match the specification.
156 Clear all SAD entries matched by the options.
163 Dumps all SAD entries matched by the options.
167 .Ar src_range Ar dst_range Ar upperspec Ar policy
174 .Ar src_range Ar dst_range Ar upperspec Fl P Ar direction
183 Clear all SPD entries.
189 Dumps all SPD entries.
193 Meta-arguments are as follows:
195 .Bl -tag -compact -width Ds
198 Source/destination of the secure communication is specified as
202 utility does not consult hostname-to-address for arguments
206 They must be in numeric form.
212 .Bl -tag -width Fl -compact
227 Security Parameter Index (SPI) for the SAD and the SPD.
228 It must be decimal number or hexadecimal number
229 You cannot use the set of SPI values in the range 0 through 255.
236 takes some of the following:
237 .Bl -tag -width Fl -compact
240 Specify a security protocol mode for use.
243 .Li transport , tunnel
250 Specify window size of bytes for replay prevention.
252 must be decimal number in 32-bit word.
255 is zero or not specified, replay check don't take place.
258 Specify the identifier of the policy entry in SPD.
262 .It Fl f Ar pad_option
263 defines the content of the ESP padding.
266 .Bl -tag -width random-pad -compact
268 All of the padding are zero.
270 A series of randomized values are set.
272 A series of sequential increasing numbers started from 1 are set.
275 .It Fl f Li nocyclic-seq
276 Don't allow cyclic sequence number.
280 Specify hard/soft life time duration of the SA.
285 .Bl -tag -width Fl -compact
286 .It Fl E Ar ealgo Ar key
287 Specify an encryption algorithm.
288 .It Fl A Ar aalgo Ar key
289 Specify an authentication algorithm.
293 .Ar protocol Li esp ,
294 it will be treated as ESP payload authentication algorithm.
295 .It Fl C Ar calgo Op Fl R
296 Specify compression algorithm.
299 is not specified with
301 line, the kernel will use well-known IPComp CPI
302 (compression parameter index)
303 on IPComp CPI field on packets, and
305 field will be ignored.
307 field is only for kernel internal use in this case.
308 .\"Therefore, compression protocol number will appear on IPComp CPI field.
314 field will appear on IPComp CPI field on outgoing packets.
316 field needs to be smaller than
326 .Ar protocol Li esp-old
336 .Ar protocol Li ipcomp
342 must be double-quoted character string or series of hexadecimal digits.
349 are specified in separate section.
354 These are selections of the secure communication specified as
355 IPv4/v6 address or IPv4/v6 address range, and it may accompany
356 TCP/UDP port specification.
357 This takes the following form:
360 .Ar address/prefixlen
362 .Ar address/prefixlen[port]
368 must be decimal number.
369 The square bracket around
372 They are not manpage metacharacters.
376 utility does not consult hostname-to-address for arguments
380 They must be in numeric form.
384 Upper-layer protocol to be used.
385 You can use one of words in
398 Also you can use the protocol number.
402 does not work against forwarding case at this moment,
403 as it requires extra reassembly at forwarding node
404 (not implemented at this moment).
405 We have many protocols in
407 but protocols except of TCP, UDP and ICMP may not be suitable to use with IPsec.
408 You have to consider and be careful to use them.
417 is the one of following:
420 .Fl P Ar direction Li discard
423 .Fl P Ar direction Li none
426 .Fl P Ar direction Li ipsec Ar protocol/mode/src-dst/level
430 You must specify the direction of its policy as
438 means the packet matching indexes will be discarded.
440 means that IPsec operation will not take place onto the packet.
442 means that IPsec operation will take place onto the packet.
459 you must specify the end-points addresses of the SA as
465 between these addresses which is used to specify the SA to use.
476 is to be one of the following:
477 .Li default , use , require
480 If the SA is not available in every level, the kernel will request
481 getting SA to the key exchange daemon.
483 means the kernel consults to the system wide default against protocol you
486 sysctl variable, when the kernel processes the packet.
488 means that the kernel use a SA if it's available,
489 otherwise the kernel keeps normal operation.
491 means SA is required whenever the kernel sends a packet matched
494 is the same to require.
495 In addition, it allows the policy to bind with the unique out-bound SA.
496 If you use the SA by manual keying,
497 you can put the decimal number as the policy identifier after
504 must be between 1 and 32767.
506 .Ar extensions Fl u .
512 are not in the syntax described in
513 .Xr ipsec_set_policy 3 .
514 There are little differences in the syntax.
516 .Xr ipsec_set_policy 3
521 The following list shows the supported algorithms.
525 are almost orthogonal.
526 Followings are the list of authentication algorithms that can be used as
533 .Bd -literal -offset indent
534 algorithm keylen (bits) comment
535 hmac-md5 128 ah: rfc2403
537 hmac-sha1 160 ah: rfc2404
538 160 ah-old: 128bit ICV (no document)
539 keyed-md5 128 ah: 96bit ICV (no document)
541 keyed-sha1 160 ah: 96bit ICV (no document)
542 160 ah-old: 128bit ICV (no document)
543 null 0 to 2048 for debugging
544 hmac-sha2-256 256 ah: 96bit ICV (no document)
545 256 ah-old: 128bit ICV (no document)
546 hmac-sha2-384 384 ah: 96bit ICV (no document)
547 384 ah-old: 128bit ICV (no document)
548 hmac-sha2-512 512 ah: 96bit ICV (no document)
549 512 ah-old: 128bit ICV (no document)
552 Followings are the list of encryption algorithms that can be used as
559 .Bd -literal -offset indent
560 algorithm keylen (bits) comment
561 des-cbc 64 esp-old: rfc1829, esp: rfc2405
563 simple 0 to 2048 rfc2410
564 blowfish-cbc 40 to 448 rfc2451
565 cast128-cbc 40 to 128 rfc2451
566 des-deriv 64 ipsec-ciph-des-derived-01 (expired)
567 3des-deriv 192 no document
568 rijndael-cbc 128/192/256 draft-ietf-ipsec-ciph-aes-cbc-00
571 Followings are the list of compression algorithms that can be used as
578 .Bd -literal -offset indent
586 add 2001:db8:4819::1 2001:db8:481d::1 esp 123457
587 -E des-cbc "ESP SA!!" ;
589 add 2001:db8:4819::1 2001:db8:481d::1 ah 123456
590 -A hmac-sha1 "AH SA configuration!" ;
592 add 10.0.11.41 10.0.11.33 esp 0x10001
593 -E des-cbc "ESP with"
594 -A hmac-md5 "authentication!!" ;
596 get 2001:db8:4819::1 2001:db8:481d::1 ah 123456 ;
602 spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any
603 -P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ;
608 The command exits with 0 on success, and non-zero on errors.
611 .Xr ipsec_set_policy 3 ,
618 utility first appeared in WIDE Hydrangea IPv6 protocol stack kit.
619 The command was completely re-designed in June 1998.