summaryrefslogtreecommitdiff
path: root/pcr/psad/PKGBUILD
blob: 145625e8905d30575261061dc3194a68781fa2ca (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Maintainer: Artur Wojcik <xartii at gmail dot com>
# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.IO>

pkgname=psad
pkgver=2.2
pkgrel=2
pkgdesc="A collection of three lightweight system daemons (two main daemons and one helper daemon) that run on Linux machines and analyze iptables log messages to detect port scans and other suspicious traffic"
arch=('i686 x86_64')
url="http://cipherdyne.org/psad/"
license=('GPL')
depends=('perl-bit-vector' 'perl-date-calc' 'perl-iptables-chainmgr' 'perl-iptables-parse' 'perl-net-ipv4addr' 'perl-storable' 'perl-unix-syslog' 'net-tools')
source=("http://cipherdyne.org/psad/download/$pkgname-$pkgver.tar.gz" "responses" "psad-sysvinit.archlinux" "psad-systemdinit.archlinux" "psad.patch1")

build() {
  cd "$srcdir/$pkgname-$pkgver"
  cp $srcdir/psad-sysvinit.archlinux init-scripts/psad-init.archlinux
  if [ ! -e responses ]; then 
    ln $srcdir/responses responses -s; 
  fi
  patch -p1 -i $srcdir/psad.patch1

  #Create the dirs it will need to make the program
  mkdir -p $pkgdir/etc/psad \
           $pkgdir/etc/rc.d \
           $pkgdir/usr/bin \
           $pkgdir/usr/sbin \
           $pkgdir/usr/share/man/man8 \
           $pkgdir/var/lib/psad \
           $pkgdir/var/log/psad \
           $pkgdir/var/run/psad \
           $pkgdir/usr/lib/psad \
           $pkgdir/usr/lib/systemd/system 
  #Set the config dirs
  sed -e "s|'/usr/sbin'|'$pkgdir/usr/sbin'|" \
      -e "s|'/usr/bin'|'$pkgdir/usr/bin'|" \
      -e "s|my \$mpath = \"/usr/share/man/man\$section\";|my \$mpath = \"$pkgdir/usr/share/man/man\$section\";|" \
          ./install.pl -i
  sed -e "s|/var/log/psad|$pkgdir&|" \
      -e "s|/var/run/psad|$pkgdir&|" \
      -e "s|/var/lib/psad|$pkgdir&|" \
      -e "s|/usr/lib/psad|$pkgdir&|" \
      -e "s|/etc/psad|$pkgdir&|" \
      -e "s|/usr/bin/whois_psad|$pkgdir&|" \
      -e "s|/usr/sbin/fwcheck_psad|$pkgdir&|" \
      -e "s|/usr/sbin/psadwatchd|$pkgdir&|" \
      -e "s|/usr/sbin/kmsgsd|$pkgdir&|" \
      -e "s|/usr/sbin/psad|$pkgdir&|" \
        ./psad.conf -i

  #hope that things work
  ./install.pl --init-dir "$pkgdir/etc/rc.d/" < responses

  #add the systemd service file
  cp $srcdir/psad-systemdinit.archlinux $pkgdir/usr/lib/systemd/system/psad.service

  # Fix the config
  sed -e "s|$pkgdir||" $pkgdir/etc/psad/psad.conf -i
  sed -e "s|$pkgdir||" $pkgdir/var/log/psad/install.log -i

  #Set correct permissions  
  chmod 0700 $pkgdir/var/lib/psad
   

}

# vim:set ts=2 sw=2 et: