mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-09 04:56:51 +03:00
Added critical log. Rm friendlywrt check. Added iptables check
This commit is contained in:
@@ -19,19 +19,18 @@ start_service() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q FriendlyWrt /etc/banner; then
|
if opkg list-installed | grep -q iptables-mod-extra; then
|
||||||
printf "\033[31;1mYou use FriendlyWrt. If you have problems, check out: https://t.me/itdogchat/44512/181082\033[0m\n"
|
echo "Conflicting package detected: iptables-mod-extra"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if opkg list-installed | grep -q kmod-ipt-nat; then
|
||||||
|
echo "Conflicting package detected: kmod-ipt-nat"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -qE 'doh_backup_noresolv|doh_backup_server|doh_server' /etc/config/dhcp; then
|
if grep -qE 'doh_backup_noresolv|doh_backup_server|doh_server' /etc/config/dhcp; then
|
||||||
printf "\033[31;1mDetected https-dns-proxy. Disable or uninstall it for correct functionality.\033[0m\n"
|
printf "\033[31;1mDetected https-dns-proxy. Disable or uninstall it for correct functionality.\033[0m\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ip addr | grep -q "br-lan"; then
|
|
||||||
echo "Interface br-lan not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -q "search lan" "$resolv_conf" || ! grep -q "nameserver 127.0.0.1" "$resolv_conf"; then
|
if ! grep -q "search lan" "$resolv_conf" || ! grep -q "nameserver 127.0.0.1" "$resolv_conf"; then
|
||||||
echo "/etc/resolv.conf does not contain 'search lan' or 'nameserver 127.0.0.1' entries"
|
echo "/etc/resolv.conf does not contain 'search lan' or 'nameserver 127.0.0.1' entries"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -46,6 +46,32 @@ nolog() {
|
|||||||
|
|
||||||
start() {
|
start() {
|
||||||
log "Starting podkop"
|
log "Starting podkop"
|
||||||
|
|
||||||
|
# checking
|
||||||
|
sing_box_version=$(sing-box version | head -n 1 | awk '{print $3}')
|
||||||
|
required_version="1.11.1"
|
||||||
|
|
||||||
|
if [ "$(echo -e "$sing_box_version\n$required_version" | sort -V | head -n 1)" != "$required_version" ]; then
|
||||||
|
log "[critical] The version of sing-box ($sing_box_version) is lower than the minimum version. Update sing-box: opkg update && opkg remove sing-box && opkg install sing-box"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if opkg list-installed | grep -q iptables-mod-extra; then
|
||||||
|
log "[critical] Conflicting package detected: iptables-mod-extra"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if opkg list-installed | grep -q kmod-ipt-nat; then
|
||||||
|
log "[critical] Conflicting package detected: kmod-ipt-nat"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -qE 'doh_backup_noresolv|doh_backup_server|doh_server' /etc/config/dhcp; then
|
||||||
|
log "[critical] Detected https-dns-proxy. Disable or uninstall it for correct functionality."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "search lan" "$resolv_conf" || ! grep -q "nameserver 127.0.0.1" "$resolv_conf"; then
|
||||||
|
log "[critical] /etc/resolv.conf does not contain 'search lan' or 'nameserver 127.0.0.1' entries"
|
||||||
|
fi
|
||||||
|
|
||||||
migration
|
migration
|
||||||
|
|
||||||
config_foreach process_validate_service
|
config_foreach process_validate_service
|
||||||
@@ -843,7 +869,7 @@ sing_box_outdound() {
|
|||||||
config_get interface "$section" "interface"
|
config_get interface "$section" "interface"
|
||||||
|
|
||||||
if [ -z "$interface" ]; then
|
if [ -z "$interface" ]; then
|
||||||
log "VPN interface is not set. Exit"
|
log "[critical] VPN interface is not set. Exit"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -869,7 +895,7 @@ sing_box_outdound() {
|
|||||||
active_proxy_string=$(echo "$proxy_string" | grep -v "^[[:space:]]*\/\/" | head -n 1)
|
active_proxy_string=$(echo "$proxy_string" | grep -v "^[[:space:]]*\/\/" | head -n 1)
|
||||||
|
|
||||||
if [ -z "$active_proxy_string" ]; then
|
if [ -z "$active_proxy_string" ]; then
|
||||||
log "Proxy string is not set. Exit"
|
log "[critical] Proxy string is not set. Exit"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -942,7 +968,7 @@ sing_box_rule_dns() {
|
|||||||
|
|
||||||
sing_box_config_check() {
|
sing_box_config_check() {
|
||||||
if ! sing-box -c $SING_BOX_CONFIG check >/dev/null 2>&1; then
|
if ! sing-box -c $SING_BOX_CONFIG check >/dev/null 2>&1; then
|
||||||
log "Sing-box configuration is invalid"
|
log "[critical] Sing-box configuration is invalid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user