community.general
community.general copied to clipboard
Become Plugin pbrun Fails to Find Command due to Quotation Padding from Ansible
SUMMARY
Adding quotation padding around commands for privilege escalation breaks pbrun's execution stating "command not found"
ISSUE TYPE
- Bug Report
COMPONENT NAME
pbrun.py
ANSIBLE VERSION
2.9.11
STEPS TO REPRODUCE
---
- hosts: all
become_method: pbrun
become: true
gather_facts: false
tasks:
- shell: echo $PATH
EXPECTED RESULTS
$PATH is echoed to stdout
ACTUAL RESULTS
ssh -o StrictHostKeyChecking=no -o 'User="remote-user"' -o ConnectTimeout=10 -tt remote-host 'pbrun '"'"'echo BECOME-SUCCESS-ofsgdkxshyqguxrkwjyvnujmakxfhuff'"'"''
pbrun9.4.1-03[24202]: 3201.08 Exec of echo BECOME-SUCCESS-ofsgdkxshyqguxrkwjyvnujmakxfhuff
failed: Command not found. Connection to remote-host closed.
Testing from command line, the above fails but removing quotes around the embedded "pbrun" commands works:
ssh -o StrictHostKeyChecking=no -o 'User="remote-user"' -o ConnectTimeout=10 -tt remote-host 'pbrun echo BECOME-SUCCESS-ofsgdkxshyqguxrkwjyvnujmakxfhuff; echo $PATH'
BECOME-SUCCESS-ofsgdkxshyqguxrkwjyvnujmakxfhuff
/usr/local/bin:/usr/bin
!component =plugins/become/pbrun.py
Any resolution on this issue?
cc @None click here for bot help
I don't think anyone has been working on this plugin. In any case, the history speaks for itself: https://github.com/ansible-collections/community.general/commits/main/plugins/become/pbrun.py (my changes are not related to any functionality except some very generic bug fixing)
pbrun (power broker) with ansible is not working as every time it is giving the error "Command not found"
Exec of echo BECOME-SUCCESS-tsafolemoxcgtbnrzzjvehfja ; /usr/bin/python /users/userid/.ansible/tmp/ansible-tmp-1628238621.82-19572-9510618362995/AnsiballZ_command.py failed: Command not found.
This is something I am seeing too