From b4a75783befa31d81e17aa3dc09af1e531d92856 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 10 Jul 2026 00:23:17 +0300 Subject: =?UTF-8?q?frontends:=20OpenBSD=20dserver=20=E2=80=94=20absolute?= =?UTF-8?q?=20CacheDir,=20persistent=20host=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The OpenBSD dserver template used relative CacheDir "cache" and HostKeyFile "cache/ssh_host_key", which only worked because rc.d starts the daemon via su -l _dserver (CWD = /var/run/dserver). Any start from another directory broke public key lookup — same bug class dtail commit fec2f9d fixed on the server side. Switch to absolute paths like the FreeBSD/NetBSD templates. OpenBSD /etc/rc wipes /var/run/* at boot, so move the SSH host key to persistent /var/db/dserver/ssh_host_key (mirrors the NetBSD template) — a regenerated host key would break clients' known_hosts. The rc.d rc_pre now also creates /var/db/dserver and re-runs the key-cache helper on every service start, so the volatile cache is repopulated right after a reboot instead of waiting for the daily cron job. Co-Authored-By: Claude Fable 5 --- frontends/etc/dserver/dtail.json.tpl | 4 ++-- frontends/etc/rc.d/dserver.tpl | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/frontends/etc/dserver/dtail.json.tpl b/frontends/etc/dserver/dtail.json.tpl index 6b96fba..634fcca 100644 --- a/frontends/etc/dserver/dtail.json.tpl +++ b/frontends/etc/dserver/dtail.json.tpl @@ -90,7 +90,7 @@ }, "Server": { "SSHBindAddress": "0.0.0.0", - "HostKeyFile": "cache/ssh_host_key", + "HostKeyFile": "/var/db/dserver/ssh_host_key", "HostKeyBits": 2048, "MapreduceLogFormat": "default", "MaxConcurrentCats": 2, @@ -120,7 +120,7 @@ "LogDir": "/var/log/dserver", "Logger": "Fout", "LogRotation": "Daily", - "CacheDir": "cache", + "CacheDir": "/var/run/dserver/cache", "SSHPort": 2222, "LogLevel": "Info" } diff --git a/frontends/etc/rc.d/dserver.tpl b/frontends/etc/rc.d/dserver.tpl index aec80f5..ee250aa 100755 --- a/frontends/etc/rc.d/dserver.tpl +++ b/frontends/etc/rc.d/dserver.tpl @@ -9,8 +9,17 @@ daemon_user="_dserver" rc_reload=NO rc_pre() { + # /var/run is wiped by /etc/rc at boot — recreate the runtime dirs and + # repopulate the SSH key cache on every service start (a daily cron job + # keeps it fresh afterwards). The SSH host key lives in persistent + # /var/db/dserver so it survives reboots (a regenerated host key would + # break clients' known_hosts). install -d -o _dserver /var/log/dserver install -d -o _dserver /var/run/dserver/cache + install -d -o _dserver -m 0700 /var/db/dserver + if [ -x /usr/local/bin/dserver-update-key-cache.sh ]; then + /usr/local/bin/dserver-update-key-cache.sh + fi } rc_cmd $1 & -- cgit v1.2.3