xref: /netbsd-src/crypto/dist/ipsec-tools/src/setkey/setkey.8 (revision 7788a0781fe6ff2cce37368b4578a7ade0850cb1)
1.\"	$NetBSD: setkey.8,v 1.34 2012/02/18 13:51:29 wiz Exp $
2.\"
3.\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the project nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.Dd February 18, 2012
31.Dt SETKEY 8
32.Os
33.\"
34.Sh NAME
35.Nm setkey
36.Nd manually manipulate the IPsec SA/SP database
37.\"
38.Sh SYNOPSIS
39.Nm setkey
40.Op Fl knrv
41.Ar file ...
42.Nm setkey
43.Op Fl knrv
44.Fl c
45.Nm setkey
46.Op Fl krv
47.Fl f Ar filename
48.Nm setkey
49.Op Fl aklPrv
50.Fl D
51.Nm setkey
52.Op Fl Pvp
53.Fl F
54.Nm setkey
55.Op Fl H
56.Fl x
57.Nm setkey
58.Op Fl ?V
59.\"
60.Sh DESCRIPTION
61.Nm
62adds, updates, dumps, or flushes
63Security Association Database (SAD) entries
64as well as Security Policy Database (SPD) entries in the kernel.
65.Pp
66.Nm
67takes a series of operations from standard input
68.Po
69if invoked with
70.Fl c
71.Pc
72or the file named
73.Ar filename
74.Po
75if invoked with
76.Fl f Ar filename
77.Pc .
78.Bl -tag -width Ds
79.It (no flag)
80Dump the SAD entries or SPD entries contained in the specified
81.Ar file .
82.It Fl ?
83Print short help.
84.It Fl a
85.Nm
86usually does not display dead SAD entries with
87.Fl D .
88If
89.Fl a
90is also specified, the dead SAD entries will be displayed as well.
91A dead SAD entry is one that has expired but remains in the
92system because it is referenced by some SPD entries.
93.It Fl D
94Dump the SAD entries.
95If
96.Fl P
97is also specified, the SPD entries are dumped.
98If
99.Fl p
100is specified, the ports are displayed.
101.It Fl F
102Flush the SAD entries.
103If
104.Fl P
105is also specified, the SPD entries are flushed.
106.It Fl H
107Add hexadecimal dump in
108.Fl x
109mode.
110.It Fl h
111On
112.Nx ,
113synonym for
114.Fl H .
115On other systems, synonym for
116.Fl ? .
117.It Fl k
118Use semantics used in kernel.
119Available only in Linux.
120See also
121.Fl r .
122.It Fl l
123Loop forever with short output on
124.Fl D .
125.It Fl n
126No action.
127The program will check validity of the input, but no changes to
128the SPD will be made.
129.It Fl r
130Use semantics described in IPsec RFCs.
131This mode is default.
132For details see section
133.Sx RFC vs Linux kernel semantics .
134Available only in Linux.
135See also
136.Fl k .
137.It Fl x
138Loop forever and dump all the messages transmitted to the
139.Dv PF_KEY
140socket.
141.Fl xx
142prints the unformatted timestamps.
143.It Fl V
144Print version string.
145.It Fl v
146Be verbose.
147The program will dump messages exchanged on the
148.Dv PF_KEY
149socket, including messages sent from other processes to the kernel.
150.El
151.Ss Configuration syntax
152With
153.Fl c
154or
155.Fl f
156on the command line,
157.Nm
158accepts the following configuration syntax.
159Lines starting with hash signs
160.Pq Sq #
161are treated as comment lines.
162.Bl -tag -width Ds
163.It Li add Oo Fl 46n Oc Ar src Ar dst Ar protocol Ar spi \
164Oo Ar extensions Oc Ar algorithm ... Li ;
165Add an SAD entry.
166.Li add
167can fail for multiple reasons, including when the key length does
168not match the specified algorithm.
169.\"
170.It Li get Oo Fl 46n Oc Ar src Ar dst Ar protocol Ar spi Li ;
171Show an SAD entry.
172.\"
173.It Li delete Oo Fl 46n Oc Ar src Ar dst Ar protocol Ar spi Li ;
174Remove an SAD entry.
175.\"
176.It Li deleteall Oo Fl 46n Oc Ar src Ar dst Ar protocol Li ;
177Remove all SAD entries that match the specification.
178.\"
179.It Li flush Oo Ar protocol Oc Li ;
180Clear all SAD entries matched by the options.
181.Fl F
182on the command line achieves the same functionality.
183.\"
184.It Li dump Oo Ar protocol Oc Li ;
185Dumps all SAD entries matched by the options.
186.Fl D
187on the command line achieves the same functionality.
188.\"
189.It Li spdadd Oo Fl 46n Oc Ar src_range Ar dst_range Ar upperspec \
190Ar label Ar policy Li ;
191Add an SPD entry.
192.\"
193.It Li spdadd tagged Ar tag Ar policy Li ;
194Add an SPD entry based on a PF tag.
195.Ar tag
196must be a string surrounded by double quotes.
197.\"
198.It Li spdupdate Oo Fl 46n Oc Ar src_range Ar dst_range Ar upperspec \
199Ar label Ar policy Li ;
200Updates an SPD entry.
201.\"
202.It Li spdupdate tagged Ar tag Ar policy Li ;
203Update an SPD entry based on a PF tag.
204.Ar tag
205must be a string surrounded by double quotes.
206.\"
207.It Li spddelete Oo Fl 46n Oc Ar src_range Ar dst_range Ar upperspec \
208Fl P Ar direction Li ;
209Delete an SPD entry.
210.\"
211.It Li spdflush Li ;
212Clear all SPD entries.
213.Fl FP
214on the command line achieves the same functionality.
215.\"
216.It Li spddump Li ;
217Dumps all SPD entries.
218.Fl DP
219on the command line achieves the same functionality.
220.El
221.\"
222.Pp
223Meta-arguments are as follows:
224.Pp
225.Bl -tag -compact -width Ds
226.It Ar src
227.It Ar dst
228Source/destination of the secure communication is specified as
229an IPv4/v6 address, and an optional port number between square
230brackets.
231.Nm
232can resolve a FQDN into numeric addresses.
233If the FQDN resolves into multiple addresses,
234.Nm
235will install multiple SAD/SPD entries into the kernel
236by trying all possible combinations.
237.Fl 4 ,
238.Fl 6 ,
239and
240.Fl n
241restrict the address resolution of FQDN in certain ways.
242.Fl 4
243and
244.Fl 6
245restrict results into IPv4/v6 addresses only, respectively.
246.Fl n
247avoids FQDN resolution and requires addresses to be numeric addresses.
248.\"
249.Pp
250.It Ar protocol
251.Ar protocol
252is one of following:
253.Bl -tag -width Fl -compact
254.It Li esp
255ESP based on rfc2406
256.It Li esp-old
257ESP based on rfc1827
258.It Li esp-udp
259UDP encapsulated ESP for NAT traversal (rfc3948)
260.It Li ah
261AH based on rfc2402
262.It Li ah-old
263AH based on rfc1826
264.It Li ipcomp
265IPComp
266.It Li tcp
267TCP-MD5 based on rfc2385
268.El
269.\"
270.Pp
271.It Ar spi
272Security Parameter Index
273.Pq SPI
274for the SAD and the SPD.
275.Ar spi
276must be a decimal number, or a hexadecimal number with a
277.Dq Li 0x
278prefix.
279SPI values between 0 and 255 are reserved for future use by IANA
280and cannot be used.
281TCP-MD5 associations must use 0x1000 and therefore only have per-host
282granularity at this time.
283.\"
284.Pp
285.It Ar extensions
286take some of the following:
287.Bl -tag -width Fl -compact
288.\"
289.It Fl m Ar mode
290Specify a security protocol mode for use.
291.Ar mode
292is one of following:
293.Li transport , tunnel ,
294or
295.Li any .
296The default value is
297.Li any .
298.\"
299.It Fl r Ar size
300Specify window size of bytes for replay prevention.
301.Ar size
302must be decimal number in 32-bit word.
303If
304.Ar size
305is zero or not specified, replay checks don't take place.
306.\"
307.It Fl u Ar id
308Specify the identifier of the policy entry in the SPD.
309See
310.Ar policy .
311.\"
312.It Fl f Ar pad_option
313defines the content of the ESP padding.
314.Ar pad_option
315is one of following:
316.Bl -tag -width random-pad -compact
317.It Li zero-pad
318All the paddings are zero.
319.It Li random-pad
320A series of randomized values are used.
321.It Li seq-pad
322A series of sequential increasing numbers started from 1 are used.
323.El
324.\"
325.It Fl f Li nocyclic-seq
326Don't allow cyclic sequence numbers.
327.\"
328.It Fl lh Ar time
329.It Fl ls Ar time
330Specify hard/soft life time duration of the SA measured in seconds.
331.\"
332.It Fl bh Ar bytes
333.It Fl bs Ar bytes
334Specify hard/soft life time duration of the SA measured in bytes transported.
335.\"
336.It Fl esp_frag Ar bytes
337Specify esp fragment size for NAT-T (only valid for NAT-T SAs).
338.\"
339.It Fl ctx Ar doi Ar algorithm Ar context-name
340Specify an access control label.
341The access control label is interpreted by the LSM (e.g., SELinux).
342Ultimately, it enables MAC on network communications.
343.Bl -tag -width Fl -compact
344.It Ar doi
345The domain of interpretation, which is used by the
346IKE daemon to identify the domain in which negotiation takes place.
347.It Ar algorithm
348Indicates the LSM for which the label is generated (e.g., SELinux).
349.It Ar context-name
350The string representation of the label that is interpreted by the LSM.
351.El
352.El
353.\"
354.Pp
355.It Ar algorithm
356.Bl -tag -width Fl -compact
357.It Fl E Ar ealgo Ar key
358Specify an encryption algorithm
359.Ar ealgo
360for ESP.
361.It Fl E Ar ealgo Ar key Fl A Ar aalgo Ar key
362Specify an encryption algorithm
363.Ar ealgo ,
364as well as a payload authentication algorithm
365.Ar aalgo ,
366for ESP.
367.It Fl A Ar aalgo Ar key
368Specify an authentication algorithm for AH.
369.It Fl C Ar calgo Op Fl R
370Specify a compression algorithm for IPComp.
371If
372.Fl R
373is specified, the
374.Ar spi
375field value will be used as the IPComp CPI
376.Pq compression parameter index
377on wire as-is.
378If
379.Fl R
380is not specified,
381the kernel will use well-known CPI on wire, and
382.Ar spi
383field will be used only as an index for kernel internal usage.
384.El
385.Pp
386.Ar key
387must be a double-quoted character string, or a series of hexadecimal
388digits preceded by
389.Dq Li 0x .
390.Pp
391Possible values for
392.Ar ealgo ,
393.Ar aalgo ,
394and
395.Ar calgo
396are specified in the
397.Sx Algorithms
398sections.
399.\"
400.Pp
401.It Ar src_range
402.It Ar dst_range
403These select the communications that should be secured by IPsec.
404They can be an IPv4/v6 address or an IPv4/v6 address range, and
405may be accompanied by a TCP/UDP port specification.
406This takes the following form:
407.Bd -literal -offset
408.Ar address
409.Ar address/prefixlen
410.Ar address[port]
411.Ar address/prefixlen[port]
412.Ed
413.Pp
414.Ar prefixlen
415and
416.Ar port
417must be decimal numbers.
418The square brackets around
419.Ar port
420are really necessary,
421they are not man page meta-characters.
422For FQDN resolution, the rules applicable to
423.Ar src
424and
425.Ar dst
426apply here as well.
427.\"
428.Pp
429.It Ar upperspec
430Upper-layer protocol to be used.
431You can use one of the words in
432.Pa /etc/protocols
433as
434.Ar upperspec ,
435or
436.Li icmp6 ,
437.Li ip4 ,
438.Li gre ,
439or
440.Li any .
441.Li any
442stands for
443.Dq any protocol .
444You can also use the protocol number.
445Additional specification can be placed after the protocol name for
446some protocols.
447You can specify a type and/or a code of ICMP or ICMPv6.
448The type is separated from a code by single comma and the code must
449always be specified.
450GRE key can be specified in dotted-quad format or as plain number.
451When a zero is specified, the kernel deals with it as a wildcard.
452Note that the kernel can not distinguish a wildcard from an ICPMv6
453type of zero.
454.Pp
455For example, the following means that the policy doesn't require IPsec
456for any inbound Neighbor Solicitation.
457.Dl spdadd ::/0 ::/0 icmp6 135,0 -P in none ;
458.Pp
459A second example of requiring transport mode encryption of specific
460GRE tunnel:
461.Dl spdadd 0.0.0.0 0.0.0.0 gre 1234 ipsec esp/transport//require ;
462.Pp
463.Em Note :
464.Ar upperspec
465does not work against forwarding case at this moment,
466as it requires extra reassembly at the forwarding node
467.Pq not implemented at this moment .
468There are many protocols in
469.Pa /etc/protocols ,
470but all protocols except of TCP, UDP, GRE, and ICMP may not be suitable
471to use with IPsec.
472You have to consider carefully what to use.
473.\"
474.Pp
475.It Ar label
476.Ar label
477is the access control label for the policy.
478This label is interpreted by the LSM (e.g., SELinux).
479Ultimately, it enables MAC on network communications.
480When a policy contains an access control label, SAs
481negotiated with this policy will contain the label.
482Its format:
483.Bl -tag -width Fl -compact
484.\"
485.It Fl ctx Ar doi Ar algorithm Ar context-name
486.Bl -tag -width Fl -compact
487.It Ar doi
488The domain of interpretation, which is used by the
489IKE daemon to identify the domain in which negotiation takes place.
490.It Ar algorithm
491Indicates the LSM for which the label is generated (e.g., SELinux).
492.It Ar context-name
493The string representation of the label that is interpreted by the LSM.
494.El
495.El
496.\"
497.Pp
498.It Ar policy
499.Ar policy
500is in one of the following three formats:
501.Bl -item -compact
502.It
503.Fl P Ar direction [priority specification] Li discard
504.It
505.Fl P Ar direction [priority specification] Li none
506.It
507.Fl P Ar direction [priority specification] Li ipsec
508.Ar protocol/mode/src-dst/level Op ...
509.El
510.Pp
511You must specify the direction of its policy as
512.Ar direction .
513Either
514.Ar out ,
515.Ar in ,
516or
517.Ar fwd
518can be used.
519.Pp
520.Ar priority specification
521is used to control the placement of the policy within the SPD.
522Policy position is determined by
523a signed integer where higher priorities indicate the policy is placed
524closer to the beginning of the list and lower priorities indicate the
525policy is placed closer to the end of the list.
526Policies with equal priorities are added at the end of groups
527of such policies.
528.Pp
529Priority can only
530be specified when setkey has been compiled against kernel headers that
531support policy priorities (Linux \*[Gt]= 2.6.6).
532If the kernel does not support priorities, a warning message will
533be printed the first time a priority specification is used.
534Policy priority takes one of the following formats:
535.Bl -tag  -width "discard"
536.It Ar {priority,prio} offset
537.Ar offset
538is an integer in the range from \-2147483647 to 214783648.
539.It Ar {priority,prio} base {+,\-} offset
540.Ar base
541is either
542.Li low (\-1073741824) ,
543.Li def (0) ,
544or
545.Li high (1073741824)
546.Pp
547.Ar offset
548is an unsigned integer.
549It can be up to 1073741824 for
550positive offsets, and up to 1073741823 for negative offsets.
551.El
552.Pp
553.Li discard
554means the packet matching indexes will be discarded.
555.Li none
556means that IPsec operation will not take place onto the packet.
557.Li ipsec
558means that IPsec operation will take place onto the packet.
559.Pp
560The
561.Ar protocol/mode/src-dst/level
562part specifies the rule how to process the packet.
563Either
564.Li ah ,
565.Li esp ,
566or
567.Li ipcomp
568must be used as
569.Ar protocol .
570.Ar mode
571is either
572.Li transport
573or
574.Li tunnel .
575If
576.Ar mode
577is
578.Li tunnel ,
579you must specify the end-point addresses of the SA as
580.Ar src
581and
582.Ar dst
583with
584.Sq -
585between these addresses, which is used to specify the SA to use.
586If
587.Ar mode
588is
589.Li transport ,
590both
591.Ar src
592and
593.Ar dst
594can be omitted.
595.Ar level
596is to be one of the following:
597.Li default , use , require ,
598or
599.Li unique .
600If the SA is not available in every level, the kernel will
601ask the key exchange daemon to establish a suitable SA.
602.Li default
603means the kernel consults the system wide default for the protocol
604you specified, e.g. the
605.Li esp_trans_deflev
606sysctl variable, when the kernel processes the packet.
607.Li use
608means that the kernel uses an SA if it's available,
609otherwise the kernel keeps normal operation.
610.Li require
611means SA is required whenever the kernel sends a packet matched
612with the policy.
613.Li unique
614is the same as
615.Li require ;
616in addition, it allows the policy to match the unique out-bound SA.
617You just specify the policy level
618.Li unique ,
619.Xr racoon 8
620will configure the SA for the policy.
621If you configure the SA by manual keying for that policy,
622you can put a decimal number as the policy identifier after
623.Li unique
624separated by a colon
625.Sq \&:
626like:
627.Li unique:number
628in order to bind this policy to the SA.
629.Li number
630must be between 1 and 32767.
631It corresponds to
632.Ar extensions Fl u
633of the manual SA configuration.
634When you want to use SA bundle, you can define multiple rules.
635For example, if an IP header was followed by an AH header followed
636by an ESP header followed by an upper layer protocol header, the
637rule would be:
638.Dl esp/transport//require ah/transport//require ;
639The rule order is very important.
640.Pp
641When NAT-T is enabled in the kernel, policy matching for ESP over
642UDP packets may be done on endpoint addresses and port
643(this depends on the system.
644System that do not perform the port check cannot support
645multiple endpoints behind the same NAT).
646When using ESP over UDP, you can specify port numbers in the endpoint
647addresses to get the correct matching.
648Here is an example:
649.Bd -literal -offset
650spdadd 10.0.11.0/24[any] 10.0.11.33/32[any] any \-P out ipsec
651    esp/tunnel/192.168.0.1[4500]-192.168.1.2[30000]/require ;
652
653.Ed
654These ports must be left unspecified (which defaults to 0) for
655anything other than ESP over UDP.
656They can be displayed in SPD dump using
657.Nm
658.Fl DPp .
659.Pp
660Note that
661.Dq Li discard
662and
663.Dq Li none
664are not in the syntax described in
665.Xr ipsec_set_policy 3 .
666There are a few differences in the syntax.
667See
668.Xr ipsec_set_policy 3
669for detail.
670.El
671.\"
672.Ss Algorithms
673The following list shows the supported algorithms.
674.Sy protocol
675and
676.Sy algorithm
677are almost orthogonal.
678These authentication algorithms can be used as
679.Ar aalgo
680in
681.Fl A Ar aalgo
682of the
683.Ar protocol
684parameter:
685.Pp
686.Bd -literal -offset indent
687algorithm	keylen (bits)
688hmac-md5	128		ah: rfc2403
689		128		ah-old: rfc2085
690hmac-sha1	160		ah: rfc2404
691		160		ah-old: 128bit ICV (no document)
692keyed-md5	128		ah: 96bit ICV (no document)
693		128		ah-old: rfc1828
694keyed-sha1	160		ah: 96bit ICV (no document)
695		160		ah-old: 128bit ICV (no document)
696null		0 to 2048	for debugging
697hmac-sha256	256		ah: 128bit ICV (RFC4868)
698		256		ah-old: 128bit ICV (no document)
699hmac-sha384	384		ah: 192bit ICV (RFC4868)
700		384		ah-old: 128bit ICV (no document)
701hmac-sha512	512		ah: 256bit ICV (RFC4868)
702		512		ah-old: 128bit ICV (no document)
703hmac-ripemd160	160		ah: 96bit ICV (RFC2857)
704				ah-old: 128bit ICV (no document)
705aes-xcbc-mac	128		ah: 96bit ICV (RFC3566)
706		128		ah-old: 128bit ICV (no document)
707tcp-md5		8 to 640	tcp: rfc2385
708.Ed
709.Pp
710These encryption algorithms can be used as
711.Ar ealgo
712in
713.Fl E Ar ealgo
714of the
715.Ar protocol
716parameter:
717.Pp
718.Bd -literal -offset indent
719algorithm	keylen (bits)
720des-cbc		64		esp-old: rfc1829, esp: rfc2405
7213des-cbc	192		rfc2451
722null		0 to 2048	rfc2410
723blowfish-cbc	40 to 448	rfc2451
724cast128-cbc	40 to 128	rfc2451
725des-deriv	64		ipsec-ciph-des-derived-01
7263des-deriv	192		no document
727rijndael-cbc	128/192/256	rfc3602
728twofish-cbc	0 to 256	draft-ietf-ipsec-ciph-aes-cbc-01
729aes-ctr		160/224/288	rfc3686
730camellia-cbc	128/192/256	rfc4312
731aes-gcm-16	160/224/288	rfc4106
732aes-gmac	160/224/288	rfc4543
733.Ed
734.Pp
735Note that the first 128/192/256 bits of a key for
736.Li aes-ctr ,
737.Li aes-gcm-16
738or
739.Li aes-gmac
740will be used as AES key, and the remaining 32 bits will be used as nonce.
741Also note that
742.Li aes-gmac
743does not encrypt the payload, it only provides authentication.
744.Pp
745These compression algorithms can be used as
746.Ar calgo
747in
748.Fl C Ar calgo
749of the
750.Ar protocol
751parameter:
752.Pp
753.Bd -literal -offset indent
754algorithm
755deflate		rfc2394
756.Ed
757.\"
758.Ss RFC vs Linux kernel semantics
759The Linux kernel uses the
760.Ar fwd
761policy instead of the
762.Ar in
763policy for packets what are forwarded through that particular box.
764.Pp
765In
766.Ar kernel
767mode,
768.Nm
769manages and shows policies and SAs exactly as they are stored in the kernel.
770.Pp
771In
772.Ar RFC
773mode,
774.Nm
775.Bl -item
776.It
777creates
778.Ar fwd
779policies for every
780.Ar in
781policy inserted
782.It
783(not implemented yet) filters out all
784.Ar fwd
785policies
786.El
787.Sh RETURN VALUES
788The command exits with 0 on success, and non-zero on errors.
789.\"
790.Sh EXAMPLES
791.Bd -literal -offset
792add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457
793	\-E des-cbc 0x3ffe05014819ffff ;
794
795add \-6 myhost.example.com yourhost.example.com ah 123456
796	\-A hmac-sha1 "AH SA configuration!" ;
797
798add 10.0.11.41 10.0.11.33 esp 0x10001
799	\-E des-cbc 0x3ffe05014819ffff
800	\-A hmac-md5 "authentication!!" ;
801
802get 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ;
803
804flush ;
805
806dump esp ;
807
808spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any
809	\-P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ;
810
811add 10.1.10.34 10.1.10.36 tcp 0x1000 \-A tcp-md5 "TCP-MD5 BGP secret" ;
812
813add 10.0.11.41 10.0.11.33 esp 0x10001
814	\-ctx 1 1 "system_u:system_r:unconfined_t:SystemLow-SystemHigh"
815	\-E des-cbc 0x3ffe05014819ffff;
816
817spdadd 10.0.11.41 10.0.11.33 any
818	\-ctx 1 1 "system_u:system_r:unconfined_t:SystemLow-SystemHigh"
819	\-P out ipsec esp/transport//require ;
820.Ed
821.\"
822.Sh SEE ALSO
823.Xr ipsec_set_policy 3 ,
824.Xr racoon 8 ,
825.Xr sysctl 8
826.Rs
827.%T "Changed manual key configuration for IPsec"
828.%U "http://www.kame.net/newsletter/19991007/"
829.%D "October 1999"
830.Re
831.\"
832.Sh HISTORY
833The
834.Nm
835command first appeared in the WIDE Hydrangea IPv6 protocol stack
836kit.
837The command was completely re-designed in June 1998.
838.\"
839.Sh BUGS
840.Nm
841should report and handle syntax errors better.
842.Pp
843For IPsec gateway configuration,
844.Ar src_range
845and
846.Ar dst_range
847with TCP/UDP port numbers does not work, as the gateway does not
848reassemble packets
849.Pq it cannot inspect upper-layer headers .
850