Skip to content

Instantly share code, notes, and snippets.

@x-magic
Created December 29, 2023 02:34
Show Gist options
  • Save x-magic/fb51667b37b44fdb5e2346b9785badee to your computer and use it in GitHub Desktop.
Save x-magic/fb51667b37b44fdb5e2346b9785badee to your computer and use it in GitHub Desktop.
UDM-SE: Boot script to add custom DNS records in dnsmasq
#!/bin/sh
# We'll plug the overriding configurations into /run/dnsmasq.conf.d/
cat > /run/dnsmasq.conf.d/local_custom_dns.conf <<- 'EOF'
# Add an A record to a specific server (i.e. override)
address=/double-click.net/127.0.0.1
# Or a SRV record, if needed
srv-host=_ldap._tcp.example.com,ldapserver.example.com,389
# You can even add MX records as you wish
mx-host=maildomain.com,servermachine.com,50
EOF
# Restart dnsmasq so it sees the new conf file
kill `cat /run/dnsmasq.pid`
@x-magic
Copy link
Author

x-magic commented Dec 29, 2023

Needs this to be bootable. Note unifios-utilities/on-boot-script will install CNI stuff and you may not need them. This can be resolved by creating dummy files:

mkdir -p /data/on_boot.d
cat > /data/on_boot.d/05-install-cni-plugins.sh <<- 'EOF'
	#!/bin/sh
	echo "Skip executing CNI plugins installer..."
EOF
cat > /data/on_boot.d/06-cni-bridge.sh <<- 'EOF'
	#!/bin/sh
	echo "Skip executing CNI bridge installer..."
EOF
chmod +x /data/on_boot.d/05-install-cni-plugins.sh /data/on_boot.d/06-cni-bridge.sh

or simply install the script manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment