Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Nov 2021 08:41:06 GMT
From:      Philip Paeps <philip@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: c55e63a03550 - 2021Q4 - dns/prometheus-dnssec-exporter: new port
Message-ID:  <202111040841.1A48f6bQ014021@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2021Q4 has been updated by philip:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c55e63a03550cae7ac7bd66f05f886b0d4383282

commit c55e63a03550cae7ac7bd66f05f886b0d4383282
Author:     Philip Paeps <philip@FreeBSD.org>
AuthorDate: 2021-11-02 07:03:51 +0000
Commit:     Philip Paeps <philip@FreeBSD.org>
CommitDate: 2021-11-04 08:40:30 +0000

    dns/prometheus-dnssec-exporter: new port
    
    Check for validity and expiration in DNSSEC signatures and expose
    metrics for Prometheus.
    
    https://github.com/chrj/prometheus-dnssec-exporter
    (cherry picked from commit 1d760bb8fe1c0f024a89b8e3966e3d2bc8722e00)
---
 dns/Makefile                                       |  1 +
 dns/prometheus-dnssec-exporter/Makefile            | 51 ++++++++++++++++++
 dns/prometheus-dnssec-exporter/distinfo            | 33 ++++++++++++
 .../files/dnssec_exporter.in                       | 63 ++++++++++++++++++++++
 dns/prometheus-dnssec-exporter/files/patch-main.go | 11 ++++
 .../files/pkg-message.in                           | 17 ++++++
 dns/prometheus-dnssec-exporter/pkg-descr           |  4 ++
 7 files changed, 180 insertions(+)

diff --git a/dns/Makefile b/dns/Makefile
index 83a25830788b..688e151d3864 100644
--- a/dns/Makefile
+++ b/dns/Makefile
@@ -176,6 +176,7 @@
     SUBDIR += pear-Net_DNS2
     SUBDIR += powerdns
     SUBDIR += powerdns-recursor
+    SUBDIR += prometheus-dnssec-exporter
     SUBDIR += public_suffix_list
     SUBDIR += py-adns
     SUBDIR += py-aiodns
diff --git a/dns/prometheus-dnssec-exporter/Makefile b/dns/prometheus-dnssec-exporter/Makefile
new file mode 100644
index 000000000000..2d71a7d54762
--- /dev/null
+++ b/dns/prometheus-dnssec-exporter/Makefile
@@ -0,0 +1,51 @@
+PORTNAME=		prometheus-dnssec-exporter
+DISTVERSION=		g20181110
+CATEGORIES=		dns
+
+MAINTAINER=		philip@FreeBSD.org
+COMMENT=		DNSSEC exporter for Prometheus
+
+LICENSE=		MIT
+
+USES=			go
+USE_GITHUB=		yes
+USE_RC_SUBR=		dnssec_exporter
+
+GH_ACCOUNT=		chrj
+GH_TAGNAME=		caa7d89
+GH_TUPLE=		beorn7:perks:v1.0.1:perks/vendor/github.com/beorn7/perks \
+			cespare:xxhash:v1.1.0:xxhash/vendor/github.com/cespare/xxhash \
+			cespare:xxhash:v2.1.2:xxhash/vendor/github.com/cespare/xxhash/v2 \
+			golang:crypto:089bfa567519:crypto/vendor/golang.org/x/crypto \
+			golang:net:4a448f8816b3:net/vendor/golang.org/x/net \
+			golang:sys:39c9dd37992c:sys/vendor/golang.org/x/sys \
+			golang:protobuf:v1.5.2:protobuf/vendor/github.com/golang/protobuf \
+			matttproud:golang_protobuf_extensions:v1.0.1:extensions/vendor/github.com/matttproud/golang_protobuf_extensions \
+			miekg:dns:v1.0.12:dns/vendor/github.com/miekg/dns \
+			naoina:go-stringutil:v0.1.0:go_stringutil/vendor/github.com/naoina/go-stringutil \
+			naoina:toml:v0.1.1:toml/vendor/github.com/naoina/toml \
+			prometheus:client_golang:v1.11.0:client_golang/vendor/github.com/prometheus/client_golang \
+			prometheus:client_model:v0.2.0:client_model/vendor/github.com/prometheus/client_model \
+			prometheus:common:v0.32.1:common/vendor/github.com/prometheus/common \
+			prometheus:procfs:v0.7.3:procfs/vendor/github.com/prometheus/procfs \
+			protocolbuffers:protobuf-go:v1.27.1:protocolbuffers_protobuf_go/vendor/google.golang.org/protobuf
+
+GO_PKGNAME=		github.com/${GH_ACCOUNT}/${PORTNAME}
+
+USERS=			nobody
+GROUPS=			nobody
+
+SUB_FILES=		pkg-message
+SUB_LIST=		USERS=${USERS} GROUPS=${GROUPS}
+
+PLIST_FILES=		bin/prometheus-dnssec-exporter \
+			"@sample etc/prometheus-dnssec-checks.sample"
+
+post-patch:
+	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|" ${WRKSRC}/main.go
+
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/config.sample \
+		${STAGEDIR}${PREFIX}/etc/prometheus-dnssec-checks.sample
+
+.include <bsd.port.mk>
diff --git a/dns/prometheus-dnssec-exporter/distinfo b/dns/prometheus-dnssec-exporter/distinfo
new file mode 100644
index 000000000000..fed8a6d05622
--- /dev/null
+++ b/dns/prometheus-dnssec-exporter/distinfo
@@ -0,0 +1,33 @@
+TIMESTAMP = 1635830663
+SHA256 (chrj-prometheus-dnssec-exporter-g20211102-caa7d89_GH0.tar.gz) = f31bae782197c302777757f28993358aec40922ac7c5f7737886a3739c15891a
+SIZE (chrj-prometheus-dnssec-exporter-g20211102-caa7d89_GH0.tar.gz) = 6359
+SHA256 (beorn7-perks-v1.0.1_GH0.tar.gz) = 98db84bb0224a26094e6adba91b7ee7a1a7ace28cb648d818f8e779e6a19f825
+SIZE (beorn7-perks-v1.0.1_GH0.tar.gz) = 10867
+SHA256 (cespare-xxhash-v2.1.2_GH0.tar.gz) = 471399cfcf0b1bd188add8d34435b91e7011cedbfe76e29687803a9d74320352
+SIZE (cespare-xxhash-v2.1.2_GH0.tar.gz) = 11244
+SHA256 (golang-crypto-089bfa567519_GH0.tar.gz) = 2ed1af12d13ad0cfe08ac49d51dfad4b8d7f5e4693fbddfa3ef53bd80c9555ab
+SIZE (golang-crypto-089bfa567519_GH0.tar.gz) = 1734789
+SHA256 (golang-net-4a448f8816b3_GH0.tar.gz) = 83961440fb234cd01f1c1ae945cec6cae35fdab6c7b085820e79ea90926e2a9d
+SIZE (golang-net-4a448f8816b3_GH0.tar.gz) = 1262428
+SHA256 (golang-sys-39c9dd37992c_GH0.tar.gz) = e6a83d750fadf594d79e4656aa27226b8bd97c55d227b4162995c598a21ff284
+SIZE (golang-sys-39c9dd37992c_GH0.tar.gz) = 1222118
+SHA256 (golang-protobuf-v1.5.2_GH0.tar.gz) = 088cc0f3ba18fb8f9d00319568ff0af5a06d8925a6e6cb983bb837b4efb703b3
+SIZE (golang-protobuf-v1.5.2_GH0.tar.gz) = 171702
+SHA256 (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 2def0ee6f6b12b1efc0e3007d89f598608a072610e805c3655ea9d13c3ead49b
+SIZE (matttproud-golang_protobuf_extensions-v1.0.1_GH0.tar.gz) = 37184
+SHA256 (miekg-dns-v1.0.12_GH0.tar.gz) = d58efc343a82d27938d9976e8d922229be264e6260a68da65e6fb4973cb41362
+SIZE (miekg-dns-v1.0.12_GH0.tar.gz) = 1315036
+SHA256 (naoina-go-stringutil-v0.1.0_GH0.tar.gz) = 0d9d4e4d8d1112e7ac7a5ea6089bdf18585a22274802bcac6ef5f02aa2c43edc
+SIZE (naoina-go-stringutil-v0.1.0_GH0.tar.gz) = 6136
+SHA256 (naoina-toml-v0.1.1_GH0.tar.gz) = 5f0875fb6eb8ed9683f925329c05cdbaa809a1ec9b676c43ea14899c25462fee
+SIZE (naoina-toml-v0.1.1_GH0.tar.gz) = 41259
+SHA256 (prometheus-client_golang-v1.11.0_GH0.tar.gz) = a3bc3312bde4182e507042ca0e7ca88aac6656bbf8d516d732e34c3f14bb612a
+SIZE (prometheus-client_golang-v1.11.0_GH0.tar.gz) = 168706
+SHA256 (prometheus-client_model-v0.2.0_GH0.tar.gz) = 4ab1be9cdfa702d7f49beeb09a256bcc6a2aad55e8a0a37e7732a46934264e12
+SIZE (prometheus-client_model-v0.2.0_GH0.tar.gz) = 10986
+SHA256 (prometheus-common-v0.32.1_GH0.tar.gz) = de06f354e24dec3bfeba9a3bd43bd3170b4231dfff3cd338b688a6e8c8050af6
+SIZE (prometheus-common-v0.32.1_GH0.tar.gz) = 146585
+SHA256 (prometheus-procfs-v0.7.3_GH0.tar.gz) = 5514e8b18c38b6376a84c623d59735d4eefb61fb3a14eb1f45e0a4c848f14a2b
+SIZE (prometheus-procfs-v0.7.3_GH0.tar.gz) = 178957
+SHA256 (protocolbuffers-protobuf-go-v1.27.1_GH0.tar.gz) = 3ec41a8324431e72f85e0dc0c2c098cc14c3cb1ee8820996c8f46afca2d65609
+SIZE (protocolbuffers-protobuf-go-v1.27.1_GH0.tar.gz) = 1278521
diff --git a/dns/prometheus-dnssec-exporter/files/dnssec_exporter.in b/dns/prometheus-dnssec-exporter/files/dnssec_exporter.in
new file mode 100644
index 000000000000..38c5d9a84034
--- /dev/null
+++ b/dns/prometheus-dnssec-exporter/files/dnssec_exporter.in
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# PROVIDE: dnssec_exporter
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# dnssec_exporter_enable (bool):	Set to NO by default
+#					Set it to YES to enable	prometheus-dnssec-exporter
+# dnssec_exporter_user (string):	Set user to run dnssec_exporter
+#					Default is "%%USERS%%"
+# dnssec_exporter_group (string):	Set group to run prometheus-dnssec-exporter
+#					Default is "%%GROUPS%%"
+# dnssec_exporter_log_file (string):	Set file that prometheus-dnssec-exporter will log to
+#					Default is "/var/log/dnssec_exporter.log"
+# dnssec_exporter_resolvers (string): 	Set resolvers to use (comma separated)
+#					Default is "9.9.9.9:53"
+# dnssec_exporter_timeout (string): 	Set timeout for network operations
+#					Default is 10s
+# dnssec_exporter_bind (string): 	Set address to listen on
+#					Default is localhost:9204
+# dnssec_exporter_args (string):	Set additional command line arguments
+#					Default is ""
+
+. /etc/rc.subr
+
+name=dnssec_exporter
+rcvar=dnssec_exporter_enable
+
+load_rc_config $name
+
+: ${dnssec_exporter_enable:=NO}
+: ${dnssec_exporter_user:=%%USERS%%}
+: ${dnssec_exporter_group:=%%GROUPS%%}
+: ${dnssec_exporter_bind="localhost:9204"}
+: ${dnssec_exporter_resolvers="9.9.9.9:53"}
+: ${dnssec_exporter_timeout="10s"}
+: ${dnssec_exporter_log_file=/var/log/dnssec_exporter.log}
+
+pidfile=/var/run/dnssec_exporter.pid
+command=/usr/sbin/daemon
+procname="%%PREFIX%%/bin/prometheus-dnssec-exporter"
+command_args="-p ${pidfile} /usr/bin/env ${procname} \
+				-listen-address ${dnssec_exporter_bind} \
+				-resolvers ${dnssec_exporter_resolvers} \
+				-timeout ${dnssec_exporter_timeout} \
+                                ${dnssec_exporter_args} > ${dnssec_exporter_log_file} 2>&1"
+
+start_precmd=dnssec_exporter_startprecmd
+
+dnssec_exporter_startprecmd()
+{
+        if [ ! -e ${pidfile} ]; then
+                install -o ${dnssec_exporter_user} -g ${dnssec_exporter_group} /dev/null ${pidfile};
+        fi
+        if [ ! -f "${dnssec_exporter_log_file}" ]; then
+                install -o ${dnssec_exporter_user} -g ${dnssec_exporter_group} -m 640 /dev/null ${dnssec_exporter_log_file};
+        fi
+}
+
+run_rc_command "$1"
diff --git a/dns/prometheus-dnssec-exporter/files/patch-main.go b/dns/prometheus-dnssec-exporter/files/patch-main.go
new file mode 100644
index 000000000000..ac59d3105a65
--- /dev/null
+++ b/dns/prometheus-dnssec-exporter/files/patch-main.go
@@ -0,0 +1,11 @@
+--- main.go.orig	2021-11-02 05:13:52 UTC
++++ main.go
+@@ -17,7 +17,7 @@ import (
+ )
+ 
+ var addr = flag.String("listen-address", ":9204", "Prometheus metrics port")
+-var conf = flag.String("config", "/etc/dnssec-checks", "Configuration file")
++var conf = flag.String("config", "%%PREFIX%%/etc/prometheus-dnssec-checks", "Configuration file")
+ var resolvers = flag.String("resolvers", "8.8.8.8:53,1.1.1.1:53", "Resolvers to use (comma separated)")
+ var timeout = flag.Duration("timeout", 10*time.Second, "Timeout for network operations")
+ 
diff --git a/dns/prometheus-dnssec-exporter/files/pkg-message.in b/dns/prometheus-dnssec-exporter/files/pkg-message.in
new file mode 100644
index 000000000000..cf3f16683af0
--- /dev/null
+++ b/dns/prometheus-dnssec-exporter/files/pkg-message.in
@@ -0,0 +1,17 @@
+[
+{ type: install
+  message: <<EOM
+A default configuration file has been installed in
+%%PREFIX%%/etc/prometheus-dnssec-checks.sample
+
+You can use the included rc script to start the exporter
+as a daemon:
+
+# sysrc dnssec_exporter_enable=YES # or edit /etc/rc.conf manually
+# service dnssec_exporter start
+
+The default configuration will bind the exporter to localhost
+on port 9204.
+EOM
+}
+]
diff --git a/dns/prometheus-dnssec-exporter/pkg-descr b/dns/prometheus-dnssec-exporter/pkg-descr
new file mode 100644
index 000000000000..a453dac4015d
--- /dev/null
+++ b/dns/prometheus-dnssec-exporter/pkg-descr
@@ -0,0 +1,4 @@
+Check for validity and expiration in DNSSEC signatures
+and expose metrics for Prometheus
+
+WWW: https://github.com/chrj/prometheus-dnssec-exporter



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111040841.1A48f6bQ014021>