|
Lines 40-63
Link Here
|
| 40 |
# sshguard_pidfile (str): Path to PID file. |
40 |
# sshguard_pidfile (str): Path to PID file. |
| 41 |
# Set to "/var/run/sshguard.pid" by default |
41 |
# Set to "/var/run/sshguard.pid" by default |
| 42 |
# sshguard_watch_logs (str): Colon splitted list of logs to watch. |
42 |
# sshguard_watch_logs (str): Colon splitted list of logs to watch. |
| 43 |
# Set to "/var/log/auth.log:/var/log/maillog" |
43 |
# Unset by default. Overrides the configuration file. |
| 44 |
# by default. |
|
|
| 45 |
# The following options directly maps to their command line options, |
44 |
# The following options directly maps to their command line options, |
| 46 |
# please read manual page sshguard(8) for detailed information: |
45 |
# and override the configuration file, so most are unset by default. |
|
|
46 |
# Please read manual page sshguard(8) for detailed information: |
| 47 |
# sshguard_blacklist (str): [thr:]/path/to/blacklist. |
47 |
# sshguard_blacklist (str): [thr:]/path/to/blacklist. |
| 48 |
# Set to "30:/var/db/sshguard/blacklist.db" |
48 |
# Set to "30:/var/db/sshguard/blacklist.db" |
| 49 |
# by default. |
49 |
# by default. |
| 50 |
# sshguard_danger_thresh (int): Danger threshold. Set to "30" by default. |
50 |
# sshguard_danger_thresh (int): Danger threshold. |
| 51 |
# sshguard_release_interval (int): |
51 |
# sshguard_release_interval (int): |
| 52 |
# Minimum interval an address remains |
52 |
# Minimum interval an address remains |
| 53 |
# blocked. Set to "120" by default. |
53 |
# blocked. |
| 54 |
# sshguard_reset_interval (int): |
54 |
# sshguard_reset_interval (int): |
| 55 |
# Interval before a suspected attack is |
55 |
# Interval before a suspected attack is |
| 56 |
# forgotten and danger is reset to 0. |
56 |
# forgotten and danger is reset to 0. |
| 57 |
# Set to "1800" by default. |
|
|
| 58 |
# sshguard_whitelistfile (str): Path to the whitelist. |
57 |
# sshguard_whitelistfile (str): Path to the whitelist. |
| 59 |
# Set to "%%PREFIX%%/etc/sshguard.whitelist" |
|
|
| 60 |
# by default. |
| 61 |
# sshguard_flags (str): Set additional command line arguments. |
58 |
# sshguard_flags (str): Set additional command line arguments. |
| 62 |
# |
59 |
# |
| 63 |
|
60 |
|
|
Lines 71-81
load_rc_config sshguard
Link Here
|
| 71 |
|
68 |
|
| 72 |
: ${sshguard_enable:=NO} |
69 |
: ${sshguard_enable:=NO} |
| 73 |
: ${sshguard_blacklist=30:/var/db/sshguard/blacklist.db} |
70 |
: ${sshguard_blacklist=30:/var/db/sshguard/blacklist.db} |
| 74 |
: ${sshguard_danger_thresh=30} |
71 |
: ${sshguard_danger_thresh=} |
| 75 |
: ${sshguard_release_interval=120} |
72 |
: ${sshguard_release_interval=} |
| 76 |
: ${sshguard_reset_interval=1800} |
73 |
: ${sshguard_reset_interval=} |
| 77 |
: ${sshguard_whitelistfile="%%PREFIX%%/etc/sshguard.whitelist"} |
74 |
: ${sshguard_whitelistfile=} |
| 78 |
: ${sshguard_watch_logs=/var/log/auth.log:/var/log/maillog} |
75 |
: ${sshguard_watch_logs=} |
| 79 |
|
76 |
|
| 80 |
pidfile=${sshguard_pidfile:="/var/run/sshguard.pid"} |
77 |
pidfile=${sshguard_pidfile:="/var/run/sshguard.pid"} |
| 81 |
|
78 |
|
|
Lines 83-89
command=/usr/sbin/daemon
Link Here
|
| 83 |
actual_command="%%PREFIX%%/sbin/sshguard" |
80 |
actual_command="%%PREFIX%%/sbin/sshguard" |
| 84 |
procname="%%PREFIX%%/libexec/sshg-blocker" |
81 |
procname="%%PREFIX%%/libexec/sshg-blocker" |
| 85 |
start_precmd=sshguard_prestart |
82 |
start_precmd=sshguard_prestart |
| 86 |
command_args="-c ${actual_command} \${sshguard_flags} \${sshguard_blacklist_params} \${sshguard_watch_params} -a ${sshguard_danger_thresh} -p ${sshguard_release_interval} -s ${sshguard_reset_interval} -w ${sshguard_whitelistfile} -i ${pidfile}" |
83 |
command_args="-c ${actual_command} \${sshguard_flags} \${sshguard_blacklist_params} \${sshguard_watch_params} \${sshguard_danger_params} \${sshguard_release_params} \${sshguard_reset_params} \${sshguard_whitelist_params} -i ${pidfile}" |
| 87 |
|
84 |
|
| 88 |
sshguard_prestart() |
85 |
sshguard_prestart() |
| 89 |
{ |
86 |
{ |
|
Lines 96-104
sshguard_prestart()
Link Here
|
| 96 |
sshguard_blacklist_params="-b ${sshguard_blacklist}" |
93 |
sshguard_blacklist_params="-b ${sshguard_blacklist}" |
| 97 |
fi |
94 |
fi |
| 98 |
|
95 |
|
| 99 |
[ -e ${sshguard_whitelistfile} ] || touch ${sshguard_whitelistfile} |
96 |
if [ ! -z ${sshguard_whitelistfile} ]; then |
|
|
97 |
[ -e "${sshguard_whitelistfile}" ] || touch ${sshguard_whitelistfile} |
| 98 |
sshguard_whitelist_params="-w ${sshguard_whitelistfile}" |
| 99 |
fi |
| 100 |
|
| 101 |
if [ ! -z ${sshguard_danger_thresh} ]; then |
| 102 |
sshguard_danger_params="-a ${sshguard_danger_thresh}" |
| 103 |
fi |
| 104 |
|
| 105 |
if [ ! -z ${sshguard_release_interval} ]; then |
| 106 |
sshguard_release_params="-p ${sshguard_release_interval}" |
| 107 |
fi |
| 100 |
|
108 |
|
| 101 |
sshguard_watch_params=$(echo ${sshguard_watch_logs} | tr : \\\n | sed -e s/^/-l\ /g | tr \\\n \ ) |
109 |
if [ ! -z ${sshguard_reset_interval} ]; then |
|
|
110 |
sshguard_reset_params="-s ${sshguard_reset_interval}" |
| 111 |
fi |
| 112 |
|
| 113 |
if [ ! -z "${sshguard_watch_logs}" ]; then |
| 114 |
sshguard_watch_params=$(echo ${sshguard_watch_logs} | tr : \\\n | sed -e s/^/-l\ /g | tr \\\n \ ) |
| 115 |
fi |
| 102 |
} |
116 |
} |
| 103 |
|
117 |
|
| 104 |
run_rc_command "$1" |
118 |
run_rc_command "$1" |
| 105 |
- |
|
|