Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable become root using rootsh (wrapper for shells) #49625

Closed
UnixArena opened this issue Dec 6, 2018 · 6 comments
Closed

unable become root using rootsh (wrapper for shells) #49625

UnixArena opened this issue Dec 6, 2018 · 6 comments
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bot_closed feature This issue/PR relates to a feature request. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@UnixArena
Copy link

SUMMARY

Unable to become a root where the environment uses rootsh (wrapper shell) method to gain root access.

ISSUE TYPE
  • Feature Idea
    Allow multiple methods or custom methods to gain the root access
COMPONENT NAME

become
become_flags

ADDITIONAL INFORMATION

We are gaining the root access using the following method.
# sudo -H rootsh

When we need to run command without gaining the root shell ,
# sudo -H rootsh -i -u root -- ls -l

@ansibot
Copy link
Contributor

ansibot commented Dec 6, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Dec 6, 2018
@bcoca
Copy link
Member

bcoca commented Dec 6, 2018

afaik, rootsh is not privilege escalation, just a 'logging shell', you can set the default executable to enforce using it https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-executable

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Dec 6, 2018
@ansibot
Copy link
Contributor

ansibot commented Feb 16, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot removed the module This issue/PR relates to a module. label Feb 16, 2019
@pborowicz
Copy link

I was able to get this working by changing these lines in my ansible.cfg:

become_method=doas
ssh_args = -o ServerAliveInterval=50
sudo_exe = "sudo -H -S -n rootsh --"

It also worked with just a "sudo rootsh"

@sivel sivel added the waiting_on_contributor This would be accepted but there are no plans to actively work on it. label Jun 18, 2019
@fedexin40
Copy link

fedexin40 commented Oct 25, 2019

Hello @pborowicz @bcoca @sivel

I am trying to accomplish similar task, in my case I only have access as root with below command
sudo /usr/bin/rootsh -i -u root

I do not have doas installed in my server so I tried in the followig ways to gain access as root

host_key_checking             = false
# ask_pass                    = True
inventory                     = inventory/hosts
allow_world_readable_tmpfiles = true
remote_user                   = fcruzloz
executable                    = sudo /usr/bin/rootsh -i -u root
timeout                       = 50

And

host_key_checking             = false
# ask_pass                    = True
inventory                     = inventory/hosts
allow_world_readable_tmpfiles = true
remote_user                   = fcruzloz
executable                    = /bin/bash
timeout                       = 50


[privilege_escalation]
become_exe                    = sudo rootsh
become_user                   = root
become_flags                  = -i

But it does not work, all the time I receive from server that I am not allowed to run commands as sudo, so do you have some suggestion?

@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2022

Thank you very much for your submission to Ansible. It means a lot to us that you've taken time to contribute.

Unfortunately, this issue has been open for some time while waiting for a contributor to take it up but there does not seem to have been anyone that did so. So we are going to close this issue to clear up the queues and make it easier for contributors to browse possible implementation targets.

However, we're absolutely always up for discussion. Because this project is very active, we're unlikely to see comments made on closed tickets and we lock them after some time. If you or anyone else has any further questions, please let us know by using any of the communication methods listed in the page below:

In the future, sometimes starting a discussion on the development list prior to proposing or implementing a feature can make getting things included a little easier, but it's not always necessary.

Thank you once again for this and your interest in Ansible!

click here for bot help

@ansibot ansibot added bot_closed and removed waiting_on_contributor This would be accepted but there are no plans to actively work on it. labels Apr 12, 2022
@ansibot ansibot closed this as completed Apr 12, 2022
@ansible ansible locked and limited conversation to collaborators Apr 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bot_closed feature This issue/PR relates to a feature request. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

6 participants