Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Currently Ansible always uses sudo become_method instead of using the specified 'Effective User Method' it does inherit other settings like 'ssh user' and 'ssh password' so one would expect it would also do this for the become_method.
Version-Release number of selected component (if applicable):
Satellite 6.5
How reproducible:
100%
Steps to Reproduce:
1. Administer -> Settings -> Remote execution settings -> Effective User Method -> su
2. Run ansible playbook
3. Will default to sudo method
Actual results:
~~~
Jul 10 08:44:38 ktordeur-test-ansible sshd[24644]: Accepted password for local from 192.168.140.2 port 44284 ssh2
Jul 10 08:44:38 ktordeur-test-ansible sshd[24644]: pam_unix(sshd:session): session opened for user local by (uid=0)
Jul 10 08:44:39 ktordeur-test-ansible unix_chkpwd[24730]: password check failed for user (local)
Jul 10 08:44:39 ktordeur-test-ansible sudo: pam_unix(sudo:auth): authentication failure; logname=local uid=1000 euid=0 tty=/dev/pts/1 ruser=local rhost= user=local
Jul 10 08:44:41 ktordeur-test-ansible sudo: pam_unix(sudo:auth): conversation failed
Jul 10 08:44:41 ktordeur-test-ansible sudo: pam_unix(sudo:auth): auth could not identify password for [local]
Jul 10 08:44:44 ktordeur-test-ansible sudo: local : user NOT in sudoers ; TTY=pts/1 ; PWD=/home/local ; USER=root ; COMMAND=/bin/sh -c echo BECOME-SUCCESS-nxajxxxwohzbndgcgikajxfdvpmaqeov; /usr/bin/python /home/local/.ansible/tmp/ansible-tmp-1562748279.11-12389537057591/setup.py
~~~
Expected results:
Use the su method
Additional info:
VERIFIED.
@satellite-6.7.0-5.beta.el7sat.noarch
tfm-rubygem-foreman_ansible-4.0.3-1.el7sat.noarch
by the following manual reproducer:
1. Run Ansible Command job with following command:
ps -f $(ps -f $(ps -f $(ps -f $$ | awk 'NR>1{print $3}') | awk 'NR>1{print $3}') | awk 'NR>1{print $3}')
2. Check the output of the job
"stdout_lines": [
"UID PID PPID C STIME TTY STAT TIME CMD",
"root 23891 23876 1 13:09 pts/1 S+ 0:00 sudo -H -S -p [sudo via ansible, key=bjewyccppqwazaqhkapkmopxvnrnrdea] password: -u test /bin/sh -c echo BECOME-SUCCESS-bjewyccppqwazaqhkapkmopxvnrnrdea ; /usr/bin/python /var/tmp/ansible-tmp-1580407876.01-46452950106097/AnsiballZ_command.py"
]
>>> by default "sudo" method is used
3. Change the method to "su" in the settings:
Administer -> Settings -> Remote execution settings -> Effective User Method -> su
4. Run Ansible Command job with the same command:
ps -f $(ps -f $(ps -f $(ps -f $$ | awk 'NR>1{print $3}') | awk 'NR>1{print $3}') | awk 'NR>1{print $3}')
5. Check the output of the job
"stdout_lines": [
"UID PID PPID C STIME TTY STAT TIME CMD",
"root 23579 23564 1 13:09 pts/1 S+ 0:00 su test -c /bin/sh -c 'echo BECOME-SUCCESS-rkdzercgvekzoxetgbxnyqwajzsgmxih ; /usr/bin/python /var/tmp/ansible-tmp-1580407930.12-1211950403156/AnsiballZ_command.py'"
]
>>> "su" method is used as Ansible REX now inherits the setting from SSH REX
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2020:1454