From d2f1a5560fe8e92fc089c65ecb03467d2c93c965 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Sat, 10 Jun 2023 10:28:35 +0200 Subject: [PATCH] fix: adapt systemd unit to load environment file with extra args --- .SRCINFO | 9 ++++++--- PKGBUILD | 19 ++++++++++++++----- prometheus-fail2ban-exporter | 1 + systemd.service | 3 ++- 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 prometheus-fail2ban-exporter diff --git a/.SRCINFO b/.SRCINFO index f0d9a97..9b4ae25 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,20 +1,23 @@ pkgbase = prometheus-fail2ban-exporter pkgdesc = Fail2Ban exporter for Fail2Ban metrics pkgver = 0.7.2 - pkgrel = 2 + pkgrel = 3 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 = prometheus-fail2ban-exporter source = systemd.service source = sysusers.conf sha512sums = b7691cc31c747965b8ac9e8f818d4411b716888be5c84c51bbe5e206022bf9b60f95abddc37c8011a412a40ba0665107e957a55b3acba5018fd5be85c442380e - sha512sums = 19a61f7a7be1c73cbe87a978f5787ae35304e2e6db03a927016e1a5a8b0715bc3d971e52da61ce5f1a7fd302ae7646a4c54c7fdc082ee9c371368d56be311d09 + sha512sums = 7f0a0770ac6f42a7bc0d6e38559da833b7cbc18f97c516418d596878537c12b5778e2705a451e16f3067ceb87ce60af2a705867b0962f7abd1a595a23902a3ba + sha512sums = 7918ea56dc94b29e25900d5bcf94c8c525226d5a490124b718686aa3c8900752baae80722c8c840d563c1ffef06a54440802cff498c9edf0c673d682518a3f1a sha512sums = c070f57c58f367421835fe757b6b46e4c6cc3a69e0e927b10c229daab945fc52e57acdf25a84f04f752cb7304c40c2ff95e7987daf41c80f8857d409def1752f b2sums = 87ab07b334594ecb792d817abb9bca1c7565be64df79d6dfa5edd268241534345a9e7e5b782dfcfd623d6a63db77b8803c614e44c3d44f9b7ca6b41952c6eb20 - b2sums = 126dae6e1a1fe9bcc67e2dafc203aeb5f057aea82fec65b4f8c18f5a4bc3154f9e22e53b043f9c6f849f625d4ecf77ea67be5bb562b0b794814ad695f48bd235 + b2sums = cd565b9262d85399ba63290d5af32fed23227d4a987499968654d4f0f7ea95c91c7781cae513d4368a87de328ac198a5e05cf5beae9199ebbdfb622c098281b9 + b2sums = e88ba4beef23dfd36a825f6b873647708b81a35d4b2debb16f0a5e35e5e42311ebd9694cb90501d65231c1ae45c863103fe93ae1f6c99c2745ed7e8c12434653 b2sums = 4b731a290e1ad967f9e7708b00d4b9279bdbc57461c62d09a8bff00958e72cb8e69848d73af486bcc9e58ffe1e087ca86dc2625770a25ebd47e41d7bba193bef pkgname = prometheus-fail2ban-exporter diff --git a/PKGBUILD b/PKGBUILD index 65a9332..ec09e5f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ pkgname=prometheus-fail2ban-exporter _pkgname=fail2ban-prometheus-exporter pkgver=0.7.2 -pkgrel=2 +pkgrel=3 pkgdesc="Fail2Ban exporter for Fail2Ban metrics" arch=('x86_64') url="https://gitlab.com/hectorjsmith/$_pkgname" @@ -12,14 +12,17 @@ makedepends=('go') optdepends=('fail2ban: for monitoring a local fail2ban daemon') source=( "$url/-/archive/$pkgver/$_pkgname-$pkgver.tar.gz" + 'prometheus-fail2ban-exporter' 'systemd.service' 'sysusers.conf' ) sha512sums=('b7691cc31c747965b8ac9e8f818d4411b716888be5c84c51bbe5e206022bf9b60f95abddc37c8011a412a40ba0665107e957a55b3acba5018fd5be85c442380e' - '19a61f7a7be1c73cbe87a978f5787ae35304e2e6db03a927016e1a5a8b0715bc3d971e52da61ce5f1a7fd302ae7646a4c54c7fdc082ee9c371368d56be311d09' + '7f0a0770ac6f42a7bc0d6e38559da833b7cbc18f97c516418d596878537c12b5778e2705a451e16f3067ceb87ce60af2a705867b0962f7abd1a595a23902a3ba' + '7918ea56dc94b29e25900d5bcf94c8c525226d5a490124b718686aa3c8900752baae80722c8c840d563c1ffef06a54440802cff498c9edf0c673d682518a3f1a' 'c070f57c58f367421835fe757b6b46e4c6cc3a69e0e927b10c229daab945fc52e57acdf25a84f04f752cb7304c40c2ff95e7987daf41c80f8857d409def1752f') b2sums=('87ab07b334594ecb792d817abb9bca1c7565be64df79d6dfa5edd268241534345a9e7e5b782dfcfd623d6a63db77b8803c614e44c3d44f9b7ca6b41952c6eb20' - '126dae6e1a1fe9bcc67e2dafc203aeb5f057aea82fec65b4f8c18f5a4bc3154f9e22e53b043f9c6f849f625d4ecf77ea67be5bb562b0b794814ad695f48bd235' + 'cd565b9262d85399ba63290d5af32fed23227d4a987499968654d4f0f7ea95c91c7781cae513d4368a87de328ac198a5e05cf5beae9199ebbdfb622c098281b9' + 'e88ba4beef23dfd36a825f6b873647708b81a35d4b2debb16f0a5e35e5e42311ebd9694cb90501d65231c1ae45c863103fe93ae1f6c99c2745ed7e8c12434653' '4b731a290e1ad967f9e7708b00d4b9279bdbc57461c62d09a8bff00958e72cb8e69848d73af486bcc9e58ffe1e087ca86dc2625770a25ebd47e41d7bba193bef') build() { @@ -32,10 +35,16 @@ build() { package() { # systemd integration - install -Dm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" - install -Dm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" + install -D --mode 0644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" + install -D --mode 0644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" # binary install -D --mode 0755 --target-directory "$pkgdir/usr/bin" "$_pkgname-$pkgver/src/$pkgname" + + # extra args + # NOTE: Set restrict file permissions by default to protect optional basic auth credentials + install -D --mode 0600 --target-directory "$pkgdir/etc/conf.d" prometheus-fail2ban-exporter + + # license install -D --mode 0755 --target-directory "$pkgdir/usr/share/licenses/$pkgname" "$_pkgname-$pkgver/LICENSE" } diff --git a/prometheus-fail2ban-exporter b/prometheus-fail2ban-exporter new file mode 100644 index 0000000..555cf8c --- /dev/null +++ b/prometheus-fail2ban-exporter @@ -0,0 +1 @@ +PROMETHEUS_FAIL2BAN_EXPORTER_EXTRA_ARGS="" \ No newline at end of file diff --git a/systemd.service b/systemd.service index b5ea6ef..8c2ddf5 100644 --- a/systemd.service +++ b/systemd.service @@ -4,7 +4,8 @@ Requires=network-online.target After=network-online.target [Service] -ExecStart=/usr/bin/prometheus-fail2ban-exporter +EnvironmentFile=/etc/conf.d/prometheus-fail2ban-exporter +ExecStart=/usr/bin/prometheus-fail2ban-exporter ${PROMETHEUS_FAIL2BAN_EXPORTER_EXTRA_ARGS} ExecReload=/bin/kill -HUP $MAINPID User=root Group=root