root / plugins / network / psad @ 1bed50bb
Historique | Voir | Annoter | Télécharger (2,86 ko)
| 1 | b5ce1d00 | Dave Driesen | #!/bin/sh |
|---|---|---|---|
| 2 | # -*- sh -*- |
||
| 3 | |||
| 4 | : << =cut |
||
| 5 | |||
| 6 | =head1 NAME |
||
| 7 | |||
| 8 | psad - Plugin to monitor the number of port scans detected by psad. |
||
| 9 | |||
| 10 | =head1 CONFIGURATION |
||
| 11 | |||
| 12 | The following environment variables are used by this plugin |
||
| 13 | |||
| 14 | psad - Path to psad binary - defaults to psad in PATH |
||
| 15 | psad_log - Path to the log where psad entries are logged. defaults to /var/log/messages |
||
| 16 | wc - wc program to use |
||
| 17 | awk - awk program to use |
||
| 18 | |||
| 19 | =head1 APPLICABLE SYSTEMS |
||
| 20 | |||
| 21 | Any system using psad for intrusion detection. |
||
| 22 | psad is a port scan detection tool. Using this plugin will allow munin to |
||
| 23 | graph its effectiveness for you so you can easily track network security |
||
| 24 | compromise or other trends. |
||
| 25 | |||
| 26 | =head2 CONFIGURATION EXAMPLES |
||
| 27 | |||
| 28 | There should be no configuration needed for a standard install. |
||
| 29 | |||
| 30 | For the sake of example, the following configuration could be used |
||
| 31 | for psad installation with non-standard logfile location (/var/log/psad/psad.log): |
||
| 32 | |||
| 33 | [psad] |
||
| 34 | env.psad_log /var/log/psad/psad.log |
||
| 35 | |||
| 36 | =head1 AUTHOR |
||
| 37 | |||
| 38 | Copyright (C) 2013 Dave Driesen <dave.driesen@honeypot.pandemonium.be> |
||
| 39 | |||
| 40 | =head1 LICENSE |
||
| 41 | |||
| 42 | This program is free software; you can redistribute it and/or modify |
||
| 43 | it under the terms of the GNU General Public License as published by |
||
| 44 | the Free Software Foundation; version 2 dated June, 1991. |
||
| 45 | |||
| 46 | This program is distributed in the hope that it will be useful, but |
||
| 47 | WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 48 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||
| 49 | General Public License for more details. |
||
| 50 | |||
| 51 | You should have received a copy of the GNU General Public License |
||
| 52 | along with this program; if not, write to the Free Software |
||
| 53 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
| 54 | 02110-1301 USA. |
||
| 55 | |||
| 56 | =head1 MAGIC MARKERS |
||
| 57 | |||
| 58 | #%# family=auto contrib |
||
| 59 | #%# capabilities=autoconf |
||
| 60 | |||
| 61 | =cut |
||
| 62 | |||
| 63 | psad_log_default=/var/log/messages |
||
| 64 | |||
| 65 | [ $awk ] || awk="awk" |
||
| 66 | [ $wc ] || wc="wc" |
||
| 67 | [ $psad ] || psad="psad" |
||
| 68 | [ $psad_log ] || psad_log="$psad_log_default" |
||
| 69 | |||
| 70 | case $1 in |
||
| 71 | autoconf) |
||
| 72 | if [ -f ${psad} ] ; then
|
||
| 73 | echo yes |
||
| 74 | else |
||
| 75 | echo no |
||
| 76 | fi |
||
| 77 | exit 0;; |
||
| 78 | |||
| 79 | config) |
||
| 80 | cat <<'EOM' |
||
| 81 | graph_title Port scans detected |
||
| 82 | graph_vlabel Events per hour |
||
| 83 | graph_info This graph shows the number of port scans detected per hour |
||
| 84 | graph_category network |
||
| 85 | graph_period minute |
||
| 86 | |||
| 87 | attacks_logged.label Scans detected per hour |
||
| 88 | attacks_logged.draw LINE1 |
||
| 89 | attacks_logged.warning 10 |
||
| 90 | attacks_logged.critical 20 |
||
| 91 | 0914022b | Dave Driesen | attacks_logged.type DERIVE |
| 92 | attacks_logged.min 0 |
||
| 93 | b5ce1d00 | Dave Driesen | attacks_logged.cdef attacks_logged,12,* |
| 94 | |||
| 95 | autoblocks_logged.label Auto-blocks per hour |
||
| 96 | autoblocks_logged.draw LINE1 |
||
| 97 | 0914022b | Dave Driesen | autoblocks_logged.type DERIVE |
| 98 | autoblocks_logged.min 0 |
||
| 99 | b5ce1d00 | Dave Driesen | autoblocks_logged.cdef autoblocks_logged,12,* |
| 100 | |||
| 101 | EOM |
||
| 102 | exit 0;; |
||
| 103 | esac |
||
| 104 | |||
| 105 | grep "psad: scan detected" "$psad_log" | $wc -l | $awk '{
|
||
| 106 | print "attacks_logged.value " $1 |
||
| 107 | }' |
||
| 108 | |||
| 109 | grep "psad: added iptables auto-block against " "$psad_log" | $wc -l | $awk '{
|
||
| 110 | print "autoblocks_logged.value " $1 |
||
| 111 | }' |
