fix alternc-slaves detection and warn the user if there's no key to authorize
This commit is contained in:
parent
049042dd87
commit
93dde12ee2
|
@ -158,19 +158,26 @@ EOF
|
||||||
# multi-server configuration: we create an alternc account with
|
# multi-server configuration: we create an alternc account with
|
||||||
# authorized keys. since this is the master, we do not give him a
|
# authorized keys. since this is the master, we do not give him a
|
||||||
# valid shell, but we still need the user for proper perms
|
# 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
|
if ! grep -q alternc /etc/passwd ; then
|
||||||
echo "Creating alternc account"
|
echo "Creating alternc account"
|
||||||
adduser --quiet --system --uid 342 --home $ALTERNC_LOC --shell /bin/false --ingroup adm alternc
|
adduser --quiet --system --uid 342 --home $ALTERNC_LOC --shell /bin/false --ingroup adm alternc
|
||||||
fi
|
fi
|
||||||
key=`cat ~root/.ssh/id_dsa.pub`
|
if [ -r ~root/.ssh/id_dsa.pub ]; then
|
||||||
if ! grep -q "$key" $ALTERNC_LOC/.ssh/authorized_keys ; then
|
key=`cat ~root/.ssh/id_dsa.pub`
|
||||||
echo "Authorizing root ssh key to access the common alternc account"
|
if ! grep -q "$key" $ALTERNC_LOC/.ssh/authorized_keys ; then
|
||||||
mkdir -p $ALTERNC_LOC/.ssh
|
echo "Authorizing root ssh key to access the common alternc account"
|
||||||
echo "$key" >> $ALTERNC_LOC/.ssh/authorized_keys
|
mkdir -p $ALTERNC_LOC/.ssh
|
||||||
chown -R alternc:adm $ALTERNC_LOC/.ssh
|
echo "$key" >> $ALTERNC_LOC/.ssh/authorized_keys
|
||||||
chmod -R og-rwx $ALTERNC_LOC/.ssh
|
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
|
fi
|
||||||
|
else
|
||||||
|
echo "AlternC slaves not configured ($ALTERNC_SLAVES)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# /var/alternc/dns/d/www.example.com
|
# /var/alternc/dns/d/www.example.com
|
||||||
|
|
Loading…
Reference in New Issue