Skip to content

Instantly share code, notes, and snippets.

View sirkirby's full-sized avatar
:octocat:

Chris Kirby sirkirby

:octocat:
View GitHub Profile
@sirkirby
sirkirby / routr-dispatch-answers.json
Created October 11, 2026 18:22
routr example dispatch response
{
"decision_model": "jev-1.13.0",
"ms": 152,
"headline": "routr: standard, debug work; approach_open, cause_unknown",
"level": "standard",
"sure": true,
"work_type": "debug",
"high_risk": false,
"worker": "worth a worker",
"facts": {
@sirkirby
sirkirby / routr-dispatch.sh
Created October 11, 2026 18:20
routr example dispatch
! routr dispatch "The nightly export job times out on large accounts. Find the cause, fix it, add a regression test, run bun test."
@sirkirby
sirkirby / udm-bgp.conf
Created July 3, 2026 20:19
UDM BGP conf
! Upload via UniFi Network -> Settings -> Routing -> BGP (UniFi OS 4.1.13+)
! UDM-Pro-SE, AS 65000. Peers with both AdGuard hosts; prefers .101.
router bgp 65000
bgp router-id 10.0.0.1
no bgp ebgp-requires-policy
neighbor 10.0.0.101 remote-as 65001
neighbor 10.0.0.102 remote-as 65002
!
address-family ipv4 unicast
neighbor 10.0.0.101 activate
@sirkirby
sirkirby / adguard-frr-secondary.conf
Created July 3, 2026 20:14
adguard frr secondary conf
! /etc/frr/frr.conf on the STANDBY (10.0.0.102, AS 65002)
! Same as the primary, plus an AS-path prepend so the gateway prefers the primary.
frr defaults traditional
hostname adguard-standby
log syslog informational
service integrated-vtysh-config
!
ip prefix-list DNSVIP seq 5 permit 10.0.53.53/32
!
route-map RM-REDIST permit 10
@sirkirby
sirkirby / adguard-frr.conf
Created July 3, 2026 20:13
adguard frr conf
! /etc/frr/frr.conf on the PRIMARY (10.0.0.101, AS 65001)
frr defaults traditional
hostname adguard-primary
log syslog informational
service integrated-vtysh-config
!
ip prefix-list DNSVIP seq 5 permit 10.0.53.53/32
!
route-map RM-REDIST permit 10
match ip address prefix-list DNSVIP
@sirkirby
sirkirby / adguard-cert-deploy.sh
Created July 3, 2026 20:09
adguard cert deploy script
#!/usr/bin/env bash
# acme.sh --reloadcmd on the primary: reload AdGuard here, then push the renewed
# cert+key to the standby and reload AdGuard there, so the standby never goes stale.
set -uo pipefail
SSL_DIR=/opt/AdGuardHome/data/ssl
ADGUARD=/opt/AdGuardHome/AdGuardHome
STANDBY=chris@10.0.0.102
OPTS=(-i /root/.ssh/id_ed25519_adguard_deploy -o BatchMode=yes -o ConnectTimeout=10)
"$ADGUARD" -s restart # primary picks up the freshly installed cert
@sirkirby
sirkirby / acme-tls.yaml
Created July 3, 2026 20:08
acme.sh with cloudflare config
tls:
enabled: true
server_name: adguard.example.com
force_https: true
certificate_path: /opt/AdGuardHome/data/ssl/cert.pem
private_key_path: /opt/AdGuardHome/data/ssl/private.key
@sirkirby
sirkirby / adguardhome-sync.yaml
Created July 3, 2026 20:05
adguardhome-sync config yaml
# ~/.adguardhome-sync.yaml (runs on the replica/standby host)
cron: "*/5 * * * *"
runOnStart: true
origin:
url: https://10.0.0.101
insecureSkipVerify: true
username: admin
password: <redacted>
replica:
url: https://10.0.0.102 # HTTPS on purpose. See the gotcha below.
@sirkirby
sirkirby / adguard-health-check.ini
Created July 3, 2026 20:03
adguard health check systemd
[Unit]
Description=AdGuard DNS anycast VIP health gate
After=network-online.target AdGuardHome.service
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/local/bin/dns-vip-health.sh
# Drop the VIP if the gate stops, so a dead node never keeps advertising.
ExecStopPost=-/usr/sbin/ip addr del 10.0.53.53/32 dev lo
@sirkirby
sirkirby / adguard-frr.sh
Created July 3, 2026 20:00
Adguard FRR setup
#!/usr/bin/env bash
# dns-vip-health.sh
# Bind the DNS anycast VIP to lo ONLY while local AdGuard answers a local rewrite.
# FRR redistributes the connected /32 into BGP, so:
# AdGuard healthy -> VIP on lo -> /32 advertised -> gateway routes here
# AdGuard down -> VIP removed -> /32 withdrawn -> gateway uses the other node
set -u
VIP="10.0.53.53/32"
HEALTH_NAME="dnshealth.home.lab" # a local rewrite -> 127.0.0.1, synced to both boxes