Fix undefined User_Alias HIPAA_ACTOR in sudoers#6403
Conversation
479d029 to
a0d0748
Compare
8318eac to
44f0b46
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a visudo warning and restores intended behavior in the bootstrap-users sudoers template by defining the missing User_Alias HIPAA_ACTOR and using it consistently for HQCOMMANDS privileges.
Changes:
- Add
User_Alias HIPAA_ACTOR = {{ cchq_user }}to eliminate the undefined-alias warning. - Replace the literal
{{ cchq_user }}sudo rule with theHIPAA_ACTORalias for consistency.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| User_Alias HIPAA_ACTOR = {{ cchq_user }} | ||
|
|
||
| Runas_Alias HIPAA_ACTOR = {{ cchq_user }} |
There was a problem hiding this comment.
Defining User_Alias HIPAA_ACTOR makes the existing rule HIPAA_ACTOR ALL = (ALL) ALL (later in this file) become effective, which grants {{ cchq_user }} full sudo access (any command as any runas user). If the intent is only to allow the limited HQCOMMANDS set, consider narrowing/removing the broad (ALL) ALL rule, or add an explicit comment here explaining why full sudo is required for the HIPAA actor to avoid accidental over-privileging in the future.
There was a problem hiding this comment.
LGTM. Reconsidering after more careful reading of the Copilot review. Waiting on secondary review by @dannyroberts, @gherceg, and/or @AmitPhulera.
This adds the missing User_Alias HIPAA_ACTOR to
/etc/sudoers.d/cchq. Visudo warns about this:This refers to line 23:
Which implies that a
User_alias HIPAA_ACTORhas been defined, however there is none such and so this line has no effect.1There is little practical impact because
{{ cchq_user }}, the intendedHIPAA_ACTOR, is a member ofHIPAA_USERS, who have nearly the same privileges, and additionally there is this line:Which presumably was put there as a workaround when
HIPAA_ACTORfailed to grant the desired privileges - precisely because it was not defined.So, this patch does two things:
HIPAA_ACTORas the intended{{ cchq_user }}{{ cchq_user }}by the intendedHIPAA_ACTORaliasFootnotes
The
Runas_Aliasby 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). ↩