Skip to content

Instantly share code, notes, and snippets.

@tete2soja
Created December 13, 2021 11:41
Show Gist options
  • Save tete2soja/93b14a231d390393f2af9d9fe8cb9cb4 to your computer and use it in GitHub Desktop.
Save tete2soja/93b14a231d390393f2af9d9fe8cb9cb4 to your computer and use it in GitHub Desktop.
valetudo_rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
### VALETUDO RC.LOCAL INIT ###
###########################################################
### VALETUDO RC.LOCAL
###########################################################
#
# Add to /etc/rc.local before the "" command
iptables -F OUTPUT
ip6tables -F OUTPUT
iptables -t nat -F OUTPUT
iptables -t nat -A OUTPUT -p tcp --dport 80 -d 203.0.113.1 -j DNAT --to-destination 127.0.0.1:8053
iptables -t nat -A OUTPUT -p udp --dport 8053 -d 203.0.113.1 -j DNAT --to-destination 127.0.0.1:8053
iptables -A OUTPUT -d 203.0.113.1/32 -j REJECT
ip6tables -A OUTPUT -d 2001:db8::1/128 -j REJECT
ip route add 203.0.113.1 via 127.0.0.1
### VALETUDO RC.LOCAL EXIT ###
### DNS CATCHER INIT ###
iptables -t nat -A OUTPUT -p udp -m owner ! --uid-owner nobody --dport 53 -j DNAT --to 127.0.0.1:55553
iptables -t nat -A OUTPUT -p tcp -m owner ! --uid-owner nobody --dport 53 -j DNAT --to 127.0.0.1:55553
### DNS CATCHER END ###
/root/run_once.sh
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment