-
Notifications
You must be signed in to change notification settings - Fork 84
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
Allow partial override of the ubtu22cis_sshd
struct
#175
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
Please join in the conversation happening on the Discord Server as well.
pre-commit.ci autofix |
When the user define only one default value for `ubtu22cis_sshd` such as: ```yaml ubtu22cis_sshd: allow_users: "{{ansible_user}}" ``` rule `5.2.5 | PATCH | Ensure SSH LogLevel is appropriate` fails if `log_level` is not also set, instead of using the default value "INFO". Signed-off-by: JULIEN MASNADA <[email protected]> Signed-off-by: Julien Masnada <[email protected]>
In case the user only want to override part of `ubtu22cis_sshd` we still a need a mechanism to not have to redefine the whole structure. Signed-off-by: JULIEN MASNADA <[email protected]> Signed-off-by: Julien Masnada <[email protected]>
Signed-off-by: JULIEN MASNADA <[email protected]> Signed-off-by: Julien Masnada <[email protected]>
Signed-off-by: JULIEN MASNADA <[email protected]> Signed-off-by: Julien Masnada <[email protected]>
Signed-off-by: JULIEN MASNADA <[email protected]> Signed-off-by: Julien Masnada <[email protected]>
Signed-off-by: JULIEN MASNADA <[email protected]> Signed-off-by: Julien Masnada <[email protected]>
for more information, see https://pre-commit.ci Signed-off-by: Julien Masnada <[email protected]>
Added EditorConfig to avoid problem in the future Signed-off-by: Julien Masnada <[email protected]>
BTW, this whole PR might be simply solved by making sure that the AllowUsers contains not only |
Hey @rostskadat, The other issues is can you remove the .editorconfig file? |
Hi @georgenalen , Thanks for your reply. The idea behind the PR was to be able to override just one part of the ---
- hosts: all
vars:
ubtu22cis_sshd:
allow_users: "ubuntu"
other_key: "default_value"
tasks:
- debug:
msg: "{{ubtu22cis_sshd}}" with the following inventory ---
all:
hosts:
target:
ubtu22cis_sshd.allow_users: admin
My question is whether I understood correctly your suggestion. As for the .editorconfig, it has been removed. |
Just wanted to add a +1 for this exact scenario and PR solution. In my project, I'm customizing
Playbook:
(This does NOT work if, e.g., I add Otherwise, I'm customizing many other, directly assigned variables using this pattern and it's working great for my needs. But because I took a look at the PR and it would seem to solve my needs here, too. If there's anything I can do to help this PR along, I'd be glad to lend the help! EDIT - I have also encountered the same issue with the |
hi @rostskadat Thank you for taking the time to raise this PR and for the feedback you have participated in. While it is possible to override a nested variable it requires you to add all of the nested options or to run just that one control with a tag, which doesnt really work or scaleable. I am happy to take this PR although we need to resolve a couple of issues.
Alternatively, i can take the work and add the updates for the audit sections also as mentioned by @joshavant and give credits once updated? Many thanks uk-bolly |
Signed-off-by: Julien Masnada <[email protected]>
Hello @uk-bolly, Thanks for your feedback. I fixed both problems. Regards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change for improvements to options
hi @rostskadat Thank you for the quick turnaround. Many thanks uk-bolly |
Hello @uk-bolly Sorry to bother you about that, but now I'm confused on how to proceed. I'm not really sure how to proceed and I would really appreciate if you could give me an indication on how to solve this issue. Regards |
Just taking a guess here. Since there's only 10 commits in this PR, maybe it wouldn't be too difficult to iterate individually through all 10 commit hashes using the above command to sign them? |
@uk-bolly @joshavant sorry for the late answer. Just a quick question to check that I understood properly what you are requesting. You want the merge commit (aa21b5b) to also be signed off by me, correct? |
On a recent PR of my own, it seemed like the CI system requires all of the following:
|
@joshavant unless I'm mistaken the commit is a merge commit from the Github Merge UI process, and therefore signed by Github's own key. Please do correct me if I'm mistaken... |
@uk-bolly is probably the best person to lead this conversation, as they're the maintainer of the CI system. |
hi @rostskadat and @joshavant Thank you for your patience on this, Probably due to the number of changes that have taken place since this was raised i maybe best for me to add to a new branch to get this into production. Many thanks uk-bolly |
Signed-off-by: Mark Bolwell <[email protected]>
* issue #175 thanks to @rostskadat Signed-off-by: Mark Bolwell <[email protected]> * issue #200 thanks to @DianaMariaDDM Signed-off-by: Mark Bolwell <[email protected]> * updated Signed-off-by: Mark Bolwell <[email protected]> * updated name for mount options variables Signed-off-by: Mark Bolwell <[email protected]> --------- Signed-off-by: Mark Bolwell <[email protected]>
hi @rostskadat and @joshavant Thank you for the time and conversations on this thread, this was merged a while back and i assume it is as expected. uk-bolly |
Overall Review of Changes:
My use case is simple:
When configuring SSHD, I need to set AllowUsers to a specific value, while leaving the rest of the configuration for SSHD as it is. More specifically I want to keep using the default ciphers (macs, kex_algorithms, etc.) as recommended by CIS.
I was only able to do that if I defined in my own variable the whole structure
ubtu22cis_sshd
as defined indefaults/main.yml
which is really cumbersome.It would be more user friendly if I was able to overwrite just on specific settings in my variable and use the recommended values for the rest of the settings, like this:
Issue Fixes:
NA
Enhancements:
NA
How has this been tested?:
Tested on a pristine VirtualBox VM straight from installation.