mirror of
https://github.com/trailofbits/algo.git
synced 2025-04-16 22:27:20 +02:00
Explicitly set SSH permissions in base.sh (#1927)
This commit is contained in:
parent
4adb35db80
commit
654809f126
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
set -eux
|
||||
|
||||
# shellcheck disable=SC2230
|
||||
which sudo || until \
|
||||
apt-get update -y && \
|
||||
apt-get install sudo -yf --install-suggests; do
|
||||
|
@ -15,9 +16,10 @@ cat <<EOF >/etc/ssh/sshd_config
|
|||
{{ lookup('template', 'files/cloud-init/sshd_config') }}
|
||||
EOF
|
||||
|
||||
test -d /home/algo/.ssh || (umask 077 && sudo -u algo mkdir -p /home/algo/.ssh/)
|
||||
echo "{{ lookup('file', '{{ SSH_keys.public }}') }}" | (umask 177 && sudo -u algo tee /home/algo/.ssh/authorized_keys)
|
||||
test -d /home/algo/.ssh || sudo -u algo mkdir -m 0700 /home/algo/.ssh
|
||||
echo "{{ lookup('file', '{{ SSH_keys.public }}') }}" | (sudo -u algo tee /home/algo/.ssh/authorized_keys && chmod 0600 /home/algo/.ssh/authorized_keys)
|
||||
|
||||
# shellcheck disable=SC2015
|
||||
dpkg -l sshguard && until apt-get remove -y --purge sshguard; do
|
||||
sleep 3
|
||||
done || true
|
||||
|
|
Loading…
Add table
Reference in a new issue