aboutsummaryrefslogtreecommitdiffstats
path: root/security/amavisd-new/files/amavis-p0fanalyzer.sh.in
blob: d7009711bcfc0d1b0bbccbe6605c5e75bdca9949 (plain) (blame)
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
33
34
35
36
37
38
#!/bin/sh
# $FreeBSD$

# PROVIDE: amavis_p0fanalyzer
# REQUIRE: DAEMON
# BEFORE: amavisd

amavis_p0fanalyzer_enable="${amavis_p0fanalyzer_enable-NO}"
amavis_p0fanalyzer_p0f_filter="${amavis_p0fanalyzer_p0f_filter-"tcp dst port 25"}"
amavis_p0fanalyzer_pidfile1="${amavis_p0fanalyzer_pidfile1-/var/run/p0fanalyzer1.pid}"
amavis_p0fanalyzer_pidfile2="${amavis_p0fanalyzer_pidfile2-/var/run/p0fanalyzer2.pid}"
amavis_p0f_daemon_flags="${amavis_p0f_daemon_flags--l}"
amavis_p0fanalyzer_flags="${amavis_p0fanalyzer_flags-2345}"

. /etc/rc.subr

name="amavis_p0fanalyzer"
rcvar=amavis_p0fanalyzer_enable

start_cmd=p0fanalyzer_start
stop_cmd=p0fanalyzer_stop

p0fanalyzer_start() {
    echo "Starting p0f-analyzer." && \
      %%DAEMON%% ${amavis_p0fanalyzer_pidfile1} \
      %%PREFIX%%/bin/p0f ${amavis_p0f_daemon_flags} \
      "${amavis_p0fanalyzer_p0f_filter}" 2>&1 | \
      %%DAEMON%% ${amavis_p0fanalyzer_pidfile2} \
      %%PREFIX%%/sbin/p0f-analyzer.pl ${amavis_p0fanalyzer_flags}
}

p0fanalyzer_stop() {
    /bin/kill `cat ${amavis_p0fanalyzer_pidfile2}` && rm ${amavis_p0fanalyzer_pidfile2}
    /bin/kill `cat ${amavis_p0fanalyzer_pidfile1}` && rm ${amavis_p0fanalyzer_pidfile1}
}

load_rc_config $name
run_rc_command "$1"