From 2bd9a04ce982e390337222d84c0b24fdab088c99 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Mon, 5 Jun 2023 22:49:25 +0200 Subject: [PATCH] Initial Commit --- .SRCINFO | 20 ++++++++++++++++++++ .gitignore | 5 +++++ PKGBUILD | 41 +++++++++++++++++++++++++++++++++++++++++ systemd.service | 17 +++++++++++++++++ sysusers.conf | 1 + 5 files changed, 84 insertions(+) create mode 100644 .SRCINFO create mode 100644 .gitignore create mode 100644 PKGBUILD create mode 100644 systemd.service create mode 100644 sysusers.conf diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..54f23cd --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,20 @@ +pkgbase = prometheus-fail2ban-exporter + pkgdesc = Fail2Ban exporter for Fail2Ban metrics + pkgver = 0.7.2 + pkgrel = 1 + url = https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter + arch = x86_64 + license = MIT + makedepends = go + optdepends = fail2ban: for monitoring a local fail2ban daemon + source = https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/archive/0.7.2/fail2ban-prometheus-exporter-0.7.2.tar.gz + source = systemd.service + source = sysusers.conf + sha512sums = b7691cc31c747965b8ac9e8f818d4411b716888be5c84c51bbe5e206022bf9b60f95abddc37c8011a412a40ba0665107e957a55b3acba5018fd5be85c442380e + sha512sums = 35747b143d7aed606ce25673061603d6c5b1623fb86c180aaa0a23f6afde26f4d2cde99d05cc1cc7fd7d8ccacbb6d3413cfcfcc3f26f7530d1f0d9151877b4d1 + sha512sums = c070f57c58f367421835fe757b6b46e4c6cc3a69e0e927b10c229daab945fc52e57acdf25a84f04f752cb7304c40c2ff95e7987daf41c80f8857d409def1752f + b2sums = 87ab07b334594ecb792d817abb9bca1c7565be64df79d6dfa5edd268241534345a9e7e5b782dfcfd623d6a63db77b8803c614e44c3d44f9b7ca6b41952c6eb20 + b2sums = a4ff2f3da50e353f8cfdca96de54a5fa83a2bcd12cf7a7c873b4cf4a55e745e35593b0d13a77edd6ade51ce582c6001d2241bd20491269538880e2b9e0816181 + b2sums = 4b731a290e1ad967f9e7708b00d4b9279bdbc57461c62d09a8bff00958e72cb8e69848d73af486bcc9e58ffe1e087ca86dc2625770a25ebd47e41d7bba193bef + +pkgname = prometheus-fail2ban-exporter diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40eeccc --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +pkg +src +*tar.gz* +*tar.zst* + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..3ac4969 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,41 @@ +# Maintainer: Markus Pesch + +pkgname=prometheus-fail2ban-exporter +_pkgname=fail2ban-prometheus-exporter +pkgver=0.7.2 +pkgrel=1 +pkgdesc="Fail2Ban exporter for Fail2Ban metrics" +arch=('x86_64') +url="https://gitlab.com/hectorjsmith/$_pkgname" +license=('MIT') +makedepends=('go') +optdepends=('fail2ban: for monitoring a local fail2ban daemon') +source=( + "$url/-/archive/$pkgver/$_pkgname-$pkgver.tar.gz" + 'systemd.service' + 'sysusers.conf' +) +sha512sums=('b7691cc31c747965b8ac9e8f818d4411b716888be5c84c51bbe5e206022bf9b60f95abddc37c8011a412a40ba0665107e957a55b3acba5018fd5be85c442380e' + '35747b143d7aed606ce25673061603d6c5b1623fb86c180aaa0a23f6afde26f4d2cde99d05cc1cc7fd7d8ccacbb6d3413cfcfcc3f26f7530d1f0d9151877b4d1' + 'c070f57c58f367421835fe757b6b46e4c6cc3a69e0e927b10c229daab945fc52e57acdf25a84f04f752cb7304c40c2ff95e7987daf41c80f8857d409def1752f') +b2sums=('87ab07b334594ecb792d817abb9bca1c7565be64df79d6dfa5edd268241534345a9e7e5b782dfcfd623d6a63db77b8803c614e44c3d44f9b7ca6b41952c6eb20' + 'a4ff2f3da50e353f8cfdca96de54a5fa83a2bcd12cf7a7c873b4cf4a55e745e35593b0d13a77edd6ade51ce582c6001d2241bd20491269538880e2b9e0816181' + '4b731a290e1ad967f9e7708b00d4b9279bdbc57461c62d09a8bff00958e72cb8e69848d73af486bcc9e58ffe1e087ca86dc2625770a25ebd47e41d7bba193bef') + +build() { + cd "$_pkgname-$pkgver/src" + go build -v \ + -buildmode=pie \ + -trimpath \ + -o fail2ban-exporter . +} + +package() { + # systemd integration + install -Dm644 systemd.service "$pkgdir/usr/lib/systemd/system/fail2ban-exporter.service" + install -Dm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/fail2ban-exporter.conf" + + # binary + install -D --mode 0755 --target-directory "$pkgdir/usr/bin" "$_pkgname-$pkgver/src/fail2ban-exporter" + install -D --mode 0755 --target-directory "$pkgdir/usr/share/licenses/$pkgname" "$_pkgname-$pkgver/LICENSE" +} diff --git a/systemd.service b/systemd.service new file mode 100644 index 0000000..a673381 --- /dev/null +++ b/systemd.service @@ -0,0 +1,17 @@ +[Unit] +Description=Prometheus exporter for fail2ban metrics +Requires=network-online.target +After=network-online.target + +[Service] +ExecStart=/usr/bin/fail2ban-exporter +ExecReload=/bin/kill -HUP $MAINPID +User=root +Group=root +Restart=on-failure +RestartSec=5s + +NoNewPrivileges=true + +[Install] +WantedBy=multi-user.target diff --git a/sysusers.conf b/sysusers.conf new file mode 100644 index 0000000..c16ef8b --- /dev/null +++ b/sysusers.conf @@ -0,0 +1 @@ +u fail2ban-exporter - "Prometheus fail2ban exporter user"