-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fixing issue https://github.com/ansible-lockdown/AMAZON2023-CIS/issues/26 #27
Changes from 1 commit
830d42c
269b56b
9e7ef28
e3ffb8b
592fbbd
7bc0c12
9a4d9fb
758bb04
53b254a
710425b
95857f7
9488e19
a95bdb1
75ea3ec
6a3c7ec
4a7ce35
c28b8a4
8bf9197
f5ec60c
5593023
9ee76ca
3bec70e
e8f766f
e14d248
a480622
f6e12ab
5b2165d
fdd3c87
19a64e3
95c7f19
1c3bc34
283366c
c9ce3e1
27f69f8
fb93017
a452618
46b8d7d
66f73f5
08d3be9
d39be02
8205dfd
bf2cffd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -89,17 +89,22 @@ | |||||
|
||||||
- name: "4.6.5 | PATCH | Ensure default user umask is 027 or more restrictive" | ||||||
block: | ||||||
- name: "4.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Set umask for /etc/login.defs pam_umask settings" | ||||||
- name: "4.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Set umask for /etc/login.defs and /etc/profile" | ||||||
ansible.builtin.lineinfile: | ||||||
path: "{{ item.path }}" | ||||||
regexp: '(?i)(umask\s*)' | ||||||
regexp: '(?i)(umask\s*\d\d\d)' | ||||||
line: '{{ item.line }} 027' | ||||||
with_items: | ||||||
- { path: '/etc/bashrc', line: 'umask' } | ||||||
- { path: '/etc/profile', line: 'umask' } | ||||||
- { path: '/etc/login.defs', line: 'UMASK' } | ||||||
|
||||||
- name: "4.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Set umask for /etc/bashrc" | ||||||
- name: "4.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Set umask for /etc/bashrc" | ||||||
ansible.builtin.replace: | ||||||
path: /etc/bashrc | ||||||
regexp: '\s+umask\s*\d\d\d' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will modify this as well, thank you for your input! |
||||||
replace: '\numask 027' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why add a new line ?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I presented in the issue responsible for this PR: The only way it worked for my tests was to add 'umask 027' with \n in order to edit properly both umask lines from /etc/bashrc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am sure this would get you where you want too.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work? This should only change those not 027 or more restrictive and whether 3 or 4 characters
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just ran manually on bashrc
Just checking we're in the same place i'm using this regexp
p.s. i did forget to sudo :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the same regexp as well, still, it did not modify the lines... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok lets close this PR i will add the fix to the new Feb24 ive been working on, there seems to be so many commits for one line change for this control. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree! Thank you for your time! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a problem at all, will ensure credit added for the update |
||||||
|
||||||
- name: "4.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Editing USERGROUPS_ENAB" | ||||||
ansible.builtin.lineinfile: | ||||||
path: /etc/login.defs | ||||||
regexp: '^USERGROUPS_ENAB' | ||||||
|
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.
umask can be 0027 or 027
should check for lines without comments
no need for capture group
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.
Agreed this should be able to capture both types 3 & 4
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.
And the
^\s*
ensure the line starts withumask
, and the line is not commented outThere 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.
I see, I will add these modifications!