forked from itdoginfo/domain-routing-openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getdomains-uninstall.sh
executable file
·78 lines (58 loc) · 2.93 KB
/
getdomains-uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/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 " |_____| |_____| | |_____| |_____/ | \_ |_____| | "