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

Commit 045dbea

Browse files
authored
Merge pull request #156 from rcII/add-pam-device-2fa-config
Adds sshd config for keyboard-interactive pam device
2 parents b5e7355 + b58d5af commit 045dbea

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
@@ -56,6 +56,7 @@ Warning: This role disables root-login on the target server! Please make sure yo
5656
|`ssh_client_password_login` | false | `true` to allow password-based authentication with the ssh client |
5757
|`ssh_server_password_login` | false | `true` to allow password-based authentication with the ssh server |
5858
|`ssh_google_auth` | false | `true` to enable google authenticator based TOTP 2FA |
59+
|`ssh_pam_device` | false | `true` to enable public key auth with pam device 2FA |
5960
|`ssh_banner` | `false` | `true` to print a banner on login |
6061
|`ssh_client_hardening` | `true` | `false` to stop harden the client |
6162
|`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
@@ -99,6 +99,11 @@ UsePAM {{ 'yes' if (ssh_use_pam|bool) else 'no' }}
9999
AuthenticationMethods publickey,keyboard-interactive
100100
{% endif %}
101101

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

0 commit comments

Comments
 (0)