##bash
#!/bin/bash
# No longer required as this is done by e-smith services

#expand-template /etc/sysconfig/shellinaboxd >/dev/null 2>&1
#expand-template /etc/httpd/conf/httpd.conf >/dev/null 2>&1
#service httpd-e-smith sigusr1 >/dev/null 2>&1
#service shellinaboxd restart >/dev/null 2>&1

# create ssh key pair if not existing
[ -f /var/lib/shellinabox/private.rsa ] || sudo ssh-keygen -t rsa -b 2048 -N "" -C "shellinabox" -f /var/lib/shellinabox/private.rsa
chmod 600 /var/lib/shellinabox/private.rsa
chown shellinabox:shellinabox /var/lib/shellinabox/private.rsa
# add it to /root/.ssh/authorized_keys,if not already present
grep -qFf /var/lib/shellinabox/private.rsa.pub /root/.ssh/authorized_keys 2>/dev/null || cat /var/lib/shellinabox/private.rsa.pub >> /root/.ssh/authorized_keys
