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