Files
ansible-openwrt-hirkn/getdomains-uninstall.sh
itdoginfo 4a0a38661d Update
2024-10-26 01:08:41 +03:00

79 lines
2.9 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/ash
echo "Выпиливаем скрипты"
/etc/init.d/getdomains disable
rm -rf /etc/init.d/getdomains
rm -f /etc/hotplug.d/iface/30-vpnroute /etc/hotplug.d/net/30-vpnroute
echo "Выпиливаем из crontab"
sed -i '/getdomains start/d' /etc/crontabs/root
echo "Выпиливаем домены"
rm -f /tmp/dnsmasq.d/domains.lst
echo "Чистим firewall, раз раз 🍴"
ipset_id=$(uci show firewall | grep -E '@ipset.*name=.vpn_domains.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$ipset_id" ]; then
while uci -q delete firewall.@ipset[$ipset_id]; do :; done
fi
rule_id=$(uci show firewall | grep -E '@rule.*name=.mark_domains.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$rule_id" ]; then
while uci -q delete firewall.@rule[$rule_id]; do :; done
fi
ipset_id=$(uci show firewall | grep -E '@ipset.*name=.vpn_domains_internal.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$ipset_id" ]; then
while uci -q delete firewall.@ipset[$ipset_id]; do :; done
fi
rule_id=$(uci show firewall | grep -E '@rule.*name=.mark_domains_intenal.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$rule_id" ]; then
while uci -q delete firewall.@rule[$rule_id]; do :; done
fi
ipset_id=$(uci show firewall | grep -E '@ipset.*name=.vpn_subnet.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$ipset_id" ]; then
while uci -q delete firewall.@ipset[$ipset_id]; do :; done
fi
rule_id=$(uci show firewall | grep -E '@rule.*name=.mark_subnet.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$rule_id" ]; then
while uci -q delete firewall.@rule[$rule_id]; do :; done
fi
uci commit firewall
/etc/init.d/firewall restart
echo "Чистим сеть"
sed -i '/99 vpn/d' /etc/iproute2/rt_tables
rule_id=$(uci show network | grep -E '@rule.*name=.mark0x1.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$rule_id" ]; then
while uci -q delete network.@rule[$rule_id]; do :; done
fi
rule_id=$(uci show network | grep -E '@rule.*name=.mark0x2.' | awk -F '[][{}]' '{print $2}' | head -n 1)
if [ ! -z "$rule_id" ]; then
while uci -q delete network.@rule[$rule_id]; do :; done
fi
while uci -q delete network.vpn_route_internal; do :; done
uci commit network
/etc/init.d/network restart
echo "Проверяем Dnsmasq"
if uci show dhcp | grep -q ipset; then
echo "В dnsmasq (/etc/config/dhcp) заданы домены. Нужные из них сохраните, остальные удалите вместе с ipset"
fi
echo "Все туннели, прокси, зоны и forwarding к ним оставляем на месте, они вам не помешают и скорее пригодятся"
echo "Dnscrypt, stubby тоже не трогаем"
echo " ______ _____ _____ _____ ______ _ _ _____ _____"
echo " | ____ | | |_____] | | | \ |____/ | | |_____]"
echo " |_____| |_____| | |_____| |_____/ | \_ |_____| | "