From a3a1da54df8614ccb92537552474ebff4c6c4287 Mon Sep 17 00:00:00 2001 From: abrown38 Date: Fri, 9 Oct 2026 09:05:58 +0000 Subject: [PATCH] Add scripts/testenv.sh to set up a test machine On a fresh Debian/Ubuntu machine it installs BIND and the build tools (Go from go.dev), writes a hand-made style configuration with internal and external views, a split-horizon zone (example.com or JARL_TEST_ZONE) and a reverse zone, starts named and prints the steps to install Jarl and adopt the configuration. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 9 ++ docs/development.md | 30 ++++ scripts/testenv.sh | 338 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 377 insertions(+) create mode 100755 scripts/testenv.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 65a7638..80c7653 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ All notable changes to Jarl are documented here. The format follows ## [Unreleased] +### Added + +- `scripts/testenv.sh`: turns a fresh Debian/Ubuntu machine into a test bed. + It installs BIND and the build tools (Go from go.dev), writes a hand-made + style configuration with internal and external views, a split-horizon + zone (`example.com` or `JARL_TEST_ZONE`) and a reverse zone, starts named + and prints the steps to install Jarl and adopt the configuration + (docs/development.md). + ## [0.1.0] - 2026-10-09 The first version. diff --git a/docs/development.md b/docs/development.md index 3fca648..cd2b2c1 100644 --- a/docs/development.md +++ b/docs/development.md @@ -114,6 +114,36 @@ ACME hooks, audit) and checks the answers with `dig`. `KEEP=1` leaves named and jarld running afterwards. The output says where; set `JARL_CLI_CONFIG` to that directory's `cli.yaml` to keep using the CLI against it. +### A test machine + +`scripts/testenv.sh` turns a fresh Debian/Ubuntu VM or container into a +server to try Jarl on, the way a user would. Run it as root from the +repository: + +```sh +sudo scripts/testenv.sh # zone example.com +sudo JARL_TEST_ZONE=lab.test scripts/testenv.sh # another zone +``` + +It installs BIND 9, make, git, curl and Go (from go.dev, at the version in +`go.mod`, unless a new enough one is installed). It then writes a typical +hand-made configuration for Jarl to import: an ACL, options with logging, +an `internal` view (this machine's networks and the private ranges, with +recursion) and an `external` view (everyone else, authoritative only). +The zone is in both views with different answers. There is also a reverse +zone for the machine's /24. The zone files in `/etc/bind/zones` use +comments, `$TTL`, `$ORIGIN`, `$GENERATE`, legacy `type master` and most +record types. The script checks the result with `named-checkconf -z`, +(re)starts named (in the background where there is no systemd), and asks +named a few questions with `dig`. At the end it prints the steps to build +and install the packages, then run `init`, `import` and `adopt`. + +`JARL_TEST_VIEWS=no` leaves out the views, and `JARL_TEST_IP` sets the +machine's address (default: the address of the default route). The old +`/etc/bind` is saved in `/root/bind-before-testenv-