1.\" $OpenBSD: iked.8,v 1.30 2021/11/29 13:20:24 jmc Exp $ 2.\" 3.\" Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: November 29 2021 $ 18.Dt IKED 8 19.Os 20.Sh NAME 21.Nm iked 22.Nd Internet Key Exchange version 2 (IKEv2) daemon 23.Sh SYNOPSIS 24.Nm iked 25.Op Fl dnSTtVv 26.Op Fl D Ar macro Ns = Ns Ar value 27.Op Fl f Ar file 28.Op Fl p Ar udpencap_port 29.Op Fl s Ar socket 30.Sh DESCRIPTION 31.Nm 32is an Internet Key Exchange (IKEv2) daemon which performs mutual 33authentication and which establishes and maintains IPsec flows and 34security associations (SAs) between the two peers. 35.Pp 36The IKEv2 protocol is defined in RFC 7296, 37which combines and updates the previous standards: 38ISAKMP/Oakley (RFC 2408), 39IKE (RFC 2409), 40and the Internet DOI (RFC 2407). 41.Nm 42only supports the IKEv2 protocol; 43support for 44ISAKMP/Oakley and IKEv1 45is provided by 46.Xr isakmpd 8 . 47.Pp 48.Nm 49supports mutual authentication using RSA or ECDSA public keys and X.509 50certificates. 51See the 52.Sx PUBLIC KEY AUTHENTICATION 53section below and PKI AND CERTIFICATE AUTHORITY COMMANDS in 54.Xr ikectl 8 55for more information about creating and maintaining the public key 56infrastructure. 57.Pp 58The options are as follows: 59.Bl -tag -width Ds 60.It Fl D Ar macro Ns = Ns Ar value 61Define 62.Ar macro 63to be set to 64.Ar value 65on the command line. 66Overrides the definition of 67.Ar macro 68in the configuration file. 69.It Fl d 70Do not daemonize and log to 71.Em stderr . 72.It Fl f Ar file 73Use 74.Ar file 75as the configuration file, instead of the default 76.Pa /etc/iked.conf . 77.It Fl n 78Configtest mode. 79Only check the configuration file for validity. 80.It Fl p Ar udpencap_port 81Specify the listen port for encapsulated UDP that 82the daemon will bind to as well as the UDP encapsulation port set 83in resulting IPsec SAs. 84In order to receive UDP encapsulated IPsec packets on ports other 85than 4500, the 86.Em net.inet.esp.udpencap_port 87.Xr sysctl 2 88variable has to be set accordingly. 89Implies -t. 90.It Fl S 91Start 92.Nm 93in passive mode. 94See the 95.Ic set passive 96option in 97.Xr iked.conf 5 98for more information. 99.It Fl s Ar socket 100Use 101.Ar socket 102as the control socket, instead of the default 103.Pa /var/run/iked.sock . 104.It Fl T 105Disable NAT-Traversal and do not propose NAT-Traversal support to the peers. 106.It Fl t 107Enforce NAT-Traversal and only listen to NAT-Traversal messages. 108This option is only recommended for testing; the default is to 109negotiate NAT-Traversal with the peers. 110.It Fl V 111Show the version and exit. 112.It Fl v 113Produce more verbose output. 114.El 115.Sh PUBLIC KEY AUTHENTICATION 116It is possible to store trusted public keys to make them directly 117usable by 118.Nm , 119bypassing the need to use certificates. 120The keys should be saved in PEM format (see 121.Xr openssl 1 ) 122and named and stored as follows: 123.Pp 124.Bl -tag -width "for_ufqdn_identitiesXX" -offset 3n -compact 125.It For IPv4 identities: 126/etc/iked/pubkeys/ipv4/A.B.C.D 127.It For IPv6 identities: 128/etc/iked/pubkeys/ipv6/abcd:abcd::ab:bc 129.It For FQDN identities: 130/etc/iked/pubkeys/fqdn/foo.bar.org 131.It For UFQDN identities: 132/etc/iked/pubkeys/ufqdn/user@foo.bar.org 133.El 134.Pp 135Depending on the 136.Ic srcid 137and 138.Ic dstid 139specifications in 140.Xr iked.conf 5 , 141keys may be named after their IPv4 address, IPv6 address, 142fully qualified domain name (FQDN) or user fully qualified domain name (UFQDN). 143.Pp 144For example, 145.Nm 146can authenticate using the pre-generated keys if the local public key, 147by default 148.Pa /etc/iked/local.pub , 149is copied to the remote gateway as 150.Pa /etc/iked/pubkeys/ipv4/local.gateway.ip.address 151and the remote gateway's public key 152is copied to the local gateway as 153.Pa /etc/iked/pubkeys/ipv4/remote.gateway.ip.address . 154Of course, new keys may also be generated 155(the user is not required to use the pre-generated keys). 156In this example, 157.Ic srcid 158and 159.Ic dstid 160would also have to be set to the specified addresses 161in 162.Xr iked.conf 5 . 163.Sh FILES 164.Bl -tag -width "/etc/iked/private/XXX" -compact 165.It Pa /etc/iked.conf 166The default 167.Nm 168configuration file. 169.It Pa /etc/iked/ca/ 170The directory where CA certificates are kept. 171.It Pa /etc/iked/certs/ 172The directory where IKE certificates are kept, both the local 173certificate(s) and those of the peers, if a choice to have them kept 174permanently has been made. 175.It Pa /etc/iked/crls/ 176The directory where CRLs are kept. 177.It Pa /etc/iked/private/ 178The directory where local private keys used for public key authentication 179are kept. 180The file 181.Pa local.key 182is used to store the local private key. 183.It Pa /etc/iked/pubkeys/ 184The directory in which trusted public keys are kept. 185The keys must be named in the fashion described above. 186.It Pa /var/run/iked.sock 187The default 188.Nm 189control socket. 190.El 191.Sh SEE ALSO 192.Xr iked.conf 5 , 193.Xr ikectl 8 , 194.Xr isakmpd 8 195.Sh STANDARDS 196.Rs 197.%A C. Kaufman 198.%A P. Hoffman 199.%A Y. Nir 200.%A P. Eronen 201.%A T. Kivinen 202.%D October 2014 203.%R RFC 7296 204.%T Internet Key Exchange Protocol Version 2 (IKEv2) 205.Re 206.Sh HISTORY 207The 208.Nm 209program first appeared in 210.Ox 4.8 . 211.Sh AUTHORS 212The 213.Nm 214program was written by 215.An Reyk Floeter Aq Mt reyk@openbsd.org . 216