I think so. (Would be open to contributions, but we could also do it ourself if needed).
Is it mostly flag compatible?
The one thing I want to fix with sudo_exe is it should be settable per inventory host, so we’ll probably do that at the same time too, and leave the ansible.cfg setting for a default.
Well, sesu supports “-” flag and “-c” flag just like su. Those two are most important I guess. The main difference is that su requires root password when you switch to root while sesu requires user password, just like sudo. But I don’t think that this should be problem.
Edgars
pirmdiena, 2014. gada 8. septembris 15:19:13 UTC+2, Michael DeHaan rakstīja:
Was there any update on adding ability to use sesu? Note that in our case sesu does NOT prompt for the ‘to become’ user. Here is how we use it:
login under my personal user id
run “sesu - <to_become_user_id>”
… it will NOT ask for any password and will directly log me under the to_become_user_id
FYI here is the the output of sesu --help:
CA ControlMinder sesu v12.80.0.1494 - Surrogate utility
Copyright (c) 2013 CA. All rights reserved.
Usage: sesu [-] [name] [-l] [-n] [-s shell] [-c command]
-h Displays this help and exits.
Changes ID associated with session to that of
user.
Same but sets environment like the target user.
-l shell will be a login shell. This option is currently supported only on Linux
-s Next argument is a shell that will be used instead of the user’s default shell. This option is currently supported only on Linux
-c Next argument is a command.
-n Do not prompt for invoker password.
NOTE: If the security authorization server is not found, system
/bin/su will be used instead.
and here is a bit of more info from man page:
NAME
sesu - Surrogate utility
SYNOPSIS
sesu [ - ] [ options ] [ name ]
DESCRIPTION
The sesu utility provides a transparent su command that does not require the user
to provide the password of the substituted user. The authorization process is based
solely on AccessControl access rules as defined in class SURROGATE.
Thanks Brian - I didn’t know that’s possible (it is not documented in the default config file) - yes, that actually gets me much closer - THANK YOU
However I am now getting another error since ansible does not seem to be able to ignore the standard ‘login information messages’ during the su / sesu login process…
Here is what I did:
Edit /etc/ansible/ansible.cfg:
su_exe = /usr/seos/bin/sesu
su_flags = -
the ‘-’ flag will make sure that I also set the users’ environment - which ultimately triggers the standard welcome login messages etc.
thx for sharing - I guess the key issue I have now really is that ansible is not able to ignore the ‘login messages’ - they seem to be ignored by the ‘remote user’ (ansible ‘-u’ parameter) but ansible is not able to ignore them when doing su (resp. sesu)… Which of the above you think would specifically address this?
Can you give example of ‘login messages’. Is it some banner or MotD? We also have multi-line banner when users ssh in and ansible works just fine. We just had a problem with su prompt and had to add sesu prompt in su_prompts.py
Edgars
pirmdiena, 2014. gada 8. septembris 14:53:46 UTC+2, Edgars rakstīja: