View | Details | Raw Unified | Return to bug 21444
Collapse All | Expand All

(-)usr.sbin/periodic/periodic.sh (-2 / +1 lines)
Lines 52-58 Link Here
52
52
53
host=`hostname`
53
host=`hostname`
54
export host
54
export host
55
echo "Subject: $host $run run output"
56
55
57
# Execute each executable file in the directory list.  If the x bit is not
56
# Execute each executable file in the directory list.  If the x bit is not
58
# set, assume the user didn't really want us to muck with it (it's a
57
# set, assume the user didn't really want us to muck with it (it's a
Lines 64-67 Link Here
64
	    $file
63
	    $file
65
	fi
64
	fi
66
    done
65
    done
67
done
66
done | periodic_maybe_print_message -0 "Subject: $host $run run output"
(-)etc/defaults/periodic.conf (+62 lines)
Lines 19-25 Link Here
19
# periodic script dirs
19
# periodic script dirs
20
local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic"
20
local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic"
21
21
22
# whether or not to "always" print the subject (or topic) line
23
periodic_always_print_message="YES"
22
24
25
23
# Daily options
26
# Daily options
24
27
25
# 100.clean-disks
28
# 100.clean-disks
Lines 168-172 Link Here
168
                                ;;
171
                                ;;
169
                        esac
172
                        esac
170
                done
173
                done
174
        }
175
fi
176
177
178
# Define periodic_maybe_print_subject, the function used by /etc/periodic/*/*
179
# scripts to print the subject (or topic) line only (or always) if there
180
# is any output.
181
182
if [ -z "${periodic_print_message_defined}" ]; then
183
        periodic_print_message_defined=yes
184
        periodic_print_message () {
185
		local n=2 message
186
187
		case $1 in
188
		-[0-9]) n=${1#-}
189
			shift ;;
190
		esac
191
192
		message="$*"
193
194
		while [ $n -gt 0 ]; do
195
			echo ""
196
			n=$(($n-1))
197
		done
198
199
		echo "${message}"
200
		echo ""
201
        }
202
fi
203
204
if [ -z "${periodic_maybe_print_message_defined}" ]; then
205
        periodic_maybe_print_message_defined=yes
206
        periodic_maybe_print_message () {
207
		local n=2 message
208
209
		case $1 in
210
		-[0-9]) n=${1#-}
211
			shift ;;
212
		esac
213
214
		message="$*"
215
216
		case ${periodic_always_print_message} in
217
		[Yy][Ee][Ss])
218
			periodic_print_message -$n "${message}"
219
			cat
220
			;;
221
		*)
222
			awk -v n=$n -v message="${message}" '
223
			/./ && !flag {
224
				flag=1
225
				while (n-- > 0)
226
					print ""
227
				print message "\n"
228
			}
229
			flag
230
			'
231
			;;
232
		esac
171
        }
233
        }
172
fi
234
fi
(-)etc/security (-46 / +32 lines)
Lines 6-15 Link Here
6
PATH=/sbin:/bin:/usr/bin
6
PATH=/sbin:/bin:/usr/bin
7
LC_ALL=C; export LC_ALL
7
LC_ALL=C; export LC_ALL
8
8
9
separator () {
9
if [ -r /etc/defaults/periodic.conf ]; then
10
	echo ''
10
    . /etc/defaults/periodic.conf
11
	echo ''
11
    source_periodic_confs
12
}
12
fi
13
13
14
sflag=FALSE ignore=
14
sflag=FALSE ignore=
15
while getopts ams c
15
while getopts ams c
Lines 24-38 Link Here
24
yesterday=`date -v-1d "+%b %e "`
24
yesterday=`date -v-1d "+%b %e "`
25
25
26
host=`hostname`
26
host=`hostname`
27
[ $sflag = FALSE ] && echo "Subject: ${host} security check output"
27
[ $sflag = FALSE ] &&
28
periodic_print_message -0 "Subject: ${host} security check output"
28
29
29
LOG=/var/log
30
LOG=/var/log
30
TMP=/var/run/_secure.$$
31
TMP=/var/run/_secure.$$
31
32
32
umask 027
33
umask 027
33
34
34
echo "checking setuid files and devices:"
35
36
# Don't have ncheck, but this does the equivalent of the commented out block.
35
# Don't have ncheck, but this does the equivalent of the commented out block.
37
# Note that one of the original problems, the possibility of overrunning
36
# Note that one of the original problems, the possibility of overrunning
38
# the args to ls, is still here...
37
# the args to ls, is still here...
Lines 48-62 Link Here
48
done | xargs -0 -n 20 ls -liTd | sort +10 > ${TMP}
47
done | xargs -0 -n 20 ls -liTd | sort +10 > ${TMP}
49
48
50
if [ ! -f ${LOG}/setuid.today ]; then
49
if [ ! -f ${LOG}/setuid.today ]; then
51
	separator
50
	periodic_print_message "no ${LOG}/setuid.today"
52
	echo "no ${LOG}/setuid.today"
53
	cp ${TMP} ${LOG}/setuid.today
51
	cp ${TMP} ${LOG}/setuid.today
54
fi
52
fi
55
53
56
if ! cmp ${LOG}/setuid.today ${TMP} >/dev/null; then
54
if ! cmp ${LOG}/setuid.today ${TMP} >/dev/null; then
57
	separator
55
	diff -w ${LOG}/setuid.today ${TMP} |
58
	echo "${host} setuid diffs:"
56
	periodic_maybe_print_message "${host} setuid diffs:"
59
	diff -w ${LOG}/setuid.today ${TMP}
60
	mv ${LOG}/setuid.today ${LOG}/setuid.yesterday
57
	mv ${LOG}/setuid.today ${LOG}/setuid.yesterday
61
	mv ${TMP} ${LOG}/setuid.today
58
	mv ${TMP} ${LOG}/setuid.today
62
fi
59
fi
Lines 66-105 Link Here
66
[ -n "$ignore" ] && cmd="egrep -v ${ignore#|}" || cmd=cat
63
[ -n "$ignore" ] && cmd="egrep -v ${ignore#|}" || cmd=cat
67
if mount -p | $cmd > $TMP; then
64
if mount -p | $cmd > $TMP; then
68
	if [ ! -f $LOG/mount.today ]; then
65
	if [ ! -f $LOG/mount.today ]; then
69
		separator
66
		periodic_print_message "no $LOG/mount.today"
70
		echo "no $LOG/mount.today"
71
		cp $TMP $LOG/mount.today
67
		cp $TMP $LOG/mount.today
72
	fi
68
	fi
69
73
	if ! cmp $LOG/mount.today $TMP >/dev/null 2>&1; then
70
	if ! cmp $LOG/mount.today $TMP >/dev/null 2>&1; then
74
		separator
71
		diff -b $LOG/mount.today $TMP |
75
		echo "$host changes in mounted filesystems:"
72
		periodic_maybe_print_message "$host changes in mounted filesystems:"
76
		diff -b $LOG/mount.today $TMP
77
		mv $LOG/mount.today $LOG/mount.yesterday
73
		mv $LOG/mount.today $LOG/mount.yesterday
78
		mv $TMP $LOG/mount.today
74
		mv $TMP $LOG/mount.today
79
	fi
75
	fi
80
fi
76
fi
81
77
82
separator
78
awk -F: '$3==0 {print $1,$3}' /etc/master.passwd |
83
echo "checking for uids of 0:"
79
periodic_maybe_print_message "checking for uids of 0:"
84
awk -F: '$3==0 {print $1,$3}' /etc/master.passwd
85
86
separator
87
echo "checking for passwordless accounts:"
88
awk -F: 'NF > 1 && $1 !~ /^[#+-]/ && $2=="" {print $0}' /etc/master.passwd
89
80
81
awk -F: 'NF > 1 && $1 !~ /^[#+-]/ && $2=="" {print $0}' /etc/master.passwd |
82
periodic_maybe_print_message "checking for passwordless accounts:"
83
90
# Show denied packets
84
# Show denied packets
91
#
85
#
92
if ipfw -a l 2>/dev/null | egrep "deny|reset|unreach" > ${TMP}; then
86
if ipfw -a l 2>/dev/null | egrep "deny|reset|unreach" > ${TMP}; then
93
	if [ ! -f ${LOG}/ipfw.today ]; then
87
	if [ ! -f ${LOG}/ipfw.today ]; then
94
		separator
88
		periodic_print_message "no ${LOG}/ipfw.today"
95
		echo "no ${LOG}/ipfw.today"
96
		cp ${TMP} ${LOG}/ipfw.today
89
		cp ${TMP} ${LOG}/ipfw.today
97
	fi
90
	fi
98
91
99
	if ! cmp ${LOG}/ipfw.today ${TMP} >/dev/null; then
92
	if ! cmp ${LOG}/ipfw.today ${TMP} >/dev/null; then
100
		separator
93
		diff -b ${LOG}/ipfw.today ${TMP} | egrep "^>" |
101
		echo "${host} denied packets:"
94
		periodic_maybe_print_message "${host} denied packets:"
102
		diff -b ${LOG}/ipfw.today ${TMP} | egrep "^>"
103
		mv ${LOG}/ipfw.today ${LOG}/ipfw.yesterday
95
		mv ${LOG}/ipfw.today ${LOG}/ipfw.yesterday
104
		mv ${TMP} ${LOG}/ipfw.today
96
		mv ${TMP} ${LOG}/ipfw.today
105
	fi
97
	fi
Lines 110-136 Link Here
110
IPFW_LOG_LIMIT=`sysctl -n net.inet.ip.fw.verbose_limit 2> /dev/null`
102
IPFW_LOG_LIMIT=`sysctl -n net.inet.ip.fw.verbose_limit 2> /dev/null`
111
if [ $? -eq 0 -a "${IPFW_LOG_LIMIT}" -ne 0 ]; then
103
if [ $? -eq 0 -a "${IPFW_LOG_LIMIT}" -ne 0 ]; then
112
	ipfw -a l | grep " log " | perl -n -e \
104
	ipfw -a l | grep " log " | perl -n -e \
113
		'/^\d+\s+(\d+)/; print if ($1 >= '$IPFW_LOG_LIMIT')' > ${TMP}
105
		'/^\d+\s+(\d+)/; print if ($1 >= '$IPFW_LOG_LIMIT')' |
114
	if [ -s "${TMP}" ]; then
106
	periodic_print_message "ipfw log limit reached:"
115
		separator
116
		echo "ipfw log limit reached:"
117
		cat ${TMP}
118
	fi
119
fi
107
fi
120
108
121
# Show kernel log messages
109
# Show kernel log messages
122
#
110
#
123
if dmesg 2>/dev/null > ${TMP}; then
111
if dmesg 2>/dev/null > ${TMP}; then
124
	if [ ! -f ${LOG}/dmesg.today ]; then
112
	if [ ! -f ${LOG}/dmesg.today ]; then
125
		separator
113
		periodic_print_message "no ${LOG}/dmesg.today"
126
		echo "no ${LOG}/dmesg.today"
127
		cp ${TMP} ${LOG}/dmesg.today
114
		cp ${TMP} ${LOG}/dmesg.today
128
	fi
115
	fi
129
116
130
	if ! cmp ${LOG}/dmesg.today ${TMP} >/dev/null 2>&1; then
117
	if ! cmp ${LOG}/dmesg.today ${TMP} >/dev/null 2>&1; then
131
		separator
118
		diff -b ${LOG}/dmesg.today ${TMP} | egrep "^>" |
132
		echo "${host} kernel log messages:"
119
		periodic_maybe_print_message "${host} kernel log messages:"
133
		diff -b ${LOG}/dmesg.today ${TMP} | egrep "^>"
134
		mv ${LOG}/dmesg.today ${LOG}/dmesg.yesterday
120
		mv ${LOG}/dmesg.today ${LOG}/dmesg.yesterday
135
		mv ${TMP} ${LOG}/dmesg.today
121
		mv ${TMP} ${LOG}/dmesg.today
136
	fi
122
	fi
Lines 138-151 Link Here
138
124
139
# Show login failures
125
# Show login failures
140
#
126
#
141
separator
127
zcat -f $LOG/messages.0* $LOG/messages |
142
echo "${host} login failures:"
128
grep -i "^$yesterday.*login failure" |
143
zcat -f $LOG/messages.0* $LOG/messages | grep -i "^$yesterday.*login failure"
129
periodic_maybe_print_message "${host} login failures:"
144
130
145
# Show tcp_wrapper warning messages
131
# Show tcp_wrapper warning messages
146
#
132
#
147
separator
133
zcat -f $LOG/messages.0* $LOG/messages |
148
echo "${host} refused connections:"
134
grep -i "^$yesterday.*refused connect" |
149
zcat -f $LOG/messages.0* $LOG/messages | grep -i "^$yesterday.*refused connect"
135
periodic_maybe_print_message "${host} refused connections:"
150
136
151
rm -f ${TMP}
137
rm -f ${TMP}
(-)etc/periodic/daily/100.clean-disks (-3 / +3 lines)
Lines 17-24 Link Here
17
    [Yy][Ee][Ss])
17
    [Yy][Ee][Ss])
18
	if [ -n "$daily_clean_disks_days" -a -n "$daily_clean_disks_files" ]
18
	if [ -n "$daily_clean_disks_days" -a -n "$daily_clean_disks_files" ]
19
	then
19
	then
20
	    echo ""
21
	    echo "Removing old temporary files:"
22
	    set -f noglob
20
	    set -f noglob
23
	    args="$args "`echo " ${daily_clean_disks_files% }" |
21
	    args="$args "`echo " ${daily_clean_disks_files% }" |
24
		sed 's/[ 	][ 	]*/ -name /g'`
22
		sed 's/[ 	][ 	]*/ -name /g'`
Lines 33-37 Link Here
33
	    find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
31
	    find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
34
		\( $args \) -atime +$daily_clean_disks_days -delete $print
32
		\( $args \) -atime +$daily_clean_disks_days -delete $print
35
	    set -f glob
33
	    set -f glob
36
	fi;;
34
	fi |
35
	periodic_maybe_print_message "Removing old temporary files:"
36
	;;
37
esac
37
esac
(-)etc/periodic/daily/110.clean-tmps (-4 / +3 lines)
Lines 18-26 Link Here
18
    [Yy][Ee][Ss])
18
    [Yy][Ee][Ss])
19
	if [ -n "$daily_clean_tmps_days" ]
19
	if [ -n "$daily_clean_tmps_days" ]
20
	then
20
	then
21
	    echo ""
22
	    echo "Removing old temporary files:"
23
24
	    set -f noglob
21
	    set -f noglob
25
	    args="-atime +$daily_clean_tmps_days -mtime +$daily_clean_tmps_days"
22
	    args="-atime +$daily_clean_tmps_days -mtime +$daily_clean_tmps_days"
26
	    [ -n "$daily_clean_tmps_ignore" ] &&
23
	    [ -n "$daily_clean_tmps_ignore" ] &&
Lines 42-46 Link Here
42
		} | sed "s,^\\.,  $dir,"
39
		} | sed "s,^\\.,  $dir,"
43
	    done
40
	    done
44
	    set -f glob
41
	    set -f glob
45
	fi;;
42
	fi |
43
	periodic_maybe_print_message "Removing old temporary files:"
44
	;;
46
esac
45
esac
(-)etc/periodic/daily/120.clean-preserve (-4 / +3 lines)
Lines 17-25 Link Here
17
    [Yy][Ee][Ss])
17
    [Yy][Ee][Ss])
18
	if [ -n "$daily_clean_preserve_days" -a -d /var/preserve ]
18
	if [ -n "$daily_clean_preserve_days" -a -d /var/preserve ]
19
	then
19
	then
20
	    echo ""
21
	    echo "Removing stale files from /var/preserve:"
22
23
	    case "$daily_clean_preserve_verbose" in
20
	    case "$daily_clean_preserve_verbose" in
24
		[Yy][Ee][Ss])
21
		[Yy][Ee][Ss])
25
		    print=-print;;
22
		    print=-print;;
Lines 30-34 Link Here
30
	    cd /var/preserve &&
27
	    cd /var/preserve &&
31
		find . ! -name . -mtime +$daily_clean_preserve_days \
28
		find . ! -name . -mtime +$daily_clean_preserve_days \
32
		    -delete $print
29
		    -delete $print
33
	fi;;
30
	fi |
31
	periodic_maybe_print_message "Removing stale files from /var/preserve:"
32
	;;
34
esac
33
esac
(-)etc/periodic/daily/130.clean-msgs (-4 / +3 lines)
Lines 17-27 Link Here
17
    [Yy][Ee][Ss])
17
    [Yy][Ee][Ss])
18
	if [ -d /var/msgs ]
18
	if [ -d /var/msgs ]
19
	then
19
	then
20
	    echo ""
21
	    echo "Cleaning out old system announcements:"
22
23
	    [ -n "$daily_clean_msgs_days" ] &&
20
	    [ -n "$daily_clean_msgs_days" ] &&
24
		arg=-${daily_clean_msgs_days#-} || arg=
21
		arg=-${daily_clean_msgs_days#-} || arg=
25
	    msgs -c $arg
22
	    msgs -c $arg
26
	fi;;
23
	fi |
24
	periodic_maybe_print_message "Cleaning out old system announcements:"
25
	;;
27
esac
26
esac
(-)etc/periodic/daily/140.clean-rwho (-4 / +3 lines)
Lines 17-25 Link Here
17
    [Yy][Ee][Ss])
17
    [Yy][Ee][Ss])
18
	if [ -n "$daily_clean_rwho_days" -a -d /var/rwho ]
18
	if [ -n "$daily_clean_rwho_days" -a -d /var/rwho ]
19
	then
19
	then
20
	    echo ""
21
	    echo "Removing stale files from /var/rwho:"
22
23
	    case "$daily_clean_rwho_verbose" in
20
	    case "$daily_clean_rwho_verbose" in
24
		[Yy][Ee][Ss])
21
		[Yy][Ee][Ss])
25
		    print=-print;;
22
		    print=-print;;
Lines 29-33 Link Here
29
26
30
	    cd /var/rwho &&
27
	    cd /var/rwho &&
31
		find . ! -name . -mtime +$daily_clean_rwho_days -delete $print
28
		find . ! -name . -mtime +$daily_clean_rwho_days -delete $print
32
	fi;;
29
	fi |
30
	periodic_maybe_print_message "Removing stale files from /var/rwho:"
31
	;;
33
esac
32
esac
(-)etc/periodic/daily/150.clean-hoststat (-4 / +3 lines)
Lines 17-25 Link Here
17
    [Yy][Ee][Ss])
17
    [Yy][Ee][Ss])
18
	if [ -n "$daily_clean_hoststat_days" -a -d /var/spool/.hoststat ]
18
	if [ -n "$daily_clean_hoststat_days" -a -d /var/spool/.hoststat ]
19
	then
19
	then
20
	    echo ""
21
	    echo "Removing stale files from /var/spool/.hoststat:"
22
23
	    case "$daily_clean_hoststat_verbose" in
20
	    case "$daily_clean_hoststat_verbose" in
24
		[Yy][Ee][Ss])
21
		[Yy][Ee][Ss])
25
		    print=-print;;
22
		    print=-print;;
Lines 30-34 Link Here
30
	    cd /var/hoststat &&
27
	    cd /var/hoststat &&
31
		find . ! -name . -mtime +$daily_clean_hoststat_days \
28
		find . ! -name . -mtime +$daily_clean_hoststat_days \
32
		    -delete $print
29
		    -delete $print
33
	fi;;
30
	fi |
31
	periodic_maybe_print_message "Removing stale files from /var/spool/.hoststat:"
32
	;;
34
esac
33
esac
(-)etc/periodic/daily/200.backup-passwd (-13 / +11 lines)
Lines 17-59 Link Here
17
	then
17
	then
18
	    bak=/var/backups
18
	    bak=/var/backups
19
19
20
	    echo ""
21
	    echo "Backup passwd and group files:"
22
23
	    if [ ! -f $bak/master.passwd.bak ]
20
	    if [ ! -f $bak/master.passwd.bak ]
24
	    then
21
	    then
25
		echo "no $bak/master.passwd.bak"
22
		periodic_print_message -1 "no $bak/master.passwd.bak"
26
		cp -p /etc/master.passwd $bak/master.passwd.bak
23
		cp -p /etc/master.passwd $bak/master.passwd.bak
27
	    fi
24
	    fi
28
25
29
	    if ! cmp -s $bak/master.passwd.bak /etc/master.passwd
26
	    if ! cmp -s $bak/master.passwd.bak /etc/master.passwd
30
	    then
27
	    then
31
		echo "$host passwd diffs:"
32
		diff $bak/master.passwd.bak /etc/master.passwd |\
28
		diff $bak/master.passwd.bak /etc/master.passwd |\
33
			sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/'
29
			sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/' |
30
		periodic_maybe_print_message -1 "$host passwd diffs:"
34
		mv $bak/master.passwd.bak $bak/master.passwd.bak2
31
		mv $bak/master.passwd.bak $bak/master.passwd.bak2
35
		cp -p /etc/master.passwd $bak/master.passwd.bak
32
		cp -p /etc/master.passwd $bak/master.passwd.bak
36
	    fi
33
	    fi
37
34
38
	    if [ ! -f $bak/group.bak ]
35
	    if [ ! -f $bak/group.bak ]
39
	    then
36
	    then
40
		echo "no $bak/group.bak"
37
		periodic_print_message -1 "no $bak/group.bak"
41
		cp -p /etc/group $bak/group.bak
38
		cp -p /etc/group $bak/group.bak
42
	    fi
39
	    fi
43
40
44
	    if ! cmp -s $bak/group.bak /etc/group
41
	    if ! cmp -s $bak/group.bak /etc/group
45
	    then
42
	    then
46
		echo "$host group diffs:"
43
		diff $bak/group.bak /etc/group |
47
		diff $bak/group.bak /etc/group
44
		periodic_maybe_print_message -1 "$host group diffs:"
48
		mv $bak/group.bak $bak/group.bak2
45
		mv $bak/group.bak $bak/group.bak2
49
		cp -p /etc/group $bak/group.bak
46
		cp -p /etc/group $bak/group.bak
50
	    fi
47
	    fi
51
48
52
	    if [ -f /etc/group ]
49
	    if [ -f /etc/group ]
53
	    then
50
	    then
54
	        echo ""
51
	        chkgrp /etc/group |
55
		echo "Verifying group file syntax:"
52
		periodic_maybe_print_message -1 "Verifying group file syntax:"
56
	        chkgrp /etc/group
57
	    fi
53
	    fi
58
	fi;;
54
	fi |
55
	periodic_maybe_print_message "Backup passwd and group files:"
56
	;;
59
esac
57
esac
(-)etc/periodic/daily/210.backup-aliases (-7 / +6 lines)
Lines 17-37 Link Here
17
	then
17
	then
18
	    bak=/var/backups
18
	    bak=/var/backups
19
19
20
	    echo ""
21
	    echo "Backing up mail aliases:"
22
23
	    if [ ! -f $bak/aliases.bak ]
20
	    if [ ! -f $bak/aliases.bak ]
24
	    then
21
	    then
25
		echo "no $bak/aliases.bak"
22
		periodic_print_message -1 "no $bak/aliases.bak"
26
		cp -p /etc/mail/aliases $bak/aliases.bak
23
		cp -p /etc/mail/aliases $bak/aliases.bak
27
	    fi
24
	    fi
28
25
29
	    if ! cmp -s $bak/aliases.bak /etc/mail/aliases
26
	    if ! cmp -s $bak/aliases.bak /etc/mail/aliases
30
	    then
27
	    then
31
		echo "$host aliases diffs:"
28
		diff -u $bak/aliases.bak /etc/mail/aliases |
32
		diff -u $bak/aliases.bak /etc/mail/aliases
29
		periodic_maybe_print_message -1 "$host aliases diffs:"
33
		mv $bak/aliases.bak $bak/aliases.bak2
30
		mv $bak/aliases.bak $bak/aliases.bak2
34
		cp -p /etc/mail/aliases $bak/aliases.bak
31
		cp -p /etc/mail/aliases $bak/aliases.bak
35
	    fi
32
	    fi
36
	fi;;
33
	fi |
34
	periodic_maybe_print_message "Backing up mail aliases:"
35
	;;
37
esac
36
esac
(-)etc/periodic/daily/220.backup-distfile (-4 / +11 lines)
Lines 17-29 Link Here
17
	then
17
	then
18
	    bak=/var/backups
18
	    bak=/var/backups
19
19
20
	    echo ""
20
            if [ ! -f $bak/Distfile.bak ]
21
	    echo "Backing up /etc/Distfile:"
21
	    then
22
		periodic_print_message -1 "no $bak/Distfile.bak"
23
		cp -p /etc/Distfile $bak/Distfile.bak
24
	    fi
22
25
23
	    if ! cmp -s $bak/Distfile.bak /etc/Distfile
26
	    if ! cmp -s $bak/Distfile.bak /etc/Distfile
24
	    then
27
	    then
28
		diff $bak/Distfile.bak /etc/Distfile |
29
		periodic_maybe_print_message -1 "$host Distfile diffs:"
25
		mv $bak/Distfile.bak $bak/Distfile.bak2
30
		mv $bak/Distfile.bak $bak/Distfile.bak2
26
		cp /etc/Distfile $bak/Distfile.bak
31
		cp -p /etc/Distfile $bak/Distfile.bak
27
	    fi
32
	    fi
28
	fi;;
33
	fi |
34
	periodic_maybe_print_message "Backing up /etc/Distfile:"
35
	;;
29
esac
36
esac
(-)etc/periodic/daily/300.calendar (-4 / +2 lines)
Lines 20-28 Link Here
20
    [Yy][Ee][Ss])
20
    [Yy][Ee][Ss])
21
	if [ -f /usr/bin/calendar ]
21
	if [ -f /usr/bin/calendar ]
22
	then
22
	then
23
	    echo ""
24
	    echo "Running calendar:"
25
26
	    calendar -a
23
	    calendar -a
27
	fi;;
24
	fi |
25
	periodic_maybe_print_message "Running calendar:"
28
esac
26
esac
(-)etc/periodic/daily/310.accounting (-4 / +3 lines)
Lines 15-23 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -f /var/account/acct ]
16
	if [ -f /var/account/acct ]
17
	then
17
	then
18
	    echo ""
19
	    echo "Rotating accounting logs and gathering statistics:"
20
21
	    cd /var/account
18
	    cd /var/account
22
19
23
	    rm -f acct.3.gz acct.3
20
	    rm -f acct.3.gz acct.3
Lines 34-38 Link Here
34
		[Yy][Ee][Ss])
31
		[Yy][Ee][Ss])
35
		    gzip -f acct.0;;
32
		    gzip -f acct.0;;
36
	    esac
33
	    esac
37
	fi;;
34
	fi |
35
	periodic_maybe_print_message "Rotating accounting logs and gathering statistics:"
36
	;;
38
esac
37
esac
(-)etc/periodic/daily/320.rdist (-4 / +3 lines)
Lines 15-23 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -f /etc/Distfile ]
16
	if [ -f /etc/Distfile ]
17
	then
17
	then
18
	    echo ""
19
	    echo "Running rdist with /etc/Distfile:"
20
21
	    rdist -f /etc/Distfile
18
	    rdist -f /etc/Distfile
22
	fi;;
19
	fi |
20
	periodic_maybe_print_message "Running rdist with /etc/Distfile:"
21
	;;
23
esac
22
esac
(-)etc/periodic/daily/330.news (-4 / +3 lines)
Lines 18-26 Link Here
18
    [Yy][Ee][Ss])
18
    [Yy][Ee][Ss])
19
	if [ -f /etc/news.expire ]
19
	if [ -f /etc/news.expire ]
20
	then
20
	then
21
	    echo ""
22
	    echo "Running news.expire:"
23
24
	    /etc/news.expire
21
	    /etc/news.expire
25
	fi;;
22
	fi |
23
	periodic_maybe_print_message "Running news.expire:"
24
	;;
26
esac
25
esac
(-)etc/periodic/daily/340.uucp (-4 / +3 lines)
Lines 18-26 Link Here
18
    [Yy][Ee][Ss])
18
    [Yy][Ee][Ss])
19
	if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]
19
	if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]
20
	then
20
	then
21
	    echo ""
22
	    echo "Cleaning up UUCP:"
23
24
	    echo /etc/uuclean.daily | su -m uucp
21
	    echo /etc/uuclean.daily | su -m uucp
25
	fi;;
22
	fi |
23
	periodic_maybe_print_message "Cleaning up UUCP:"
24
	;;
26
esac
25
esac
(-)etc/periodic/daily/400.status-disks (-6 / +4 lines)
Lines 13-25 Link Here
13
13
14
case "$daily_status_disks_enable" in
14
case "$daily_status_disks_enable" in
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	echo ""
16
	df $daily_status_disks_df_flags |
17
	echo "Disk status:"
17
	periodic_maybe_print_message "Disk status:"
18
18
19
	df $daily_status_disks_df_flags
20
21
	# display which filesystems need backing up
19
	# display which filesystems need backing up
22
20
23
	echo ""
21
	dump W |
24
	dump W;;
22
	periodic_maybe_print_message -1 "Backup status:"
25
esac
23
esac
(-)etc/periodic/daily/410.status-uucp (-4 / +3 lines)
Lines 15-23 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -d /var/spool/uucp -a -x /usr/bin/uustat ]
16
	if [ -d /var/spool/uucp -a -x /usr/bin/uustat ]
17
	then
17
	then
18
	    echo ""
19
	    echo "UUCP status:"
20
21
	    uustat -a
18
	    uustat -a
22
	fi;;
19
	fi |
20
	periodic_maybe_print_message "UUCP status:"
21
	;;
23
esac
22
esac
(-)etc/periodic/daily/420.status-network (-4 / +3 lines)
Lines 15-28 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -x /usr/bin/netstat ]
16
	if [ -x /usr/bin/netstat ]
17
	then
17
	then
18
	    echo ""
19
	    echo "Network interface status:"
20
21
	    case "$daily_status_network_usedns" in
18
	    case "$daily_status_network_usedns" in
22
		[Yy][Ee][Ss])
19
		[Yy][Ee][Ss])
23
		    netstat -i;;
20
		    netstat -i;;
24
		*)
21
		*)
25
		    netstat -in;;
22
		    netstat -in;;
26
	    esac
23
	    esac
27
	fi;;
24
	fi |
25
	periodic_maybe_print_message "Network interface status:"
26
	;;
28
esac
27
esac
(-)etc/periodic/daily/430.status-rwho (-6 / +4 lines)
Lines 16-27 Link Here
16
	rwho=$(echo /var/rwho/*)
16
	rwho=$(echo /var/rwho/*)
17
        if [ -x /usr/bin/rwho -a -f "${rwho%% *}" ]
17
        if [ -x /usr/bin/rwho -a -f "${rwho%% *}" ]
18
        then
18
        then
19
	    echo ""
19
	    ruptime |
20
	    echo "Local network system status:"
20
	    periodic_maybe_print_message "Local network system status:"
21
	    ruptime
22
	else
21
	else
23
	    echo ""
22
	    uptime |
24
	    echo "Local system status:"
23
	    periodic_maybe_print_message "Local system status:"
25
	    uptime
26
	fi;;
24
	fi;;
27
esac
25
esac
(-)etc/periodic/daily/440.status-mailq (-4 / +3 lines)
Lines 15-23 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -x /usr/bin/mailq -a -d /var/spool/mqueue ]
16
	if [ -x /usr/bin/mailq -a -d /var/spool/mqueue ]
17
	then
17
	then
18
	    echo ""
19
	    echo "Mail in local queue:"
20
21
	    case "$daily_status_mailq_shorten" in
18
	    case "$daily_status_mailq_shorten" in
22
		[Yy][Ee][Ss])
19
		[Yy][Ee][Ss])
23
		    mailq |
20
		    mailq |
Lines 29-33 Link Here
29
		*)
26
		*)
30
		    mailq;;
27
		    mailq;;
31
	    esac
28
	    esac
32
	fi;;
29
	fi |
30
	periodic_maybe_print_message "Mail in local queue:"
31
	;;
33
esac
32
esac
(-)etc/periodic/daily/450.status-security (-4 / +3 lines)
Lines 15-23 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -f /etc/security -a -x /usr/sbin/sendmail ]
16
	if [ -f /etc/security -a -x /usr/sbin/sendmail ]
17
	then
17
	then
18
	    echo ""
19
	    echo "Security check:"
20
21
	    case "$daily_status_security_noamd" in
18
	    case "$daily_status_security_noamd" in
22
		[Yy][Ee][Ss])
19
		[Yy][Ee][Ss])
23
			args=-a;;
20
			args=-a;;
Lines 38-42 Link Here
38
		    echo "    (output mailed separately)"
35
		    echo "    (output mailed separately)"
39
		    sh /etc/security $args 2>&1 | sendmail root;;
36
		    sh /etc/security $args 2>&1 | sendmail root;;
40
	    esac
37
	    esac
41
	fi;;
38
	fi |
39
	periodic_maybe_print_message "Security check:"
40
	;;
42
esac
41
esac
(-)etc/periodic/daily/460.status-mail-rejects (-4 / +3 lines)
Lines 16-24 Link Here
16
	if [ -d /etc/mail -a -f /var/log/maillog -a \
16
	if [ -d /etc/mail -a -f /var/log/maillog -a \
17
	    "$daily_status_mail_rejects_logs" -gt 0 ]
17
	    "$daily_status_mail_rejects_logs" -gt 0 ]
18
	then
18
	then
19
	    echo
20
	    echo Checking for rejected mail hosts:
21
22
	    start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
19
	    start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
23
	    n=$(($daily_status_mail_rejects_logs - 2))
20
	    n=$(($daily_status_mail_rejects_logs - 2))
24
	    {
21
	    {
Lines 38-42 Link Here
38
		perl -ne "print \"\$2\n\"
35
		perl -ne "print \"\$2\n\"
39
		    if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" |
36
		    if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" |
40
		sort | uniq -c | sort -nr
37
		sort | uniq -c | sort -nr
41
	fi;;
38
	fi |
39
	periodic_maybe_print_message "Checking for rejected mail hosts:"
40
	;;
42
esac
41
esac
(-)etc/periodic/daily/999.local (-4 / +3 lines)
Lines 20-29 Link Here
20
	/*)
20
	/*)
21
	    if [ -f "$script" ]
21
	    if [ -f "$script" ]
22
	    then
22
	    then
23
		echo ""
24
		echo "Running $script:"
25
26
		sh $script
23
		sh $script
27
	    fi;;
24
	    fi |
25
	    periodic_maybe_print_message "Running $script:"
26
	    ;;
28
    esac
27
    esac
29
done
28
done
(-)etc/periodic/monthly/200.accounting (-4 / +3 lines)
Lines 18-27 Link Here
18
	then
18
	then
19
	    if [ -x /usr/sbin/ac ]
19
	    if [ -x /usr/sbin/ac ]
20
	    then
20
	    then
21
		echo ""
22
		echo "Doing login accounting:"
23
24
		ac -p -w $W.0 | sort -nr +1
21
		ac -p -w $W.0 | sort -nr +1
25
	    fi
22
	    fi
26
	fi;;
23
	fi |
24
	periodic_maybe_print_message "Doing login accounting:"
25
	;;
27
esac
26
esac
(-)etc/periodic/monthly/999.local (-4 / +3 lines)
Lines 17-26 Link Here
17
	/*)
17
	/*)
18
	    if [ -f "$script" ]
18
	    if [ -f "$script" ]
19
	    then
19
	    then
20
		echo ""
21
		echo "Running $script:"
22
23
		sh $script
20
		sh $script
24
	    fi;;
21
	    fi |
22
	    periodic_maybe_print_message "Running $script:"
23
	    ;;
25
    esac
24
    esac
26
done
25
done
(-)etc/periodic/weekly/120.clean-kvmdb (-4 / +3 lines)
Lines 14-22 Link Here
14
    [Yy][Ee][Ss])
14
    [Yy][Ee][Ss])
15
	if [ -d /var/db -a -n "$weekly_clean_kvmdb_days" ]
15
	if [ -d /var/db -a -n "$weekly_clean_kvmdb_days" ]
16
	then
16
	then
17
	    echo ""
18
	    echo "Cleaning up kernel database files:"
19
20
	    kernel=`sysctl -n kern.bootfile`
17
	    kernel=`sysctl -n kern.bootfile`
21
	    kernel=kvm_${kernel##*/}.db
18
	    kernel=kvm_${kernel##*/}.db
22
19
Lines 29-33 Link Here
29
26
30
	    find /var/db -name "kvm_*.db" ! -name $kernel \
27
	    find /var/db -name "kvm_*.db" ! -name $kernel \
31
		-atime +$weekly_clean_kvmdb_days -delete $print
28
		-atime +$weekly_clean_kvmdb_days -delete $print
32
	fi;;
29
	fi |
30
	periodic_maybe_print_message "Cleaning up kernel database files:"
31
	;;
33
esac
32
esac
(-)etc/periodic/weekly/300.uucp (-4 / +3 lines)
Lines 17-25 Link Here
17
    [Yy][Ee][Ss])
17
    [Yy][Ee][Ss])
18
	if [ -d /var/spool/uucp -a -f /usr/libexec/uucp/clean.weekly ]
18
	if [ -d /var/spool/uucp -a -f /usr/libexec/uucp/clean.weekly ]
19
	then
19
	then
20
	    echo ""
21
	    echo "Cleaning up UUCP:"
22
23
	    echo /usr/libexec/uucp/clean.weekly | su daemon
20
	    echo /usr/libexec/uucp/clean.weekly | su daemon
24
	fi;;
21
	fi |
22
	periodic_maybe_print_message "Cleaning up UUCP:"
23
	;;
25
esac
24
esac
(-)etc/periodic/weekly/310.locate (-4 / +3 lines)
Lines 15-23 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -x /usr/libexec/locate.updatedb -a -f $locdb ]
16
	if [ -x /usr/libexec/locate.updatedb -a -f $locdb ]
17
	then
17
	then
18
	    echo ""
19
	    echo "Rebuilding locate database:"
20
21
	    locdb=/var/db/locate.database
18
	    locdb=/var/db/locate.database
22
19
23
	    touch $locdb
20
	    touch $locdb
Lines 27-31 Link Here
27
	    cd /
24
	    cd /
28
	    echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody
25
	    echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody
29
	    chmod 444 $locdb
26
	    chmod 444 $locdb
30
	fi;;
27
	fi |
28
	periodic_maybe_print_message "Rebuilding locate database:"
29
	;;
31
esac
30
esac
(-)etc/periodic/weekly/320.whatis (-4 / +3 lines)
Lines 15-23 Link Here
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	if [ -x /usr/libexec/makewhatis.local -a -x /usr/bin/manpath ]
16
	if [ -x /usr/libexec/makewhatis.local -a -x /usr/bin/manpath ]
17
	then
17
	then
18
	    echo ""
19
	    echo "Rebuilding whatis database:"
20
21
	    MANPATH=`/usr/bin/manpath -q`
18
	    MANPATH=`/usr/bin/manpath -q`
22
	    if [ $? = 0 ]
19
	    if [ $? = 0 ]
23
	    then
20
	    then
Lines 42-46 Link Here
42
		    fi
39
		    fi
43
		fi
40
		fi
44
	    fi
41
	    fi
45
	fi;;
42
	fi |
43
	periodic_maybe_print_message "Rebuilding whatis database:"
44
	;;
46
esac
45
esac
(-)etc/periodic/weekly/330.catman (-4 / +3 lines)
Lines 16-24 Link Here
16
	if [ -x /usr/libexec/catman.local -a -d /usr/share/man/cat1 -a \
16
	if [ -x /usr/libexec/catman.local -a -d /usr/share/man/cat1 -a \
17
	     -x /usr/bin/manpath ]
17
	     -x /usr/bin/manpath ]
18
	then
18
	then
19
	    echo ""
20
	    echo "Reformatting manual pages:"
21
22
	    MANPATH=`/usr/bin/manpath -q`
19
	    MANPATH=`/usr/bin/manpath -q`
23
	    if [ $? = 0 ]
20
	    if [ $? = 0 ]
24
	    then
21
	    then
Lines 42-46 Link Here
42
		    fi
39
		    fi
43
		fi
40
		fi
44
	    fi
41
	    fi
45
	fi;;
42
	fi |
43
	periodic_maybe_print_message "Reformatting manual pages:"
44
	;;
46
esac
45
esac
(-)etc/periodic/weekly/340.noid (-4 / +3 lines)
Lines 13-21 Link Here
13
13
14
case "$weekly_noid_enable" in
14
case "$weekly_noid_enable" in
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	echo ""
17
	echo "Check for files with an unknown user or group:"
18
19
	find -H ${weekly_noid_dirs:-/} -fstype local \
16
	find -H ${weekly_noid_dirs:-/} -fstype local \
20
	    \( -nogroup -o -nouser \) -print | sed 's/^/  /';;
17
	    \( -nogroup -o -nouser \) -print | sed 's/^/  /' |
18
	periodic_maybe_print_message "Check for files with an unknown user or group:"
19
	;;
21
esac
20
esac
(-)etc/periodic/weekly/400.status-pkg (-4 / +3 lines)
Lines 13-20 Link Here
13
13
14
case "$weekly_status_pkg_enable" in
14
case "$weekly_status_pkg_enable" in
15
    [Yy][Ee][Ss])
15
    [Yy][Ee][Ss])
16
	echo ""
16
	pkg_version -v | sed -n 's/^\([^ ]*\)  *<  */  \1 /p' |
17
	echo "Check for out of date packages:"
17
	periodic_maybe_print_message "Check for out of date packages:"
18
18
	;;
19
	pkg_version -v | sed -n 's/^\([^ ]*\)  *<  */  \1 /p';;
20
esac
19
esac
(-)etc/periodic/weekly/999.local (-4 / +2 lines)
Lines 17-26 Link Here
17
	/*)
17
	/*)
18
	    if [ -f "$script" ]
18
	    if [ -f "$script" ]
19
	    then
19
	    then
20
		echo ""
21
		echo "Running $script:"
22
23
		sh $script
20
		sh $script
24
	    fi;;
21
	    fi |
22
	    periodic_maybe_print_message "Running $script:"
25
    esac
23
    esac
26
done
24
done

Return to bug 21444