![]() ![]() | ![]() |
added new option in kernel config added new key in sshd startup script
1: #!/bin/sh 2: 3: CONFDIR="/etc/ssh" 4: CONFIG="${CONFDIR}/sshd_config" 5: 6: sshd_keygen() 7: { 8: echo "Starting SSH ..." 9: ( 10: umask 022 11: if [ -f ${CONFDIR}/ssh_host_key ]; then 12: echo "You already have an RSA host key in ${CONFDIR}/ssh_host_key" 13: echo "Skipping protocol version 1 RSA Key Generation" 14: else 15: echo "Generating SSH version 1 RSA host key..." 16: /usr/bin/ssh-keygen -t rsa1 -f ${CONFDIR}/ssh_host_key -N '' 1>/dev/null 2>&1 17: fi 18: 19: if [ -f ${CONFDIR}/ssh_host_dsa_key ]; then 20: echo "You already have a DSA host key in ${CONFDIR}/ssh_host_dsa_key" 21: echo "Skipping protocol version 2 DSA Key Generation" 22: else 23: echo "Generating SSH DSA host key..." 24: /usr/bin/ssh-keygen -t dsa -f ${CONFDIR}/ssh_host_dsa_key -N '' 1>/dev/null 2>&1 25: fi 26: 27: if [ -f ${CONFDIR}/ssh_host_rsa_key ]; then 28: echo "You already have a RSA host key in ${CONFDIR}/ssh_host_rsa_key" 29: echo "Skipping protocol version 2 RSA Key Generation" 30: else 31: echo "Generating SSH version 2 RSA key ..." 32: /usr/bin/ssh-keygen -t rsa -f ${CONFDIR}/ssh_host_rsa_key -N '' 1>/dev/null 2>&1 33: fi 34: 35: if [ -f ${CONFDIR}/ssh_host_ecdsa_key ]; then 36: echo "You already have an ECDSA host key in ${CONFDIR}/ssh_host_ecdsa_key" 37: echo "Skipping protocol version 2 ECDSA Key Generation" 38: else 39: /usr/bin/ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' 40: fi 41: ) 42: } 43: 44: if [ ! -f /etc/ssh/ssh_host_key -o \ 45: ! -f /etc/ssh/ssh_host_dsa_key -o \ 46: ! -f /etc/ssh/ssh_host_rsa_key ]; then 47: echo "Creating SSH Keys ..." 48: sshd_keygen 49: fi 50: 51: /usr/sbin/sshd -f $CONFIG