Deploy ssh keys to repo
oginstaller/pipeline/head There was a failure building this commit Details

ogrepo-keys
Nicolas Arenas 2025-02-06 12:22:09 +01:00
parent 22650060af
commit 3344157d6b
1 changed files with 10 additions and 0 deletions

View File

@ -37,10 +37,20 @@ add_user_ogrepository() {
echo "User ogrepository does not exist, creating it"
useradd -m -d $OGUSER_HOME -r -s /bin/bash $OGUSER
fi
if [ ! -d $OGUSER_HOME/.ssh ] ; then
mkdir -p $OGUSER_HOME/.ssh
cp ssh-keys/opengnsys $OGUSER_HOME/.ssh/id_ed25519
cp ssh-keys/opengnsys.pub $OGUSER_HOME/.ssh/id_ed25519.pub
cat ssh-keys/opengnsys.pub >> $OGUSER_HOME/.ssh/authorized_keys
chown -R $OGUSER:$OGUSER $OGUSER_HOME/.ssh
chmod 0600 $OGUSER_HOME/.ssh/*
fi
if [ ! -f /etc/sudoers.d/$OGUSER ]; then
echo "User $OGUSER does not have sudo permissions, adding it"
echo "$OGUSER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$OGUSER"
fi
}