summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: be59e546dc3fc6f71e17a588d1523364b641e521 (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
# Maintainer: FirstAirBender <noblechuk5[at]web[dot]de>
pkgname=(crowdsec-firewall-bouncer-{iptables,nftables})
pkgbase=crowdsec-firewall-bouncer
pkgver=0.0.31
pkgrel=3
pkgdesc="Crowdsec bouncer written in golang for firewalls"
arch=('x86_64')
url="https://doc.crowdsec.net/docs/bouncers/firewall/"
license=('MIT')
depends=(crowdsec)
optdepends=(
    'systemd: running as a systemd service'
)
provides=(crowdsec-firewall-bouncer cs-firewall-bouncer)
conflicts=(cs-firewall-bouncer)
backup=(etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml)
install=cs-firewall-bouncer.install
source=(
    "$pkgbase-$pkgver.tar.gz::https://github.com/crowdsecurity/cs-firewall-bouncer/releases/download/v${pkgver}/${pkgbase}-linux-amd64.tgz"
)
sha256sums=('e4f6ed09fd9ce74117c2bc3db950326304cc741e1f6f532583d35b73a42dbad9')
    
prepare() {
    cd "$pkgbase-v$pkgver"
    export BIN='/usr/bin/crowdsec-firewall-bouncer'
    export CFG='/etc/crowdsec/bouncers'
    envsubst '$BIN,$CFG' <config/crowdsec-firewall-bouncer.service >crowdsec-firewall-bouncer.service
}

package_base() {
    export BACKEND=${pkgname##$pkgbase-}
    install -Dm600 <(envsubst '$BACKEND' <config/crowdsec-firewall-bouncer.yaml) "${pkgdir}/etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml"
}

package_crowdsec-firewall-bouncer-iptables() {
    pkgdesc="$pkgdesc (iptables)"
    depends+=(iptables ipset)
    conflicts+=(crowdsec-firewall-bouncer-nftables)

    cd "$pkgbase-v$pkgver"
    package_base
    install -Dm644 crowdsec-firewall-bouncer.service -t "${pkgdir}/usr/lib/systemd/system/"
    install -Dm755 crowdsec-firewall-bouncer -t "${pkgdir}/usr/bin/"
}

package_crowdsec-firewall-bouncer-nftables() {
    pkgdesc="$pkgdesc (nftables)"
    depends+=(nftables)
    conflicts+=(crowdsec-firewall-bouncer-iptables)

    cd "$pkgbase-v$pkgver"
    package_base
    install -Dm644 crowdsec-firewall-bouncer.service -t "${pkgdir}/usr/lib/systemd/system/"
    install -Dm755 crowdsec-firewall-bouncer -t "${pkgdir}/usr/bin/"
}