mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 02:35:13 +08:00
⛄ Sync 2026-04-23 20:32:35
This commit is contained in:
1 parent
17738c6f79
commit
fe51d2b304
206 files changed
+725671
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$(uci -q get luci.diag)" != "internal" ]; then
|
||||
host=""
|
||||
|
||||
if [ -s /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
host="${HOME_URL:-${BUG_URL:-$OPENWRT_DEVICE_MANUFACTURER_URL}}"
|
||||
host="${host#*://}"
|
||||
host="${host%%/*}"
|
||||
fi
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set luci.diag=internal
|
||||
set luci.diag.dns='${host:-openwrt.org}'
|
||||
set luci.diag.ping='${host:-openwrt.org}'
|
||||
set luci.diag.route='${host:-openwrt.org}'
|
||||
commit luci
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
NL="
|
||||
"
|
||||
|
||||
function ifaces_by_device() {
|
||||
ubus call network.interface dump 2>/dev/null | \
|
||||
jsonfilter -e "@.interface[@.device='$1' || @.l3_device='$1'].interface"
|
||||
}
|
||||
|
||||
function device_by_addr() {
|
||||
set -- $(ip route get "$1" ${2:+from "$2"} 2>/dev/null)
|
||||
echo "$5"
|
||||
}
|
||||
|
||||
for inbound_device in $(device_by_addr "$REMOTE_ADDR" "$SERVER_ADDR"); do
|
||||
inbound_devices="$inbound_device"
|
||||
inbound_interfaces=""
|
||||
|
||||
for iface in $(ifaces_by_device "$inbound_device"); do
|
||||
inbound_interfaces="${inbound_interfaces:+$inbound_interfaces$NL}$iface"
|
||||
|
||||
for peeraddr in $(uci get "network.$iface.peeraddr"); do
|
||||
for ipaddr in $(resolveip -t 1 "$peeraddr" 2>/dev/null); do
|
||||
for peerdev in $(device_by_addr "$ipaddr"); do
|
||||
for iface in $(ifaces_by_device "$peerdev"); do
|
||||
inbound_devices="${inbound_devices:+$inbound_devices$NL}$peerdev"
|
||||
inbound_interfaces="${inbound_interfaces:+$inbound_interfaces$NL}$iface"
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
inbound_devices="$(echo "$inbound_devices" | sort -u | sed ':a;N;$!ba;s/\n/", "/g')"
|
||||
inbound_interfaces="$(echo "$inbound_interfaces" | sort -u | sed ':a;N;$!ba;s/\n/", "/g')"
|
||||
|
||||
cat <<JSON
|
||||
{
|
||||
"remote_addr": "$REMOTE_ADDR",
|
||||
"server_addr": "$SERVER_ADDR",
|
||||
"inbound_devices": [ ${inbound_devices:+\"$inbound_devices\"} ],
|
||||
"inbound_interfaces": [ ${inbound_interfaces:+\"$inbound_interfaces\"} ]
|
||||
}
|
||||
JSON
|
||||
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"admin/network/switch": {
|
||||
"title": "Switch",
|
||||
"order": 20,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/switch"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-mod-network-config" ],
|
||||
"fs": { "/sbin/swconfig": "executable" },
|
||||
"uci": { "network": { "@switch": true } }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/wireless": {
|
||||
"title": "Wireless",
|
||||
"order": 15,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/wireless"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-mod-network-config" ],
|
||||
"uci": { "wireless": { "@wifi-device": true } }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/remote_addr/*": {
|
||||
"action": {
|
||||
"type": "call",
|
||||
"module": "luci.controller.admin.network",
|
||||
"function": "remote_addr"
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/network": {
|
||||
"title": "Interfaces",
|
||||
"order": 10,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/interfaces"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-mod-network-config" ]
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/routes": {
|
||||
"title": "Routing",
|
||||
"order": 30,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/routes"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-mod-network-config" ]
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/dhcp": {
|
||||
"title": "DHCP",
|
||||
"order": 40,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/dhcp"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-mod-network-dhcp" ],
|
||||
"fs": [
|
||||
{ "/usr/sbin/odhcpd": "executable" },
|
||||
{ "/usr/sbin/dnsmasq": "executable" }
|
||||
],
|
||||
"uci": { "dhcp": true }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/dns": {
|
||||
"title": "DNS",
|
||||
"order": 45,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/dns"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-mod-network-dns" ],
|
||||
"fs": { "/usr/sbin/dnsmasq": "executable" },
|
||||
"uci": { "dhcp": true }
|
||||
}
|
||||
},
|
||||
|
||||
"admin/network/diagnostics": {
|
||||
"title": "Diagnostics",
|
||||
"order": 50,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "network/diagnostics"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-mod-network-diagnostics" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"luci-mod-network-config": {
|
||||
"description": "Grant access to network configuration",
|
||||
"read": {
|
||||
"cgi-io": [ "exec" ],
|
||||
"file": {
|
||||
"/etc/iproute2/rt_tables": [ "read" ],
|
||||
"/proc/sys/net/ipv6/conf/*/mtu": [ "read" ],
|
||||
"/proc/sys/net/ipv6/conf/*/hop_limit": [ "read" ],
|
||||
"/usr/sbin/iw": [ "exec" ],
|
||||
"/usr/libexec/luci-peeraddr": [ "exec" ],
|
||||
"/usr/sbin/wlanconfig": [ "exec" ],
|
||||
"/proc/sys/net/ipv[46]/conf/*": [ "read" ],
|
||||
"/sys/class/net/*/brport/*": [ "read" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "exec" ],
|
||||
"iwinfo": [ "assoclist", "countrylist", "devices", "freqlist", "info", "txpowerlist" ],
|
||||
"luci": [ "getSwconfigFeatures", "getSwconfigPortState" ],
|
||||
"network.wireless": [ "status" ]
|
||||
},
|
||||
"uci": [ "dhcp", "firewall", "network", "wireless", "system" ]
|
||||
},
|
||||
"write": {
|
||||
"cgi-io": [ "exec" ],
|
||||
"file": {
|
||||
"/sbin/ifup": [ "exec" ],
|
||||
"/sbin/ifdown": [ "exec" ],
|
||||
"/sbin/wifi": [ "exec" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "exec" ],
|
||||
"hostapd.*": [ "del_client" ],
|
||||
"iwinfo": [ "scan" ]
|
||||
},
|
||||
"uci": [ "dhcp", "firewall", "network", "wireless" ]
|
||||
}
|
||||
},
|
||||
|
||||
"luci-mod-network-dns": {
|
||||
"description": "Grant access to DNS configuration",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci-rpc": [ "getHostHints" ]
|
||||
},
|
||||
"uci": [ "dhcp" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "dhcp" ]
|
||||
}
|
||||
},
|
||||
|
||||
"luci-mod-network-dhcp": {
|
||||
"description": "Grant access to DHCP configuration",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci-rpc": [ "getDHCPLeases", "getDUIDHints", "getHostHints", "getNetworkDevices" ],
|
||||
"fingerprint": [ "fingerprint" ],
|
||||
"service": [ "list" ]
|
||||
},
|
||||
"uci": [ "dhcp" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "dhcp" ]
|
||||
}
|
||||
},
|
||||
|
||||
"luci-mod-network-diagnostics": {
|
||||
"description": "Grant access to network diagnostic tools",
|
||||
"read": {
|
||||
"file": {
|
||||
"/bin/ping": [ "exec" ],
|
||||
"/bin/ping6": [ "exec", "list" ],
|
||||
"/bin/traceroute": [ "exec" ],
|
||||
"/bin/traceroute6": [ "exec", "list" ],
|
||||
"/usr/bin/nslookup": [ "exec" ],
|
||||
"/usr/bin/ping": [ "exec" ],
|
||||
"/usr/bin/ping6": [ "exec", "list" ],
|
||||
"/usr/bin/traceroute": [ "exec" ],
|
||||
"/usr/bin/traceroute6": [ "exec", "list" ],
|
||||
"/usr/bin/arp-scan": [ "exec", "list" ]
|
||||
},
|
||||
"ubus": {
|
||||
"file": [ "exec", "stat" ]
|
||||
},
|
||||
"uci": [ "luci" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"config": "dhcp",
|
||||
"init": "dnsmasq",
|
||||
"affects": [
|
||||
"odhcpd"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"config": "network",
|
||||
"init": "network",
|
||||
"affects": [
|
||||
"dhcp"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"config": "odhcpd",
|
||||
"init": "odhcpd"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"config": "wireless",
|
||||
"affects": [
|
||||
"network"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user