Francois Leurent
2014-Feb-05 10:44 UTC
Make SSH_ORIGINAL_COMMAND available in AuthorizedKeysCommand context
Hi Using SSH_ORIGINAL_COMMAND in AuthorizedKeys is so helpful, I'd like to know if it might be possible to access it in the AuthorizedKeysCommand context (via env ?). Is this possible ? can anybody give me advice on going into this ? If possible, I'll use this SSH_ORIGINAL_COMMAND to send client specifics information to the AuthorizedKeysCommand script. Currently, the only alternative to this is to use the login itself (we have around 30k+ different 'hosts' that might want to connect to our servers) to identify the client, but that come with the need of a custom nss endpoint configuration (we use libnss-pgsql2 ) to support dynamic user lookup, and more work (to manage uid & co) Using 'one' standard user file was enough (and a lot simplier), as those hosts don't need to do anything but to setup a revert port forwarding rule, and are bound to a very limited shell. My (now useless) /home/host_controler/.ssh/authorized_keys file (build on a cron run) was like : command="limited_shell.sh --host_id=XXX1 $SSH_ORIGINAL_COMMAND" ssh-rsa pubkey of host 1" command="limited_shell.sh --host_id=XXX2 $SSH_ORIGINAL_COMMAND" ssh-rsa pubkey of host 2" command="limited_shell.sh --host_id=XXX3 $SSH_ORIGINAL_COMMAND" ssh-rsa pubkey of host 3" ... Thank you very much for your help Francois Leurent
Damien Miller
2014-Feb-05 12:25 UTC
Make SSH_ORIGINAL_COMMAND available in AuthorizedKeysCommand context
On Wed, 5 Feb 2014, Francois Leurent wrote:> Hi > > Using SSH_ORIGINAL_COMMAND in AuthorizedKeys is so helpful, > I'd like to know if it might be possible to access it in the > AuthorizedKeysCommand context (via env ?). Is this possible ? can > anybody give me advice on going into this ?Can't be done sorry - authentication happens well before the command is sent. When command="..." is specified in authorized_keys and the output of AuthorizedKeysCommand, it's just saving the restriction for later once authentication has completed and the protocol has progressed far enough for the client to request a shell or command execution. -d
Maybe Matching Threads
- [Bug 2253] New: No "$@"-like SSH_ORIGINAL_COMMAND leads to escaping, arg-sep and metachar issues
- SSH_ORIGINAL_COMMAND and no forced command
- Dovecot pgsqlauthentication database reconnection/failover problem
- Deleting an exported resource
- [PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.