Skip to content
File

Blob: dev/vm/smartos/configure-ssh.sh

bash20 lines
1set -eu
2umask 077
3 
4# /etc/ssh is backed by /usbkey/ssh; /root is recreated on every boot.
5cat > /usbkey/ssh/specter_authorized_keys
6config=/usbkey/ssh/sshd_config
7sed \
8 -e '/^[[:space:]]*AuthorizedKeysFile[[:space:]]/d' \
9 -e '/^[[:space:]]*PasswordAuthentication[[:space:]]/d' \
10 -e '/^[[:space:]]*ChallengeResponseAuthentication[[:space:]]/d' \
11 "$config" > "$config.new"
12cat >> "$config.new" <<'EOF'
13AuthorizedKeysFile /etc/ssh/specter_authorized_keys
14PasswordAuthentication no
15ChallengeResponseAuthentication no
16EOF
17/usr/lib/ssh/sshd -t -f "$config.new"
18mv "$config.new" "$config"
19svcadm refresh svc:/network/ssh:default