summaryrefslogtreecommitdiffstats
path: root/usr.sbin/setkey/setkey.8
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2003-11-05 09:47:54 +0000
committerume <ume@FreeBSD.org>2003-11-05 09:47:54 +0000
commit832d3f0af5caaf598c2d5fad02933d42fad01078 (patch)
treef650d6c8624acdedbc28ef079442ba99097fdba0 /usr.sbin/setkey/setkey.8
parent1b0d2b237ef5dc12f3fb211efc7b75ca8569ceea (diff)
downloadFreeBSD-src-832d3f0af5caaf598c2d5fad02933d42fad01078.zip
FreeBSD-src-832d3f0af5caaf598c2d5fad02933d42fad01078.tar.gz
- 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
Diffstat (limited to 'usr.sbin/setkey/setkey.8')
-rw-r--r--usr.sbin/setkey/setkey.8320
1 files changed, 183 insertions, 137 deletions
diff --git a/usr.sbin/setkey/setkey.8 b/usr.sbin/setkey/setkey.8
index 4ab8927..ebe28e2 100644
--- a/usr.sbin/setkey/setkey.8
+++ b/usr.sbin/setkey/setkey.8
@@ -1,4 +1,4 @@
-.\" $KAME: setkey.8,v 1.49 2001/05/18 05:49:51 sakane Exp $
+.\" $KAME: setkey.8,v 1.89 2003/09/07 22:17:41 itojun Exp $
.\" $FreeBSD$
.\"
.\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@@ -34,20 +34,20 @@
.\"
.Sh NAME
.Nm setkey
-.Nd "manually manipulate the IPsec SA/SP database"
+.Nd manually manipulate the IPsec SA/SP database
.\"
.Sh SYNOPSIS
.Nm
-.Op Fl dv
+.Op Fl v
.Fl c
.Nm
-.Op Fl dv
+.Op Fl v
.Fl f Ar filename
.Nm
-.Op Fl adPlv
+.Op Fl aPlv
.Fl D
.Nm
-.Op Fl dPv
+.Op Fl Pv
.Fl F
.Nm
.Op Fl h
@@ -56,19 +56,23 @@
.Sh DESCRIPTION
The
.Nm
-utility adds, updates, dumps, or flushes
+command adds, updates, dumps, or flushes
Security Association Database (SAD) entries
as well as Security Policy Database (SPD) entries in the kernel.
.Pp
The
.Nm
-utility takes a series of operations from the standard input
-(if invoked with
-.Fl c )
+command takes a series of operations from the standard input
+.Po
+if invoked with
+.Fl c
+.Pc
or the file named
.Ar filename
-(if invoked with
-.Fl f Ar filename ) .
+.Po
+if invoked with
+.Fl f Ar filename
+.Pc .
.Bl -tag -width Ds
.It Fl D
Dump the SAD entries.
@@ -81,24 +85,15 @@ If with
.Fl P ,
the SPD entries are flushed.
.It Fl a
-Dead SAD entries are usually not displayed with
+.Nm
+usually does not display dead SAD entries with
.Fl D .
If with
.Fl a ,
the dead SAD entries will be displayed as well.
A dead SAD entry means that
-it has been expired but remains
-because it is referenced by SPD entries.
-.It Fl d
-Enable to print debugging messages for command parser,
-without talking to kernel.
-It is not used usually.
-.It Fl x
-Loop forever and dump all the messages transmitted to
-.Dv PF_KEY
-socket.
-.Fl xx
-makes each timestamps unformatted.
+it has been expired but remains in the system
+because it is referenced by some SPD entries.
.It Fl h
Add hexadecimal dump on
.Fl x
@@ -111,23 +106,39 @@ Be verbose.
The program will dump messages exchanged on
.Dv PF_KEY
socket, including messages sent from other processes to the kernel.
+.It Fl x
+Loop forever and dump all the messages transmitted to
+.Dv PF_KEY
+socket.
+.Fl xx
+makes each timestamps unformatted.
.El
-.Pp
-Operations have the following grammar.
-Note that lines starting with
-hashmarks ('#') are treated as comment lines.
+.Ss Configuration syntax
+With
+.Fl c
+or
+.Fl f
+on the command line,
+.Nm
+accepts the following configuration syntax.
+Lines starting with hash signs ('#') are treated as comment lines.
.Bl -tag -width Ds
.It Xo
.Li add
+.Op Fl 46n
.Ar src Ar dst Ar protocol Ar spi
.Op Ar extensions
-.Ar algorithm...
+.Ar algorithm ...
.Li ;
.Xc
Add an SAD entry.
+.Li add
+can fail with multiple reasons,
+including when the key length does not match the specified algorithm.
.\"
.It Xo
.Li get
+.Op Fl 46n
.Ar src Ar dst Ar protocol Ar spi
.Li ;
.Xc
@@ -135,6 +146,7 @@ Show an SAD entry.
.\"
.It Xo
.Li delete
+.Op Fl 46n
.Ar src Ar dst Ar protocol Ar spi
.Li ;
.Xc
@@ -142,6 +154,7 @@ Remove an SAD entry.
.\"
.It Xo
.Li deleteall
+.Op Fl 46n
.Ar src Ar dst Ar protocol
.Li ;
.Xc
@@ -153,6 +166,8 @@ Remove all SAD entries that match the specification.
.Li ;
.Xc
Clear all SAD entries matched by the options.
+.Fl F
+on the command line achieves the same functionality.
.\"
.It Xo
.Li dump
@@ -160,9 +175,12 @@ Clear all SAD entries matched by the options.
.Li ;
.Xc
Dumps all SAD entries matched by the options.
+.Fl D
+on the command line achieves the same functionality.
.\"
.It Xo
.Li spdadd
+.Op Fl 46n
.Ar src_range Ar dst_range Ar upperspec Ar policy
.Li ;
.Xc
@@ -170,6 +188,7 @@ Add an SPD entry.
.\"
.It Xo
.Li spddelete
+.Op Fl 46n
.Ar src_range Ar dst_range Ar upperspec Fl P Ar direction
.Li ;
.Xc
@@ -180,12 +199,16 @@ Delete an SPD entry.
.Li ;
.Xc
Clear all SPD entries.
+.Fl FP
+on the command line achieves the same functionality.
.\"
.It Xo
.Li spddump
.Li ;
.Xc
Dumps all SPD entries.
+.Fl DP
+on the command line achieves the same functionality.
.El
.\"
.Pp
@@ -196,13 +219,23 @@ Meta-arguments are as follows:
.It Ar dst
Source/destination of the secure communication is specified as
IPv4/v6 address.
-The
.Nm
-utility does not consult hostname-to-address for arguments
-.Ar src
+can resolve a FQDN into numeric addresses.
+If the FQDN resolves into multiple addresses,
+.Nm
+will install multiple SAD/SPD entries into the kernel
+by trying all possible combinations.
+.Fl 4 ,
+.Fl 6
and
-.Ar dst .
-They must be in numeric form.
+.Fl n
+restricts the address resolution of FQDN in certain ways.
+.Fl 4
+and
+.Fl 6
+restrict results into IPv4/v6 addresses only, respectively.
+.Fl n
+avoids FQDN resolution and requires addresses to be numeric addresses.
.\"
.Pp
.It Ar protocol
@@ -210,7 +243,7 @@ They must be in numeric form.
is one of following:
.Bl -tag -width Fl -compact
.It Li esp
-ESP based on rfc2405
+ESP based on rfc2406
.It Li esp-old
ESP based on rfc1827
.It Li ah
@@ -218,21 +251,24 @@ AH based on rfc2402
.It Li ah-old
AH based on rfc1826
.It Li ipcomp
-IPCOMP
+IPComp
.El
.\"
.Pp
.It Ar spi
-Security Parameter Index (SPI) for the SAD and the SPD.
-It must be decimal number or hexadecimal number
-You cannot use the set of SPI values in the range 0 through 255.
-(with
-.Li 0x
-attached).
+Security Parameter Index
+.Pq SPI
+for the SAD and the SPD.
+.Ar spi
+must be a decimal number, or a hexadecimal number with
+.Dq Li 0x
+prefix.
+SPI values between 0 and 255 are reserved for future use by IANA
+and they cannot be used.
.\"
.Pp
.It Ar extensions
-takes some of the following:
+take some of the following:
.Bl -tag -width Fl -compact
.\"
.It Fl m Ar mode
@@ -283,62 +319,41 @@ Specify hard/soft life time duration of the SA.
.It Ar algorithm
.Bl -tag -width Fl -compact
.It Fl E Ar ealgo Ar key
-Specify an encryption algorithm.
+Specify an encryption algorithm
+.Ar ealgo
+for ESP.
+.It Xo
+.Fl E Ar ealgo Ar key
+.Fl A Ar aalgo Ar key
+.Xc
+Specify a encryption algorithm
+.Ar ealgo ,
+as well as a payload authentication algorithm
+.Ar aalgo ,
+for ESP.
.It Fl A Ar aalgo Ar key
-Specify an authentication algorithm.
-If
-.Fl A
-is used with
-.Ar protocol Li esp ,
-it will be treated as ESP payload authentication algorithm.
+Specify an authentication algorithm for AH.
.It Fl C Ar calgo Op Fl R
-Specify compression algorithm.
+Specify a compression algorithm for IPComp.
If
.Fl R
-is not specified with
-.Li ipcomp
-line, the kernel will use well-known IPComp CPI
-(compression parameter index)
-on IPComp CPI field on packets, and
-.Ar spi
-field will be ignored.
+is specified,
.Ar spi
-field is only for kernel internal use in this case.
-.\"Therefore, compression protocol number will appear on IPComp CPI field.
+field value will be used as the IPComp CPI
+.Pq compression parameter index
+on wire as is.
If
.Fl R
-is used,
-the value on
-.Ar spi
-field will appear on IPComp CPI field on outgoing packets.
+is not specified,
+the kernel will use well-known CPI on wire, and
.Ar spi
-field needs to be smaller than
-.Li 0x10000
-in this case.
+field will be used only as an index for kernel internal usage.
.El
.Pp
-.Ar protocol Li esp
-accepts
-.Fl E
-and
-.Fl A .
-.Ar protocol Li esp-old
-accepts
-.Fl E
-only.
-.Ar protocol Li ah
-and
-.Li ah-old
-accept
-.Fl A
-only.
-.Ar protocol Li ipcomp
-accepts
-.Fl C
-only.
-.Pp
.Ar key
-must be double-quoted character string or series of hexadecimal digits.
+must be double-quoted character string, or a series of hexadecimal digits
+preceded by
+.Dq Li 0x .
.Pp
Possible values for
.Ar ealgo ,
@@ -369,14 +384,11 @@ The square bracket around
.Ar port
is really necessary.
They are not manpage metacharacters.
-.Pp
-The
-.Nm
-utility does not consult hostname-to-address for arguments
+For FQDN resolution, the rules applicable to
.Ar src
and
-.Ar dst .
-They must be in numeric form.
+.Ar dst
+apply here as well.
.\"
.Pp
.It Ar upperspec
@@ -395,34 +407,38 @@ can be specified.
stands for
.Dq any protocol .
Also you can use the protocol number.
+You can specify a type and/or a code of ICMPv6 when
+Upper-layer protocol is ICMPv6.
+the specification can be placed after
+.Li icmp6 .
+A type is separated with a code by single comma.
+A code must be specified anytime.
+When a zero is specified, the kernel deals with it as a wildcard.
+Note that the kernel can not distinguish a wildcard from that a type
+of ICMPv6 is zero.
+For example, the following means the policy doesn't require IPsec
+for any inbound Neighbor Solicitation.
+.Dl spdadd ::/0 ::/0 icmp6 135,0 -P in none ;
.Pp
NOTE:
.Ar upperspec
does not work against forwarding case at this moment,
as it requires extra reassembly at forwarding node
-(not implemented at this moment).
+.Pq not implemented at this moment .
We have many protocols in
.Pa /etc/protocols ,
but protocols except of TCP, UDP and ICMP may not be suitable to use with IPsec.
You have to consider and be careful to use them.
-.Li icmp
-.Li tcp
-.Li udp
-all protocols
.\"
.Pp
.It Ar policy
.Ar policy
-is the one of following:
-.Bd -literal -offset
-.Xo
-.Fl P Ar direction Li discard
-.Xc
-.Xo
-.Fl P Ar direction Li none
-.Xc
-.Xo
-.Fl P Ar direction Li ipsec Ar protocol/mode/src-dst/level
+is the one of the following three formats:
+.Bd -literal -offset indent
+.It Fl P Ar direction Li discard
+.It Fl P Ar direction Li none
+.It Xo Fl P Ar direction Li ipsec
+.Ar protocol/mode/src-dst/level Op ...
.Xc
.Ed
.Pp
@@ -439,6 +455,9 @@ means the packet matching indexes will be discarded.
means that IPsec operation will not take place onto the packet.
.Li ipsec
means that IPsec operation will take place onto the packet.
+The part of
+.Ar protocol/mode/src-dst/level
+specifies the rule how to process the packet.
Either
.Li ah ,
.Li esp
@@ -480,7 +499,7 @@ If the SA is not available in every level, the kernel will request
getting SA to the key exchange daemon.
.Li default
means the kernel consults to the system wide default against protocol you
-specified, e.g.\&
+specified, e.g.
.Li esp_trans_deflev
sysctl variable, when the kernel processes the packet.
.Li use
@@ -492,17 +511,29 @@ with the policy.
.Li unique
is the same to require.
In addition, it allows the policy to bind with the unique out-bound SA.
-If you use the SA by manual keying,
+You just specify the policy level
+.Li unique ,
+.Xr racoon 8
+will configure the SA for the policy.
+If you configure the SA by manual keying for that policy,
you can put the decimal number as the policy identifier after
.Li unique
separated by colon
-.Sq \:
+.Sq \&:
like the following;
.Li unique:number .
+in order to bind this policy to the SA.
.Li number
must be between 1 and 32767.
It corresponds to
-.Ar extensions Fl u .
+.Ar extensions Fl u
+of the manual SA configuration.
+When you want to use SA bundle, you can define multiple rules.
+For example, if an IP header was followed by AH header followed by ESP header
+followed by an upper layer protocol header, the rule
+would be:
+.Dl esp/transport//require ah/transport//require ;
+The rule order is very important.
.Pp
Note that
.Dq Li discard
@@ -543,7 +574,8 @@ keyed-md5 128 ah: 96bit ICV (no document)
keyed-sha1 160 ah: 96bit ICV (no document)
160 ah-old: 128bit ICV (no document)
null 0 to 2048 for debugging
-hmac-sha2-256 256 ah: 96bit ICV (no document)
+hmac-sha2-256 256 ah: 96bit ICV
+ (draft-ietf-ipsec-ciph-sha-256-00)
256 ah-old: 128bit ICV (no document)
hmac-sha2-384 384 ah: 96bit ICV (no document)
384 ah-old: 128bit ICV (no document)
@@ -551,8 +583,8 @@ hmac-sha2-512 512 ah: 96bit ICV (no document)
512 ah-old: 128bit ICV (no document)
hmac-ripemd160 160 ah: 96bit ICV (RFC2857)
ah-old: 128bit ICV (no document)
-aes-xcbc-mac 128 ah: 96bit ICV (RFC3566)
- 128 ah-old: 128bit ICV (no document)
+.\"aes-xcbc-mac 128 ah: 96bit ICV (RFC3566)
+.\" 128 ah-old: 128bit ICV (no document)
.Ed
.Pp
Followings are the list of encryption algorithms that can be used as
@@ -567,13 +599,13 @@ parameter:
algorithm keylen (bits) comment
des-cbc 64 esp-old: rfc1829, esp: rfc2405
3des-cbc 192 rfc2451
-simple 0 to 2048 rfc2410
+null 0 to 2048 rfc2410
blowfish-cbc 40 to 448 rfc2451
cast128-cbc 40 to 128 rfc2451
-des-deriv 64 ipsec-ciph-des-derived-01 (expired)
+des-deriv 64 ipsec-ciph-des-derived-01
3des-deriv 192 no document
-rijndael-cbc 128/192/256 draft-ietf-ipsec-ciph-aes-cbc-00
-aes-ctr 160/224/288 draft-ietf-ipsec-ciph-aes-ctr-03
+rijndael-cbc 128/192/256 rfc3602
+.\"aes-ctr 160/224/288 draft-ietf-ipsec-ciph-aes-ctr-03
.Ed
.Pp
Note that the first 128 bits of a key for
@@ -591,44 +623,58 @@ parameter:
.Bd -literal -offset indent
algorithm comment
deflate rfc2394
-lzs rfc2395
.Ed
.\"
+.Sh RETURN VALUES
+The command exits with 0 on success, and non-zero on errors.
+.\"
.Sh EXAMPLES
.Bd -literal -offset
-add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457
- -E des-cbc "ESP SA!!" ;
+add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457
+ -E des-cbc 0x3ffe05014819ffff ;
-add 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456
- -A hmac-sha1 "AH SA configuration!" ;
+add -6 myhost.example.com yourhost.example.com ah 123456
+ -A hmac-sha1 "AH SA configuration!" ;
-add 10.0.11.41 10.0.11.33 esp 0x10001
- -E des-cbc "ESP with"
- -A hmac-md5 "authentication!!" ;
+add 10.0.11.41 10.0.11.33 esp 0x10001
+ -E des-cbc 0x3ffe05014819ffff
+ -A hmac-md5 "authentication!!" ;
-get 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ;
+get 3ffe:501:4819::1 3ffe:501:481d::1 ah 123456 ;
flush ;
dump esp ;
-spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any
- -P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ;
+spdadd 10.0.11.41/32[21] 10.0.11.33/32[any] any
+ -P out ipsec esp/tunnel/192.168.0.1-192.168.1.2/require ;
.Ed
.\"
-.Sh RETURN VALUES
-The command exits with 0 on success, and non-zero on errors.
-.\"
.Sh SEE ALSO
.Xr ipsec_set_policy 3 ,
.Xr racoon 8 ,
.Xr sysctl 8
+.Rs
+.%T "Changed manual key configuration for IPsec"
+.%O "http://www.kame.net/newsletter/19991007/"
+.%D "October 1999"
+.Re
.\"
.Sh HISTORY
The
.Nm
-utility first appeared in WIDE Hydrangea IPv6 protocol stack kit.
+command first appeared in WIDE Hydrangea IPv6 protocol stack kit.
The command was completely re-designed in June 1998.
.\"
-.\" .Sh BUGS
+.Sh BUGS
+.Nm
+should report and handle syntax errors better.
+.Pp
+For IPsec gateway configuration,
+.Ar src_range
+and
+.Ar dst_range
+with TCP/UDP port number do not work, as the gateway does not reassemble
+packets
+.Pq cannot inspect upper-layer headers .
OpenPOWER on IntegriCloud