openssh-portable icon indicating copy to clipboard operation
openssh-portable copied to clipboard

auth-pam: Immediately report instructions to clients and fix handling in ssh client

Open 3v1n0 opened this issue 2 years ago • 19 comments

As it has been discussed some long time ago in bug #2876, I'm adding support for immediate reporting of instructions to clients as defined by RFC4256. There was a similar attempt on #337, however this implied few more changes (see each commit for further details), in particular:

  • ~~Add an option to disable this behavior server-side~~
  • Fix ssh client to properly handle the instructions, parsing them properly as per the standard format

~~I'm not fully sure if the server-side setting is needed given that SSHv1 is not supported anymore by sshd, but probably it still makes sense to disable this behavior form server-side, even though using the device selection is possible too now.~~

3v1n0 avatar Oct 17 '23 04:10 3v1n0

FYI this has been tested also with PuTTy, and it properly supports the changes without any modification.

3v1n0 avatar Oct 17 '23 21:10 3v1n0

Thanks for raising this @3v1n0! I'm running into issues with PAM/SSH and would love to see your fix implemented. Hopefully this can gain some traction.

JoeStewart93 avatar Dec 04 '23 20:12 JoeStewart93

I think implementing it without backwards compatibility is fine, we could land this early in the release cycle and see if anyone finds breakage with non-OpenSSH clients. If there are problems we can use a compat.[ch] hack to turn it off for the broken clients somehow.

Message ID: @.*** com>

djmdjm avatar Dec 05 '23 21:12 djmdjm

Oh, I see... Well I thought they were also more prone to errors, but will do.

There's very little type safety gained by enums, so it doesn't help as much as we'd like :(

djmdjm avatar Dec 05 '23 21:12 djmdjm

I think implementing it without backwards compatibility is fine, we could land this early in the release cycle and see if anyone finds breakage with non-OpenSSH clients. If there are problems we can use a compat.[ch] hack to turn it off for the broken clients somehow.

Fair... My only concerns is for those new clients (modulo this PR), that may still want the old behavior because otherwise they may get wrong utf-8 output, but if this is not a problem, we can avoid supporting -o KbdInteractiveDevices=pam-legacy-instructions too.

3v1n0 avatar Dec 05 '23 21:12 3v1n0

On Wed, 6 Dec 2023 at 08:26, Marco Trevisan @.***> wrote:

Fair... My only concerns is for those new clients (modulo this PR), that may still want the old behavior because otherwise they may get wrong utf-8 output, but if this is not a problem, we can avoid supporting -o KbdInteractiveDevices=pam-legacy-instructions too.

Wouldn't those clients either 1) not be using notification only PAM modules because they don't work properly now or 2) using them before a module that prompts and therefore be seeing the messed up UTF-8 (as the messages are accumulated) already?

Message ID: @.***>

djmdjm avatar Dec 05 '23 21:12 djmdjm

On Wed, 6 Dec 2023 at 08:26, Marco Trevisan @.***> wrote: Fair... My only concerns is for those new clients (modulo this PR), that may still want the old behavior because otherwise they may get wrong utf-8 output, but if this is not a problem, we can avoid supporting -o KbdInteractiveDevices=pam-legacy-instructions too. Wouldn't those clients either 1) not be using notification only PAM modules because they don't work properly now or 2) using them before a module that prompts and therefore be seeing the messed up UTF-8 (as the messages are accumulated) already?

  1. Eh, but it's not up to the clients to decide if the server uses a pam module that may require that or not.

However, I've been conservative since there are tons of setups I may not have considered, and so providing working-already workaround for old clients seemed to me sane.

But I'll drop this. :)

3v1n0 avatar Dec 05 '23 21:12 3v1n0

@djmdjm I feel that this code and similar one can be now probably dropped too, right?

3v1n0 avatar Dec 05 '23 22:12 3v1n0

@djmdjm can you have a look again on that please?

3v1n0 avatar Jan 11 '24 13:01 3v1n0

@djmdjm any chance you could have another look at this? Ubuntu plans to ship this in 24.04 and I'd very much prefer if we had an upstream approved fix instead of an out-of-tree patch.

tobhe avatar Feb 13 '24 14:02 tobhe

Is there any progress on this PR? We are writing customized multi-factor authentication pam module for ssh and hope to have the ability to prompt some message without requiring any user input during authentication.

taleintervenor avatar Mar 11 '24 02:03 taleintervenor

@djmdjm ping?

3v1n0 avatar Jun 25 '24 23:06 3v1n0