MODULI(5)
โจ NAME โจ
okay so the page is all about moduli ๐ซถ (that's the Diffie-Hellman moduli, fr). it's from the File Formats Manual, so this is literally the file format bestie, not a command ๐
๐ DESCRIPTION ๐
okay so /etc/ssh/moduli is basically a list of prime numbers and generators that sshd(8) uses for the Diffie-Hellman Group Exchange key exchange method ๐ฆ it's giving secure and organized โจ
making new moduli is lowkey a two-step glow up with ssh-keygen(1) ๐ธ
- step one: an initial candidate pass with
ssh-keygen -M generatedigs up numbers that are likely to be useful ๐ง - step two: a primality testing pass with
ssh-keygen -M screengives you a high level of assurance that the numbers are prime and actually safe for Diffie-Hellman withsshd(8)๐
both passes spit out this same moduli format, so it's consistent no cap ๐
the file is newline-separated records, one per modulus ๐ each record has seven space-separated fields, and they go like this:
- timestamp ๐ฐ๏ธ the time the modulus was last processed, written as
YYYYMMDDHHMMSS - type ๐ข a decimal number for the internal structure of the prime modulus. the supported types are:
0โ unknown, not tested ๐2โ "Safe" prime; (p-1)/2 is also prime โจ4โ Sophie Germain; 2p+1 is also prime ๐
ngl the candidates from ssh-keygen(1) start out as Sophie Germain primes (type 4) ๐
then more primality testing with ssh-keygen(1) turns them into safe prime moduli (type 2), which are the ones ready to go for sshd(8) ๐ฅ other types are not used by OpenSSH, so skip those vibes ๐
โโ๏ธ
- tests ๐งช a decimal number showing which primality tests the number went through, stored as a bitmask:
0x00โ not tested ๐0x01โ composite number โ not prime ๐ซ0x02โ Sieve of Eratosthenes ๐ธ0x04โ probabilistic Miller-Rabin primality tests ๐ฆ
the ssh-keygen(1) candidate generation uses the Sieve of Eratosthenes (flag 0x02) ๐ง and the later ssh-keygen(1) primality tests are Miller-Rabin tests (flag 0x04) โจ
- trials ๐ a decimal number for how many primality trials the modulus has gotten
- size ๐ a decimal number for the size of the prime in bits
- generator ๐ the recommended generator to use with this modulus, in hexadecimal
- modulus ๐ the modulus itself, in hexadecimal
when Diffie-Hellman Group Exchange is happening, sshd(8) first estimates how big the modulus needs to be so there's enough Diffie-Hellman output to properly key the chosen symmetric cipher ๐ then it randomly picks a modulus from /etc/ssh/moduli that best fits that size requirement ๐ฒ iykyk, it's a whole vibe โจ
๐ SEE ALSO ๐
ssh-keygen(1), sshd(8) ๐ซถ
๐ STANDARDS ๐
M. Friedl, N. Provos, and W. Simpson, Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol, RFC 4419, March 2006 ๐
okay that's the tea, bestie ๐ซถโจ this page came from Debian, April 16, 2022, and it's MODULI(5) all the way ๐ ๐ธ
๐ฆ where this page comes from
- alpine 3.22: openssh-doc 10.0_p1-r10 ยท SSH-OpenSSH
- alpine 3.23: openssh-doc 10.2_p1-r0 ยท SSH-OpenSSH
- alpine 3.24: openssh-doc 10.3_p1-r1 ยท SSH-OpenSSH
- arch rolling: openssh 10.6p1-1
- arch rolling: openssh 10.6p1-2 ยท 0BSD AND BSD-2-Clause AND BSD-3-Clause AND ISC AND LicenseRef-Public-Domain AND MIT
- centos-stream 10: openssh-server 9.9p1-34.el10 ยท BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- centos-stream 9: openssh-server 9.9p1-16.el9 ยท BSD
- debian bookworm: openssh-server 1:9.2p1-2+deb12u10
- debian bookworm: openssh-server 1:9.2p1-2+deb12u7
- debian bookworm: openssh-server 1:9.2p1-2+deb12u9
- debian trixie: openssh-server 1:10.0p1-7+deb13u2
- debian trixie: openssh-server 1:10.0p1-7+deb13u4
- fedora 43: openssh-server 10.0p1-12.fc43
- fedora 43: openssh-server 10.0p1-14.fc43 ยท BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- fedora 43: openssh-server 10.0p1-5.fc43 ยท BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND sprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- fedora 44: openssh-server 10.2p1-14.fc44
- fedora 44: openssh-server 10.2p1-16.fc44 ยท BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- fedora 44: openssh-server 10.2p1-7.fc44 ยท BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- nixos 26.05: openssh 10.6p1
- nixos 26.05: openssh-test 10.6p1
- nixos 26.05: openssh-with-gssapi 10.4p1
- nixos 26.05: openssh-with-hpn 10.5p1
- nixpkgs unstable: openssh 10.6p1
- nixpkgs unstable: openssh-test 10.6p1
- nixpkgs unstable: openssh-with-gssapi 10.4p1
- nixpkgs unstable: openssh-with-hpn 10.5p1
- opensuse-leap 16.0: openssh-common 10.0p2-160000.7.1 ยท BSD-2-Clause AND MIT
- opensuse-leap 16.0: openssh-common 10.0p2-160000.7.1 ยท BSD-2-Clause AND MIT
- opensuse-leap 16.0: openssh-common 10.0p2-160000.7.1 ยท BSD-2-Clause AND MIT
- opensuse-leap 16.0: openssh-common 10.0p2-160000.7.1 ยท BSD-2-Clause AND MIT
- ubuntu noble: openssh-server 1:9.6p1-3ubuntu13
- ubuntu noble: openssh-server 1:9.6p1-3ubuntu13.19
- ubuntu noble: openssh-server 1:9.6p1-3ubuntu13.20
- ubuntu questing: openssh-server 1:10.0p1-5ubuntu5
- ubuntu questing: openssh-server 1:10.0p1-5ubuntu5.4 ยท OpenSSH
- ubuntu resolute: openssh-server 1:10.2p1-2ubuntu3
- ubuntu resolute: openssh-server 1:10.2p1-2ubuntu3.6
- ubuntu resolute: openssh-server 1:10.2p1-2ubuntu3.7
- ubuntu resolute: openssh-server 1:10.2p1-2ubuntu3.8
- ubuntu stonking: openssh-server 1:10.5p1-1ubuntu2
- ubuntu stonking: openssh-server 1:10.5p1-1ubuntu3.1
- ubuntu stonking: openssh-server-gssapi 1:10.5p1-1ubuntu3 ยท OpenSSH
- ubuntu stonking: openssh-server-gssapi 1:10.5p1-1ubuntu3.1 ยท OpenSSH
- Copyright (c) 2008 Damien Miller <djm@mindrot.org>
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms