-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Labels
Description
Your setup
Formula commit hash / release tag
Versions reports (master & minion)
Pillar / config used
Bug details
Describe the bug
Currently, rules are run through dictsort
, which causes issues with users/groups which match multiple rules. Sudo takes the last matching rule - which may not always be desirable - for example if one wants to have NOPASSWD
for a specific command take priority over a general password enforced rule.
Example:
sudoers:
groups:
wheel:
- 'ALL=(ALL) ALL'
hypervisor.cluster-admins:
- >-
{{ grains['host'] }}=(root) NOPASSWD:
/sbin/multipath -f [[\:alnum\:]]*,
Returns:
%hypervisor.cluster-admins falkor21=(root) NOPASSWD: /sbin/multipath -f [[\:alnum\:]]*
%wheel ALL=(ALL) ALL
It should be vice versa, as now, for users who are in both groups (wheel
and hypervisor.cluster-admins
) the NOPASSWD
rule never matches, as the wheel
rule takes priority.
I'm not sure if just removing dictsort
is the right solution either though, I think it requires some other logic.