summarylogtreecommitdiffstats
path: root/pulledpork.install
blob: 6768e7e4dbd11bbb827f67e9ab2b3d945446cc68 (plain)
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
39
40
41
post_install() {
cat << _EOF

>>> You may want to ADJUST files in /etc/pulledpork/ directory

>>> Default config is set up for:
>>>   snort community rules, if using pulledpork 3
>>>   emergingthreats open rules, if using pulledpork 2

>>> By default rules auto-update every week if
>>>   file /etc/snort/rules/snort.rules exists

>>> To use these rules in snort, you must include snort.rules
>>> file in your snort configuration (if not already setup to be so)

_EOF
  snort2_detect
}

post_upgrade() {
  if (( $(vercmp $2 0.7.3-2) < 0)); then
    systemctl --now enable pulledpork.timer
  fi
  if (( $(vercmp $2 0.7.4) <= 0)); then
    snort2_detect
  fi
}

snort2_detect() {
cat << _EOF

>>> Package now uses pulledpork 3 by default.
>>> To use pulledpork 2, create (touch) a file
>>>   touch /etc/pulledpork/update_via_pp2

_EOF
    if snort -V  2>&1 | grep -q 'Version 2.'; then
      echo "snort 2 detected, creating /etc/pulledpork/update_via_pp2"
      touch /etc/pulledpork/update_via_pp2
    fi
}