IKECTL(8)

πŸ’– ikectl β€” bestie's guide to the IKEv2 daemon πŸ’–

okay so. ikectl(8) is the little control remote for your system manager's manual era, and it's literally the bestie of the iked(8) daemon. it also hands you commands to keep a simple X.509 certificate authority (CA) alive and thriving for your IKEv2 peers. no cap, it's giving admin main character energy. πŸ‘‘


✨ SYNOPSIS ✨

ikectl [-q] [-s socket] command [arg ...]

🌸 DESCRIPTION 🌸

ikectl controls the iked(8) daemon, and on top of that it gives you commands to maintain a whole simple X.509 certificate authority (CA) for IKEv2 peers. two jobs, one icon. πŸ’…

okay so the options are as follows:

  • -q β€” don't ask for confirmation of any default options. she's confident, she's not checking in with you first. πŸ™ˆ
  • -s socket β€” use socket instead of the default /var/run/iked.sock to communicate with iked(8).

πŸŽ€ IKED CONTROL COMMANDS πŸŽ€

these are the commands you get for controlling iked(8), and they are lowkey iconic:

  • active β€” set iked(8) to active mode.
  • passive β€” set iked(8) to passive mode. in passive mode no packets are sent to peers and no connections are initiated by iked(8). she's just vibing. πŸ¦‹
  • couple β€” load the negotiated security associations (SAs) and flows into the kernel.
  • decouple β€” unload the negotiated SAs and flows from the kernel. > heads up bestie: this mode is only useful for testing and debugging. it is not the everyday slay. πŸ’€
  • load filename β€” reload the configuration from the specified file.
  • log brief β€” disable verbose logging.
  • log verbose β€” enable verbose logging.
  • monitor β€” monitor internal messages of the iked(8) subsystems.
  • reload β€” reload the configuration from the default configuration file.
  • reset all β€” reset the running state.
  • reset ca β€” reset the X.509 CA and certificate state.
  • reset policy β€” flush the configured policies.
  • reset sa β€” flush the running SAs.
  • reset user β€” flush the local user database.
  • reset id ikeid β€” delete all IKE SAs with matching ID.
  • show sa β€” show internal state of active IKE SAs, Child SAs and IPsec flows.

🌈 PKI AND CERTIFICATE AUTHORITY COMMANDS 🌈

so here's the situation: to use public key based authentication with IKEv2, a public key infrastructure (PKI) has to be set up to create and sign the peer certificates. and ikectl includes commands to simplify maintenance of the PKI and to set up a simple certificate authority (CA) for iked(8) and its peers. it's giving "i made it easy for you". 🫢

the following commands are available to control the CA:

  • ca name create [password password] β€” create a new certificate authority with the specified name. the command will prompt for a CA password unless it is specified with the optional password argument. the password will be saved in a protected file ikeca.passwd in the CA directory and used for subsequent commands. πŸ”
  • ca name delete β€” delete the certificate authority with the specified name.
  • ca name export [peer peer] [password password] β€” export the certificate authority with the specified name into the current directory for transport to other systems. this command will create a compressed tarball called ca.tgz in the local directory and optionally ca.zip if the zip tool is installed. the optional peer argument can be used to specify the address or FQDN of the local gateway which will be written into a text file peer.txt and included in the archives. πŸ“¦
  • ca name install [path] β€” install the certificate and Certificate Revocation List (CRL) for CA name as the currently active CA or into the specified path.
  • ca name certificate host create [server | client | ocsp] β€” create a private key and certificate for host and sign then with the key of certificate authority with the specified name.
    • the certificate will be valid for client and server authentication by default by setting both flags as the extended key usage in the certificate; this can be restricted using the optional server or client argument. if the ocsp argument is specified the extended key usage will be set for OCSP signing.
  • ca name certificate host delete β€” deletes the private key and certificates associated with host.
  • ca name certificate host export [peer peer] [password password] β€” export key files for host of the certificate authority with the specified name into the current directory for transport to other systems. this command will create a compressed tarball host.tgz in the local directory and optionally host.zip if the zip tool is installed. the optional peer argument can be used to specify the address or FQDN of the local gateway which will be written into a text file peer.txt and included in the archives.
  • ca name certificate host install [path] β€” install the private and public key for host into the active configuration or specified path.
  • ca name certificate host revoke β€” revoke the certificate specified by host and generate a new Certificate Revocation List (CRL).
  • show ca name certificates [host] β€” display a listing of certificates associated with CA name or display certificate details if host is specified.
  • ca name key host create β€” create a private key for host if one does not already exist.
  • ca name key host install [path] β€” install the private and public keys for host into the active configuration or specified path.
  • ca name key host delete β€” delete the private key for host.
  • ca name key host import file β€” source the private key for host from the named file.

πŸ“ FILES πŸ“

  • /etc/iked/ β€” active configuration.
  • /etc/ssl/ β€” directory to store the CA files.
  • /usr/share/iked/ β€” if this optional directory exists, ikectl will include the contents with the ca export commands.
  • /var/run/iked.sock β€” default Unix-domain socket used for communication with iked(8).

⭐ EXAMPLES ⭐

first, create a new certificate authority:

# ikectl ca vpn create

now create the certificates for the VPN peers. the specified hostname, either IP address or FQDN, will be saved in the signed certificate and has to match the IKEv2 identity, or srcid, of the peers:

# ikectl ca vpn certificate 10.1.2.3 create
# ikectl ca vpn certificate 10.2.3.4 create
# ikectl ca vpn certificate 10.3.4.5 create

it is possible that the host that was used to create the CA is also one of the VPN peers. in this case you can install the peer and CA certificates locally:

# ikectl ca vpn install
# ikectl ca vpn certificate 10.1.2.3 install

now export the individual host key, the certificate and the CA certificate to each other peer. first run the export command to create tarballs that include the required files:

# ikectl ca vpn certificate 10.2.3.4 export
# ikectl ca vpn certificate 10.3.4.5 export

these commands will produce two tarballs 10.2.3.4.tgz and 10.3.4.5.tgz. copy these tarballs over to the appropriate peers and extract them to the /etc/iked/ directory:

10.2.3.4# tar -C /etc/iked -xzpf 10.2.3.4.tgz
10.3.4.5# tar -C /etc/iked -xzpf 10.3.4.5.tgz

ikectl will also create zip archives 10.2.3.4.zip and 10.3.4.5.zip in addition to the tarballs if the zip tool is found in /usr/local/bin/zip. these archives can be exported to peers running Windows and will include the certificates in a format that is supported by the OS. the zip tool can be installed from the OpenBSD packages or ports collection before running the export commands, see packages(7) for more information. for example:

# pkg_add zip

πŸ‘‘ SEE ALSO πŸ‘‘

packages(7), iked(8), ssl(8)


🧚 HISTORY 🧚

the ikectl program first appeared in OpenBSD 4.8. a true elder, still slaying. πŸ’œ


πŸ’– AUTHORS πŸ’–

the ikectl program was written by Reyk Floeter <reyk@openbsd.org> and Jonathan Gray <jsg@openbsd.org>. legends, honestly. 🫢


πŸ’€ CAVEATS πŸ’€

for ease of use, the ca commands maintain all peers' private keys on the CA machine. in contrast to a "real" CA, it does not support signing of public keys that have been imported from peers that do not want to expose their private keys to the CA. > so yeah bestie, know what you're signing up for before you hand over your keys. πŸ”₯


okay that's the whole page!! this one's from the Debian crew, dated April 25, 2020, and it lives in the IKECTL(8) era of the manual. go forth and certificate-ify. πŸŒΈβœ¨πŸ’…

πŸ“¦ where this page comes from