Skip to content

Instantly share code, notes, and snippets.

@Jas0n99
Forked from ulif/generate-moduli.sh
Last active January 26, 2020 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jas0n99/9c35cb14abc2f77a74f779eb0a7c010f to your computer and use it in GitHub Desktop.
Save Jas0n99/9c35cb14abc2f77a74f779eb0a7c010f to your computer and use it in GitHub Desktop.
Generate primes for use with SSH
#!/bin/bash
#
# Create primes for use with ssh.
#
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
for bitlen in 2048 3072 4096 6144 8192 ;
do
echo Looking for candidates: $bitlen bits. ;
ssh-keygen -G moduli-${bitlen}.candidates -b $bitlen ;
cat moduli-${bitlen}.candidates >> moduli.candidates
rm moduli-${bitlen}.candidates
done ;
echo Testing all candidates... ;
ssh-keygen -T moduli.strong -f moduli.candidates ;
rm moduli.candidates
echo Done. Result in moduli.strong ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment