Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pam_touchid appears to break sudo over SSH #2

Open
modest opened this issue Dec 19, 2016 · 8 comments
Open

pam_touchid appears to break sudo over SSH #2

modest opened this issue Dec 19, 2016 · 8 comments

Comments

@modest
Copy link

modest commented Dec 19, 2016

I haven't fully tested this scenario, but at first pass, it seems like pam_touchid prevents a remote SSH user from using sudo on a Mac with pam_touchid installed. The GUI prompt appears and never gives up without GUI user input.

Are there some possible mitigations here?

  • Checking the tty being used (does PAM expose this?) and immediately falling back to password authentication if the user is coming from a remote terminal
  • or: Adding a timeout so that the Touch ID prompt automatically aborts after 5 seconds, causing a fallback to password authentication.
@hamzasood
Copy link
Owner

Interesting, I hadn't thought of that.

Does it work if you add something like:

if (getenv("SSH_TTY"))  
    return PAM_IGNORE;

to the very top of pam_sm_authenticate?

I can't test it at the moment, but hopefully that will make it fallback to the default authentication method when run from ssh (assuming you kept the opendirectory line intact in the ssh pam.d entry)

@fraimondo
Copy link

Just tested it. I can confirm it works.

@cqexbesd
Copy link

cqexbesd commented Jan 6, 2017

I think also that XPC_SERVICE_NAME will be set if running a shell locally - but that might depend on if you are using Terminal.app or an alternative. Neither way seem that great as a proxy for detecting if the user is local or not but I can't think of a better way.

@barry-scott
Copy link

@cqexbesd what if I have a GUI app that spawns a sudo command? Will I see the XPC_SERVICE_NAME then?

@ITJesse
Copy link

ITJesse commented Jun 3, 2017

if (getenv("SSH_TTY"))
return PAM_IGNORE;

@hamzasood
I can also confirm it works.
Why don't you merge it into code?

@caesar
Copy link

caesar commented Aug 22, 2017

Looks like this project may be abandoned, sadly... in the meantime, @BenKesselring has a fork with this bug fixed: https://github.com/BenKesselring/pam_touchid/

@AdnanHodzic
Copy link

@caesar didn't have a chance to check, did he include if (getenv("SSH_TTY")) return PAM_IGNORE; into his fork/master?

@caesar
Copy link

caesar commented Aug 22, 2017

@AdnanHodzic yes. He also opened a PR (#4) to merge that fix into this project but @hamzasood unfortunately never merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants