commit 875485807eb9195ee029ca49d0244db19f28af47 Author: Markus Pesch Date: Tue Jun 13 18:58:53 2023 +0200 Initial Commit diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..2ffdbf6 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = prometheus-x509-certificate-exporter + pkgdesc = metric exporter for x509 certificates + pkgver = 3.6.0 + pkgrel = 1 + url = https://github.com/enix/x509-certificate-exporter + arch = armv7h + arch = aarch64 + arch = x86_64 + license = MIT + makedepends = go + source = https://github.com/enix/x509-certificate-exporter/archive/refs/tags/v3.6.0.zip + source = prometheus-x509-certificate-exporter + source = systemd.service + source = sysusers.conf + sha512sums = 7d8d4e091d37f3cd0bdff42ed62797d8a2d5749ad8b0d01acbb8edc15571d79daf7d08c0d4a7aeb85416fdbd396d98a89b6ddc0bc0fb92f394e6ef21e35eb06b + sha512sums = 681a744d7a7d7825d857b5d14ea19fefe0302de2d98fa76a2442335ecc7cf4cf2dfd03aa8fe9b3356544ef29b0823279a3810c78eabbf8be6c88a0a71f509967 + sha512sums = 5fb623fd40983b1ae9de5a2fe05fe70ece36c8ce6ca80f58dbfdaa160afbaba99efd125f5a6b90e6f0e2d4f3545f1d68a66c67feaac58972bd8d1572cc5c08c7 + sha512sums = 02585897ce834c1f23aa0d0eda61e60d003ae3bf16ff9ec819d029602d5d78c260f8ba3b9e9a6e28c1ebe84e6d7e9aaf3c757db5d8656b9f0bdd9caab6d9f36d + b2sums = fbc8ed61f07fa7c44138ce303f5f73d4ff32e6a71e47e7cae0b7f7d97e9fd02635fd80d59a1d67b5a5de2eefa83693431797c6b519b60cccf87bceb83f7ab751 + b2sums = 3d6adfad59d88ff99b1e4f924651746e62e562fefa0360f02fe1091e920b0bb74e4f54930ff1f863b9004a490e90c78dc92d16ca234b5b536315b7fd45cbf4e4 + b2sums = d94c2a9a9a895be60e3d4d0db08ceb163b27fe12c96c7f1d51497627a4ce4e9d03a0fa434b2aacb232e3dc279d7158238b43ea48c85fe4d82cffd00992c89c66 + b2sums = 6e4ed3697654dbc6cdef10f92dfe324459158769f2287ffd167172f9a5f2fbb3ebaa2e79c5da8ff88950ab9ad0f301d5c348c5d8e872d2efc56530ee1547918e + +pkgname = prometheus-x509-certificate-exporter diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..823aa8f --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +pkg +src +*tar.gz* +*tar.zst* +*.zip diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..61289bf --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,49 @@ +# Maintainer: Markus Pesch + +pkgname=prometheus-x509-certificate-exporter +_pkgname=x509-certificate-exporter +pkgver=3.6.0 +pkgrel=1 +pkgdesc="metric exporter for x509 certificates" +arch=('armv7h' 'aarch64' 'x86_64') +url="https://github.com/enix/$_pkgname" +license=('MIT') +makedepends=('go') +source=( + "$url/archive/refs/tags/v$pkgver.zip" + 'prometheus-x509-certificate-exporter' + 'systemd.service' + 'sysusers.conf' +) +sha512sums=('7d8d4e091d37f3cd0bdff42ed62797d8a2d5749ad8b0d01acbb8edc15571d79daf7d08c0d4a7aeb85416fdbd396d98a89b6ddc0bc0fb92f394e6ef21e35eb06b' + '681a744d7a7d7825d857b5d14ea19fefe0302de2d98fa76a2442335ecc7cf4cf2dfd03aa8fe9b3356544ef29b0823279a3810c78eabbf8be6c88a0a71f509967' + '5fb623fd40983b1ae9de5a2fe05fe70ece36c8ce6ca80f58dbfdaa160afbaba99efd125f5a6b90e6f0e2d4f3545f1d68a66c67feaac58972bd8d1572cc5c08c7' + '02585897ce834c1f23aa0d0eda61e60d003ae3bf16ff9ec819d029602d5d78c260f8ba3b9e9a6e28c1ebe84e6d7e9aaf3c757db5d8656b9f0bdd9caab6d9f36d') +b2sums=('fbc8ed61f07fa7c44138ce303f5f73d4ff32e6a71e47e7cae0b7f7d97e9fd02635fd80d59a1d67b5a5de2eefa83693431797c6b519b60cccf87bceb83f7ab751' + '3d6adfad59d88ff99b1e4f924651746e62e562fefa0360f02fe1091e920b0bb74e4f54930ff1f863b9004a490e90c78dc92d16ca234b5b536315b7fd45cbf4e4' + 'd94c2a9a9a895be60e3d4d0db08ceb163b27fe12c96c7f1d51497627a4ce4e9d03a0fa434b2aacb232e3dc279d7158238b43ea48c85fe4d82cffd00992c89c66' + '6e4ed3697654dbc6cdef10f92dfe324459158769f2287ffd167172f9a5f2fbb3ebaa2e79c5da8ff88950ab9ad0f301d5c348c5d8e872d2efc56530ee1547918e') + +build() { + cd "$_pkgname-$pkgver/cmd/$_pkgname" + go build -v \ + -buildmode=pie \ + -trimpath \ + -o $pkgname . +} + +package() { + # systemd integration + 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/cmd/$_pkgname/$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-x509-certificate-exporter + + # license + install -D --mode 0755 --target-directory "$pkgdir/usr/share/licenses/$pkgname" "$_pkgname-$pkgver/LICENSE" +} diff --git a/prometheus-x509-certificate-exporter b/prometheus-x509-certificate-exporter new file mode 100644 index 0000000..f8e0bc2 --- /dev/null +++ b/prometheus-x509-certificate-exporter @@ -0,0 +1,6 @@ +# F2B_COLLECTOR_SOCKET="" +# F2B_COLLECTOR_TEXT_PATH="" +# F2B_WEB_LISTEN_ADDRESS="" +# F2B_WEB_BASICAUTH_USER="" +# F2B_WEB_BASICAUTH_PASS="" +# F2B_EXIT_ON_SOCKET_CONN_ERROR="" \ No newline at end of file diff --git a/systemd.service b/systemd.service new file mode 100644 index 0000000..6659bbc --- /dev/null +++ b/systemd.service @@ -0,0 +1,18 @@ +[Unit] +Description=Prometheus exporter for x509 certificate metrics +Requires=network-online.target +After=network-online.target + +[Service] +EnvironmentFile=/etc/conf.d/prometheus-x509-certificate-exporter +ExecStart=/usr/bin/prometheus-x509-certificate-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..800ae95 --- /dev/null +++ b/sysusers.conf @@ -0,0 +1 @@ +u prometheus-x509-certificate-exporter - "Prometheus x509 certificate exporter user"