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

Conversation

@rcII
Copy link
Contributor

@rcII rcII commented Apr 12, 2018

  • 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.

- 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)).

# Force public key auth then ask for pam device input
{% if ssh_pam_device %}
AuthenticationMethods publickey,keyboard-interactive:pam
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have almost the same configuration on lines 96-98, except for the :pam-part. What's the difference between these two? Are both needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rndmh3ro the added :pam option only allows authentication from the PAM (yubikey) device itself. From the sshd docs:

	     For keyboard interactive authentication it	is also	possible to
	     restrict authentication to	a specific device by appending a colon
	     followed by the device identifier ``bsdauth'', ``pam'', or
	     ``skey'', depending on the	server configuration.  For example,
	     ``keyboard-interactive:bsdauth'' would restrict keyboard interac-
	     tive authentication to the	``bsdauth'' device.

(Sorry for the crappy formatting). Source: https://www.freebsd.org/cgi/man.cgi?query=sshd_config&sektion=5.
Regarding ChallengeResponseAuthentication and UsePam, this is the mechanism that prompts a challenge response via the PAM interface. The excepted "2FA" outcome is as follows.

  1. Authenticate via ssh public key first.
  2. Prompt a challenge response from PAM device (Yubikey).
    The user will be prompted as follows:
YubiKey for `foouser':

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your explanation!

@rndmh3ro
Copy link
Member

rndmh3ro commented Apr 12, 2018

Hey @rcII,

Thanks for your PR!

I never used a Yubikey with 2FA and sshd, so my knowledge here is limited.. Hope you can answer my comments.

EDIT:
Also what's with ChallengeResponseAuthentication? And the ssh-option UsePam? Is this needed for 2FA with yubikey? Seems I've got something more to learn here. :)

What I want from a variable like ssh_pam_device is to tell me what exactly it does and it should do everything it needs to.

@rndmh3ro rndmh3ro merged commit 045dbea into dev-sec:master Apr 20, 2018
@rcII rcII deleted the add-pam-device-2fa-config branch April 20, 2018 20:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants