Initial commit

This commit is contained in:
monoadmin
2026-04-10 15:36:36 -07:00
commit 918ff903f0
16 changed files with 929 additions and 0 deletions

53
backup/etc/config/dhcp Normal file
View File

@@ -0,0 +1,53 @@
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option nonegcache '0'
option cachesize '1000'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
option filter_aaaa '0'
option filter_a '0'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
option dhcpv6 'server'
option ra 'server'
option ra_slaac '1'
list ra_flags 'managed-config'
list ra_flags 'other-config'
option ignore '1'
config dhcp 'wan'
option interface 'wan'
option ignore '1'
config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
option loglevel '4'
option piofolder '/tmp/odhcpd-piofolder'
config dhcp 'wifi_ap'
option interface 'wifi_ap'
option start '100'
option limit '100'
option leasetime '12h'

60
backup/etc/config/network Normal file
View File

@@ -0,0 +1,60 @@
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd6b:e811:df87::/48'
option packet_steering '1'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0.1'
list ports 'eth1'
config device
option name 'eth0.1'
option macaddr '4c:5e:0c:b5:35:f3'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '20.0.0.26'
option netmask '255.255.255.0'
option gateway '20.0.0.1'
list dns '64.126.133.1'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '1 2 3 4 0t'
config interface 'wifi_ap'
option proto 'static'
option ipaddr '192.168.88.1'
option netmask '255.255.255.0'
config device 'br_lan_dev'
option name 'br-lan'
option type 'bridge'
list ports 'eth0.1'
list ports 'eth1'
config switch 'switch'
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan 'switch_vlan1'
option device 'switch0'
option vlan '1'
option ports '1 2 3 4 0t'

View File

@@ -0,0 +1,8 @@
config upsset
config host 'tripplite'
option upsname 'tripplite'
option hostname 'localhost'
option displayname 'Local UPS'

View File

@@ -0,0 +1,17 @@
config upsmon 'upsmon'
option minsupplies '1'
option shutdowncmd '/sbin/halt'
option pollfreq '5'
option pollfreqalert '5'
option hostsync '15'
option deadtime '15'
option finaldelay '5'
config master 'tripplite'
option upsname 'tripplite'
option hostname 'localhost'
option powervalue '1'
option username 'upsmon'
option password 'nutlocal'

View File

@@ -0,0 +1,24 @@
config driver 'tripplite'
option driver 'usbhid-ups'
option port 'auto'
option desc 'Local UPS'
option pollinterval '5'
option vendorid '09ae'
option productid '3015'
config listen_address 'listen1'
option address '127.0.0.1'
config user 'upsmon_user'
option username 'upsmon'
option password 'nutlocal'
option upsmon 'master'
config user
option username 'monitor'
option upsmon 'slave'
config listen_address
option address '0.0.0.0'

139
backup/etc/config/snmpd Normal file
View File

@@ -0,0 +1,139 @@
config agent
option agentaddress 'UDP:161,UDP6:161'
config agentx
option agentxsocket '/var/run/agentx.sock'
config com2sec 'public'
option secname 'ro'
option source 'default'
option community 'fsr'
config com2sec 'private'
option secname 'rw'
option source 'localhost'
option community 'private'
config com2sec6 'public6'
option secname 'ro'
option source 'default'
option community 'fsr'
config com2sec6 'private6'
option secname 'rw'
option source 'localhost'
option community 'private'
config group 'public_v1'
option group 'public'
option version 'v1'
option secname 'ro'
config group 'public_v2c'
option group 'public'
option version 'v2c'
option secname 'ro'
config group 'public_usm'
option group 'public'
option version 'usm'
option secname 'ro'
config group 'private_v1'
option group 'private'
option version 'v1'
option secname 'rw'
config group 'private_v2c'
option group 'private'
option version 'v2c'
option secname 'rw'
config group 'private_usm'
option group 'private'
option version 'usm'
option secname 'rw'
config view 'all'
option viewname 'all'
option type 'included'
option oid '.1'
config access 'public_access'
option group 'public'
option context 'none'
option version 'any'
option level 'noauth'
option prefix 'exact'
option read 'all'
option write 'none'
option notify 'none'
config access 'private_access'
option group 'private'
option context 'none'
option version 'any'
option level 'noauth'
option prefix 'exact'
option read 'all'
option write 'all'
option notify 'all'
config system
option sysLocation 'office'
option sysContact 'bofh@example.com'
option sysName 'HeartOfGold'
config exec
option name 'filedescriptors'
option prog '/bin/cat'
option args '/proc/sys/fs/file-nr'
config engineid
option engineidtype '3'
option engineidnic 'eth0'
config snmpd 'general'
option enabled '1'
config extend 'battery_charge'
option name 'battery_charge'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost battery.charge'
config extend 'battery_runtime'
option name 'battery_runtime'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost battery.runtime'
config extend 'ups_load'
option name 'ups_load'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost ups.load'
config extend 'input_voltage'
option name 'input_voltage'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost input.voltage'
config extend 'output_voltage'
option name 'output_voltage'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost output.voltage'
config extend 'ups_status'
option name 'ups_status'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost ups.status'
config extend 'battery_temp'
option name 'battery_temp'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost battery.temperature'
config extend 'battery_voltage'
option name 'battery_voltage'
option prog '/usr/bin/upsc'
option args 'tripplite@localhost battery.voltage'

View File

@@ -0,0 +1,17 @@
config wifi-device 'radio0'
option type 'mac80211'
option path 'platform/ahb/18100000.wmac'
option band '2g'
option channel '1'
option htmode 'HT20'
option disabled '0'
config wifi-iface 'default_radio0'
option device 'radio0'
option network 'wifi_ap'
option mode 'ap'
option ssid 'First Step Internet'
option encryption 'psk2'
option key '12345678'

View File

@@ -0,0 +1,21 @@
#!/bin/sh
# Auto-restart NUT when Tripp Lite UPS is plugged/unplugged
UPS_VENDOR="09ae"
case "$ACTION" in
add)
if echo "$PRODUCT" | grep -qi "^${UPS_VENDOR}"; then
# Fix USB device permissions so NUT driver (nut user) can access it
[ -n "$DEVNAME" ] && chmod 0660 "/dev/$DEVNAME" && chown root:nut "/dev/$DEVNAME"
logger -t NUT "Tripp Lite UPS connected (PRODUCT=$PRODUCT) - restarting NUT"
sleep 3
/etc/init.d/nut-server restart
fi
;;
remove)
if echo "$PRODUCT" | grep -qi "^${UPS_VENDOR}"; then
logger -t NUT "Tripp Lite UPS disconnected - restarting NUT"
/etc/init.d/nut-server restart
fi
;;
esac

8
backup/etc/rc.local Normal file
View File

@@ -0,0 +1,8 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
mkdir -p /var/etc/nut
chgrp nut /var/etc/nut
chmod 750 /var/etc/nut
exit 0

Binary file not shown.

100
backup/www/cgi-bin/wifi.cgi Executable file
View File

@@ -0,0 +1,100 @@
#!/bin/sh
urldecode() {
echo -e "$(echo "$1" | sed "s/+/ /g; s/%\([0-9A-Fa-f][0-9A-Fa-f]\)/\\\\x\1/g")"
}
if [ "$REQUEST_METHOD" = "POST" ]; then
read -n "$CONTENT_LENGTH" POST_DATA 2>/dev/null
action=$(echo "$POST_DATA" | tr "&" "\n" | grep "^action=" | cut -d= -f2-)
new_ssid=$(echo "$POST_DATA" | tr "&" "\n" | grep "^ssid=" | cut -d= -f2-)
new_key=$(echo "$POST_DATA" | tr "&" "\n" | grep "^key=" | cut -d= -f2-)
new_ssid=$(urldecode "$new_ssid")
new_key=$(urldecode "$new_key")
case "$action" in
toggle)
disabled=$(uci get wireless.radio0.disabled 2>/dev/null || echo 0)
if [ "$disabled" = "1" ]; then
uci set wireless.radio0.disabled="0"
uci commit wireless
wifi up &
else
uci set wireless.radio0.disabled="1"
uci commit wireless
wifi down &
fi
;;
update)
[ -n "$new_ssid" ] && uci set wireless.default_radio0.ssid="$new_ssid"
[ -n "$new_key" ] && [ ${#new_key} -ge 8 ] && uci set wireless.default_radio0.key="$new_key"
uci commit wireless
wifi reload &
;;
esac
fi
disabled=$(uci get wireless.radio0.disabled 2>/dev/null || echo 0)
ssid=$(uci get wireless.default_radio0.ssid 2>/dev/null)
[ "$disabled" = "1" ] && wstatus="Disabled" && wcolor="#dc2626" && toggle_lbl="Enable WiFi" \
|| wstatus="Enabled" && wcolor="#16a34a" && toggle_lbl="Disable WiFi"
echo "Content-Type: text/html"
echo ""
cat << HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WiFi Control</title>
<style>
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#f1f5f9;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}
.card{background:#fff;border-radius:12px;box-shadow:0 4px 6px rgba(0,0,0,.1);padding:32px;width:100%;max-width:400px}
h1{font-size:1.3rem;color:#0f172a;margin-bottom:20px}
.status{display:flex;align-items:center;gap:10px;background:#f8fafc;border-radius:8px;padding:12px 16px;margin-bottom:20px}
.dot{width:10px;height:10px;border-radius:50%;background:${wcolor};flex-shrink:0}
.slabel{font-size:.8rem;color:#64748b}
.sval{font-weight:700;color:${wcolor}}
.ssid{font-size:.85rem;color:#475569;margin-top:2px}
.btn{width:100%;padding:11px;border:none;border-radius:8px;font-size:.9rem;font-weight:600;cursor:pointer}
.btn-toggle{background:#0f172a;color:#fff;margin-bottom:20px}
.btn-toggle:hover{background:#1e293b}
.divider{border:none;border-top:1px solid #e2e8f0;margin-bottom:20px}
label{display:block;font-size:.75rem;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.05em;margin-bottom:5px}
input{width:100%;padding:9px 12px;border:1px solid #e2e8f0;border-radius:8px;font-size:.9rem;margin-bottom:14px;outline:none}
input:focus{border-color:#0284c7;box-shadow:0 0 0 2px rgba(2,132,199,.15)}
.btn-save{background:#0284c7;color:#fff}
.btn-save:hover{background:#0369a1}
.note{font-size:.75rem;color:#94a3b8;margin-top:12px;text-align:center}
</style>
</head>
<body>
<div class="card">
<h1>WiFi Control</h1>
<div class="status">
<div class="dot"></div>
<div>
<div class="slabel">Status: <span class="sval">${wstatus}</span></div>
<div class="ssid">SSID: ${ssid}</div>
</div>
</div>
<form method="POST">
<input type="hidden" name="action" value="toggle">
<button class="btn btn-toggle">${toggle_lbl}</button>
</form>
<hr class="divider">
<form method="POST">
<input type="hidden" name="action" value="update">
<label>SSID</label>
<input type="text" name="ssid" value="${ssid}" placeholder="Network name">
<label>Password <span style="font-weight:400;text-transform:none">(min 8 chars — blank = no change)</span></label>
<input type="password" name="key" placeholder="••••••••">
<button class="btn btn-save">Save &amp; Apply</button>
</form>
<p class="note">Changes apply within ~5 seconds</p>
</div>
</body>
</html>
HTML