summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2f3a75eaff2bf45cf00856d3627e5fd9d20a7816 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Maintainer: FirstAirBender <noblechuk5[at]web[dot]de>
# Contributor: Bjoern Franke <bjo+aur@schafweide.org>
# Contributor: Crowdsec Team <debian@crowdsec.net>

pkgname=crowdsec-bin
pkgver=1.6.0
pkgrel=1
pkgdesc="The open-source and participative security solution offering crowdsourced protection against malicious IPs and access to the most advanced real-world CTI"
arch=('any')
url="https://github.com/crowdsecurity/crowdsec"
license=('MIT')
provides=('crowdsec')
conflicts=('crowdsec')
install=crowdsec-bin.install
depends=(
  'ca-certificates'
  'glibc'
  'sqlite'
  'systemd'
)
makedepends=(
  sed
  findutils
)
optdepends=(
  'docker: for running the observability dashboard via docker'
)
backup=(
  etc/crowdsec/config.yaml
  etc/crowdsec/local_api_credentials.yaml
  etc/crowdsec/online_api_credentials.yaml
)
source=(
  "$pkgname-v${pkgver}.tgz"::https://github.com/crowdsecurity/crowdsec/releases/download/v${pkgver}/crowdsec-release.tgz
  crowdsec-bin.install
  crowdsec.sysusers
)
sha256sums=('8a9e9385d1a2615c7cadb8f499b0012372dcbea1ad1c7e6b38b87962fa569597'
  'cd5a8ca9d46d6d6ce9f94c72530dc6594351b28e5764e2a6ef7692a63a92a7f3'
  'a97e2c4bc07470dad890fca27b6da7c4a9ac9762551a0888dd812d2da63200ad')

prepare() {
  cd "$srcdir/crowdsec-v${pkgver}"
  sed -ie 's|plugin_dir:.*|plugin_dir: /usr/lib/crowdsec/plugins/|' config/config.yaml
  sed -ie 's|usr/local/bin/crowdsec|usr/bin/crowdsec|' config/crowdsec.service
  find ./config -type f -regex '.*_win_?.*\.yaml' -delete
}

package() {
  cd "$srcdir/crowdsec-v${pkgver}"
  # create directories
  install -dm755 $pkgdir{/usr/lib/{crowdsec/plugins,systemd/system,sysusers.d},/etc/crowdsec{,/hub,/notifications,/console,/acquis.d,/scenarios,/postoverflows,/collections,/bouncers,/metabase},/usr/bin,/var/lib/crowdsec/data/,/opt/crowdsec/}

  # config
  install -m640 ./config/{config,console,profiles,simulation,acquis,local_api_credentials,online_api_credentials,dev,user}.yaml -t $pkgdir/etc/crowdsec/
  install -m640 ./config/context.yaml $pkgdir/etc/crowdsec/console/context.yaml
  cp -R ./config/patterns $pkgdir/etc/crowdsec/

  # systemd
  install -m640 ./config/crowdsec.service $pkgdir/usr/lib/systemd/system/crowdsec.service

  # executables
  install -m755 ./cmd/{crowdsec-cli/cscli,crowdsec/crowdsec} -t $pkgdir/usr/bin/

  # plugins
  install -m700 ./cmd/notification-dummy/notification-dummy $pkgdir/usr/lib/crowdsec/plugins/dummy
  install -m640 ./cmd/notification-dummy/dummy.yaml -t $pkgdir/etc/crowdsec/notifications
  install -m700 ./cmd/notification-email/notification-email $pkgdir/usr/lib/crowdsec/plugins/email
  install -m640 ./cmd/notification-email/email.yaml -t $pkgdir/etc/crowdsec/notifications
  install -m700 ./cmd/notification-http/notification-http $pkgdir/usr/lib/crowdsec/plugins/http
  install -m640 ./cmd/notification-http/http.yaml -t $pkgdir/etc/crowdsec/notifications
  install -m700 ./cmd/notification-slack/notification-slack $pkgdir/usr/lib/crowdsec/plugins/slack
  install -m640 ./cmd/notification-slack/slack.yaml -t $pkgdir/etc/crowdsec/notifications
  install -m700 ./cmd/notification-splunk/notification-splunk $pkgdir/usr/lib/crowdsec/plugins/splunk
  install -m640 ./cmd/notification-splunk/splunk.yaml -t $pkgdir/etc/crowdsec/notifications

  # extras
  install -m640 ./config/crowdsec.cron.daily -t $pkgdir/opt/crowdsec/
  install -m740 ./wizard.sh -t $pkgdir/opt/crowdsec/
  install -m644 "$srcdir/crowdsec.sysusers" "$pkgdir/usr/lib/sysusers.d/crowdsec.conf"
}