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

Password prompt goes to stdout #3

Closed
ghost opened this issue Jun 24, 2016 · 4 comments
Closed

Password prompt goes to stdout #3

ghost opened this issue Jun 24, 2016 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 24, 2016

It should go to stderr, so that e.g. doas ls > ls.out works and ls.out does not contain the Password: prompt. OpenBSD's doas does the right thing here.

I think this can be setup with PAM somehow, so this is likely related to #2.

@slicer69
Copy link
Owner

Confirmed this is an issue. Trying to find the proper PAM documentation to direct the prompt to stderr.

@slicer69
Copy link
Owner

This issue has been fixed (or at least worked around) in the latest commit: cef2929

The password prompt is now displayed on stderr and the target command's output is written to stdout. At least it's working for me, would like to get it tested before I send update the FreeBSD port.

@ghost
Copy link
Author

ghost commented Jun 25, 2016

While it solves the problem I initially reported it still has another one. Redirecting stderr has the same problem. On OpenBSD doas ls &> ls.out works without putting the password prompt in ls.out (this works with sudo too). On FreeBSD with your fix the prompt still ends up in ls.out.

AFAICT su(1) solves this by using ttyname with pam_set_item(..., PAM_TTY, ...) (https://github.com/freebsd/freebsd/blob/master/usr.bin/su/su.c#L297 and https://github.com/freebsd/freebsd/blob/master/usr.bin/su/su.c#L123).

@slicer69
Copy link
Owner

I tried using ttyname and pam_set_item the way su does yesterday. It didn't work. Depending on where the call is made, I either ended up with the password prompt in stdout or no visible password prompt at all.

You said ls &> ls.out put the password prompt in the output, but that is what I would consider expected behaviour considering the command. I mean that is what I would want to happen if I ran doas ls &> ls.out.

slicer69 added a commit that referenced this issue Nov 9, 2016
Workaround for issue #3: hide stdin from openpam_ttyconv
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

1 participant