|
|
38a2c0 |
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/rule.yml b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/rule.yml
|
|
|
38a2c0 |
new file mode 100644
|
|
|
38a2c0 |
index 00000000000..968ef336148
|
|
|
38a2c0 |
--- /dev/null
|
|
|
38a2c0 |
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/rule.yml
|
|
|
38a2c0 |
@@ -0,0 +1,39 @@
|
|
|
38a2c0 |
+documentation_complete: true
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+title: 'Audit Configuration Files Must Be Owned By Root'
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+description: |-
|
|
|
38a2c0 |
+ All audit configuration files must be owned by root user.
|
|
|
38a2c0 |
+ {{{ describe_file_owner(file="/etc/audit/", owner="root") }}}
|
|
|
38a2c0 |
+ {{{ describe_file_owner(file="/etc/audit/rules.d/", owner="root") }}}
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+rationale: |-
|
|
|
38a2c0 |
+ Without the capability to restrict which roles and individuals can
|
|
|
38a2c0 |
+ select which events are audited, unauthorized personnel may be able
|
|
|
38a2c0 |
+ to prevent the auditing of critical events.
|
|
|
38a2c0 |
+ Misconfigured audits may degrade the system's performance by
|
|
|
38a2c0 |
+ overwhelming the audit log. Misconfigured audits may also make it more
|
|
|
38a2c0 |
+ difficult to establish, correlate, and investigate the events relating
|
|
|
38a2c0 |
+ to an incident or identify those responsible for one.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+severity: medium
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+references:
|
|
|
38a2c0 |
+ disa: CCI-000171
|
|
|
38a2c0 |
+ srg: SRG-OS-000063-GPOS-00032
|
|
|
38a2c0 |
+ stigid@ubuntu2004: UBTU-20-010134
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ocil: |-
|
|
|
38a2c0 |
+ {{{ describe_file_owner(file="/etc/audit/", owner="root") }}}
|
|
|
38a2c0 |
+ {{{ describe_file_owner(file="/etc/audit/rules.d/", owner="root") }}}
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+template:
|
|
|
38a2c0 |
+ name: file_owner
|
|
|
38a2c0 |
+ vars:
|
|
|
38a2c0 |
+ filepath:
|
|
|
38a2c0 |
+ - /etc/audit/
|
|
|
38a2c0 |
+ - /etc/audit/rules.d/
|
|
|
38a2c0 |
+ file_regex:
|
|
|
38a2c0 |
+ - ^audit(\.rules|d\.conf)$
|
|
|
38a2c0 |
+ - ^.*\.rules$
|
|
|
38a2c0 |
+ fileuid: '0'
|
|
|
38a2c0 |
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/correct_owner.pass.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/correct_owner.pass.sh
|
|
|
38a2c0 |
new file mode 100644
|
|
|
38a2c0 |
index 00000000000..4d67307a1ef
|
|
|
38a2c0 |
--- /dev/null
|
|
|
38a2c0 |
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/correct_owner.pass.sh
|
|
|
38a2c0 |
@@ -0,0 +1,6 @@
|
|
|
38a2c0 |
+#!/bin/bash
|
|
|
38a2c0 |
+# packages = audit
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+chown 0 /etc/audit/audit.rules
|
|
|
38a2c0 |
+chown 0 /etc/audit/auditd.conf
|
|
|
38a2c0 |
+chown 0 -R /etc/audit/rules.d/
|
|
|
38a2c0 |
diff --git a/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/incorrect_owner.fail.sh b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/incorrect_owner.fail.sh
|
|
|
38a2c0 |
new file mode 100644
|
|
|
38a2c0 |
index 00000000000..337074fab92
|
|
|
38a2c0 |
--- /dev/null
|
|
|
38a2c0 |
+++ b/linux_os/guide/system/auditing/auditd_configure_rules/file_ownership_audit_configuration/tests/incorrect_owner.fail.sh
|
|
|
38a2c0 |
@@ -0,0 +1,7 @@
|
|
|
38a2c0 |
+#!/bin/bash
|
|
|
38a2c0 |
+# packages = audit
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+useradd testuser_123
|
|
|
38a2c0 |
+chown testuser_123 /etc/audit/audit.rules
|
|
|
38a2c0 |
+chown testuser_123 /etc/audit/auditd.conf
|
|
|
38a2c0 |
+chown testuser_123 -R /etc/audit/rules.d/
|
|
|
38a2c0 |
diff --git a/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_owner_var_log_syslog/rule.yml b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_owner_var_log_syslog/rule.yml
|
|
|
38a2c0 |
new file mode 100644
|
|
|
38a2c0 |
index 00000000000..f1bf515455d
|
|
|
38a2c0 |
--- /dev/null
|
|
|
38a2c0 |
+++ b/linux_os/guide/system/permissions/files/permissions_var_log_dir/file_owner_var_log_syslog/rule.yml
|
|
|
38a2c0 |
@@ -0,0 +1,27 @@
|
|
|
38a2c0 |
+documentation_complete: true
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+title: 'Verify User Who Owns /var/log/syslog File'
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+description: '{{{ describe_file_owner(file="/var/log/syslog", owner="syslog") }}}'
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+rationale: |-
|
|
|
38a2c0 |
+ The <tt>/var/log/syslog</tt> file contains logs of error messages in
|
|
|
38a2c0 |
+ the system and should only be accessed by authorized personnel.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+severity: medium
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+references:
|
|
|
38a2c0 |
+ disa: CCI-001314
|
|
|
38a2c0 |
+ srg: SRG-OS-000206-GPOS-00084
|
|
|
38a2c0 |
+ stigid@ubuntu2004: UBTU-20-010421
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ocil_clause: '{{{ ocil_clause_file_owner(file="/var/log/syslog", owner="syslog") }}}'
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ocil: |-
|
|
|
38a2c0 |
+ {{{ ocil_file_owner(file="/var/log/syslog", owner="syslog") }}}
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+template:
|
|
|
38a2c0 |
+ name: file_owner
|
|
|
38a2c0 |
+ vars:
|
|
|
38a2c0 |
+ filepath: /var/log/syslog
|
|
|
38a2c0 |
+ fileuid: '104'
|
|
|
38a2c0 |
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_binary_dirs/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_binary_dirs/rule.yml
|
|
|
38a2c0 |
new file mode 100644
|
|
|
38a2c0 |
index 00000000000..e2362388678
|
|
|
38a2c0 |
--- /dev/null
|
|
|
38a2c0 |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/dir_ownership_binary_dirs/rule.yml
|
|
|
38a2c0 |
@@ -0,0 +1,55 @@
|
|
|
38a2c0 |
+documentation_complete: true
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+title: 'Verify that System Executable Have Root Ownership'
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+description: |-
|
|
|
38a2c0 |
+ /bin
|
|
|
38a2c0 |
+ /sbin
|
|
|
38a2c0 |
+ /usr/bin
|
|
|
38a2c0 |
+ /usr/sbin
|
|
|
38a2c0 |
+ /usr/local/bin
|
|
|
38a2c0 |
+ /usr/local/sbin
|
|
|
38a2c0 |
+ All these directories should be owned by the <tt>root</tt> user.
|
|
|
38a2c0 |
+ If any directory DIR in these directories is found
|
|
|
38a2c0 |
+ to be owned by a user other than root, correct its ownership with the
|
|
|
38a2c0 |
+ following command:
|
|
|
38a2c0 |
+ $ sudo chown root DIR
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+rationale: |-
|
|
|
38a2c0 |
+ System binaries are executed by privileged users as well as system services,
|
|
|
38a2c0 |
+ and restrictive permissions are necessary to ensure that their
|
|
|
38a2c0 |
+ execution of these programs cannot be co-opted.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+severity: medium
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+references:
|
|
|
38a2c0 |
+ disa: CCI-001495
|
|
|
38a2c0 |
+ srg: SRG-OS-000258-GPOS-00099
|
|
|
38a2c0 |
+ stigid@ubuntu2004: UBTU-20-010424
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ocil_clause: 'any system exectables directories are found to not be owned by root'
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ocil: |-
|
|
|
38a2c0 |
+ System executables are stored in the following directories by default:
|
|
|
38a2c0 |
+ /bin
|
|
|
38a2c0 |
+ /sbin
|
|
|
38a2c0 |
+ /usr/bin
|
|
|
38a2c0 |
+ /usr/local/bin
|
|
|
38a2c0 |
+ /usr/local/sbin
|
|
|
38a2c0 |
+ /usr/sbin
|
|
|
38a2c0 |
+ For each of these directories, run the following command to find files
|
|
|
38a2c0 |
+ not owned by root:
|
|
|
38a2c0 |
+ $ sudo find -L DIR/ ! -user root -type d -exec chown root {} \;
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+template:
|
|
|
38a2c0 |
+ name: file_owner
|
|
|
38a2c0 |
+ vars:
|
|
|
38a2c0 |
+ filepath:
|
|
|
38a2c0 |
+ - /bin/
|
|
|
38a2c0 |
+ - /sbin/
|
|
|
38a2c0 |
+ - /usr/bin/
|
|
|
38a2c0 |
+ - /usr/sbin/
|
|
|
38a2c0 |
+ - /usr/local/bin/
|
|
|
38a2c0 |
+ - /usr/local/sbin/
|
|
|
38a2c0 |
+ recursive: 'true'
|
|
|
38a2c0 |
+ fileuid: '0'
|
|
|
38a2c0 |
diff --git a/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_ownership_audit_binaries/rule.yml b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_ownership_audit_binaries/rule.yml
|
|
|
38a2c0 |
new file mode 100644
|
|
|
38a2c0 |
index 00000000000..0c7d9b313d5
|
|
|
38a2c0 |
--- /dev/null
|
|
|
38a2c0 |
+++ b/linux_os/guide/system/permissions/files/permissions_within_important_dirs/file_ownership_audit_binaries/rule.yml
|
|
|
38a2c0 |
@@ -0,0 +1,77 @@
|
|
|
38a2c0 |
+documentation_complete: true
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+prodtype: ubuntu2004
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+title: 'Verify that audit tools are owned by root'
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+description: |-
|
|
|
38a2c0 |
+ The {{{ full_name }}} operating system audit tools must have the proper
|
|
|
38a2c0 |
+ ownership configured to protected against unauthorized access.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ Verify it by running the following command:
|
|
|
38a2c0 |
+ $ stat -c "%n %U" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ /sbin/auditctl root
|
|
|
38a2c0 |
+ /sbin/aureport root
|
|
|
38a2c0 |
+ /sbin/ausearch root
|
|
|
38a2c0 |
+ /sbin/autrace root
|
|
|
38a2c0 |
+ /sbin/auditd root
|
|
|
38a2c0 |
+ /sbin/audispd root
|
|
|
38a2c0 |
+ /sbin/augenrules root
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ Audit tools needed to successfully view and manipulate audit information
|
|
|
38a2c0 |
+ system activity and records. Audit tools include custom queries and report
|
|
|
38a2c0 |
+ generators
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+rationale: |-
|
|
|
38a2c0 |
+ Protecting audit information also includes identifying and protecting the
|
|
|
38a2c0 |
+ tools used to view and manipulate log data. Therefore, protecting audit
|
|
|
38a2c0 |
+ tools is necessary to prevent unauthorized operation on audit information.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ Operating systems providing tools to interface with audit information
|
|
|
38a2c0 |
+ will leverage user permissions and roles identifying the user accessing the
|
|
|
38a2c0 |
+ tools and the corresponding rights the user enjoys to make access decisions
|
|
|
38a2c0 |
+ regarding the access to audit tools.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+severity: medium
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+references:
|
|
|
38a2c0 |
+ disa: CCI-001493,CCI-001494
|
|
|
38a2c0 |
+ srg: SRG-OS-000256-GPiOS-00097,SRG-OS-000257-GPOS-00098
|
|
|
38a2c0 |
+ stigid@ubuntu2004: UBTU-20-010200
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ocil: |-
|
|
|
38a2c0 |
+ Verify it by running the following command:
|
|
|
38a2c0 |
+ $ stat -c "%n %U" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ /sbin/auditctl root
|
|
|
38a2c0 |
+ /sbin/aureport root
|
|
|
38a2c0 |
+ /sbin/ausearch root
|
|
|
38a2c0 |
+ /sbin/autrace root
|
|
|
38a2c0 |
+ /sbin/auditd root
|
|
|
38a2c0 |
+ /sbin/audispd root
|
|
|
38a2c0 |
+ /sbin/augenrules root
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ If the command does not return all the above lines, the missing ones
|
|
|
38a2c0 |
+ need to be added.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ Run the following command to correct the permissions of the missing
|
|
|
38a2c0 |
+ entries:
|
|
|
38a2c0 |
+ $ sudo chown root [audit_tool]
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+ Replace "[audit_tool]" with each audit tool not owned by root.
|
|
|
38a2c0 |
+
|
|
|
38a2c0 |
+template:
|
|
|
38a2c0 |
+ name: file_owner
|
|
|
38a2c0 |
+ vars:
|
|
|
38a2c0 |
+ filepath:
|
|
|
38a2c0 |
+ - /sbin/auditctl
|
|
|
38a2c0 |
+ - /sbin/aureport
|
|
|
38a2c0 |
+ - /sbin/ausearch
|
|
|
38a2c0 |
+ - /sbin/autrace
|
|
|
38a2c0 |
+ - /sbin/auditd
|
|
|
38a2c0 |
+ - /sbin/audispd
|
|
|
38a2c0 |
+ - /sbin/augenrules
|
|
|
38a2c0 |
+ fileuid: '0'
|
|
|
38a2c0 |
diff --git a/shared/templates/file_owner/ansible.template b/shared/templates/file_owner/ansible.template
|
|
|
38a2c0 |
index 80eaae8d50b..590c9fc6055 100644
|
|
|
38a2c0 |
--- a/shared/templates/file_owner/ansible.template
|
|
|
38a2c0 |
+++ b/shared/templates/file_owner/ansible.template
|
|
|
38a2c0 |
@@ -25,7 +25,7 @@
|
|
|
38a2c0 |
|
|
|
38a2c0 |
- name: Ensure owner on {{{ path }}} recursively
|
|
|
38a2c0 |
file:
|
|
|
38a2c0 |
- paths "{{{ path }}}"
|
|
|
38a2c0 |
+ path: "{{{ path }}}"
|
|
|
38a2c0 |
state: directory
|
|
|
38a2c0 |
recurse: yes
|
|
|
38a2c0 |
owner: "{{{ FILEUID }}}"
|
|
|
38a2c0 |
diff --git a/shared/templates/file_owner/tests/missing_file_test.pass.sh b/shared/templates/file_owner/tests/missing_file_test.pass.sh
|
|
|
38a2c0 |
index 938e6b30819..4e3683f9dcf 100644
|
|
|
38a2c0 |
--- a/shared/templates/file_owner/tests/missing_file_test.pass.sh
|
|
|
38a2c0 |
+++ b/shared/templates/file_owner/tests/missing_file_test.pass.sh
|
|
|
38a2c0 |
@@ -1,8 +1,18 @@
|
|
|
38a2c0 |
#!/bin/bash
|
|
|
38a2c0 |
#
|
|
|
38a2c0 |
|
|
|
38a2c0 |
-{{% if MISSING_FILE_PASS %}}
|
|
|
38a2c0 |
- rm -f {{{ FILEPATH }}}
|
|
|
38a2c0 |
-{{% else %}}
|
|
|
38a2c0 |
- true
|
|
|
38a2c0 |
-{{% endif %}}
|
|
|
38a2c0 |
+{{% for path in FILEPATH %}}
|
|
|
38a2c0 |
+ {{% if MISSING_FILE_PASS %}}
|
|
|
38a2c0 |
+ rm -f {{{ path }}}
|
|
|
38a2c0 |
+ {{% else %}}
|
|
|
38a2c0 |
+ {{% if IS_DIRECTORY and RECURSIVE %}}
|
|
|
38a2c0 |
+ find -L {{{ path }}} -type d -exec chown {{{ FILEUID }}} {} \;
|
|
|
38a2c0 |
+ {{% else %}}
|
|
|
38a2c0 |
+ if [ ! -f {{{ path }}} ]; then
|
|
|
38a2c0 |
+ mkdir -p "$(dirname '{{{ path }}}')"
|
|
|
38a2c0 |
+ touch {{{ path }}}
|
|
|
38a2c0 |
+ fi
|
|
|
38a2c0 |
+ chown {{{ FILEUID }}} {{{ path }}}
|
|
|
38a2c0 |
+ {{% endif %}}
|
|
|
38a2c0 |
+ {{% endif %}}
|
|
|
38a2c0 |
+{{% endfor %}}
|