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

sudoers module does not support host restrictions #5702

Closed
1 task done
loz-hurst opened this issue Dec 18, 2022 · 2 comments · Fixed by #5703
Closed
1 task done

sudoers module does not support host restrictions #5702

loz-hurst opened this issue Dec 18, 2022 · 2 comments · Fixed by #5703
Labels
feature This issue/PR relates to a feature request has_pr module module plugins plugin (any type) system

Comments

@loz-hurst
Copy link
Contributor

Summary

Currently the sudoers module is hardcoded to set the host to the magic value ALL:

return "{owner} ALL={runas}{nopasswd} {commands}\n".format(owner=owner, runas=runas_str, nopasswd=nopasswd_str, commands=commands_str)

This is a problem for me in two different scenarios I have:

  1. Some network booted (diskless) systems with a shared /etc/sudoers.d (network) filesystem using the host restrictions to constrain which commands are permitted on which host
  2. A security policy that requires specifying the host to mitigate the risk of inappropriate escalation being possible if the file is inadvertently copied to the wrong host (e.g. via poorly aimed scp, restoring the wrong host's /etc/sudoers.d from backup or copying it inappropriately after mounting the disk on a different host in a DR situation - all 3 of which have happened at some point and I'm sure there's more ways to mess it up too)

If accepted, this is a trivial feature to add - it is essentially a carbon-copy of runas just before the =.

In comparing the code with the sudoers manual, I noticed that like the host list - runas supports a list of users but that has not been implemented either - just noting it, I have no use case for needing that feature (or supporting a list for the host).

Issue Type

Feature Idea

Component Name

sudoers

Additional Information

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

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

click here for bot help

@ansibullbot
Copy link
Collaborator

cc @JonEllis @JonEllis0
click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request has_pr module module plugins plugin (any type) system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants