Added ssh config (for accessing kobayashi chat)

This commit is contained in:
2024-12-13 18:39:21 +01:00
parent c7b89345bf
commit 862f2567b1
6 changed files with 41 additions and 4 deletions

View File

@@ -115,8 +115,30 @@ case "$action" in
if test -e "/usr/local/bastille/keys/$user" -a ! -e "/home/$user/.ssh/authorized_keys"; then
# install ssh key
uid=$(getuid "$root" "$user")
install -m 700 -o "$uid" -g "$uid" -d "/home/$user/.ssh"
install -m 600 -o "$uid" -g "$uid" "/usr/local/bastille/keys/$user" "/home/$user/.ssh/authorized_keys"
run install -m 700 -o "$uid" -g "$uid" -d "/home/$user/.ssh"
run install -m 600 -o "$uid" -g "$uid" "/usr/local/bastille/keys/$user" "/home/$user/.ssh/authorized_keys"
# generate chat key, which is required so login to
# kobayashi, so that ssh-chat works even if the user does
# not have their own key yet.
run ssh-keygen -t ed25519 -f /home/$user/.ssh/id_chat_kobayashi -P ""
(
echo "The key id_chat_kobayashi exists so that you're able to reach"
echo "the kobayashi chat service. Once you have generated your own"
echo "key, you can just delete it."
) > "/home/$user/.ssh/README"
if test ! -e "/home/$user/.ssh/config"; then
(
echo "Host kobayashi"
echo " Port 2222"
echo " IdentityFile ~/.ssh/id_chat_kobayashi"
echo " StrictHostKeyChecking no"
) > "/home/$user/.ssh/config"
fi
run chown "$uid:$uid" /home/$user/.ssh/*
fi
;;
absent)

View File

@@ -13,8 +13,8 @@ CMD mkdir -p /home
FSTAB /home home nullfs rw 0 0
# FIXME: fails for now, see: https://github.com/BastilleBSD/bastille/issues/743
#CP usr/share/skel /usr/share/skel
SERVICE sshd start
SERVICE motd restart