# hooks addon to have a SSH daemon in terminal # need dropbear SSH package if [ ! $TCOS_SSH ] ;then _verbose "(14ssh) TCOS_SSH disabled" else stat_before if [ ! -d /usr/share/doc/dropbear ]; then echo "WARNING" echo "" echo "Please install dropbear package or disable SSH support." echo " => apt-get install dropbear" echo "" else mkdir -p $DESTDIR/etc mkdir -p $DESTDIR/usr/lib/dropbear mkdir -p $DESTDIR/var/log/dropbear mkdir -p $DESTDIR/var/run/dropbear copydir /etc/dropbear/ /etc/ rm -f $DESTDIR/etc/dropbear/supervise rm -f $DESTDIR/etc/dropbear/log/supervise rm -f $DESTDIR/etc/dropbear/log/main cpifexists /usr/sbin/dropbear /usr/bin/ # ssh server cpifexists /usr/bin/dbclient /usr/bin/ # ssh client ( no have ssh -X support ) cpifexists /etc/shells /etc/ cpifexists /usr/lib/dropbear/dropbearconvert /usr/lib/dropbear/ # copy pub key if [ ${TCOS_ADMIN_USER} ]; then mkdir -p $DESTDIR/root/.ssh _echo " Copying ${TCOS_ADMIN_USER} public SSH key" if [ "${TCOS_ADMIN_USER}" = "root" ]; then pkey=/root/.ssh/id_rsa.pub key=/root/.ssh/id_rsa else home=$(getent passwd ${TCOS_ADMIN_USER} | head -1 | awk -F":" '{print $6}') if [ "$home" = "" ]; then home="/home/${TCOS_ADMIN_USER}"; fi pkey=${home}/.ssh/id_rsa.pub key=${home}/.ssh/id_rsa fi #### key exists? ### if [ -f ${key} ]; then #_echo " Copying $key...." cat $pkey >> $DESTDIR/root/.ssh/authorized_keys cat $pkey >> $DESTDIR/root/.ssh/id_rsa.pub cat $key >> $DESTDIR/root/.ssh/id_rsa chmod 600 $DESTDIR/root/.ssh/id_rsa #else # _echo " WARNING: $key not found !!!" # _echo " You need to create ssh-key as \"${TCOS_ADMIN_USER}\" user or select another user in preferences." # _echo " => $ ssh-keygen -t rsa" fi #################### else _verbose "(14ssh) TCOS_ADMIN_USER is empty" fi fi stat_after "Dropbear ssh server" fi # end of TCOS_SSH