NTPKEYGEN(8)
π NTPKEYGEN(8) π
okay bestie, welcome to the manual page for ntpkeygen β it's the NTPsec tool that creates and manages NTP host keys, and honestly? it's giving key-smith realness. let's get into it π
β¨ NAME β¨
ntpkeygen β create and manage NTP host keys ποΈ
π¦ SYNOPSIS π¦
ntpkeygen [-V]
πΈ DESCRIPTION πΈ
so this program makes a file stuffed with keys that you can use in NTP's symmetric key cryptography. that's the whole vibe. π«Ά
here's what's inside, no cap:
- a file with ten pseudo-random printable ASCII strings, built for the MD5 message digest algorithm
- plus an additional ten hex-encoded random bit strings, built for SHA-1 and other message digest algorithms π
β οΈ the keys file has to be distributed and stored using secure means beyond the scope of NTP itself. do not just casually yeet this file around. it is not that kind of file.
oh and btw, those keys can also be used as passwords for the ntpq utility program. multitasking queen behavior fr fr π
π COMMAND LINE OPTIONS π
-V,--versionβ prints the version string and then exits. that's it, that's the option. short and iconic. β¨
π₯ RUNNING THE PROGRAM π₯
the simplest way to run ntpkeygen? be logged in directly as root. main character energy, but make it privileged.
the recommended procedure is:
- change into the keys directory β usually
/etc/ntp/ - run the program
chownthe output file tontp:ntp- it should be mode
400π
Warning π¨ntpkeygenuses the system randomness source. on a POSIX system, that's usually/dev/urandom. keep in mind: immediately after a reboot, on any OS, there may not be sufficient entropy available for this program to perform well. do not run this program from any startup scripts. only run this program on an active host with a lot of available entropy. periodt. π
π§ KEY FILE ACCESS AND LOCATION π§
file names begin with the prefix ntpkey and end with the postfix hostname.filestamp, where:
hostnameis the owner name β usually the string returned by the Unixgethostname()routine π₯οΈfilestampis the NTP seconds when the file was generated, in decimal digits β±οΈ
ntpkeygen also makes a soft link from ntp.keys to the generated file. and ntp.keys is the normal file used in ntp.conf. iykyk π«
π RANDOM SEED FILE π
every key generation scheme has to have some means to randomize the entropy seed used to initialize the internal pseudo-random number generator that the library routines use. that's just the assignment.
important thing to understand, bestie: entropy must be evolved for each generation, because otherwise the random number sequence would be predictable π. various means dependent on external events β like keystroke intervals β can be used to do this, and some systems have built-in entropy sources. slay for them.
this implementation uses Python's random.SystemRandom class, which relies on os.urandom(). and the security of os.urandom() is improved in Python 3.5+ β check the docs at https://docs.python.org/library/os.html#os.urandom if you wanna read up. πΈ
π CRYPTOGRAPHIC DATA FILES π
unlike NTP Classic, this implementation generates only AES keys β not MD5 or SHA1. glow-up behavior honestly.
since the file contains private shared keys, it should be visible only to root or ntp. nobody else. gatekeeping for safety. π
in order to use a shared key, the line to be used must also be setup on the target server. both sides need to be in on the bit, fr fr.
this file is also used to authenticate remote configuration commands used by the ntpq(1) utility.
comments may appear in the file and are preceded with the # character. π¬
following any headers, the keys are entered one per line in the format:
keynoβ positive integer in the range1-65,535π’typeβ type of key (MD5,SHA-1,AES-CMACetc). this program generates only AES.keyβ the actual key, printable ASCII or hex π
β EXIT STATUS β
one of the following exit values will be returned:
0(EXIT_SUCCESS) β successful program execution. we love to see it π1(EXIT_FAILURE) β the operation failed or the command syntax was not valid. π
okay that's the whole page!! go forth and generate keys responsibly, bestie π«Άπ
NTPsec Β· version date: 2026-10-21 Β· NTPKEYGEN(8) β mwah, bye!! πβ¨π
π¦ 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 on : a language model's rewrite of the original, under its terms