fixup key managemetn script

This commit is contained in:
Antoine Beaupré 2008-10-16 21:31:05 +00:00
parent 82d4a46f65
commit 64827fbbc1
1 changed files with 5 additions and 3 deletions

View File

@ -44,12 +44,14 @@ case "$1" in
adduser --quiet postfix sasl
db_get "alternc-slave/mergelog-key"
if [ "X$ret" != "" ]; then
key="$RET"
if [ "X$key" != "" ]; then
echo "Creating alternc-mergelog account"
adduser --quiet --system --home /var/run/alternc-mergelog --shell /bin/false --ingroup adm alternc-mergelog
if ! grep -q "$ret" /var/run/alternc-mergelog/.ssh/authorized_keys ; then
if ! grep -q "$key" /var/run/alternc-mergelog/.ssh/authorized_keys ; then
echo "Authorizing requested key to access alternc-mergelog account"
mkdir -p /var/run/alternc-mergelog/.ssh
echo "$ret" >> /var/run/alternc-mergelog/.ssh/authorized_keys
echo "$key" >> /var/run/alternc-mergelog/.ssh/authorized_keys
chown -R alternc-mergelog:adm /var/run/alternc-mergelog/.ssh
chmod -R og-rwx /var/run/alternc-mergelog/.ssh
fi