-
Notifications
You must be signed in to change notification settings - Fork 50
/
remote-syslog.sh
executable file
·32 lines (31 loc) · 1.04 KB
/
remote-syslog.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
#!/bin/bash
while true;
do
if [ -f /etc/rsyslog.d/remote_v2.conf ]; then
rm -r /etc/rsyslog.d/remote_v2.conf
fi
if [ -f /etc/rsyslog.d/remote_v3.conf ]; then
rm -r /etc/rsyslog.d/remote_v3.conf
fi
if [ -f /etc/rsyslog.d/remote_v4.conf ]; then
rm -r /etc/rsyslog.d/remote_v4.conf
fi
if [ ! -f /etc/rsyslog.d/remote_v5.conf ]; then
echo 'auth,authpriv.* @@${SYSLOG_SERVER}' > /etc/rsyslog.d/remote_v5.conf
systemctl restart syslog
echo "rsyslog configured for remote syslog host"
fi
if [ ! -f /etc/rsyslog.d/30-audisp.conf ]; then
echo "if \$programname == 'audispd' then @@${SYSLOG_SERVER}" > /etc/rsyslog.d/30-audisp.conf
systemctl restart syslog
fi
if grep -q "LogLevel INFO" /etc/ssh/sshd_config; then
sed -i 's/LogLevel INFO/LogLevel VERBOSE/' /etc/ssh/sshd_config
systemctl restart sshd
fi
if grep -q "ForwardToSyslog=no" /etc/systemd/journald.conf; then
sed -i 's/ForwardToSyslog\=no/ForwardToSyslog\=yes/' /etc/systemd/journald.conf
systemctl restart systemd-journald
fi
sleep 600
done