NTP.KEYS(5)
💖 NAME 💖 — ntp.keys (NTP.KEYS(5))
okay bestie, welcome to NTP.KEYS(5): this is the manual for ntp.keys, aka the NTP symmetric key file format. It’s giving “small file, huge trust issues” energy, because yes — this is where your symmetric keys live. 🔐✨
✨ DESCRIPTION ✨
This page describes the format of an NTP symmetric key file. For a description of the use of this type of file, see the “Authentication Support” page of the Web documentation. 👀
ntpd(8) reads its keys from a file specified using the -k command line option or the keys statement in the configuration file. While key number 0 is fixed by the NTP standard (as 56 zero bits) and may not be changed, one or more keys numbered between 1 and 65535 may be arbitrarily set in the keys file. 🎀
The key file uses the same comment conventions as the configuration file. Key entries use a fixed format of the form:
keyno type key
where keyno is a positive integer (between 1 and 65535), type is the message digest or cipher algorithm, and key is the key itself.
The file does not need to be sorted by keyno. lowkey chaotic, but valid. 💅
Internally, there are 3 modes corresponding to 3 different types: Digest, CMAC, and HMAC. let’s break those down:
- Digest mode computes the MAC (Message Authentication Code) by computing the digest of the key prepended to the packet. You get digest mode by specifying a
typethat is the name of a digest-algorithm that OpenSSL supports. You can get a list fromopenssl list -digest-algorithms. - CMAC mode uses a cipher algorithm. You get CMAC mode by specifying a
typethat is the name of a cipher-algorithm that OpenSSL supports. You can get a list fromopenssl list -cipher-algorithms. Only the-CBCcipher modes are useful. The-CBCis appended to thetypeinternally. Do not include it intype. 🚨 - HMAC mode uses a digest-algorithm. You get to HMAC mode by prepending
HMAC-to the name of a digest-algorithm.
MACs longer than 20 bytes will be truncated. ✂️
AES is an alias for AES-128.
SHA-1 is an alias for SHA1. (NIST uses SHA-1. OpenSSL uses SHA1.) iykyk.
Note that MD5 was deprecated by RFC 8573 in June of 2019 which recommends AES-CMAC as described in RFC 4493 as a replacement. AES-128 is the appropriate type. Most modern CPUs have hardware support. Our code still supports MD5 for backwards compatibility. (So yes, the old vibe is still around, but it’s very much old vibe. 💀)
FIPS 140-2, FIPS 180-4, and/or FIPS 202 may restrict your choices. If it matters to you, check with your lawyer. (Let us know if you find a good reference.) In particular, they don’t allow MD5. ⚠️
The key may be printable ASCII excluding # or hex encoded. Keys longer than 20 characters are assumed to be hex. The max length of a (de-hexified) key is 32 bytes. If you want to use an ASCII key longer than 20 bytes, you must hexify it. 🧚
Digest (and HMAC-) keys can be any length. CMAC keys will be truncated or padded to match what the cipher-algorithm requires.
Note that the keys used by the ntpq(1) programs are checked against passwords entered by hand, so it is generally appropriate to specify these keys in ASCII format. Or you can cut-paste a hex string from your password manager. 💖
🫶 USAGE 🫶
In order to use symmetric keys, the client side configuration file needs:
keys <path-to-client-keys-file>
trustedkey <keyno>
server ... key <keyno>
The server side needs:
keys <path-to-server-keys-file>
trustedkey <keyno>
Note that the client and server key files must both contain identical copies of the line specified by keyno. no cap — matching lines or it’s not gonna work. 🫶
🎀 FILES 🎀
/etc/ntp.keys— is a common location for the keys file.
Reminder: You have to keep it secret. 🔐🤫 (Seriously, bestie — secret secret.)
👀 SEE ALSO 👀
ntp.conf(5), ntpd(8), ntpq(1), ntpkeygen(8), ntpdig(1).
and that’s the whole page, bestie — NTPsec source/version, dated 2026-10-21, manual page NTP.KEYS(5). now go keep those keys secret 💖✨
📦 where this page comes from
- fedora 43: ntpsec 1.2.6-1.fc43 · NTP AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC AND Apache-2.0 AND Beerware
- fedora 43: ntpsec 1.2.6-1.fc43 · NTP AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC AND Apache-2.0 AND Beerware
- fedora 44: ntpsec 1.2.6-1.fc44 · NTP AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC AND Apache-2.0 AND Beerware
- fedora 44: ntpsec 1.2.6-1.fc44 · NTP AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND ISC AND Apache-2.0 AND Beerware
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms