Added ssh config (for accessing kobayashi chat)
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
git clone https://github.com/tlinden/devzat
|
||||
cd /tmp/devzat
|
||||
go build
|
||||
args:
|
||||
creates: "/tmp/.ansible.devzatbuild"
|
||||
|
||||
- name: create services template dir
|
||||
file:
|
||||
@@ -33,6 +35,8 @@
|
||||
|
||||
- name: copy devzat binary
|
||||
shell: install -m 755 /tmp/devzat/devzat /usr/local/bastille/templates/services/{{ role_name }}/usr/local/sbin/devzat
|
||||
args:
|
||||
creates: "/tmp/.ansible.devzat"
|
||||
|
||||
- name: copy devzat config file
|
||||
copy:
|
||||
@@ -55,3 +59,8 @@
|
||||
|
||||
- name: template jail
|
||||
shell: "bastille template {{ role_name }} services/{{ role_name }}"
|
||||
args:
|
||||
# FIXME: might make it impossible to update, on the other hand w/o
|
||||
# it this command fails with "devzat binary busy" when the jail is
|
||||
# already running, since go binaries do not fork.
|
||||
creates: "/tmp/.ansible.devzattemplate"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user