IPSECKEY Record
IPsec Key
- Type code
- 45
- Status
- In use
- Defined in
- RFC 4025
What the IPSECKEY record is for
IPSECKEY was designed for opportunistic encryption: a host that wants to reach another host over IPsec looks up an IPSECKEY record for the destination, usually at its reverse DNS name, and learns which gateway to negotiate with and which public key to authenticate it with.
A name can have several records with different precedence values, and lower values are tried first, as with MX. The gateway can be an IPv4 or IPv6 address, a domain name, or absent when the host is its own gateway. The record should be validated with DNSSEC before the key is trusted.
It replaced the IPsec use of the KEY record, which RFC 3445 removed. It is supported by some IPsec software, such as Libreswan, but is rarely deployed.
Wire format and fields
| Field | Size | Meaning |
|---|---|---|
| precedence | 8 bits | Lower values are tried first, like the MX preference. |
| gateway type | 8 bits | The format of the gateway field: 0 no gateway, 1 IPv4 address, 2 IPv6 address, 3 domain name. |
| algorithm | 8 bits | The public key algorithm: 0 no key present, 1 DSA, 2 RSA. Later RFCs added more, including EdDSA (RFC 9373). |
| gateway | variable | 0 bits for type 0, 32 bits for IPv4, 128 bits for IPv6, or an uncompressed domain name for type 3. Written as . when there is no gateway. |
| public key | variable | The key in the format for the algorithm, base64 in zone files. Empty when the algorithm is 0. |
Zone file syntax
<owner> <ttl> IN IPSECKEY <precedence> <gateway type> <algorithm> <gateway> <public key (base64)>
Common mistakes
- Setting the gateway type to 0 but putting an address in the gateway field, or the reverse. The gateway field must match the type, and is written as . when there is none.
- Publishing IPSECKEY records in an unsigned zone. RFC 4025 expects them to be validated with DNSSEC; otherwise an attacker can redirect the tunnel.
- Putting the record at the forward name when the IPsec software looks it up at the reverse name of the address, or the other way round.
Specifications
- RFC 4025: A Method for Storing IPsec Keying Material in DNS
- RFC 9373: EdDSA Value for IPSECKEY (Adds an algorithm value for EdDSA keys.)
- IANA DNS Resource Record (RR) TYPEs registry: type code and status
Related record types
Domain Intelligence APIs
Get started with our easy-to-use API docs.