v0.1.0
This commit is contained in:
commit
fa432bebda
189 files changed
+26219
No files matched your search
@@ -0,0 +1,17 @@
|
||||
Package: easydns
|
||||
Version: @VERSION@
|
||||
Architecture: @ARCH@
|
||||
Maintainer: EasyDNS maintainers <maintainers@example.invalid>
|
||||
Installed-Size: @SIZE@
|
||||
Depends: libc6 (>= 2.34), ca-certificates, adduser
|
||||
Section: net
|
||||
Priority: optional
|
||||
Homepage: https://example.invalid/easydns
|
||||
Description: DNS server: primary, secondary, recursive, forwarder, hybrid
|
||||
EasyDNS is an authoritative (primary/secondary with AXFR/IXFR, NOTIFY, TSIG,
|
||||
DNSSEC signing), recursive (iterative, DNSSEC-validating), forwarding and hybrid
|
||||
DNS server with DoT/DoH, REST API and Prometheus metrics.
|
||||
.
|
||||
Includes the EasyDNS Tools: easydig, easyhost, easynslookup, easytrace,
|
||||
easydnssec, easyptr, easyzone, easyconf, easybench, easywhois, easydoh,
|
||||
easydot and easydiff (short names ed, eh, ... are created when free).
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
TOOLS="edns:easydns ed:easydig eh:easyhost ens:easynslookup etrace:easytrace ednssec:easydnssec eptr:easyptr ezone:easyzone econf:easyconf ebench:easybench ewhois:easywhois edoh:easydoh edot:easydot ediff:easydiff"
|
||||
if [ "$1" = "configure" ]; then
|
||||
if ! getent passwd easydns >/dev/null; then
|
||||
adduser --system --group --home /etc/easydns/data --no-create-home --shell /usr/sbin/nologin easydns >/dev/null
|
||||
fi
|
||||
# /etc/easydns: config, zones.d/, keys.d/ (root:easydns, not world-readable – may hold keys)
|
||||
install -d -o root -g easydns -m 0750 /etc/easydns /etc/easydns/zones.d /etc/easydns/keys.d
|
||||
# data_dir: zone files (data/zones/), secondary copies, journals, control token
|
||||
install -d -o easydns -g easydns -m 0750 /etc/easydns/data /etc/easydns/data/zones
|
||||
chgrp easydns /etc/easydns/config.yaml 2>/dev/null || true
|
||||
chmod 0640 /etc/easydns/config.yaml 2>/dev/null || true
|
||||
# Short tool names only when the name is free (e.g. `ed` is often the line editor).
|
||||
for pair in $TOOLS; do
|
||||
s="${pair%%:*}"; l="${pair##*:}"
|
||||
if [ ! -e "/usr/bin/$s" ] && ! command -v "$s" >/dev/null 2>&1; then
|
||||
ln -s "$l" "/usr/bin/$s"
|
||||
fi
|
||||
done
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl daemon-reload >/dev/null || true
|
||||
if [ -n "$2" ] && systemctl is-active --quiet easydns.service; then
|
||||
# Upgrade of a running server: restart only if the new version accepts the
|
||||
# configuration (checked as the service user); otherwise keep the old one running.
|
||||
if command -v runuser >/dev/null 2>&1; then
|
||||
CHECK="runuser -u easydns -- /usr/bin/easydns check-config --config /etc/easydns/config.yaml"
|
||||
else
|
||||
CHECK="/usr/bin/easydns check-config --config /etc/easydns/config.yaml"
|
||||
fi
|
||||
if $CHECK >/tmp/easydns-upgrade-check.log 2>&1; then
|
||||
systemctl restart easydns.service && echo "EasyDNS upgraded from $2 and restarted."
|
||||
rm -f /tmp/easydns-upgrade-check.log
|
||||
else
|
||||
echo "WARNING: the new EasyDNS rejects /etc/easydns/config.yaml; the previous version keeps running."
|
||||
echo " details: /tmp/easydns-upgrade-check.log fix, then: systemctl restart easydns"
|
||||
fi
|
||||
elif [ -z "$2" ]; then
|
||||
echo "EasyDNS installed (hybrid: authoritative + recursive for LAN)."
|
||||
echo " config: /etc/easydns/config.yaml zones: /etc/easydns/data/zones/"
|
||||
echo " new zone: easydns zone create example.com --ns ns1.example.com --ip 192.0.2.1"
|
||||
echo " start: systemctl enable --now easydns then: easydns status"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
TOOLS="edns:easydns ed:easydig eh:easyhost ens:easynslookup etrace:easytrace ednssec:easydnssec eptr:easyptr ezone:easyzone econf:easyconf ebench:easybench ewhois:easywhois edoh:easydoh edot:easydot ediff:easydiff"
|
||||
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
|
||||
# remove only symlinks we created
|
||||
for pair in $TOOLS; do
|
||||
s="${pair%%:*}"; l="${pair##*:}"
|
||||
if [ -L "/usr/bin/$s" ] && [ "$(readlink "/usr/bin/$s")" = "$l" ]; then rm -f "/usr/bin/$s"; fi
|
||||
done
|
||||
fi
|
||||
if [ "$1" = "purge" ]; then
|
||||
# /etc/easydns holds your zone files and keys: never deleted automatically
|
||||
rm -f /etc/easydns/data/control.token
|
||||
echo "EasyDNS purged. /etc/easydns (zones, keys, data) was kept – remove it manually if no longer needed."
|
||||
|
||||
fi
|
||||
[ -d /run/systemd/system ] && systemctl daemon-reload >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ "$1" = "remove" ] && [ -d /run/systemd/system ]; then
|
||||
systemctl stop easydns.service easydns-blocklists.timer >/dev/null 2>&1 || true
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,55 @@
|
||||
# Build .deb and .rpm with nfpm (https://nfpm.goreleaser.com):
|
||||
# ARCH=amd64 VERSION=0.1.0 nfpm pkg -f deploy/packaging/nfpm.yaml -p deb
|
||||
# ARCH=arm64 VERSION=0.1.0 nfpm pkg -f deploy/packaging/nfpm.yaml -p rpm
|
||||
name: easydns
|
||||
arch: "${ARCH}"
|
||||
platform: linux
|
||||
version: "${VERSION}"
|
||||
maintainer: "EasyDNS maintainers"
|
||||
description: |
|
||||
EasyDNS: authoritative (primary/secondary), recursive, forwarding and hybrid DNS
|
||||
server with DoT/DoH, DNSSEC and the EasyDNS Tools (easydig, easyhost, ...).
|
||||
license: MIT
|
||||
contents:
|
||||
- src: target/release/easydns
|
||||
dst: /usr/bin/easydns
|
||||
- src: target/release/easydig
|
||||
dst: /usr/bin/easydig
|
||||
- src: target/release/easyhost
|
||||
dst: /usr/bin/easyhost
|
||||
- src: target/release/easynslookup
|
||||
dst: /usr/bin/easynslookup
|
||||
- src: target/release/easytrace
|
||||
dst: /usr/bin/easytrace
|
||||
- src: target/release/easydnssec
|
||||
dst: /usr/bin/easydnssec
|
||||
- src: target/release/easyptr
|
||||
dst: /usr/bin/easyptr
|
||||
- src: target/release/easyzone
|
||||
dst: /usr/bin/easyzone
|
||||
- src: target/release/easyconf
|
||||
dst: /usr/bin/easyconf
|
||||
- src: target/release/easybench
|
||||
dst: /usr/bin/easybench
|
||||
- src: target/release/easywhois
|
||||
dst: /usr/bin/easywhois
|
||||
- src: target/release/easydoh
|
||||
dst: /usr/bin/easydoh
|
||||
- src: target/release/easydot
|
||||
dst: /usr/bin/easydot
|
||||
- src: target/release/easydiff
|
||||
dst: /usr/bin/easydiff
|
||||
- src: deploy/systemd/easydns.service
|
||||
dst: /usr/lib/systemd/system/easydns.service
|
||||
- src: deploy/systemd/easydns.sysusers
|
||||
dst: /usr/lib/sysusers.d/easydns.conf
|
||||
- src: config/config.yaml
|
||||
dst: /etc/easydns/config.yaml
|
||||
type: config|noreplace
|
||||
- src: config/root.hints
|
||||
dst: /etc/easydns/root.hints
|
||||
type: config|noreplace
|
||||
- src: target/man/easydns.1
|
||||
dst: /usr/share/man/man1/easydns.1
|
||||
scripts:
|
||||
postinstall: deploy/packaging/postinstall.sh
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Create the service user and short tool names when they do not collide.
|
||||
set -e
|
||||
systemd-sysusers /usr/lib/sysusers.d/easydns.conf 2>/dev/null || true
|
||||
mkdir -p /etc/easydns/zones.d /etc/easydns/keys.d /etc/easydns/data/zones
|
||||
chown -R easydns:easydns /etc/easydns/data 2>/dev/null || true
|
||||
chgrp easydns /etc/easydns /etc/easydns/zones.d /etc/easydns/keys.d /etc/easydns/config.yaml 2>/dev/null || true
|
||||
chmod 0750 /etc/easydns /etc/easydns/zones.d /etc/easydns/keys.d /etc/easydns/data 2>/dev/null || true
|
||||
for pair in edns:easydns ed:easydig eh:easyhost ens:easynslookup etrace:easytrace ednssec:easydnssec eptr:easyptr ezone:easyzone econf:easyconf ebench:easybench ewhois:easywhois edoh:easydoh edot:easydot ediff:easydiff; do
|
||||
s="${pair%%:*}"; l="${pair##*:}"
|
||||
if ! command -v "$s" >/dev/null 2>&1; then ln -s "/usr/bin/$l" "/usr/bin/$s"; fi
|
||||
done
|
||||
systemctl daemon-reload 2>/dev/null || true
|
||||
Reference in new issue
Block a user