diff --git a/dns/Makefile b/dns/Makefile index 190723bd4586..afb718d62c0f 100644 --- a/dns/Makefile +++ b/dns/Makefile @@ -1,253 +1,254 @@ COMMENT = Domain Name Service tools SUBDIR += aardvark-dns SUBDIR += acme-dns SUBDIR += adns SUBDIR += amass SUBDIR += axfr2acl SUBDIR += bind-tools SUBDIR += bind9-devel SUBDIR += bind918 SUBDIR += bind920 SUBDIR += bindgraph SUBDIR += blocky SUBDIR += c-ares SUBDIR += cascade SUBDIR += cli53 SUBDIR += coredns SUBDIR += ddclient SUBDIR += ddns SUBDIR += denominator SUBDIR += dhisd SUBDIR += dlint SUBDIR += dns-blackhole SUBDIR += dns-ui SUBDIR += dns2blackhole SUBDIR += dns2tcp SUBDIR += dnsblast SUBDIR += dnscap SUBDIR += dnscontrol SUBDIR += dnscrypt-proxy2 SUBDIR += dnscrypt-wrapper SUBDIR += dnsdbck SUBDIR += dnsdbflex SUBDIR += dnsdbq SUBDIR += dnsdist SUBDIR += dnsenum SUBDIR += dnsflood SUBDIR += dnshistory SUBDIR += dnsjava SUBDIR += dnsjit SUBDIR += dnsmasq SUBDIR += dnsmasq-devel SUBDIR += dnsmax-perl SUBDIR += dnsperf SUBDIR += dnsproxy SUBDIR += dnsrecon SUBDIR += dnsreflector SUBDIR += dnssec-rr SUBDIR += dnst SUBDIR += dnstable SUBDIR += dnstable-convert SUBDIR += dnstop SUBDIR += dnstracer SUBDIR += dnstracer-rs SUBDIR += dnsutl SUBDIR += dnsviz SUBDIR += dnswalk SUBDIR += dnswall SUBDIR += dnsx SUBDIR += doc SUBDIR += dog SUBDIR += doggo SUBDIR += doh-proxy SUBDIR += dq SUBDIR += drool SUBDIR += dsc SUBDIR += dynip SUBDIR += encrypted-dns-server SUBDIR += fastresolve SUBDIR += flamethrower SUBDIR += gdnsd2 SUBDIR += gdnsd3 SUBDIR += gen6dns SUBDIR += getdns SUBDIR += godns SUBDIR += hesiod SUBDIR += hetzner_ddns SUBDIR += hostdb SUBDIR += https_dns_proxy SUBDIR += idnkit SUBDIR += idnkit2 SUBDIR += inadyn SUBDIR += ipcheck SUBDIR += kadnode SUBDIR += kf5-kdnssd SUBDIR += kf6-kdnssd SUBDIR += knock SUBDIR += knot-resolver SUBDIR += knot3 SUBDIR += ldapdns SUBDIR += ldns SUBDIR += letsdns SUBDIR += libbind SUBDIR += libidn SUBDIR += libidn2 SUBDIR += libmicrodns SUBDIR += libnspsl SUBDIR += libpsl SUBDIR += linux-c7-libasyncns SUBDIR += linux-rl9-libasyncns SUBDIR += lua-resty-dns SUBDIR += luaunbound SUBDIR += mDNSResponder_nss SUBDIR += maradns SUBDIR += mdnsd SUBDIR += mosdns SUBDIR += namesilo_ddns SUBDIR += nextdns SUBDIR += noip SUBDIR += nsd SUBDIR += nslint SUBDIR += nsnotifyd SUBDIR += nsping SUBDIR += nss_mdns SUBDIR += nss_resinit SUBDIR += opendnssec2 SUBDIR += openresolv SUBDIR += p5-AnyEvent-CacheDNS SUBDIR += p5-AnyEvent-DNS-EtcHosts SUBDIR += p5-App-DSC-DataTool SUBDIR += p5-BIND-Conf_Parser SUBDIR += p5-BIND-Config-Parser SUBDIR += p5-DNS-Config SUBDIR += p5-DNS-EasyDNS SUBDIR += p5-DNS-Ldns SUBDIR += p5-DNS-Zone SUBDIR += p5-DNS-ZoneParse SUBDIR += p5-DNS-nsdiff SUBDIR += p5-Data-Validate-Domain SUBDIR += p5-IO-Async-Resolver-DNS SUBDIR += p5-Mozilla-PublicSuffix SUBDIR += p5-Net-Amazon-Route53 SUBDIR += p5-Net-Bonjour SUBDIR += p5-Net-DNS SUBDIR += p5-Net-DNS-Async SUBDIR += p5-Net-DNS-Check SUBDIR += p5-Net-DNS-Codes SUBDIR += p5-Net-DNS-Lite SUBDIR += p5-Net-DNS-Match SUBDIR += p5-Net-DNS-Paranoid SUBDIR += p5-Net-DNS-RR-SRV-Helper SUBDIR += p5-Net-DNS-Resolver-Mock SUBDIR += p5-Net-DNS-Resolver-Programmable SUBDIR += p5-Net-DNS-SEC SUBDIR += p5-Net-DNS-TestNS SUBDIR += p5-Net-DNS-ToolKit SUBDIR += p5-Net-DNS-Zone-Parser SUBDIR += p5-Net-DNS-ZoneFile-Fast SUBDIR += p5-Net-DNSBL-MultiDaemon SUBDIR += p5-Net-DNSBL-Statistics SUBDIR += p5-Net-DRI SUBDIR += p5-Net-Domain-ExpireDate SUBDIR += p5-Net-Domain-TLD SUBDIR += p5-Net-LibIDN SUBDIR += p5-Net-LibIDN2 SUBDIR += p5-Net-Nslookup SUBDIR += p5-Net-RBLClient SUBDIR += p5-Net-RNDC SUBDIR += p5-POE-Component-Client-DNS SUBDIR += p5-POE-Component-Client-DNS-Recursive SUBDIR += p5-POE-Component-Client-DNSBL SUBDIR += p5-POE-Component-Resolver SUBDIR += p5-POE-Component-Server-DNS SUBDIR += p5-POE-Filter-DNS-TCP SUBDIR += p5-Tie-DNS SUBDIR += p5-URBL-Prepare SUBDIR += p5-Zonemaster-Backend SUBDIR += p5-Zonemaster-CLI SUBDIR += p5-Zonemaster-Engine SUBDIR += p5-Zonemaster-LDNS SUBDIR += packetq SUBDIR += pdnsd SUBDIR += pear-File_DNS SUBDIR += pear-Horde_Idna SUBDIR += pear-Net_DNS2 SUBDIR += pear-Net_DNS21 SUBDIR += powerdns SUBDIR += powerdns-recursor SUBDIR += prometheus-dnssec-exporter SUBDIR += public_suffix_list SUBDIR += py-adns SUBDIR += py-aiodns SUBDIR += py-cloudflare SUBDIR += py-dns-crawler SUBDIR += py-dns-lexicon SUBDIR += py-dnslib SUBDIR += py-dnspython SUBDIR += py-dnspython1 SUBDIR += py-easyzone SUBDIR += py-idna SUBDIR += py-ldns SUBDIR += py-libknot SUBDIR += py-localzone SUBDIR += py-ns1-python SUBDIR += py-publicsuffix SUBDIR += py-publicsuffix2 SUBDIR += py-publicsuffixlist SUBDIR += py-py3dns SUBDIR += py-pybonjour SUBDIR += py-pycares SUBDIR += py-pydnstable SUBDIR += py-pywdns SUBDIR += py-tld SUBDIR += py-tldextract SUBDIR += q-dns SUBDIR += qmdnsengine SUBDIR += radns SUBDIR += rbldnsd SUBDIR += rbllookup SUBDIR += rbllookup-ng SUBDIR += rdap + SUBDIR += register-dnsclient SUBDIR += renewck SUBDIR += rpsl2acl SUBDIR += rubygem-dnsruby SUBDIR += rubygem-gitlab-net-dns SUBDIR += rubygem-google-apis-dns_v1 SUBDIR += rubygem-google-apis-dns_v1-gitlab SUBDIR += rubygem-google-cloud-dns SUBDIR += rubygem-idn-ruby SUBDIR += rubygem-net-dns SUBDIR += rubygem-public_suffix SUBDIR += rubygem-public_suffix_service SUBDIR += rubygem-resolv SUBDIR += rubygem-resolv-replace SUBDIR += rubygem-simpleidn SUBDIR += rubygem-simpleidn02 SUBDIR += rubygem-validates_hostname SUBDIR += rubygem-validates_hostname-gitlab SUBDIR += rubygem-zonefile SUBDIR += samba-nsupdate SUBDIR += scavenge SUBDIR += sleuth SUBDIR += subfinder SUBDIR += tldx SUBDIR += totd SUBDIR += udns SUBDIR += unbound SUBDIR += utdns SUBDIR += vhostcname SUBDIR += vizone SUBDIR += void-zones-tools SUBDIR += walker SUBDIR += wdns SUBDIR += whoseip SUBDIR += wrapsrv SUBDIR += yadifa SUBDIR += yandex-ddns SUBDIR += zdns SUBDIR += zkt SUBDIR += zns SUBDIR += zonenotify .include diff --git a/dns/register-dnsclient/Makefile b/dns/register-dnsclient/Makefile new file mode 100644 index 000000000000..fec4660ba51a --- /dev/null +++ b/dns/register-dnsclient/Makefile @@ -0,0 +1,35 @@ +PORTNAME= register-dnsclient +PORTVERSION= 20260101 +CATEGORIES= dns +DISTFILES= + +MAINTAINER= michaelo@FreeBSD.org +COMMENT= Dynamically register hostnames with a DNS server using GSS-TSIG + +LICENSE= APACHE20 + +RUN_DEPENDS= nsupdate:dns/bind-tools + +NO_ARCH= yes +NO_BUILD= yes + +SUB_FILES= crontab pkg-install ${PORTNAME} +SUB_LIST= PORTNAME=${PORTNAME} GSSAPIBASE=${GSSAPIBASEDIR} + +PLIST_SUB= PORTNAME=${PORTNAME} + +OPTIONS_DEFAULT= GSSAPI_BASE +OPTIONS_SINGLE= GSSAPI +OPTIONS_SINGLE_GSSAPI= GSSAPI_BASE GSSAPI_HEIMDAL GSSAPI_MIT + +GSSAPI_BASE_USES= gssapi +GSSAPI_HEIMDAL_USES= gssapi:heimdal +GSSAPI_MIT_USES= gssapi:mit + +do-install: + @${MKDIR} ${STAGEDIR}${PREFIX}/etc/cron.d + ${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/sbin + ${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.nsupdate.sample ${STAGEDIR}${PREFIX}/etc + ${INSTALL_DATA} ${WRKDIR}/crontab ${STAGEDIR}${PREFIX}/etc/cron.d/${PORTNAME} + +.include diff --git a/dns/register-dnsclient/files/crontab.in b/dns/register-dnsclient/files/crontab.in new file mode 100644 index 000000000000..410e7f8e30b2 --- /dev/null +++ b/dns/register-dnsclient/files/crontab.in @@ -0,0 +1 @@ +@daily root %%LOCALBASE%%/sbin/%%PORTNAME%% diff --git a/dns/register-dnsclient/files/pkg-install.in b/dns/register-dnsclient/files/pkg-install.in new file mode 100644 index 000000000000..5a7956ec7d1a --- /dev/null +++ b/dns/register-dnsclient/files/pkg-install.in @@ -0,0 +1,21 @@ +#!/bin/sh + +PREFIX=${PKG_PREFIX:-%%LOCALBASE%%} + +err() { + echo "$@" >&2 + exit 1 +} + +case $2 in + POST-INSTALL) + DOMAIN=$(hostname -d) + HOSTNAME=$(hostname -f) + PRIMARY_IF=$(route -n get default | awk '/interface:/{print $2}') + [ -z "$PRIMARY_IF" ] && err "Could not determine primary interface (no default route)" + PRIMARY_IP=$(ifconfig "$PRIMARY_IF" inet | awk '/inet /{print $2; exit}') + [ -z "$PRIMARY_IP" ] && err "No IPv4 address found on $PRIMARY_IF" + echo "Updating $PREFIX/etc/%%PORTNAME%%.nsupdate with your hostname ($HOSTNAME) and primary IPv4 address ($PRIMARY_IP)" + sed -i "" -e "s#%%ZONE%%#$DOMAIN#" -e "s#%%HOSTNAME%%#$HOSTNAME#" -e "s#%%PRIMARY_IP%%#$PRIMARY_IP#" $PREFIX/etc/%%PORTNAME%%.nsupdate + ;; +esac diff --git a/dns/register-dnsclient/files/register-dnsclient.in b/dns/register-dnsclient/files/register-dnsclient.in new file mode 100644 index 000000000000..af2674d3aaef --- /dev/null +++ b/dns/register-dnsclient/files/register-dnsclient.in @@ -0,0 +1,64 @@ +#!/bin/sh +# %%PORTNAME%% + +name=$(basename $0) + +if [ ! -t 1 ] +then + tmp_output="$(mktemp /tmp/$name.XXXXXXXXXX)" + exec 3>&1 4>&2 + exec > $tmp_output 2>&1 +fi + +clean_exit() { + local rc=$1 + + if [ ! -t 1 ] + then + exec 1>&3 3>&- + exec 2>&4 4>&- + if [ $rc -ne 0 ] + then + [ -s $tmp_output ] && cat $tmp_output + cp /dev/null $tmp_output + rm -f $tmp_output + exit $rc + fi + cp /dev/null $tmp_output + rm -f $tmp_output + exit $rc + else + exit $rc + fi +} + +export KRB5CCNAME=/tmp/krb5cc_$name +KRB5_CLIENT_PRINCIPAL="$(hostname -s)\$" + +%%GSSAPIBASE%%/bin/kinit -k $KRB5_CLIENT_PRINCIPAL +rc=$? +if [ $rc -ne 0 ] +then + KRB5_CLIENT_PRINCIPAL="$(hostname -s | tr \"[:lower:]\" \"[:upper:]\")\$" + >&2 echo "$name: retrying with $KRB5_CLIENT_PRINCIPAL" + %%GSSAPIBASE%%/bin/kinit -k $KRB5_CLIENT_PRINCIPAL + rc=$? + if [ $rc -ne 0 ] + then + >&2 echo "$name: kinit failed" + rc=1 + fi +fi + +[ $rc -ne 0 ] && clean_exit $rc + +%%LOCALBASE%%/bin/nsupdate -g %%LOCALBASE%%/etc/$name.nsupdate +rc=$? +if [ $rc -ne 0 ] +then + >&2 echo "$name: nsupdate failed" + rc=2 +fi + +clean_exit $rc + diff --git a/dns/register-dnsclient/files/register-dnsclient.nsupdate.sample b/dns/register-dnsclient/files/register-dnsclient.nsupdate.sample new file mode 100644 index 000000000000..2ba397ac9f4b --- /dev/null +++ b/dns/register-dnsclient/files/register-dnsclient.nsupdate.sample @@ -0,0 +1,5 @@ +zone %%ZONE%% +update delete %%HOSTNAME%%. A +update add %%HOSTNAME%%. 3600 A %%PRIMARY_IP%% +send + diff --git a/dns/register-dnsclient/pkg-descr b/dns/register-dnsclient/pkg-descr new file mode 100644 index 000000000000..cde890534085 --- /dev/null +++ b/dns/register-dnsclient/pkg-descr @@ -0,0 +1,2 @@ +Dynamically register hostnames with a DNS server like Active Directory DNS +using GSS-TSIG. diff --git a/dns/register-dnsclient/pkg-plist b/dns/register-dnsclient/pkg-plist new file mode 100644 index 000000000000..94624321430d --- /dev/null +++ b/dns/register-dnsclient/pkg-plist @@ -0,0 +1,3 @@ +sbin/%%PORTNAME%% +@sample etc/%%PORTNAME%%.nsupdate.sample +etc/cron.d/%%PORTNAME%%