Skip to content

Commit 1bfac74

Browse files
committed
Add SlowDNS support with installation and management scripts
1 parent 281a6b5 commit 1bfac74

8 files changed

Lines changed: 963 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
- **Automated Installation**: One-command setup for all dependencies and configurations.
4747
- **SSH & WebSocket Management**: Create, renew, lock/unlock, and delete SSH accounts with WebSocket and SSL support.
48+
- **SlowDNS Support**: DNS tunneling for SSH connections, perfect for bypassing network restrictions.
4849
- **Service Control**: Start, stop, and restart core services (SSH, Nginx, Dropbear, Stunnel, WebSocket Proxy, etc.).
4950
- **Domain & SSL Automation**: Easily set or change your VPS domain and auto-issue SSL certificates.
5051
- **System Information**: View detailed system, network, and service status.
@@ -92,6 +93,7 @@ asx
9293
- Create, delete, renew, lock/unlock SSH accounts
9394
- Edit SSH banner and HTTP 101 response
9495
- Change domain and auto-issue SSL
96+
- Setup and manage SlowDNS (DNS tunneling)
9597
- Manage services (start/stop/restart)
9698
- View system information
9799

bin/dns-server

4.54 MB
Binary file not shown.

install.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ apply_firewall_rules() {
275275
install_scripts() {
276276
log_info "Installing scripts..."
277277
declare -A script_dirs=(
278-
[menu]="menu.sh"
278+
[menu]="menu.sh slowdns-menu.sh"
279279
[ssh]="create-account.sh delete-account.sh edit-banner.sh edit-response.sh lock-unlock.sh renew-account.sh"
280-
[system]="change-domain.sh manage-services.sh system-info.sh clean-expired-accounts.sh"
280+
[system]="change-domain.sh manage-services.sh system-info.sh clean-expired-accounts.sh setup-slowdns.sh slowdns-status.sh help.sh"
281281
)
282282
for dir in "${!script_dirs[@]}"; do
283283
for s in ${script_dirs[$dir]}; do
@@ -286,6 +286,11 @@ install_scripts() {
286286
chmod +x "/usr/bin/$base"
287287
done
288288
done
289+
290+
# Install uninstall script to AutoScriptX directory
291+
wget -qO /etc/AutoScriptX/uninstall.sh "$BASE_URL/uninstall.sh" > /dev/null 2>&1 || log_warning "Failed to download uninstall.sh."
292+
chmod +x /etc/AutoScriptX/uninstall.sh
293+
289294
log_success "Scripts installed."
290295
}
291296

scripts/menu/menu.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ opt=$(gum choose --limit=1 --header " Choose" \
4141
"7. Change Domain" \
4242
"8. Manage Services" \
4343
"9. System Info" \
44-
"x. Exit")
44+
"x. Exit" \
45+
"10. SlowDNS Menu" \
46+
"11. X-UI Menu" \
47+
"12. Uninstall" \
48+
"xx. Exit")
4549

4650
clear
4751
case "$opt" in
@@ -55,4 +59,9 @@ case "$opt" in
5559
"8. Manage Services") manage-services ;;
5660
"9. System Info") system-info ;;
5761
"x. Exit") exit ;;
62+
"10. SlowDNS Menu") slowdns-menu ;;
63+
"11. X-UI Menu") xui-menu ;;
64+
"12. Uninstall")
65+
gum confirm "Are you sure you want to uninstall AutoScriptX? This action cannot be undone." && bash /etc/AutoScriptX/uninstall.sh ;;
66+
"xx. Exit") exit ;;
5867
esac

scripts/menu/slowdns-menu.sh

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
#!/bin/bash
2+
3+
green="\033[0;32m"
4+
blue="\033[0;34m"
5+
red="\033[0;31m"
6+
yellow="\033[1;33m"
7+
nc="\033[0m"
8+
9+
check_slowdns_status() {
10+
if [ -d "/etc/slowdns" ] && [ -f "/etc/systemd/system/server-sldns.service" ]; then
11+
return 0
12+
else
13+
return 1
14+
fi
15+
}
16+
17+
get_service_status() {
18+
local server_status="STOPPED"
19+
20+
if systemctl is-active --quiet server-sldns 2>/dev/null; then
21+
server_status="RUNNING"
22+
fi
23+
24+
echo "$server_status"
25+
}
26+
27+
main_slowdns_menu() {
28+
while true; do
29+
clear
30+
31+
if check_slowdns_status; then
32+
installation_status="Installed"
33+
server_status=$(get_service_status)
34+
else
35+
installation_status="Not Installed"
36+
server_status="N/A"
37+
fi
38+
39+
if [ -f "/root/nsdomain" ]; then
40+
nameserver=$(cat /root/nsdomain)
41+
else
42+
nameserver="Not configured"
43+
fi
44+
45+
if [ -f "/etc/AutoScriptX/slowdns-domain" ]; then
46+
subdomain=$(cat /etc/AutoScriptX/slowdns-domain)
47+
else
48+
subdomain="Not configured"
49+
fi
50+
51+
gum format --theme dracula <<EOF
52+
53+
# 🌐 SlowDNS Server Management Center
54+
55+
- **Installation** : $installation_status
56+
- **Server Service** : $server_status
57+
- **Nameserver** : $nameserver
58+
- **Subdomain** : $subdomain
59+
60+
## 🚀 SlowDNS Server Menu
61+
EOF
62+
63+
if check_slowdns_status; then
64+
opt=$(gum choose --limit=1 --header " Choose Option" \
65+
"1. View Server Status & Configuration" \
66+
"2. Start SlowDNS Server" \
67+
"3. Stop SlowDNS Server" \
68+
"4. Restart SlowDNS Server" \
69+
"5. View Server Logs" \
70+
"6. Reinstall SlowDNS Server" \
71+
"7. Uninstall SlowDNS Server" \
72+
"←. Back to Main Menu")
73+
else
74+
opt=$(gum choose --limit=1 --header " Choose Option" \
75+
"1. Install SlowDNS Server" \
76+
"←. Back to Main Menu")
77+
fi
78+
79+
clear
80+
case "$opt" in
81+
"1. View Server Status & Configuration")
82+
if check_slowdns_status; then
83+
slowdns-status
84+
else
85+
echo -e "${red}SlowDNS Server is not installed.${nc}"
86+
echo "Please install SlowDNS Server first."
87+
fi
88+
echo ""
89+
read -p "Press Enter to continue..."
90+
;;
91+
"1. Install SlowDNS Server")
92+
setup-slowdns
93+
echo ""
94+
read -p "Press Enter to continue..."
95+
;;
96+
"2. Start SlowDNS Server")
97+
echo -e "${blue}[ Info ]${nc} Starting SlowDNS server..."
98+
systemctl start server-sldns
99+
sleep 2
100+
if systemctl is-active --quiet server-sldns; then
101+
echo -e "${green}[ Success ]${nc} SlowDNS server started successfully."
102+
else
103+
echo -e "${red}[ Error ]${nc} Failed to start SlowDNS server."
104+
fi
105+
echo ""
106+
read -p "Press Enter to continue..."
107+
;;
108+
"3. Stop SlowDNS Server")
109+
echo -e "${blue}[ Info ]${nc} Stopping SlowDNS server..."
110+
systemctl stop server-sldns
111+
sleep 2
112+
if ! systemctl is-active --quiet server-sldns; then
113+
echo -e "${green}[ Success ]${nc} SlowDNS server stopped successfully."
114+
else
115+
echo -e "${red}[ Error ]${nc} Failed to stop SlowDNS server."
116+
fi
117+
echo ""
118+
read -p "Press Enter to continue..."
119+
;;
120+
"4. Restart SlowDNS Server")
121+
echo -e "${blue}[ Info ]${nc} Restarting SlowDNS server..."
122+
systemctl restart server-sldns
123+
sleep 2
124+
if systemctl is-active --quiet server-sldns; then
125+
echo -e "${green}[ Success ]${nc} SlowDNS server restarted successfully."
126+
else
127+
echo -e "${red}[ Error ]${nc} Failed to restart SlowDNS server."
128+
fi
129+
echo ""
130+
read -p "Press Enter to continue..."
131+
;;
132+
"5. View Server Logs")
133+
clear
134+
echo "=========================================="
135+
echo " SlowDNS Server Logs "
136+
echo "=========================================="
137+
echo ""
138+
139+
echo "📋 Server Service Logs (last 30 lines):"
140+
echo "========================================"
141+
journalctl -u server-sldns --no-pager -n 30
142+
echo ""
143+
read -p "Press Enter to continue..."
144+
;;
145+
"6. Reinstall SlowDNS Server")
146+
echo -e "${yellow}[ Warning ]${nc} This will reinstall SlowDNS Server and may require reconfiguration."
147+
echo ""
148+
read -p "Are you sure you want to proceed? (y/N): " confirm
149+
150+
if [[ $confirm =~ ^[Yy]$ ]]; then
151+
echo -e "${blue}[ Info ]${nc} Reinstalling SlowDNS Server..."
152+
setup-slowdns
153+
else
154+
echo -e "${blue}[ Info ]${nc} Reinstallation cancelled."
155+
fi
156+
echo ""
157+
read -p "Press Enter to continue..."
158+
;;
159+
"7. Uninstall SlowDNS Server")
160+
echo -e "${red}[ Warning ]${nc} This will completely remove SlowDNS Server from your system."
161+
echo "This action cannot be undone!"
162+
echo ""
163+
read -p "Type 'CONFIRM' to proceed with uninstallation: " confirm
164+
165+
if [ "$confirm" = "CONFIRM" ]; then
166+
uninstall_slowdns
167+
else
168+
echo -e "${blue}[ Info ]${nc} Uninstallation cancelled."
169+
fi
170+
echo ""
171+
read -p "Press Enter to continue..."
172+
;;
173+
"←. Back to Main Menu")
174+
return 0
175+
;;
176+
*)
177+
echo -e "${red}[ Error ]${nc} Invalid option selected."
178+
sleep 2
179+
;;
180+
esac
181+
done
182+
}
183+
184+
main_slowdns_menu

0 commit comments

Comments
 (0)