1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

sshd_log: CRLF to LF (bad interp. error)

This commit is contained in:
Artem Sheremet 2012-09-15 17:32:20 +03:00
parent 580f586dbb
commit 4ab213e166

View file

@ -1,73 +1,73 @@
#!/bin/sh #!/bin/sh
# #
# Plugin to monitor auth.log for sshd server events. # Plugin to monitor auth.log for sshd server events.
# #
# Require read permitions for $LOG # Require read permitions for $LOG
# (set in /etc/munin/plugin-conf.d/munin-node on debian) # (set in /etc/munin/plugin-conf.d/munin-node on debian)
# On busy servers you can change value type to COUNTER and set min to 0 to avoid minus peaks at logrotate # On busy servers you can change value type to COUNTER and set min to 0 to avoid minus peaks at logrotate
# #
# $Log$ # $Log$
# Revision 1.2 2010/03/19 15:03:00 pmoranga # Revision 1.2 2010/03/19 15:03:00 pmoranga
# Revision 1.1 2009/04/26 23:28:00 ckujau # Revision 1.1 2009/04/26 23:28:00 ckujau
# Revision 1.0 2009/04/22 22:00:00 zlati # Revision 1.0 2009/04/22 22:00:00 zlati
# Initial revision # Initial revision
# #
# Parameters: # Parameters:
# #
# config (required) # config (required)
# autoconf (optional - used by munin-config) # autoconf (optional - used by munin-config)
# #
# Magick markers (optional): # Magick markers (optional):
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
# config example for /etc/munin/plugin-conf.d/munin-node # config example for /etc/munin/plugin-conf.d/munin-node
#[sshd_log] #[sshd_log]
#user root #user root
#group root #group root
#env.logfile /var/log/messages #env.logfile /var/log/messages
#env.category users #env.category users
# #
LOG=${logfile:-/var/log/secure} LOG=${logfile:-/var/log/secure}
CATEGORY=${category:-system} CATEGORY=${category:-system}
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -r "$LOG" ]; then if [ -r "$LOG" ]; then
echo yes echo yes
exit 0 exit 0
else else
echo no echo no
exit 1 exit 1
fi fi
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title SSHD login stats from' $LOG echo 'graph_title SSHD login stats from' $LOG
echo 'graph_args --base 1000 -l 0' echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel logins' echo 'graph_vlabel logins'
echo 'graph_category' $CATEGORY echo 'graph_category' $CATEGORY
echo 'LogPass.label Successful password logins' echo 'LogPass.label Successful password logins'
echo 'LogPassPAM.label Successful login via PAM' echo 'LogPassPAM.label Successful login via PAM'
echo 'LogKey.label Successful PublicKey logins' echo 'LogKey.label Successful PublicKey logins'
echo 'NoID.label No identification from user' echo 'NoID.label No identification from user'
echo 'rootAttempt.label Root login attempts' echo 'rootAttempt.label Root login attempts'
echo 'InvUsr.label Invalid user login attepmts' echo 'InvUsr.label Invalid user login attepmts'
echo 'NoRDNS.label No reverse DNS for peer' echo 'NoRDNS.label No reverse DNS for peer'
echo 'Breakin.label Potential Breakin Attempts' echo 'Breakin.label Potential Breakin Attempts'
exit 0 exit 0
fi fi
awk 'BEGIN{c["LogPass"]=0;c["LogKey"]=0;c["NoID"]=0;c["rootAttempt"]=0;c["InvUsr"]=0;c["LogPassPAM"]=0;c["Breakin"]=0;c["NoRDNS"]=0; } awk 'BEGIN{c["LogPass"]=0;c["LogKey"]=0;c["NoID"]=0;c["rootAttempt"]=0;c["InvUsr"]=0;c["LogPassPAM"]=0;c["Breakin"]=0;c["NoRDNS"]=0; }
/sshd\[.*Accepted password for/{c["LogPass"]++} /sshd\[.*Accepted password for/{c["LogPass"]++}
/sshd\[.*Accepted publickey for/{c["LogKey"]++} /sshd\[.*Accepted publickey for/{c["LogKey"]++}
/sshd\[.*Did not receive identification string/{c["NoID"]++} /sshd\[.*Did not receive identification string/{c["NoID"]++}
/sshd\[.*Failed password for root/{c["rootAttempt"]++} /sshd\[.*Failed password for root/{c["rootAttempt"]++}
/sshd\[.*Invalid user/{c["InvUsr"]++} /sshd\[.*Invalid user/{c["InvUsr"]++}
/sshd\[.*POSSIBLE BREAK-IN ATTEMPT!/{c["Breakin"]++} /sshd\[.*POSSIBLE BREAK-IN ATTEMPT!/{c["Breakin"]++}
/sshd\[.*keyboard-interactive\/pam/{c["LogPassPAM"]++} /sshd\[.*keyboard-interactive\/pam/{c["LogPassPAM"]++}
/sshd\[.*reverse mapping checking getaddrinfo/{c["NoRDNS"]++}a /sshd\[.*reverse mapping checking getaddrinfo/{c["NoRDNS"]++}a
END{for(i in c){print i".value " c[i]} }' < $LOG END{for(i in c){print i".value " c[i]} }' < $LOG