mirror of
https://github.com/kiddin9/openwrt-packages.git
synced 2025-01-09 09:57:46 +08:00
🍕 Sync 2023-10-12 08:59:19
This commit is contained in:
parent
d90094d3a8
commit
1d6472df5a
@ -6,11 +6,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=adguardhome
|
||||
PKG_VERSION:=0.107.38
|
||||
PKG_RELEASE:=104
|
||||
PKG_VERSION:=0.107.39
|
||||
PKG_RELEASE:=105
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=258eecc55b982257a62d64d207b195e2ccbdb84c
|
||||
PKG_SOURCE_VERSION:=c6aed4eb5715279310c2ab9a7b1ef894c6cdcd7c
|
||||
PKG_SOURCE_URL:=https://github.com/AdguardTeam/AdGuardHome
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
|
21
luci-app-ttl/Makefile
Normal file
21
luci-app-ttl/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Antitethering module for luci-app-firewall
|
||||
LUCI_DEPENDS:= +luci-app-firewall +iptables-mod-ipopt +kmod-ipt-ipopt +kmod-ipt-nat6
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
define Package/luci-app-ttl/postrm
|
||||
uci delete "firewall.@include[-1]" && \
|
||||
rm -rf /etc/config/ttl
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
110
luci-app-ttl/htdocs/luci-static/resources/view/firewall/ttl.js
Normal file
110
luci-app-ttl/htdocs/luci-static/resources/view/firewall/ttl.js
Normal file
@ -0,0 +1,110 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require ui';
|
||||
'require rpc';
|
||||
'require uci';
|
||||
'require form';
|
||||
'require fs';
|
||||
'require network';
|
||||
'require firewall as fwmodel';
|
||||
'require tools.firewall as fwtool';
|
||||
'require tools.widgets as widgets';
|
||||
|
||||
var briefInfo = _('Firewall restart required. <br>In Method proxy Proxy server must be configured in transparent mode on port 3128 tcp.<br>Disable masquerade recommened.');
|
||||
|
||||
var rebootButton = E('button', {
|
||||
'class': 'btn cbi-button cbi-button-neutral',
|
||||
'click': ui.createHandlerFn(this, function() {
|
||||
return handleAction('fwrestart');
|
||||
}),
|
||||
}, _('Restart'));
|
||||
|
||||
var FWrestart = form.DummyValue.extend({
|
||||
load: function() {
|
||||
var setupButton = E('button', {
|
||||
'class': 'cbi-button cbi-button-neutral',
|
||||
'click': ui.createHandlerFn(this, function() {
|
||||
return handleAction('reload');
|
||||
}),
|
||||
}, _('Restart Firewall'));
|
||||
return L.resolveDefault(fs.exec_direct('/etc/init.d/firewall'), ['restart']).then(L.bind(function(html) {
|
||||
this.default = E([
|
||||
E('div', { 'class': 'cbi-value' }, [
|
||||
E('label', { 'class': 'cbi-value-title' },
|
||||
_('Restart Firewall')
|
||||
),
|
||||
E('div', { 'class': 'cbi-value-field', 'style': 'width:25vw' },
|
||||
E('div', { 'class': 'cbi-section-node' }, [
|
||||
rebootButton,
|
||||
]),
|
||||
),
|
||||
]),
|
||||
]);
|
||||
}, this));
|
||||
}
|
||||
});
|
||||
|
||||
function handleAction(ev) {
|
||||
if (ev === 'fwrestart') {
|
||||
fs.exec('/etc/init.d/firewall', ['restart']);
|
||||
}
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
render: function() {
|
||||
var m, s, o;
|
||||
|
||||
m = new form.Map('ttl', _('Antitetheting Config'),
|
||||
briefInfo);
|
||||
|
||||
s = m.section(form.TypedSection, 'fw');
|
||||
s.anonymous = true;
|
||||
o = s.option(FWrestart);
|
||||
|
||||
s = m.section(form.TypedSection, 'ttl', _('TTL or Proxy antitether'));
|
||||
s.anonymous = true;
|
||||
s.addremove = true;
|
||||
|
||||
o = s.option(widgets.NetworkSelect, 'iface', _('Set interface'));
|
||||
o.exclude = s.section;
|
||||
o.nocreate = true;
|
||||
o.optional = true;
|
||||
|
||||
o = s.option(form.ListValue, 'method', _('Method'),
|
||||
_('TTL method outgoing interface<br />Proxy method incoming interfcace'));
|
||||
o.value('ttl', 'TTL');
|
||||
o.value('proxy', 'Proxy');
|
||||
|
||||
o = s.option(form.Flag, 'advanced', _('Advanced Option'));
|
||||
o.default = '0';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.ListValue, 'inet', _('Inet Family'));
|
||||
o.value('ipv4', 'IPv4');
|
||||
o.value('ipv6', 'IPv6');
|
||||
o.value('ipv4v6', _('Both'));
|
||||
o.rmempty = true;
|
||||
o.editable = true;
|
||||
o.depends('advanced', '1');
|
||||
|
||||
o = s.option(form.Value, 'ttl', _('TTL Value'),
|
||||
_('Select TTL value. Range 1 - 255'));
|
||||
o.value('64','64')
|
||||
o.value('128','128')
|
||||
o.default = '64';
|
||||
o.rmempty = true;
|
||||
o.editable = true;
|
||||
o.depends({advanced: '1', method: /ttl/});
|
||||
|
||||
o = s.option(form.Value, 'ports', _('Ports'),
|
||||
_('Incoming ports route to proxy-server<br />Custom ports range: 0-65535'));
|
||||
o.editable = true;
|
||||
o.rmempty = true;
|
||||
o.value('all', _('ALL Ports'));
|
||||
o.value('http', _('HTTP Ports'));
|
||||
o.default = 'all';
|
||||
o.depends({advanced: '1', method: /proxy/})
|
||||
|
||||
return m.render();
|
||||
},
|
||||
});
|
54
luci-app-ttl/po/ru/ttl.po
Normal file
54
luci-app-ttl/po/ru/ttl.po
Normal file
@ -0,0 +1,54 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
"Language: ru\n"
|
||||
"Last-Translator: Konstantine Shevlakov <shevlakov@132lan.ru\n"
|
||||
|
||||
msgid "Firewall restart required. <br>In Method proxy Proxy server must be configured in transparent mode on port 3128 tcp.<br>Disable masquerade recommened."
|
||||
msgstr "Требуется перезапуск сетевого экрана. <br>В режиме прокси, прокси-сервер должен быть настроен в прозрачном режиме на порту 3128 tcp.<br>Рекомендуется отключить NAT."
|
||||
|
||||
msgid "Restart Firewall"
|
||||
msgstr "Перезапуск сетевого экрана"
|
||||
|
||||
msgid "Antitetheting Config"
|
||||
msgstr "Настройки антитетеринга"
|
||||
|
||||
msgid "TTL or Proxy antitether"
|
||||
msgstr "TTL или прокси"
|
||||
|
||||
msgid "Set interface"
|
||||
msgstr "Выбор интерфейса"
|
||||
|
||||
msgid "Method"
|
||||
msgstr "Способ"
|
||||
|
||||
msgid "TTL method outgoing interface<br />Proxy method incoming interfcace"
|
||||
msgstr "Для метода TTL интерфейс - исходящий<br />Для метода прокси интерфейс - входящий"
|
||||
|
||||
msgid "Inet Family"
|
||||
msgstr "Протокол IP"
|
||||
|
||||
msgid "Advanced Option"
|
||||
msgstr "Дополнительно"
|
||||
|
||||
msgid "Both"
|
||||
msgstr "Оба"
|
||||
|
||||
msgid "Ports"
|
||||
msgstr "Порты"
|
||||
|
||||
msgid "TTL Value"
|
||||
msgstr "Значение TTL"
|
||||
|
||||
msgid "Select TTL value. Range 1 - 255"
|
||||
msgstr "Выбор значения TTL. От 1 до 255"
|
||||
|
||||
msgid "Incoming ports route to proxy-server<br />Custom ports range: 0-65535"
|
||||
msgstr "Порты для перенаправления на прокси-сервер<br />Диапазон 0-65535"
|
||||
|
||||
msgid "ALL Ports"
|
||||
msgstr "Все порты"
|
||||
|
||||
msgid "HTTP Ports"
|
||||
msgstr "Порты HTTP"
|
||||
|
1
luci-app-ttl/root/etc/hotplug.d/iface/90-ttl
Normal file
1
luci-app-ttl/root/etc/hotplug.d/iface/90-ttl
Normal file
@ -0,0 +1 @@
|
||||
sleep 5 && /etc/init.d/firewall restart &
|
10
luci-app-ttl/root/etc/uci-defaults/64_luci-app-ttl
Normal file
10
luci-app-ttl/root/etc/uci-defaults/64_luci-app-ttl
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
if [ ! -f /etc/config/ttl ]; then
|
||||
touch /etc/config/ttl
|
||||
uci add ttl fw
|
||||
uci add ttl ttl
|
||||
uci add firewall include
|
||||
uci set firewall.@include[-1].path='/usr/share/ttl.sh'
|
||||
uci commit
|
||||
fi
|
24
luci-app-ttl/root/usr/share/luci/menu.d/luci-app-ttl.json
Normal file
24
luci-app-ttl/root/usr/share/luci/menu.d/luci-app-ttl.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"admin/network/firewall": {
|
||||
"title": "Firewall",
|
||||
"order": 60,
|
||||
"action": {
|
||||
"type": "alias",
|
||||
"path": "admin/network/firewall/zones"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-firewall" ],
|
||||
"fs": { "/sbin/fw3": "executable" },
|
||||
"uci": { "firewall": true }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/firewall/ttl": {
|
||||
"title": "TTL",
|
||||
"order": 45,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "firewall/ttl"
|
||||
}
|
||||
}
|
||||
}
|
24
luci-app-ttl/root/usr/share/rpcd/acl.d/luci-app-ttl.json
Normal file
24
luci-app-ttl/root/usr/share/rpcd/acl.d/luci-app-ttl.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"luci-app-ttl": {
|
||||
"description": "Grant access to TTL configuration",
|
||||
"read": {
|
||||
"file": {
|
||||
"/etc/confug/ttl": [ "read" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "read" ],
|
||||
"luci": [ "getConntrackHelpers" ]
|
||||
},
|
||||
"uci": [ "firewall" ]
|
||||
},
|
||||
"write": {
|
||||
"file": {
|
||||
"/etc/config/ttl": [ "write" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "write" ]
|
||||
},
|
||||
"uci": [ "firewall" ]
|
||||
}
|
||||
}
|
||||
}
|
110
luci-app-ttl/root/usr/share/ttl.sh
Normal file
110
luci-app-ttl/root/usr/share/ttl.sh
Normal file
@ -0,0 +1,110 @@
|
||||
|
||||
SECTIONS=$(echo $(uci show ttl | awk -F [\]\[\@=] '/=ttl/{print $3}'))
|
||||
|
||||
get_vars(){
|
||||
for v in method advanced inet ports ttl iface; do
|
||||
eval $v=$(uci -q get ttl.@ttl[${s}].${v} 2>/dev/nul)
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
method_ttl(){
|
||||
if [ ! $ttl ]; then
|
||||
ttl=64
|
||||
fi
|
||||
case $(($ttl % 2)) in
|
||||
0) TTL_INC=4 ;;
|
||||
*) TTL_INC=5 ;;
|
||||
esac
|
||||
for T in $IPT; do
|
||||
case $T in
|
||||
iptables)
|
||||
SUFFIX="TTL --ttl-set"
|
||||
if [ $iface ]; then
|
||||
$T -t mangle -A PREROUTING -i $DEV -m ttl --ttl 1 -j TTL --ttl-inc $TTL_INC
|
||||
else
|
||||
$T -t mangle -A PREROUTING -m ttl --ttl 1 -j TTL --ttl-inc $TTL_INC
|
||||
fi
|
||||
;;
|
||||
ip6tables)
|
||||
SUFFIX="HL --hl-set"
|
||||
if [ $iface ]; then
|
||||
$T -t mangle -A PREROUTING -i $DEV -m hl --hl 1 -j HL --hl-inc $TTL_INC
|
||||
$T -t mangle -A OUTPUT -o $DEV -j $SUFFIX $ttl
|
||||
$T -t mangle -A POSTROUTING -o $DEV -j $SUFFIX $ttl
|
||||
else
|
||||
$T -t mangle -A PREROUTING -m hl --hl 1 -j HL --hl-inc $TTL_INC
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ $iface ]; then
|
||||
$T -t mangle -A OUTPUT -o $DEV -j $SUFFIX $ttl
|
||||
$T -t mangle -A POSTROUTING -o $DEV -j $SUFFIX $ttl
|
||||
else
|
||||
$T -t mangle -A OUTPUT -j $SUFFIX $ttl
|
||||
$T -t mangle -A POSTROUTING -j $SUFFIX $ttl
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
method_proxy(){
|
||||
for T in $IPT; do
|
||||
case $T in
|
||||
iptables)
|
||||
IPADDR=$(ifstatus $iface | jsonfilter -e '@["ipv4-address"][*]["address"]')
|
||||
END="${IPADDR}:3128"
|
||||
;;
|
||||
ip6tables)
|
||||
for a in $(ifstatus $iface | jsonfilter -e '@["ipv6-prefix-assignment"][*]["local-address"]["address"]'); do
|
||||
IPADDR="$a"
|
||||
done
|
||||
END="[$IPADDR]:3128"
|
||||
;;
|
||||
esac
|
||||
$T -t nat -N PROXY
|
||||
$T -t nat -A PREROUTING -i $DEV -j PROXY
|
||||
case $ports in
|
||||
all)
|
||||
$T -t nat -A PROXY ! -d ${IPADDR} \
|
||||
! -s ${IPADDR} -p tcp \
|
||||
-j DNAT --to-destination $END
|
||||
;;
|
||||
http)
|
||||
$T -t nat -A PROXY ! -d ${IPADDR} \
|
||||
! -s ${IPADDR} -p tcp -m multiport \
|
||||
--dports 80,443 -j DNAT --to-destination $END
|
||||
;;
|
||||
*)
|
||||
if [ $ports ]; then
|
||||
$T -t nat -A PROXY ! -d ${IPADDR} \
|
||||
! -s ${IPADDR} -p tcp -m multiport \
|
||||
--dports $ports -j DNAT --to-destination $END
|
||||
else
|
||||
$T -t nat -A PROXY ! -d ${IPADDR} \
|
||||
! -s ${IPADDR} -p tcp \
|
||||
-j DNAT --to-destination $END
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
for s in $SECTIONS; do
|
||||
if [ "$s" ]; then
|
||||
get_vars
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
case $inet in
|
||||
ipv4) IPT="iptables" ;;
|
||||
ipv6) IPT="ip6tables" ;;
|
||||
*) IPT="iptables ip6tables";;
|
||||
esac
|
||||
DEV=$(ifstatus $iface | jsonfilter -e '@["device"]')
|
||||
case $method in
|
||||
ttl) method_ttl ;;
|
||||
proxy) method_proxy ;;
|
||||
esac
|
||||
done
|
Loading…
Reference in New Issue
Block a user