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

Fix undefined User_Alias HIPAA_ACTOR in sudoers #6403

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zwets
Copy link
Contributor

@zwets zwets commented Oct 11, 2024

This adds the missing User_Alias HIPAA_ACTOR to /etc/sudoers.d/cchq. Visudo warns about this:

$ sudo visudo /etc/sudoers.d/cchq # and save the file without changes
Warning: /etc/sudoers.d/cchq:24:28: User_Alias "HIPAA_ACTOR" referenced but not defined

This refers to line 23:

HIPAA_ACTOR ALL = (ALL) ALL

Which implies that a User_alias HIPAA_ACTOR has been defined, however there is none such and so this line has no effect.1

There is little practical impact because {{ cchq_user }}, the intended HIPAA_ACTOR, is a member of HIPAA_USERS, who have nearly the same privileges, and additionally there is this line:

{{ cchq_user }} ALL = (ALL) NOPASSWD: HQCOMMANDS

Which presumably was put there as a workaround when HIPAA_ACTOR failed to grant the desired privileges - precisely because it was not defined.

So, this patch does two things:

  • Define the User_Alias HIPAA_ACTOR as the intended {{ cchq_user }}
  • Replace the literal {{ cchq_user }} by the intended HIPAA_ACTOR alias

Footnotes

  1. The Runas_Alias by the same name is in a separate "namespace", and can't be mistaken for a User_Alias: it only occurs between parentheses, whereas User_Alias is the leftmost token of a rule. Even so, sudoers(5) advises against using the same name (to avoid confusion) though in this case it makes sense, as the intention clearly is that the Runas and User aliases have the same member(s).

@zwets zwets force-pushed the fix-sudoers-hipaa-actor branch from 479d029 to a0d0748 Compare October 18, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant