Skip to content
This repository was archived by the owner on Dec 26, 2020. It is now read-only.

Commit b58d5af

Browse files
author
Raney Cain
committed
Adds sshd config for keyboard-interactive pam device
- Adds configuration option for public key authentication with 2FA input from a PAM device such as a Yubikey. This will allow keyboard interaction from the _device only_. See the documentation on AuthenticationMethods [here](https://www.freebsd.org/cgi/man.cgi?sshd_config(5)).
1 parent 6397a1e commit b58d5af

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Warning: This role disables root-login on the target server! Please make sure yo
5252
|`ssh_client_password_login` | false | `true` to allow password-based authentication with the ssh client |
5353
|`ssh_server_password_login` | false | `true` to allow password-based authentication with the ssh server |
5454
|`ssh_google_auth` | false | `true` to enable google authenticator based TOTP 2FA |
55+
|`ssh_pam_device` | false | `true` to enable public key auth with pam device 2FA |
5556
|`ssh_banner` | `false` | `true` to print a banner on login |
5657
|`ssh_client_hardening` | `true` | `false` to stop harden the client |
5758
|`ssh_client_port` | `'22'` | Specifies the port number to connect on the remote host. |

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ ssh_use_pam: false # sshd
7979
# false to disable google 2fa authentication
8080
ssh_google_auth: false # sshd
8181

82+
# false to disable pam device 2FA input
83+
ssh_pam_device: false # sshd
84+
8285
# if specified, login is disallowed for user names that match one of the patterns.
8386
ssh_deny_users: '' # sshd
8487

templates/opensshd.conf.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ UsePAM {{ 'yes' if (ssh_use_pam|bool) else 'no' }}
9797
AuthenticationMethods publickey,keyboard-interactive
9898
{% endif %}
9999

100+
# Force public key auth then ask for pam device input
101+
{% if ssh_pam_device %}
102+
AuthenticationMethods publickey,keyboard-interactive:pam
103+
{% endif %}
104+
100105
# Disable password-based authentication, it can allow for potentially easier brute-force attacks.
101106
PasswordAuthentication {{ 'yes' if (ssh_server_password_login|bool) else 'no' }}
102107
PermitEmptyPasswords no

0 commit comments

Comments
 (0)