-
Notifications
You must be signed in to change notification settings - Fork 685
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
Complete CIS requirement for system accounts #10627
Complete CIS requirement for system accounts #10627
Conversation
This datastream diff is auto generated by the check Click here to see the full diffNew content has different text for rule 'xccdf_org.ssgproject.content_rule_no_password_auth_for_systemaccounts'.%0A--- xccdf_org.ssgproject.content_rule_no_password_auth_for_systemaccounts%0A+++ xccdf_org.ssgproject.content_rule_no_password_auth_for_systemaccounts%0A@@ -3,17 +3,13 @@%0A Ensure that System Accounts Are Locked%0A %0A [description]:%0A-Some accounts are not associated with a human user of the system, and exist to%0A-perform some administrative function. An attacker should not be able to log into%0A-these accounts.%0A+Some accounts are not associated with a human user of the system, and exist to perform some%0A+administrative functions. An attacker should not be able to log into these accounts.%0A %0A-System accounts are those user accounts with a user ID%0A-less than UID_MIN, where value of the UID_MIN directive is set in%0A-/etc/login.defs configuration file. In the default configuration UID_MIN is set%0A-to 500, thus system accounts are those user accounts with a user ID less than%0A-500. If any system account SYSACCT (other than root) has an unlocked password,%0A-disable it with the command:%0A-$ sudo passwd -l SYSACCT%0A+System accounts are those user accounts with a user ID less than 1000.%0A+If any system account other than root, halt, sync, shutdown%0A+and nfsnobody has an unlocked password, disable it with the command:%0A+$ sudo usermod -L account%0A %0A [reference]:%0A CIP-003-8 R5.1.1%0A@@ -48,6 +44,12 @@%0A [reference]:%0A CM-6(a)%0A %0A+[reference]:%0A+5.6.2%0A+%0A [rationale]:%0A-Disabling authentication for default system accounts makes it more difficult%0A-for attackers to make use of them to compromise a system.false%0A+Disabling authentication for default system accounts makes it more difficult for attackers%0A+to make use of them to compromise a system.%0A+%0A+[ident]:%0A+CCE-86112-0%0A%0ANew datastream adds OVAL for rule 'xccdf_org.ssgproject.content_rule_no_password_auth_for_systemaccounts'.%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_no_password_auth_for_systemaccounts' differs.%0A--- ocil:ssg-no_password_auth_for_systemaccounts_ocil:questionnaire:1%0A+++ ocil:ssg-no_password_auth_for_systemaccounts_ocil:questionnaire:1%0A@@ -1,9 +1,5 @@%0A-To obtain a listing of all users and the contents of their shadow password%0A-field, run the command:%0A-$ sudo awk -F: '$1 !~ /^root$/ && $2 !~ /^[!*]/ {print $1 ":" $2}' /etc/shadow%0A-Identify the system accounts from this listing. These will primarily be the accounts%0A-with UID numbers less than UID_MIN, other than root. Value of the UID_MIN%0A-directive is set in /etc/login.defs configuration file. In the default%0A-configuration, UID_MIN is set to 500.%0A- Is it the case that it is not?%0A+To obtain a list of all users and the content of their shadow password field, run the command:%0A+$ sudo readarray -t systemaccounts %0A+Verify if all accounts are locked.%0A+ Is it the case that system accounts are not locked?%0A %0ANew datastream adds bash remediation for rule 'xccdf_org.ssgproject.content_rule_no_password_auth_for_systemaccounts'.%0ANew datastream adds ansible remediation for rule 'xccdf_org.ssgproject.content_rule_no_password_auth_for_systemaccounts'.%0ANew content has different text for rule 'xccdf_org.ssgproject.content_rule_no_shelllogin_for_systemaccounts'.%0A--- xccdf_org.ssgproject.content_rule_no_shelllogin_for_systemaccounts%0A+++ xccdf_org.ssgproject.content_rule_no_shelllogin_for_systemaccounts%0A@@ -3,22 +3,19 @@%0A Ensure that System Accounts Do Not Run a Shell Upon Login%0A %0A [description]:%0A-Some accounts are not associated with a human user of the system, and exist to%0A-perform some administrative function. Should an attacker be able to log into%0A-these accounts, they should not be granted access to a shell.%0A-%0A-The login shell for each local account is stored in the last field of each line%0A-in /etc/passwd. System accounts are those user accounts with a user ID%0A-less than UID_MIN, where value of UID_MIN directive is set in%0A-/etc/login.defs configuration file. In the default configuration UID_MIN is set%0A-to 1000, thus system accounts are those user accounts with a user ID less than%0A+Some accounts are not associated with a human user of the system, and exist to perform some%0A+administrative functions. Should an attacker be able to log into these accounts, they should%0A+not be granted access to a shell.%0A+%0A+The login shell for each local account is stored in the last field of each line in%0A+/etc/passwd. System accounts are those user accounts with a user ID less than%0A 1000. The user ID is stored in the third field. If any system account%0A-SYSACCT (other than root) has a login shell, disable it with the%0A-command: $ sudo usermod -s /sbin/nologin SYSACCT%0A+other than root has a login shell, disable it with the command:%0A+$ sudo usermod -s /sbin/nologin account%0A %0A [warning]:%0A-Do not perform the steps in this section on the root account. Doing so might%0A-cause the system to become inaccessible.%0A+Do not perform the steps in this section on the root account. Doing so might cause the%0A+system to become inaccessible.%0A %0A [reference]:%0A 1%0A@@ -210,8 +207,8 @@%0A 5.6.2%0A %0A [rationale]:%0A-Ensuring shells are not given to system accounts upon login makes it more%0A-difficult for attackers to make use of system accounts.%0A+Ensuring shells are not given to system accounts upon login makes it more difficult for%0A+attackers to make use of system accounts.%0A %0A [ident]:%0A CCE-80843-6%0A%0AOCIL for rule 'xccdf_org.ssgproject.content_rule_no_shelllogin_for_systemaccounts' differs.%0A--- ocil:ssg-no_shelllogin_for_systemaccounts_ocil:questionnaire:1%0A+++ ocil:ssg-no_shelllogin_for_systemaccounts_ocil:questionnaire:1%0A@@ -1,8 +1,6 @@%0A-To obtain a listing of all users, their UIDs, and their shells, run the%0A-command: $ awk -F: '{print $1 ":" $3 ":" $7}' /etc/passwd Identify%0A-the system accounts from this listing. These will primarily be the accounts%0A-with UID numbers less than UID_MIN, other than root. Value of the UID_MIN%0A-directive is set in /etc/login.defs configuration file. In the default%0A-configuration UID_MIN is set to 1000.%0A- Is it the case that any system account (other than root) has a login shell?%0A+To obtain a listing of all users, their UIDs, and their shells, run the command:%0A+$ awk -F: '{print $1 ":" $3 ":" $7}' /etc/passwd%0A+Identify the system accounts from this listing. These will primarily be the accounts with UID%0A+numbers less than 1000, other than root.%0A+ Is it the case that any system account other than root has a login shell?%0A %0ANew datastream adds bash remediation for rule 'xccdf_org.ssgproject.content_rule_no_shelllogin_for_systemaccounts'.%0ANew datastream adds ansible remediation for rule 'xccdf_org.ssgproject.content_rule_no_shelllogin_for_systemaccounts'. |
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.
Thanks for the PR!
I just have couple of minor changes.
...counts/accounts-restrictions/root_logins/no_password_auth_for_systemaccounts/oval/shared.xml
Show resolved
Hide resolved
...counts/accounts-restrictions/root_logins/no_shelllogin_for_systemaccounts/ansible/shared.yml
Show resolved
Hide resolved
/packit build |
Once #10628 lands in master, can you rebase this PR? |
#10628 has been merged to master. |
Using a similar logic from the create_interactive_users_list_object macro but focused in system accounts only.
The no_password_auth_for_systemaccounts was missing OVAL. It is not capable to check if systems have system accounts with a password defined.
Aligned to the Project Style Guide. Also updated description, references, indentifiers, ocil and ocil_clause.
The no_password_auth_for_systemaccounts rule was moved from related_rules to rules in CIS control file for RHEL8 and RHEL9.
Aligned to the Project Style Guide. Also updated description, ocil, ocil_clause and fixtext.
The CIS 5.6.2 requirement for RHEL8 and RHEL9 is now automated. Relevant rules include OVAL checking plus Bash and Ansible remediation.
fd17680
to
fb89db4
Compare
Rebased |
Code Climate has analyzed commit fb89db4 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 52.5% (0.0% change). View more on Code Climate. |
I'm waving the Automatus failures as the tests pass locally. |
Description:
This PR updates the following rules:
Rationale:
Review Hints:
Automatus should be enough for tests
The commits are organized chronologically, to make it easier to review how the PR evolved.