Compare commits

...

39 Commits

Author SHA1 Message Date
itdoginfo
2074ccecce 0.3.15 2025-02-21 17:41:35 +03:00
itdoginfo
06f9bee038 #42 2025-02-21 17:40:52 +03:00
itdoginfo
891b8f713d Fix 2025-02-21 16:07:27 +03:00
itdoginfo
b96552fb49 Fix #41 2025-02-21 16:06:17 +03:00
itdoginfo
ce9a7cdc45 Fix \n 2025-02-21 15:40:22 +03:00
itdoginfo
6071a96e9c 0.3.14 2025-02-21 15:37:43 +03:00
itdoginfo
e17422a0cf Fix #37 #41 2025-02-21 15:37:20 +03:00
itdoginfo
2e78b2b4b8 Merge pull request #41 from itdoginfo/refactor/deduplicate-sections
Refactor/deduplicate sections
2025-02-21 14:55:03 +03:00
Ivan K
b84f3b6782 feat: add get_proxy_label function to podkop init script 2025-02-21 12:01:46 +03:00
itdoginfo
0f66305e50 Fix 2025-02-21 11:53:08 +03:00
Ivan K
a32a5c600b fix: update domain validation regex to allow single-level domains 2025-02-21 11:47:14 +03:00
Ivan K
89737efcbc refactor: refactor checkFakeIP to return a promise and update updateDiagnostics to use async/await 2025-02-21 11:22:37 +03:00
Ivan K
4608bc31cd refactor: update podkop.js to modularize configuration sections and improve validation logic 2025-02-21 11:09:47 +03:00
itdoginfo
d9e9f2dfe4 Update 2025-02-21 00:50:53 +03:00
Nikita Skryabin
bb9318e96f Merge pull request #37 from vernette/feature/fakeip-cache-path-and-ttl
feat(podkop): add configurable cache file path and dns rewrite_ttl options
2025-02-21 00:20:15 +03:00
Nikita Skryabin
7ff49c3e4e chore(init.d/podkop): remove unused cache file path and constant 2025-02-21 00:17:43 +03:00
Nikita Skryabin
134a79cb3b refactor(podkop.js): remove redundant path validation logic 2025-02-20 23:56:20 +03:00
Nikita Skryabin
560dda8604 feat(podkop): add translations for cache file and rewrite ttl options 2025-02-20 23:49:41 +03:00
Nikita Skryabin
255c08a6de feat(podkop.js): add validation for cache file path to ensure it meets specific criteria 2025-02-20 23:44:32 +03:00
Nikita Skryabin
1f3a65347e feat(podkop): add DNS Rewrite TTL configuration option 2025-02-20 23:27:50 +03:00
Nikita Skryabin
ec936e2369 feat(podkop): add configurable cache file path support 2025-02-20 22:49:58 +03:00
itdoginfo
cee934d139 Merge pull request #34 from itdoginfo/feature/fakeip-updater
feat: enhance FakeIP status check with periodic updates
2025-02-20 21:59:04 +03:00
Ivan K
a25c6b8013 feat: enhance FakeIP status check with periodic updates 2025-02-20 20:28:51 +03:00
itdoginfo
ec3a281cef v0.3.13 2025-02-20 17:22:15 +03:00
itdoginfo
86947e7dee Fix dns_server value 2025-02-20 17:22:03 +03:00
itdoginfo
ff5d017acc Update and rm install 0.2.5 2025-02-20 16:50:06 +03:00
itdoginfo
22d919657c Merge remote-tracking branch 'origin/main' 2025-02-20 16:48:20 +03:00
itdoginfo
3271f23ae0 Fix noresolv bakup 2025-02-20 16:45:22 +03:00
itdoginfo
35ea1a14cf Merge pull request #33 from vernette/feature/dns-server-selection
feat(podkop): add DNS server and protocol selection options
2025-02-20 16:39:05 +03:00
unknown
51a9cc5934 feat(podkop.po): add translations for DNS server address validation messages 2025-02-20 16:34:55 +03:00
unknown
e1df26e62b feat(podkop.js): add DNS server validation for IP and domain formats 2025-02-20 16:33:23 +03:00
unknown
75b8bef0e0 fix(podkop.js): update DNS protocol type and server labels to use translation function 2025-02-20 16:07:38 +03:00
unknown
1a6b0cac46 chore(init.d/podkop): remove redundant comments 2025-02-20 16:03:15 +03:00
unknown
e49bd91109 feat(podkop.po): add translations for DNS protocol and server options 2025-02-20 16:01:23 +03:00
unknown
85642a2585 feat(podkop.pot): add new DNS protocol and server options for translation 2025-02-20 16:01:12 +03:00
unknown
c31785d20e feat(init.d/podkop): add DNS resolver discovery and dynamic configuration 2025-02-20 15:57:52 +03:00
unknown
a0af04037a feat(podkop.js): add DNS protocol type and server options to configuration 2025-02-20 15:57:18 +03:00
itdoginfo
51fb10e30e fix 2025-02-20 00:43:39 +03:00
itdoginfo
069ea41ef8 Hide don't touch my dhcp 2025-02-20 00:25:24 +03:00
9 changed files with 1122 additions and 1582 deletions

View File

@@ -89,11 +89,8 @@ Luci: Services/podkop
- [x] Сеть рестартится при любом раскладе
- [x] Выкл-вкл wg через luci не отрабатывает поднятие маршрута
- [ ] Если eof после последней строки в rt_tables, то скрипт не добавляет перенос строки
- [ ] Парсинг VLESS не отрабатывает, если в SNI два домена. Пример `sni=telegram.org%3Bwww.telegram.org`
- [ ] `service network restart` ломает маршруты при sing-box
- [ ] Совпадение секции с ruleset ломает конфиг sing-box
- [ ] В каких-то случаях плохо отрабатывает localfile
- [ ] exit 1 если в конфиге присуствует
- [ ] warnging если в конфиге присуствует. Значит в системе есть https-dns-proxy, который тоже может перетирать конфигурацию dhcp. Рекомендовать его выключить и сделать disable. Возможно в будущем добавить несовместимость на уровне Makefile
```
option doh_backup_noresolv '0'
list doh_backup_server ''
@@ -103,7 +100,7 @@ Luci: Services/podkop
```
- [x] Только кастомный remote list не создаёт секцию в route-rules-rule-set и dns-rules-ruleset
- [ ] Не отрабатывает service podkop stop, если podkop запущен и не может, к пример, зарезолвить домен с сломанным DNS
- [ ] Всплывает в логах при старте. Не каждый раз. На работу не влияет. Wed Feb 19 17:12:28 2025 daemon.err sh[17665]: Command failed: ubus call service delete { "name": "sing-box" } (Not found)
- [ ] Длинный label ломает sing-box
# ToDo
Этот раздел не означает задачи, которые нужно брать и делать. Это общий список хотелок. Если вы хотите помочь, пожалуйста, спросите сначала в телеграмме.
@@ -145,23 +142,19 @@ Luci: Services/podkop
3) включен, версия 1 (старые релизы xray, sing-box на сервере)
Проблема в том, что это нужно только если SS. Выставлять выбор при парсинг из конфига вопрос можно ли. Если совсем тупо - сделать костыль в допонительные настройки
- [x] Проверка места в скрипте install. Если доступно меньше 20MB - exit 1 c выводом колько надо и сколько доступно. + показ модели роутера
- [ ] Правило запрещающее QUIC
- [x] Правило запрещающее QUIC
- [ ] Проверить обновление списков, отрабатывает ли
- [ ] Проверка на ванильную openwrt
- [ ] Проверка откуда установлен sing-box. Например, проверять установлен ли он из официального репозитория
- [x] TG в сервисы
- [ ] Выбор ткуда направлять трафик в туннель. В том числе чтоб откуда угодно, а не только br-lan
- [ ] Диагностика: Proxy check completed successfully предположительно не показывает IP, если вернулся это IPv6.
- [ ] Диагностика: podkop_domains: 0 elements как проверять что доходят запросы при fakeip? Мб врубать логи dnsmasq и их чекать.
- [ ] Сделать галку запрещающую подкопу редачить dhcp. Допилить в исключение вместе с пустыми полями proxy и vpn
- [ ] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
- [ ] Добавление в список доменов домены первого уровня (LuCI)
- [x] Валидации предустановленных значений. Если прописаны другие, то вывод в лог о неизвестной переменной и продолжение работы
- [ ] Проверка, что версия в makefile совпадает с тегом
- [ ] Don't touch my DHCP!
Приоритет 2
- [x] Списки доменов и подсетей с роутера
- [ ] Кнопка обновления списка доменов и подсетей. Запихнуть в главное меню
- [x] Кнопка обновления списка доменов и подсетей. Запихнуть в главное меню
- [ ] IPv6
Wiki
@@ -181,17 +174,6 @@ Wiki
- [ ] Unit тесты (BATS)
- [ ] Интеграционые тесты бекенда (OpenWrt rootfs + BATS)
Хз как сделать
- [ ] Добавить label от конфига vless\ss\etc в luci.
# Установка версии v0.2.5
Удаляет полностью все пакеты podkop. Удаляет текущую конфигурацию podkop.
После установки **обязательно** сбросьте кэш в LuCI.
```
sh <(wget -O - https://raw.githubusercontent.com/itdoginfo/podkop/refs/heads/main/install-v0.2.5.sh)
```
# Разработка
Есть два варианта:
- Просто поставить пакет на роутер или виртуалку и прям редактировать через SFTP (opkg install openssh-sftp-server)

View File

@@ -1,97 +0,0 @@
#!/bin/sh
REPO="https://api.github.com/repos/itdoginfo/podkop/releases/tags/v0.2.5"
DOWNLOAD_DIR="/tmp/podkop"
COUNT=3
rm -rf "$DOWNLOAD_DIR"
mkdir -p "$DOWNLOAD_DIR"
main() {
check_system
opkg update
if [ -f "/etc/init.d/podkop" ]; then
echo "Remove current vesrion podkop"
opkg remove luci-i18n-podkop-ru luci-app-podkop podkop
rm /etc/config/podkop
else
echo "Installed podkop..."
fi
wget -qO- "$REPO" | grep -o 'https://[^"[:space:]]*\.ipk' | while read -r url; do
filename=$(basename "$url")
filepath="$DOWNLOAD_DIR/$filename"
attempt=0
while [ $attempt -lt $COUNT ]; do
if [ -f "$filepath" ] && [ -s "$filepath" ]; then
echo "$filename has already been uploaded"
break
fi
echo "Download $filename (count $((attempt+1)))..."
wget -q -O "$filepath" "$url"
if [ -s "$filepath" ]; then
echo "$filename successfully downloaded"
else
echo "Download error $filename. Retry..."
rm -f "$filepath"
fi
attempt=$((attempt+1))
done
done
for pkg in podkop luci-app-podkop; do
file=$(ls "$DOWNLOAD_DIR" | grep "^$pkg" | head -n 1)
if [ -n "$file" ]; then
echo "Installing $file"
opkg install "$DOWNLOAD_DIR/$file"
fi
done
ru=$(ls "$DOWNLOAD_DIR" | grep "luci-i18n-podkop-ru" | head -n 1)
if [ -n "$ru" ]; then
printf "\033[32;1mРусский язык интерфейса ставим? y/n (Need a Russian translation?)\033[0m "
while true; do
read -r -p '' RUS
case $RUS in
y)
opkg install "$DOWNLOAD_DIR/$ru"
break
;;
n)
break
;;
*)
echo "Введите y или n"
;;
esac
done
fi
rm -f $DOWNLOAD_DIR/podkop*.ipk $DOWNLOAD_DIR/luci-app-podkop*.ipk $DOWNLOAD_DIR/luci-i18n-podkop-ru*.ipk
}
check_system() {
# Get router model
MODEL=$(cat /tmp/sysinfo/model)
echo "Router model: $MODEL"
if ! nslookup google.com >/dev/null 2>&1; then
log "DNS not working"
exit 1
fi
if opkg list-installed | grep -qE "iptables|kmod-iptab"; then
printf "\033[31;1mFound incompatible iptables packages. If you're using FriendlyWrt: https://t.me/itdogchat/44512/181082\033[0m\n"
fi
}
main

View File

@@ -111,7 +111,7 @@ main() {
}
add_tunnel() {
printf "\033[32;1mWill you be using Wireguard, AmneziaWG, OpenVPN, OpenConnect? If yes, select a number and they will be automatically installed\033[0m "
printf "\033[32;1mWill you be using Wireguard, AmneziaWG, OpenVPN, OpenConnect? If yes, select a number and they will be automatically installed\033[0m\n"
echo "1) Wireguard"
echo "2) AmneziaWG"
echo "3) OpenVPN"
@@ -412,7 +412,7 @@ check_system() {
fi
if ! nslookup google.com >/dev/null 2>&1; then
log "DNS not working"
printf "\033[31;1mDNS not working\033[0m\n"
exit 1
fi

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-podkop
PKG_VERSION:=0.3.11
PKG_VERSION:=0.3.15
PKG_RELEASE:=1
LUCI_TITLE:=LuCI podkop app

View File

@@ -494,4 +494,64 @@ msgid "Update Lists"
msgstr "Обновить списки"
msgid "Lists Update Results"
msgstr "Результаты обновления списков"
msgstr "Результаты обновления списков"
msgid "DNS Protocol Type"
msgstr "Тип DNS протокола"
msgid "Select DNS protocol to use"
msgstr "Выберите протокол DNS"
msgid "DNS over HTTPS (DoH)"
msgstr "DNS через HTTPS (DoH)"
msgid "DNS over TLS (DoT)"
msgstr "DNS через TLS (DoT)"
msgid "UDP (Unprotected DNS)"
msgstr "UDP (Незащищённый DNS)"
msgid "DNS Server"
msgstr "DNS сервер"
msgid "Select or enter DNS server address"
msgstr "Выберите или введите адрес DNS сервера"
msgid "DNS server address cannot be empty"
msgstr "Адрес DNS сервера не может быть пустым"
msgid "Invalid DNS server format. Examples: 8.8.8.8 or dns.example.com"
msgstr "Неверный формат DNS сервера. Примеры: 8.8.8.8 или dns.example.com"
msgid "DNS Rewrite TTL"
msgstr "Перезапись TTL для DNS"
msgid "Time in seconds for DNS record caching (default: 600)"
msgstr "Время в секундах для кэширования DNS записей (по умолчанию: 600)"
msgid "TTL value cannot be empty"
msgstr "Значение TTL не может быть пустым"
msgid "TTL must be a positive number"
msgstr "TTL должно быть положительным числом"
msgid "Cache File Path"
msgstr "Путь к файлу кэша"
msgid "Select or enter path for sing-box cache file. Change this ONLY if you know what you are doing"
msgstr "Выберите или введите путь к файлу кэша sing-box. Меняйте ТОЛЬКО если знаете, что делаете"
msgid "Cache file path cannot be empty"
msgstr "Путь к файлу кэша не может быть пустым"
msgid "Path must be absolute (start with /)"
msgstr "Путь должен быть абсолютным (начинаться с /)"
msgid "Path must end with cache.db"
msgstr "Путь должен заканчиваться на cache.db"
msgid "Path must contain at least one directory (like /tmp/cache.db)"
msgstr "Путь должен содержать хотя бы одну директорию (например /tmp/cache.db)"
msgid "Invalid path format. Must be like /tmp/cache.db"
msgstr "Неверный формат пути. Пример: /tmp/cache.db"

View File

@@ -854,4 +854,58 @@ msgid "Check completed"
msgstr ""
msgid "Check failed"
msgstr ""
msgid "DNS Protocol Type"
msgstr ""
msgid "Select DNS protocol to use"
msgstr ""
msgid "DNS over HTTPS (DoH)"
msgstr ""
msgid "DNS over TLS (DoT)"
msgstr ""
msgid "UDP (Unprotected DNS)"
msgstr ""
msgid "DNS Server"
msgstr ""
msgid "Select or enter DNS server address"
msgstr ""
msgid "DNS Rewrite TTL"
msgstr ""
msgid "Time in seconds for DNS record caching (default: 600)"
msgstr ""
msgid "TTL value cannot be empty"
msgstr ""
msgid "TTL must be a positive number"
msgstr ""
msgid "Cache File Path"
msgstr ""
msgid "Select or enter path for sing-box cache file. Change this ONLY if you know what you are doing"
msgstr ""
msgid "Cache file path cannot be empty"
msgstr ""
msgid "Path must be absolute (start with /)"
msgstr ""
msgid "Path must end with cache.db"
msgstr ""
msgid "Path must contain at least one directory (like /tmp/cache.db)"
msgstr ""
msgid "Invalid path format. Must be like /tmp/cache.db"
msgstr ""

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=podkop
PKG_VERSION:=0.3.11
PKG_VERSION:=0.3.15
PKG_RELEASE:=1
PKG_MAINTAINER:=ITDog <podkop@itdog.info>

View File

@@ -7,7 +7,7 @@ script=$(readlink "$initscript")
NAME="$(basename ${script:-$initscript})"
config_load "$NAME"
EXTRA_COMMANDS="main list_update check_proxy check_nft check_github check_logs check_sing_box_connections check_sing_box_logs check_dnsmasq show_config show_version show_sing_box_config show_luci_version show_sing_box_version show_system_info get_status get_sing_box_status"
EXTRA_COMMANDS="main list_update check_proxy check_nft check_github check_logs check_sing_box_connections check_sing_box_logs check_dnsmasq show_config show_version show_sing_box_config show_luci_version show_sing_box_version show_system_info get_status get_sing_box_status get_proxy_label"
EXTRA_HELP=" list_update Updating domain and subnet lists
check_proxy Check if sing-box proxy works correctly
check_nft Show PodkopTable nftables rules
@@ -37,9 +37,10 @@ SUBNETS_META="${GITHUB_RAW_URL}/Subnets/IPv4/meta.lst"
SUBNETS_DISCORD="${GITHUB_RAW_URL}/Subnets/IPv4/discord.lst"
SUBNETS_TELERAM="${GITHUB_RAW_URL}/Subnets/IPv4/telegram.lst"
SING_BOX_CONFIG="/etc/sing-box/config.json"
CACHE_FILE_PATH="/tmp/cache.db"
FAKEIP="198.18.0.0/15"
VALID_SERVICES="russia_inside russia_outside ukraine_inside geoblock block porn news anime youtube discord meta twitter hdrezka tiktok telegram"
DNS_RESOLVERS="1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 9.9.9.9 9.9.9.11 94.140.14.14 94.140.15.15 208.67.220.220 208.67.222.222 77.88.8.1 77.88.8.8"
TEST_DOMAIN="google.com"
start_service() {
log "Start podkop"
@@ -334,7 +335,7 @@ save_dnsmasq_config() {
value=$(uci get "$key" 2>/dev/null)
if [ -z "$value" ]; then
uci -q delete "$backup_key"
uci set "$backup_key"="unset"
else
uci set "$backup_key"="$value"
fi
@@ -375,8 +376,9 @@ dnsmasq_restore() {
fi
local noresolv=$(uci get dhcp.@dnsmasq[0].podkop_noresolv 2>/dev/null)
if [ -z "$noresolv" ]; then
if [[ "$noresolv" == "unset" ]]; then
log "dnsmasq revert: noresolv is unset"
uci -q delete dhcp.@dnsmasq[0].noresolv
else
uci set dhcp.@dnsmasq[0].noresolv="$noresolv"
fi
@@ -545,6 +547,17 @@ list_update() {
config_foreach process_subnet_for_section_remote
}
find_working_resolver() {
local resolver_found=""
for resolver in $DNS_RESOLVERS; do
if nslookup $TEST_DOMAIN $resolver >/dev/null 2>&1; then
echo "$resolver"
return 0
fi
done
echo "8.8.8.8"
return 1
}
# sing-box funcs
@@ -622,32 +635,86 @@ sing_box_inbound_proxy() {
}
sing_box_dns() {
local dns_type
local dns_server
local resolver_tag="resolver"
config_get dns_type "main" "dns_type" "doh"
config_get dns_server "main" "dns_server" "1.1.1.1"
local server_json
local is_ip=$(echo "$dns_server" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' && echo "1" || echo "0")
if [ "$is_ip" = "0" ]; then
log "Finding working DNS resolver"
local dns_resolver=$(find_working_resolver)
log "Found working resolver: $dns_resolver"
fi
log "Configure DNS in sing-box"
server_json=$(jq -n \
--arg type "$dns_type" \
--arg server "$dns_server" \
--arg resolver "$resolver_tag" \
--arg is_ip "$is_ip" \
'{
"servers": [
{
"tag": "dns-server",
"address": (
if $type == "doh" then
"https://" + $server + "/dns-query"
elif $type == "dot" then
"tls://" + $server
else
$server
end
),
"detour": "direct-out"
} + (
if $is_ip == "0" then
{"address_resolver": $resolver}
else
{}
end
)
]
}')
if [ "$is_ip" = "0" ]; then
server_json=$(echo "$server_json" | jq \
--arg resolver "$resolver_tag" \
--arg address "$dns_resolver" \
'.servers += [{
"tag": $resolver,
"address": $address
}]')
fi
server_json=$(echo "$server_json" | jq '.servers += [{"tag": "fakeip-server", "address": "fakeip"}]')
jq \
--arg FAKEIP "$FAKEIP" \
'.dns = {
"strategy": "ipv4_only",
"fakeip": {
"enabled": true,
"inet4_range": $FAKEIP
},
"servers": [
{
"tag": "cloudflare-doh-server",
"address": "https://1.1.1.1/dns-query",
"detour": "direct-out"
--argjson dns_config "$server_json" \
--arg fakeip "$FAKEIP" \
'.dns = {
"strategy": "ipv4_only",
"fakeip": {
"enabled": true,
"inet4_range": $fakeip
},
{
"tag": "fakeip-server",
"address": "fakeip"
}
]
}' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
"servers": $dns_config.servers
}' $SING_BOX_CONFIG > /tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
}
sing_box_dns_rule_fakeip() {
log "Configure fakeip route in sing-box"
local rewrite_ttl
config_get rewrite_ttl "main" "dns_rewrite_ttl" "600"
log "Configure fakeip route in sing-box and set TTL to $rewrite_ttl seconds"
jq \
--arg ttl "$rewrite_ttl" \
'.dns += {
"rules": [
{
@@ -664,6 +731,8 @@ sing_box_dns_rule_fakeip() {
},
{
"server": "fakeip-server",
"domain": "",
"rewrite_ttl": ($ttl | tonumber),
"rule_set": []
}
]
@@ -691,14 +760,17 @@ sing_box_dns_rule_fakeip_section() {
}
sing_box_cache_file() {
log "Configure cache.db in sing-box"
config_get cache_file "main" "cache_file" "/tmp/cache.db"
log "Configure sing-box cache.db path"
jq \
--arg CACHE_FILE_PATH "$CACHE_FILE_PATH" \
--arg cache_file "$cache_file" \
'.experimental = {
"cache_file": {
"enabled": true,
"store_fakeip": true,
"path": $CACHE_FILE_PATH
"path": $cache_file
}
}' $SING_BOX_CONFIG >/tmp/sing-box-config-tmp.json && mv /tmp/sing-box-config-tmp.json $SING_BOX_CONFIG
}
@@ -1764,6 +1836,18 @@ get_status() {
echo "{\"running\":$running,\"enabled\":$enabled,\"status\":\"$status\"}"
}
get_proxy_label() {
local section="$1"
local proxy_string
local label=""
config_get proxy_string "$section" "proxy_string"
if [ -n "$proxy_string" ]; then
label=$(echo "$proxy_string" | sed -n 's/.*#\(.*\)$/\1/p')
echo "$label"
fi
}
sing_box_add_secure_dns_probe_domain() {
local domain="httpbin.org"
local override_address="numbersapi.com"
@@ -1780,10 +1864,8 @@ sing_box_add_secure_dns_probe_domain() {
--arg override "$override_address" \
'.dns.rules |= map(
if .server == "fakeip-server" then
{
"server": .server,
"domain": $domain,
"rule_set": .rule_set
. + {
"domain": $domain
}
else
.