From e17422a0cf7f26923069f494d6b6bf38b5579ba5 Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 21 Feb 2025 15:37:20 +0300 Subject: [PATCH 1/8] Fix #37 #41 --- .../resources/view/podkop/podkop.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index 5048098..51ddf9e 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -525,6 +525,50 @@ return view.extend({ return true; }; + o = mainSection.taboption('additional', form.Value, 'dns_rewrite_ttl', _('DNS Rewrite TTL'), _('Time in seconds for DNS record caching (default: 600)')); + o.default = '600'; + o.rmempty = false; + o.ucisection = 'main'; + o.validate = function (section_id, value) { + if (!value) { + return _('TTL value cannot be empty'); + } + + const ttl = parseInt(value); + if (isNaN(ttl) || ttl < 0) { + return _('TTL must be a positive number'); + } + + return true; + }; + + o = mainSection.taboption('additional', form.Value, 'cache_file', _('Cache File Path'), _('Select or enter path for sing-box cache file. Change this ONLY if you know what you are doing')); + o.value('/tmp/cache.db', 'RAM (/tmp/cache.db)'); + o.value('/usr/share/sing-box/cache.db', 'Flash (/usr/share/sing-box/cache.db)'); + o.default = '/tmp/cache.db'; + o.rmempty = false; + o.ucisection = 'main'; + o.validate = function(section_id, value) { + if (!value) { + return _('Cache file path cannot be empty'); + } + + if (!value.startsWith('/')) { + return _('Path must be absolute (start with /)'); + } + + if (!value.endsWith('cache.db')) { + return _('Path must end with cache.db'); + } + + const parts = value.split('/').filter(Boolean); + if (parts.length < 2) { + return _('Path must contain at least one directory (like /tmp/cache.db)'); + } + + return true; + }; + // Extra IPs and exclusions (main section) o = mainSection.taboption('basic', form.Flag, 'exclude_from_ip_enabled', _('IP for exclusion'), _('Specify local IP addresses that will never use the configured route')); o.default = '0'; From 6071a96e9c53959b438f047ef88400d20f1a5f9c Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 21 Feb 2025 15:37:43 +0300 Subject: [PATCH 2/8] 0.3.14 --- luci-app-podkop/Makefile | 2 +- podkop/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/luci-app-podkop/Makefile b/luci-app-podkop/Makefile index 652e39f..42396ca 100644 --- a/luci-app-podkop/Makefile +++ b/luci-app-podkop/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-podkop -PKG_VERSION:=0.3.13 +PKG_VERSION:=0.3.14 PKG_RELEASE:=1 LUCI_TITLE:=LuCI podkop app diff --git a/podkop/Makefile b/podkop/Makefile index 0271e95..81a2332 100644 --- a/podkop/Makefile +++ b/podkop/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=podkop -PKG_VERSION:=0.3.13 +PKG_VERSION:=0.3.14 PKG_RELEASE:=1 PKG_MAINTAINER:=ITDog From ce9a7cdc4532058babb37f0e2d960a1fa264863c Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 21 Feb 2025 15:40:22 +0300 Subject: [PATCH 3/8] Fix \n --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 451f56d..34d4e30 100755 --- a/install.sh +++ b/install.sh @@ -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" From b96552fb495d2be3267e34a6e7cec90cb991f978 Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 21 Feb 2025 16:06:17 +0300 Subject: [PATCH 4/8] Fix #41 --- .../resources/view/podkop/podkop.js | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index 51ddf9e..af48aaa 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -499,29 +499,38 @@ return view.extend({ o.rmempty = false; o.ucisection = 'main'; - o = mainSection.taboption('additional', form.Value, 'dns_server', _('DNS Server'), _('Select or enter DNS server address')); + o = mainSection.taboption('additional', form.Value, 'dns_servers', _('DNS Server'), _('Select or enter DNS server address')); o.value('1.1.1.1', 'Cloudflare (1.1.1.1)'); o.value('8.8.8.8', 'Google (8.8.8.8)'); o.value('9.9.9.9', 'Quad9 (9.9.9.9)'); - o.value('dns.adguard-dns.com', 'AdGuard Default'); - o.value('unfiltered.adguard-dns.com', 'AdGuard Unfiltered'); - o.value('family.adguard-dns.com', 'AdGuard Family'); + o.value('dns.adguard-dns.com', 'AdGuard Default (dns.adguard-dns.com)'); + o.value('unfiltered.adguard-dns.com', 'AdGuard Unfiltered (unfiltered.adguard-dns.com)'); + o.value('family.adguard-dns.com', 'AdGuard Family (family.adguard-dns.com)'); o.default = '1.1.1.1'; o.rmempty = false; o.ucisection = 'main'; - o.validate = function (section_id, value) { - if (!value) return _('DNS server address cannot be empty'); + o.validate = function(section_id, value) { + if (!value) { + return _('DNS server address cannot be empty'); + } + const ipRegex = /^(\d{1,3}\.){3}\d{1,3}$/; if (ipRegex.test(value)) { const parts = value.split('.'); for (const part of parts) { const num = parseInt(part); - if (num < 0 || num > 255) return _('IP address parts must be between 0 and 255'); + if (num < 0 || num > 255) { + return _('IP address parts must be between 0 and 255'); + } } return true; } + const domainRegex = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$/; - if (!domainRegex.test(value)) return _('Invalid DNS server format. Examples: 8.8.8.8 or dns.example.com'); + if (!domainRegex.test(value)) { + return _('Invalid DNS server format. Examples: 8.8.8.8 or dns.example.com'); + } + return true; }; From 891b8f713d33a7da6cbeba1e22387f06a425c499 Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 21 Feb 2025 16:07:27 +0300 Subject: [PATCH 5/8] Fix --- .../htdocs/luci-static/resources/view/podkop/podkop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index af48aaa..883861a 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -499,7 +499,7 @@ return view.extend({ o.rmempty = false; o.ucisection = 'main'; - o = mainSection.taboption('additional', form.Value, 'dns_servers', _('DNS Server'), _('Select or enter DNS server address')); + o = mainSection.taboption('additional', form.Value, 'dns_server', _('DNS Server'), _('Select or enter DNS server address')); o.value('1.1.1.1', 'Cloudflare (1.1.1.1)'); o.value('8.8.8.8', 'Google (8.8.8.8)'); o.value('9.9.9.9', 'Quad9 (9.9.9.9)'); From 06f9bee0388e2e46e78a5d7d8f813df279728010 Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 21 Feb 2025 17:40:52 +0300 Subject: [PATCH 6/8] #42 --- .../resources/view/podkop/podkop.js | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index 883861a..b2967f6 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -13,6 +13,23 @@ function formatDiagnosticOutput(output) { .replace(/\r/g, '\n'); } +function getNetworkInterfaces(o) { + const excludeInterfaces = ['br-lan', 'eth0', 'eth1', 'wan', 'phy0-ap0', 'phy1-ap0', 'pppoe-wan']; + + return network.getDevices().then(devices => { + devices.forEach(device => { + if (device.dev && device.dev.name) { + const deviceName = device.dev.name; + if (!excludeInterfaces.includes(deviceName) && !/^lan\d+$/.test(deviceName)) { + o.value(deviceName, deviceName); + } + } + }); + }).catch(error => { + console.error('Failed to get network devices:', error); + }); +} + // Общая функция для создания конфигурационных секций function createConfigSection(section, map, network) { const s = section; @@ -168,21 +185,7 @@ function createConfigSection(section, map, network) { o = s.taboption('basic', form.ListValue, 'interface', _('Network Interface'), _('Select network interface for VPN connection')); o.depends('mode', 'vpn'); o.ucisection = s.section; - - try { - const devices = network.getDevicesSync ? network.getDevicesSync() : network.getDevices(); - const excludeInterfaces = ['br-lan', 'eth0', 'eth1', 'wan', 'phy0-ap0', 'phy1-ap0']; - devices.forEach(device => { - if (device.dev && device.dev.name) { - const deviceName = device.dev.name; - if (!excludeInterfaces.includes(deviceName) && !/^lan\d+$/.test(deviceName)) { - o.value(deviceName, deviceName); - } - } - }); - } catch (error) { - console.error('Error fetching devices:', error); - } + getNetworkInterfaces(o); o = s.taboption('basic', form.Flag, 'domain_list_enabled', _('Community Lists')); o.default = '0'; @@ -637,10 +640,6 @@ return view.extend({ 'class': 'btn cbi-button-apply', 'click': () => fs.exec('/etc/init.d/podkop', ['restart']).then(() => location.reload()) }, _('Restart Podkop')), - E('button', { - 'class': 'btn cbi-button-' + (podkopStatus.enabled ? 'remove' : 'apply'), - 'click': () => fs.exec('/etc/init.d/podkop', [podkopStatus.enabled ? 'disable' : 'enable']).then(() => location.reload()) - }, podkopStatus.enabled ? _('Disable Podkop') : _('Enable Podkop')), E('button', { 'class': 'btn', 'click': () => fs.exec('/etc/init.d/podkop', ['show_config']).then(res => { From 2074ccecce51f15a40e4787b88b87469b515c0fb Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 21 Feb 2025 17:41:35 +0300 Subject: [PATCH 7/8] 0.3.15 --- README.md | 1 + luci-app-podkop/Makefile | 2 +- podkop/Makefile | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 90df3b5..14bd92e 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ Luci: Services/podkop ``` - [x] Только кастомный remote list не создаёт секцию в route-rules-rule-set и dns-rules-ruleset - [ ] Не отрабатывает service podkop stop, если podkop запущен и не может, к пример, зарезолвить домен с сломанным DNS +- [ ] Длинный label ломает sing-box # ToDo Этот раздел не означает задачи, которые нужно брать и делать. Это общий список хотелок. Если вы хотите помочь, пожалуйста, спросите сначала в телеграмме. diff --git a/luci-app-podkop/Makefile b/luci-app-podkop/Makefile index 42396ca..3a8eeca 100644 --- a/luci-app-podkop/Makefile +++ b/luci-app-podkop/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-podkop -PKG_VERSION:=0.3.14 +PKG_VERSION:=0.3.15 PKG_RELEASE:=1 LUCI_TITLE:=LuCI podkop app diff --git a/podkop/Makefile b/podkop/Makefile index 81a2332..cfdb0a7 100644 --- a/podkop/Makefile +++ b/podkop/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=podkop -PKG_VERSION:=0.3.14 +PKG_VERSION:=0.3.15 PKG_RELEASE:=1 PKG_MAINTAINER:=ITDog From 5f5b1cbe1f7044101771e6df802c05139578773d Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Sat, 22 Feb 2025 00:04:24 +0300 Subject: [PATCH 8/8] Warnning for friendlywrt, http-dns-proxy. Validation domains in local file --- README.md | 32 ++------------------------------ podkop/files/etc/init.d/podkop | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 14bd92e..bce2f0a 100644 --- a/README.md +++ b/README.md @@ -88,9 +88,8 @@ Luci: Services/podkop - [x] awg работает не стабильно - [x] Сеть рестартится при любом раскладе - [x] Выкл-вкл wg через luci не отрабатывает поднятие маршрута -- [ ] Если eof после последней строки в rt_tables, то скрипт не добавляет перенос строки -- [ ] В каких-то случаях плохо отрабатывает localfile -- [ ] warnging если в конфиге присуствует. Значит в системе есть https-dns-proxy, который тоже может перетирать конфигурацию dhcp. Рекомендовать его выключить и сделать disable. Возможно в будущем добавить несовместимость на уровне Makefile +- [x] В каких-то случаях плохо отрабатывает localfile +- [x] warnging если в конфиге присуствует. Значит в системе есть https-dns-proxy, который тоже может перетирать конфигурацию dhcp. Рекомендовать его выключить и сделать disable. Возможно в будущем добавить несовместимость на уровне Makefile ``` option doh_backup_noresolv '0' list doh_backup_server '' @@ -105,30 +104,6 @@ Luci: Services/podkop # ToDo Этот раздел не означает задачи, которые нужно брать и делать. Это общий список хотелок. Если вы хотите помочь, пожалуйста, спросите сначала в телеграмме. -Сделано -- [x] Скрипт для автоматической установки. -- [x] Подсети дискорда. -- [x] Удаление getdomains через скрипт. Кроме туннеля и sing-box. -- [x] Дополнительная вкладка для ещё одного туннеля. Домены, подсети. -- [x] Улучшение скрипта автоматической установки. Спрашивать про туннели. -- [x] Зависимость от dnsmasq-full -- [x] Весь трафик для устойства пускать в туннель\прокси -- [x] Исключение для IP, не ходить в туннель\прокси совсем 0x0 -- [x] Врубать галочкой yacd в sing-box -- [x] Свои списки. Просто список доменов с переносом строки -- [x] Свои списки ipv4 -- [x] В nft разделить правило tproxy на маркировку и tproxy -- [x] Вернуть две цепочки nft -- [x] Ntp (порт 123) делать маркировку 0x0. По галке -- [x] Открытый прокси порт на роутере для браузеров -- [x] Автонастройка wireguard по примеру getdomains -- [x] Автонастройка awg по примеру getdomains -- [x] RU перевод -- [x] Переделать на PROCD и выкинуть ucitrack. -- [x] Нужен дебаг. Restart ucitrack в отдельный скрипт postinst, не отрабатывает. -- [x] Закомментировать дефолтные значения у list. interface поставить в пустое. -- [x] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси. - Приоритет 1 - [x] Изменить название "Alternative Config" - [x] "domain_service_enabled" Добавить _second @@ -143,9 +118,6 @@ Luci: Services/podkop Проблема в том, что это нужно только если SS. Выставлять выбор при парсинг из конфига вопрос можно ли. Если совсем тупо - сделать костыль в допонительные настройки - [x] Проверка места в скрипте install. Если доступно меньше 20MB - exit 1 c выводом колько надо и сколько доступно. + показ модели роутера - [x] Правило запрещающее QUIC -- [ ] Проверить обновление списков, отрабатывает ли -- [ ] Проверка на ванильную openwrt -- [ ] Проверка откуда установлен sing-box. Например, проверять установлен ли он из официального репозитория - [x] TG в сервисы - [ ] Диагностика: Proxy check completed successfully предположительно не показывает IP, если вернулся это IPv6. - [ ] Сделать галку запрещающую подкопу редачить dhcp. Допилить в исключение вместе с пустыми полями proxy и vpn diff --git a/podkop/files/etc/init.d/podkop b/podkop/files/etc/init.d/podkop index a5584a1..dd5640f 100755 --- a/podkop/files/etc/init.d/podkop +++ b/podkop/files/etc/init.d/podkop @@ -53,8 +53,12 @@ start_service() { 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" + if grep -q FriendlyWrt /etc/banner; then + printf "\033[31;1mYou use FriendlyWrt. If you have problems, check out: https://t.me/itdogchat/44512/181082\033[0m\n" + fi + + 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" fi if ! ip addr | grep -q "br-lan"; then @@ -1373,8 +1377,13 @@ list_custom_local_domains_create() { local filename=$(basename "$local_file" | cut -d. -f1) while IFS= read -r domain; do - log "From local file: $domain" - sing_box_ruleset_domains $domain $section + domain=$(echo "$domain" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') + if [ -n "$domain" ] && echo "$domain" | grep -E -q '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$'; then + log "Added $domain from local file" + sing_box_ruleset_domains "$domain" "$section" + else + log "Invalid domain skipped: $domain" + fi done <"$local_file" }