Commit 93dde12e authored by Antoine Beaupré's avatar Antoine Beaupré

fix alternc-slaves detection and warn the user if there's no key to authorize

parent 049042dd
......@@ -158,19 +158,26 @@ EOF
# multi-server configuration: we create an alternc account with
# authorized keys. since this is the master, we do not give him a
# valid shell, but we still need the user for proper perms
if [ ! -z "$ALTERNC_SLAVES" && "$ALTERNC_SLAVES" != "localhost" ] ; then
if [ ! -z "$ALTERNC_SLAVES" ] && [ "$ALTERNC_SLAVES" != "localhost" ] ; then
if ! grep -q alternc /etc/passwd ; then
echo "Creating alternc account"
adduser --quiet --system --uid 342 --home $ALTERNC_LOC --shell /bin/false --ingroup adm alternc
fi
key=`cat ~root/.ssh/id_dsa.pub`
if ! grep -q "$key" $ALTERNC_LOC/.ssh/authorized_keys ; then
echo "Authorizing root ssh key to access the common alternc account"
mkdir -p $ALTERNC_LOC/.ssh
echo "$key" >> $ALTERNC_LOC/.ssh/authorized_keys
chown -R alternc:adm $ALTERNC_LOC/.ssh
chmod -R og-rwx $ALTERNC_LOC/.ssh
if [ -r ~root/.ssh/id_dsa.pub ]; then
key=`cat ~root/.ssh/id_dsa.pub`
if ! grep -q "$key" $ALTERNC_LOC/.ssh/authorized_keys ; then
echo "Authorizing root ssh key to access the common alternc account"
mkdir -p $ALTERNC_LOC/.ssh
echo "$key" >> $ALTERNC_LOC/.ssh/authorized_keys
chown -R alternc:adm $ALTERNC_LOC/.ssh
chmod -R og-rwx $ALTERNC_LOC/.ssh
fi
else
echo "No SSH key in "~root/.ssh/id_dsa.pub
echo "create one and reconfigure alternc to propagate SSH keys"
fi
else
echo "AlternC slaves not configured ($ALTERNC_SLAVES)"
fi
# /var/alternc/dns/d/www.example.com
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment