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

Support modifying sudoers Defaults #282

Merged
merged 10 commits into from
May 13, 2024
Merged

Support modifying sudoers Defaults #282

merged 10 commits into from
May 13, 2024

Conversation

deric
Copy link
Contributor

@deric deric commented Jun 29, 2022

This PR introduces a possibility to modify sudoers defaults without the need to provide whole configuration file.

However, it would be only possible to add new entries:

sudo::defaults:
  mailto: 
    value: 'root'

would be converted to a line in /etc/sudoers

Defaults mailto=root

The sudoers syntax is fairly complex:

     Default_Type ::= 'Defaults' |
                      'Defaults' '@' Host_List |
                      'Defaults' ':' User_List |
                      'Defaults' '!' Cmnd_List |
                      'Defaults' '>' Runas_List

     Default_Entry ::= Default_Type Parameter_List

     Parameter_List ::= Parameter |
                        Parameter ',' Parameter_List

     Parameter ::= Parameter '=' Value |
                   Parameter '+=' Value |
                   Parameter '-=' Value |
                   '!'* Parameter

There's a possibility to add more complex configurations:

sudo::defaults:
  mailto:
    type: '@hosts_list'
    operator: '+='
    value: [email protected]

@bschonec
Copy link
Contributor

What a great idea. You just saved me a lot of time, too in implementing this. I'm going to play with your changes today.

@bschonec bschonec mentioned this pull request Jul 12, 2022
@deric
Copy link
Contributor Author

deric commented Jul 13, 2022

Ruby 2.5 is EOL, probably could be updated to Ruby 2.6, right?

Ruby 2.5
status: eol
release date: 2017-12-25
EOL date: 2021-04-05

@bschonec
Copy link
Contributor

@deric Would you be so kind as to slipstream my updates to your fork and resubmit this pull request?

@saz
Copy link
Owner

saz commented Jul 17, 2022

@deric LGTM but I'd prefer, to have separate PRs for using hiera and the defaults part. Easier to spot any issues in each part.

@deric
Copy link
Contributor Author

deric commented Jul 18, 2022

@bschonec I've added your RHEL7 template modifications.
@saz I understand the PR is modifying too many files. I've added a common Ruby function that formats the defaults config. Thus each OS template requires only single line change.

@saz saz merged commit 47b8628 into saz:master May 13, 2024
@saz
Copy link
Owner

saz commented May 13, 2024

Thanks for this PR. I'll do some more changes and will get a new release published asap.

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.

3 participants