Skip to content

Instantly share code, notes, and snippets.

@LordVeovis
Last active June 11, 2022 22:50
Show Gist options
  • Save LordVeovis/30e5c869125113b3238cdd2f8e06d831 to your computer and use it in GitHub Desktop.
Save LordVeovis/30e5c869125113b3238cdd2f8e06d831 to your computer and use it in GitHub Desktop.
Restore custom config into edgerouter
#!/bin/bash
# to be stored into /config/scripts/post-config.d/10_restore-custom.sh
config_root=/config/user-data/root/
# custom PS1
sed -i -e 's/^PS1=.*$/PS1='"'"'\\[\\033[01;32m\\]\\u@\\h\\[\\033[01;34m\\] \\w \\$\\[\\033[00m\\] '"'"'/' /etc/bash.bashrc
# disable ipv6 on eth2 because I do not use the tunnel from sfr
echo 1 > /proc/sys/net/ipv6/conf/eth2/disable_ipv6
# synchronize the config tree with root
if [ ! -d "$config_root" ]; then
echo "Nothing to sync"
exit 0
fi
find "$config_root" -type f -print | \
while read i;
do
target=$(echo $i | cut -d'/' -f5-)
cp "$i" "/$target"
done
# specific tasks for ipsec
ipsec rereadall
ipsec reload
# specific tasks for unbound
curl "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=unbound&showintro=1&mimetype=plaintext" > /etc/unbound/local-blocking-data.conf
install -d -o unbound -g unbound -m 755 /var/log/unbound
service unbound restart
if [ ! -d /var/run/nsd3 ]; then
install -d -o nsd -g nsd -m 755 /var/run/nsd3
fi
zonec -v
service nsd3 restart
server:
ip-address: ::1@8053
ip-address: 127.0.0.1@8053
hide-version: yes
port: 8053
zone:
name: "home.kveer.fr"
zonefile: "home.kveer.fr.zone"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment