当用户使用ssh-keygen创buildRSA密钥对时,默认密钥长度为2048位。
你可以用-b参数在命令行中覆盖它,但是很less有用户会打扰。
如本文所述,如果您需要超过2030年的安全性,build议使用3072或更大的密钥长度。是否有办法使3072(或4096)成为所有生成密钥的默认长度? 我没有看到它在ssh_config或sshd_config手册页。 还是需要重新编译程序?
我不认为有任何方式通过configuration文件来做到这一点。 你可以设置一个别名,并把它放在一个shell初始化文件中。 这不会阻止用户删除别名并运行自己的命令。
alias ssh-keygen='ssh-keygen -b 3072'
然后
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/iain/.ssh/id_rsa): /tmp/testkey Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /tmp/testkey. Your public key has been saved in /tmp/testkey.pub. The key fingerprint is: 47:3a:03:c8:ac:63:1c:bf:9d:44:1d:4b:b4:0e:66:04 $ ssh-keygen -lf /tmp/testkey 3072 47:3a:03:c8:ac:63:1c:bf:9d:44:1d:4b:b4:0e:66:04 /tmp/testkey.pub
你可以把它放在每个(现有)用户的〜/ .bashrc和/etc/skel/.bashrc中,这样新用户也可以得到它。