Fix sudo::defaults function to correctly place list#338
Open
gettalong wants to merge 1 commit into
Open
Conversation
I was using this module on a new Debian 13 host and checked the changes to the default sudoers file.
Reviewing the changes I wanted to preserve some of the defaults. However, most of the Debian defaults are specified like `Defaults:%sudo ...`. Therefore I tried using the `list` value with `:%sudo`. As this was placed after the key and not directly after `Defaults` it led to an error in the sudoers configuration:
~~~
/etc/sudoers:4:18: syntax error
Defaults env_keep:%sudo+="http_proxy https_proxy ftp_proxy all_proxy no_proxy"
^~~~~~~
~~~
I'm not entirely sure what the `list` key does in the current form but I think it needs to go directly after the `Defaults` string, as indicated by `man sudoers`. With this change the resulting sudoers file works correctly:
~~~
Defaults:%sudo env_keep+="http_proxy https_proxy ftp_proxy all_proxy no_proxy"
~~~
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was using this module on a new Debian 13 host and checked the changes to the default sudoers file.
Reviewing the changes I wanted to preserve some of the defaults. However, most of the Debian defaults are specified like
Defaults:%sudo .... Therefore I tried using thelistvalue with:%sudo. As this was placed after the key and not directly afterDefaultsit led to an error in the sudoers configuration:I'm not entirely sure what the
listkey does in the current form but I think it needs to go directly after theDefaultsstring, as indicated byman sudoers. With this change the resulting sudoers file works correctly: