--- alx-src/trunk/tinyalxconfig-ng/functions/config_ssh_auth.sh 2008/06/04 16:54:35 388 +++ alx-src/trunk/tinyalxconfig-ng/functions/config_ssh_auth.sh 2008/06/04 17:13:19 389 @@ -1,24 +1,26 @@ -# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_ssh_auth.sh,v 1.1 2008-06-04 16:47:56 niro Exp $ +# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_ssh_auth.sh,v 1.2 2008-06-04 17:13:19 niro Exp $ # exchanges the public server and client ssh keys gen_keys() { - if [ ! -e /etc/ssh/ssh_host_key ] + if [ ! -e /etc/dropbear/dropbear_dss_host_key ] then - echo -e ${COLOREDSTAR}"Generating SSH-Hostkey ..." - /usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' + echo -e ${COLOREDSTAR}"Generating DSS-Hostkey ..." + /usr/bin/dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key fi - if [ ! -e /etc/ssh/ssh_host_dsa_key ] + if [ ! -e /etc/dropbear/dropbear_rsa_host_key ] then - echo -e ${COLREDSTAR}"Generating DSA-Hostkey ..." - /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' + echo -e ${COLOREDSTAR}"Generating RSA-Hostkey ..." + /usr/bin/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key fi - if [ ! -e /etc/ssh/ssh_host_rsa_key ] + if [ ! -e /etc/dropbear/dropbear_rsa_host_key.pub ] then - echo -e ${COLOREDSTAR}"Generating RSA-Hostkey ..." - /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + echo -e ${COLOREDSTAR}"Generating Public RSA-Hostkey ..." + # note: the key is stored in the second line of the output + /usr/bin/dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | sed -n '2p' \ + > /etc/dropbear/dropbear_rsa_host_key.pub fi } @@ -33,7 +35,7 @@ # write the public key of the server to the host system PUB_KEY_SERVER="$(mysqldo "select public_key from ssh_auth_server where id=1;")" - if [ -n "${PUB_KEY_SERVER}" ] + if [[ -n ${PUB_KEY_SERVER} ]] then HOME=/root # only if not empty @@ -44,10 +46,10 @@ # put the public key of the host into the db ID=$(mysqldo "select serial from ssh_auth_clients where serial=${ALX_SERIAL};") - if [ -n "${ID}" ] + if [[ -n ${ID} ]] then # run an update - mysqldo "update ssh_auth_clients set public_key='$(< /etc/ssh/ssh_host_rsa_key.pub)' where serial=${ALX_SERIAL};" + mysqldo "update ssh_auth_clients set public_key='$(< /etc/dropbear/dropbear_rsa_host_key.pub)' where serial=${ALX_SERIAL};" else # run an insert mysqldo "insert into ssh_auth_clients(serial,public_key) values('${ALX_SERIAL}','$(< /etc/ssh/ssh_host_rsa_key.pub)')"