Skip to content

Commit

Permalink
simplify sshd config and add basic tests for it
Browse files Browse the repository at this point in the history
Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux committed Jun 21, 2023
1 parent 1749415 commit ba48fea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 4 additions & 10 deletions templates/sshd_config.j2
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# Security - public keys only
PasswordAuthentication no
ChallengeResponseAuthentication no
KbdInteractiveAuthentication no
AuthenticationMethods publickey
AuthorizedKeysFile .ssh/authorized_keys
PermitRootLogin no
X11Forwarding no
AllowTcpForwarding yes

# Misc
Port 8702
PrintMotd no
LoginGraceTime 30

# Privileges
PermitRootLogin no
{% if ansible_os_family == "Archlinux" %}
Subsystem sftp /usr/lib/ssh/sftp-server
{% elif ansible_os_family == "Debian" %}
Subsystem sftp /usr/lib/openssh/sftp-server
{% endif %}
AllowTcpForwarding yes
Subsystem sftp internal-sftp
6 changes: 6 additions & 0 deletions test/install.test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,9 @@ exists() {
run gpg --list-keys
echo "$output" && echo "$output" | grep -iq "\[ultimate\] Eirik"
}

@test "ssh" {
# verify sshd works against a keychain loaded private key
run ssh -q localhost -i ~/.ssh/main_id -p 8702 -o StrictHostKeyChecking=no echo ok
echo "$output" | grep "ok"
}

0 comments on commit ba48fea

Please sign in to comment.