-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRHEL-06-000133.sh
executable file
·91 lines (80 loc) · 2.99 KB
/
RHEL-06-000133.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
#
##########################################################################
#Red Hat Enterprise Linux 6 - DISA STIG Compliance Remediation Content
#Copyright (C) 2013
#Vincent C. Passaro ([email protected])
#
##########################################################################
#
###################### Buddha Labs LLC ################################
# By Vincent C. Passaro #
# Buddha Labs LLC. #
# vince[@]buddhalabs[.]com #
# www.buddhalabs.com #
###################### Buddha Labs LLC ################################
#_________________________________________________________________________
# Version | Change Information | Author | Date
#-------------------------------------------------------------------------
# 1.0 | Initial Script Creation | Vincent Passaro | 1-JUNE-2013
# 1.1 | Script add test and fix | Leam Hall | 3-OCT-2013
#
#
#######################DISA INFORMATION##################################
# Group ID (Vulid): RHEL-06-000133
# Group Title: SRG-OS-000206
#
# Rule ID: RHEL-06-000133_rule
# Severity: medium
# Rule Version (STIG-ID): RHEL-06-000133
# Rule Title: All rsyslog-generated log files must be owned by root.
#
# Vulnerability Discussion: The log files generated by rsyslog contain
# valuable information regarding system configuration, user authentication,
# and other such information. Log files should be protected from
# unauthorized access.
#
# Responsibility:
# IAControls:
#
# Check Content:
#
# The owner of all log files written by "rsyslog" should be root. These
# log files are determined by the second part of each Rule line in
# "/etc/rsyslog.conf" and typically all appear in "/var/log". For each log
# file [LOGFILE] referenced in "/etc/rsyslog.conf", run the following
# command to inspect the file's owner:
# $ ls -l [LOGFILE]
# If the owner is not root, this is a finding.
#
# Fix Text:
#
# The owner of all log files written by "rsyslog" should be root. These
# log files are determined by the second part of each Rule line in
# "/etc/rsyslog.conf" typically all appear in "/var/log". For each log file
# [LOGFILE] referenced in "/etc/rsyslog.conf", run the following command to
# inspect the file's owner:
# $ ls -l [LOGFILE]
# If the owner is not "root", run the following command to correct this:
# chown root [LOGFILE]
#######################DISA INFORMATION##################################
#
# Global Variables
PDI=RHEL-06-000133
#
#BEGIN_CHECK
LOGFILES=`grep '/' /etc/rsyslog.conf | grep -v ^# | awk '{ print $NF}' | sed 's/-//g'`
#END_CHECK
#BEGIN_REMEDY
for FILE in $LOGFILES
do
if [ -f $FILE ]
then
CUROWN=`stat -c %U $FILE`
if [ "$CUROWN" != "root" ]
then
chown root $FILE
fi
fi
done
#END_REMEDY