gedankensplitter/openwrt-selfbuild.md

484 lines
10 KiB
Markdown
Raw Normal View History

2022-10-16 08:31:42 +00:00
# openwrt build
2022-10-16 20:16:29 +00:00
## base config
### etc
#### blacklist.dns
```
127.0.0.1 lmlicenses.wip4.adobe.com
127.0.0.1 lm.licenses.adobe.com
127.0.0.1 na1r.services.adobe.com
127.0.0.1 hlrcv.stage.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 activate.adobe.com
```
#### rc.local
```
2023-03-10 07:54:19 +00:00
# iw phy1 set distance auto
2022-10-16 20:16:29 +00:00
touch /var/run/mosquitto.pid
chown mosquitto:mosquitto /var/run/mosquitto.pid
service mosquitto start
/root/precache_dns.sh
```
#### /etc/config/luci
```
config command
option name 'WPS sys@localhost'
option command 'hostapd_cli -i wlan0 wps_pbc'
config command
option name 'WPS sys@legacy'
option command 'hostapd_cli -i wlan1 wps_pbc'
config command
option name 'WPS @ IoT'
option command 'hostapd_cli -i wlan1-1 wps_pbc'
config command
option name 'WOL NAS1'
option command '/usr/bin/etherwake -i br-lan A8:A1:59:51:38:10'
config command
option name 'refreh dynvpn desec'
option command 'curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update.dedyn.io/update?username=koelner.dedyn.io 2>&1 > /dev/null'
```
#### /etc/crontabs/root
```
2023-03-10 07:54:19 +00:00
# 5 */1 * * * curl -s -f -X PUT -u "waenger@googlemail.com:e04d4a9f56cbdd8d6da7fe91119807e7fbb85dba" -d '{"ip_address": "auto"}' https://api.twodns.de/hosts/koelner.dynvpn.de 2>&1 > /dev/null
2022-10-16 20:16:29 +00:00
5 */5 * * * curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update.dedyn.io/update?username=koelner.dedyn.io 2>&1 > /dev/null
#
5 2 * * * curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update.dedyn.io/update?username=geekable.dedyn.io 2>&1 > /dev/null
2023-03-10 07:54:19 +00:00
# 5 */5 * * * curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update6.dedyn.io/update?username=koelner.dedyn.io 2>&1 > /dev/null
# 5 */1 * * * curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update.dedyn.io/update?username=cloud.koelner.dedyn.io 2>&1 > /dev/null
# 5 */1 * * * curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update.dedyn.io/update?username=git.koelner.dedyn.io 2>&1 > /dev/null
# 5 */1 * * * curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update.dedyn.io/update?username=sync.koelner.dedyn.io 2>&1 > /dev/null
# 5 */1 * * * curl -s -f --header "Authorization:Token 367e6bae0552cdfd133a9d222f56dcf9a79a0e99" https://update.dedyn.io/update?username=pyload.koelner.dedyn.io 2>&1 > /dev/null
2022-10-16 20:16:29 +00:00
```
#### /etc/mosquitto/mosquitto.conf
```
acl_file /etc/mosquitto/acl
password_file /etc/mosquitto/passwd
listener 1883
protocol mqtt
max_inflight_messages 20
max_queued_messages 100
allow_zero_length_clientid true
use_username_as_clientid false
pid_file /var/run/mosquitto.pid
sys_interval 60
user mosquitto
```
#### /usr/share/nlbwmon/protocols
`6 22000 syncthing`
### root helper script
#### .profile
```
#!/bin/sh
2023-03-10 07:54:19 +00:00
opkgInstalled="$(opkg list-installed 2> /dev/null | wc -l)" # silencing error output
opkgUpgradable="$(opkg list-upgradable 2> /dev/null | wc -l)" # silencing error output
2022-10-16 20:16:29 +00:00
echo "$opkgInstalled packages are installed." && echo "$opkgUpgradable packages can be upgraded." && echo
echo "Upgrade commands:"
echo "List available updates: opkg list-upgradable"
echo "Upgrade package: upgrade <PACKAGE>"
echo "Upgrade all packages: opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade" && echo
```
#### precache_dns.sh
```
/usr/bin/nslookup google.de 2>&1 >/dev/null &
/usr/bin/nslookup google.com 2>&1 >/dev/null &
/usr/bin/nslookup desec.io 2>&1 >/dev/null &
/usr/bin/nslookup twodns.de 2>&1 >/dev/null &
/usr/bin/nslookup update.dedyn.io 2>&1 >/dev/null &
/usr/bin/nslookup api.twodns.de 2>&1 >/dev/null &
/usr/bin/nslookup fernwartung.dynvpn.de 2>&1 >/dev/null &
/usr/bin/nslookup koelner.dynvpn.de 2>&1 >/dev/null &
/usr/bin/nslookup koelner.dedyn.io 2>&1 >/dev/null &
/usr/bin/nslookup mailbox.org 2>&1 >/dev/null &
/usr/bin/nslookup mail.google.com 2>&1 >/dev/null &
/usr/bin/nslookup github.com 2>&1 >/dev/null &
/usr/bin/nslookup gitlab.com 2>&1 >/dev/null &
/usr/bin/nslookup mozilla.org 2>&1 >/dev/null &
/usr/bin/nslookup startpage.com 2>&1 >/dev/null &
```
#### wifi-reboot.sh
```
#!/bin/sh
# list the interfaces names.
INTERFACES=$(iw dev | awk '$1=="Interface"{print $2}')
# list interfaces that does not have any clients connected.
for INTERFACE in $INTERFACES
do
ASSOC_CLIENTS=`iw dev $INTERFACE station dump | awk '$1=="Station"' | grep -c "Station"`
if [ "$ASSOC_CLIENTS" -lt 1 ]
then
RESTART_LIST="$RESTART_LIST $INTERFACE"
fi
done
if [ ! -z $RESTART_LIST ]
then
echo "$(date +"%F_%T"): restarting wifi - no clients or issues with $RESTART_LIST"
wifi down
sleep 1
wifi up
fi
```
2023-11-04 07:30:21 +00:00
#### wol_nas1.sh
2022-10-16 20:16:29 +00:00
```
/usr/bin/etherwake -i br-lan A8:A1:59:51:38:10
```
2023-11-04 07:30:21 +00:00
#### check-dyndns.sh
```
#!/usr/bin/env ash
echo "current external IP"
curl https://checkipv4.dedyn.io
echo -e "\ndesec.io"
nslookup koelner.dedyn.io 9.9.9.9 | grep "Address"
#echo "dynvpn.de"
#nslookup koelner.dynvpn.de 9.9.9.9 | grep "Address"
```
2022-10-16 08:31:42 +00:00
## package list
#### useful packages
```
2023-01-14 15:54:44 +00:00
ath10k-firmware-qca988x base-files busybox ca-bundle dnsmasq dropbear firewall4 fstools kmod-ath10k kmod-ath9k kmod-gpio-button-hotplug kmod-nft-offload kmod-usb-ledtrig-usbport kmod-usb2 libc libgcc libustream-wolfssl logd mtd netifd nftables odhcp6c odhcpd-ipv6only opkg ppp ppp-mod-pppoe procd procd-seccomp procd-ujail swconfig uboot-envtools uci uclient-fetch urandom-seed urngd
2022-10-16 08:31:42 +00:00
wget-ssl
curl
wireguard-tools
fwknopd
2023-05-07 09:33:02 +00:00
#fwknop
2022-10-16 20:16:29 +00:00
mosquitto-client-ssl
2023-05-07 09:33:02 +00:00
#mosquitto-ssl
2022-10-16 20:16:29 +00:00
stubby
2022-10-16 08:31:42 +00:00
2022-11-01 15:55:51 +00:00
wpad-wolfssl
hostapd-utils
2022-10-16 20:16:29 +00:00
coreutils
coreutils-sort
addrwatch
2022-10-16 08:31:42 +00:00
htop
tmux
2022-10-16 20:16:29 +00:00
vim
2022-10-16 08:31:42 +00:00
zram-swap
luci
luci-ssl
luci-theme-bootstrap
luci-theme-material
2022-10-16 20:16:29 +00:00
luci-app-commands
luci-app-nlbwmon
2023-03-10 07:54:19 +00:00
# luci-app-ntpc chrony-nts
2022-10-16 20:16:29 +00:00
luci-app-upnp
luci-app-wireguard
luci-app-wol
luci-app-fwknopd
2023-05-07 09:33:02 +00:00
#luci-app-mosquitto
2022-10-16 20:16:29 +00:00
luci-proto-wireguard
2022-10-16 08:31:42 +00:00
blkid
block-mount
usbutils
2022-10-16 20:16:29 +00:00
usbids
2023-11-04 07:30:21 +00:00
ugpsd
2022-10-16 20:16:29 +00:00
2023-11-04 07:30:21 +00:00
kmod-nft-dup-inet
2022-10-16 20:16:29 +00:00
kmod-nls-cp437
kmod-nls-cp850
kmod-nls-iso8859-1
kmod-nls-utf8
kmod-loop
kmod-fs-vfat
kmod-usb-serial
kmod-usb-serial-ch341
kmod-usb-serial-cp210x
kmod-usb-serial-ftdi
kmod-usb-serial-pl2303
kmod-usb-storage
kmod-usb-storage-uas
kmod-usb-gadget
kmod-usb-gadget-mass-storage
kmod-usb-gadget-serial
2022-10-16 08:31:42 +00:00
```
2023-11-04 07:30:21 +00:00
###### default 23.05 packages
```
ath10k-firmware-qca988x-ct base-files busybox ca-bundle dnsmasq dropbear firewall4 fstools kmod-ath10k-ct kmod-ath9k kmod-gpio-button-hotplug kmod-nft-offload kmod-usb-ledtrig-usbport kmod-usb2 libc libgcc libustream-mbedtls logd luci mtd netifd nftables odhcp6c odhcpd-ipv6only opkg ppp ppp-mod-pppoe procd procd-seccomp procd-ujail swconfig uboot-envtools uci uclient-fetch urandom-seed urngd wpad-basic-mbedtls
2023-11-16 17:51:49 +00:00
```
###### archer c7 v2 packages current selection
```
addrwatch
ath10k-board-qca988x
ath10k-firmware-qca988x
base-files
blkid
block-mount
btop
busybox
cJSON
ca-bundle
cgi-io
chrony-nts
coreutils
coreutils-sort
curl
dnsmasq
dropbear
etherwake
firewall4
fstools
fwtool
getrandom
hostapd-common
hostapd-utils
htop
iw
iwinfo
jansson4
jshn
jsonfilter
kernel
kmod-ath
kmod-ath10k
kmod-ath9k
kmod-ath9k-common
kmod-cfg80211
kmod-crypto-aead
kmod-crypto-ccm
kmod-crypto-cmac
kmod-crypto-crc32c
kmod-crypto-ctr
kmod-crypto-gcm
kmod-crypto-gf128
kmod-crypto-ghash
kmod-crypto-hash
kmod-crypto-hmac
kmod-crypto-kpp
kmod-crypto-lib-chacha20
kmod-crypto-lib-chacha20poly1305
kmod-crypto-lib-curve25519
kmod-crypto-lib-poly1305
kmod-crypto-manager
kmod-crypto-null
kmod-crypto-rng
kmod-crypto-seqiv
kmod-crypto-sha512
kmod-fs-configfs
kmod-fs-vfat
kmod-gpio-button-hotplug
kmod-ipt-core
kmod-lib-crc-ccitt
kmod-lib-crc32c
kmod-loop
kmod-mac80211
kmod-nf-conntrack
kmod-nf-conntrack-netlink
kmod-nf-conntrack6
kmod-nf-flow
kmod-nf-ipt
kmod-nf-log
kmod-nf-log6
kmod-nf-nat
kmod-nf-reject
kmod-nf-reject6
kmod-nfnetlink
kmod-nft-core
kmod-nft-dup-inet
kmod-nft-fib
kmod-nft-nat
kmod-nft-offload
kmod-nls-base
kmod-nls-cp437
kmod-nls-cp850
kmod-nls-iso8859-1
kmod-nls-utf8
kmod-phy-ath79-usb
kmod-ppp
kmod-pppoe
kmod-pppox
kmod-random-core
kmod-scsi-core
kmod-slhc
kmod-udptunnel4
kmod-udptunnel6
kmod-usb-acm
kmod-usb-core
kmod-usb-ehci
kmod-usb-gadget
kmod-usb-gadget-mass-storage
kmod-usb-gadget-serial
kmod-usb-ledtrig-usbport
kmod-usb-lib-composite
kmod-usb-serial
kmod-usb-serial-ch341
kmod-usb-serial-cp210x
kmod-usb-serial-ftdi
kmod-usb-serial-pl2303
kmod-usb-storage
kmod-usb2
kmod-wireguard
kmod-zram
libatomic1
libblkid1
libblobmsg-json20230523
libc
libcap
libcap-ng
libcares
libcurl4
libevdev
libevent2-7
libevent2-core7
libfko
libgcc1
libgmp10
libgnutls
libip4tc2
libip6tc2
libiptext0
libiptext6-0
libiwinfo-data
libiwinfo20230701
libjson-c5
libjson-script20230523
liblucihttp-ucode
liblucihttp0
libmbedtls12
libmnl0
libmosquitto-ssl
libncurses6
libnettle8
libnftnl11
libnghttp2-14
libnl-tiny1
libopenssl3
libpcap1
libpcre2
libpthread
librt
libstdcpp6
libubox
libubus
libuci
libuclient
libucode
libudev-zero
libusb-1.0-0
libustream-mbedtls20201210
libuuid1
libxtables12
logd
luci
luci-app-commands
luci-app-firewall
luci-app-nlbwmon
luci-app-opkg
luci-app-upnp
luci-app-wol
luci-base
luci-light
luci-mod-admin-full
luci-mod-network
luci-mod-status
luci-mod-system
luci-proto-ipv6
luci-proto-ppp
luci-proto-wireguard
luci-ssl
luci-theme-bootstrap
luci-theme-material
miniupnpd-nftables
2024-04-28 18:51:32 +00:00
mosquitto-ssl
2023-11-16 17:51:49 +00:00
mtd
netifd
nftables-json
nlbwmon
odhcp6c
odhcpd-ipv6only
openwrt-keyring
opkg
ppp
ppp-mod-pppoe
procd
procd-seccomp
procd-ujail
px5g-mbedtls
rpcd
rpcd-mod-file
rpcd-mod-iwinfo
rpcd-mod-luci
rpcd-mod-rrdns
rpcd-mod-ucode
swconfig
terminfo
tmux
uboot-envtools
ubox
ubus
ubusd
uci
uclient-fetch
ucode
ucode-mod-fs
ucode-mod-html
ucode-mod-math
ucode-mod-nl80211
ucode-mod-rtnl
ucode-mod-ubus
ucode-mod-uci
ucode-mod-uloop
ugps
uhttpd
uhttpd-mod-ubus
urandom-seed
urngd
usbids
usbutils
usign
vim
wget-ssl
wireguard-tools
wireless-regdb
wpad-mbedtls
zlib
zram-swap
2023-11-04 07:30:21 +00:00
```
2023-08-10 15:52:26 +00:00
#### chrony-nts
chrony does not support the ref clock via gpsd shm
2022-10-16 08:31:42 +00:00
```
2023-08-10 15:52:26 +00:00
root@heimdall:/tmp/etc/chrony.d# cat /etc/config/chrony
config pool
option hostname 'ptbtime1.ptb.de'
option maxpoll '12'
option iburst 'yes'
option nts '1'
config pool
option hostname 'ptbtime2.ptb.de'
option maxpoll '12'
option iburst 'yes'
option nts '1'
config dhcp_ntp_server
option iburst 'yes'
option disabled 'no'
config allow
option interface 'lan'
config makestep
option threshold '1.0'
option limit '3'
config nts
option rtccheck 'yes'
option systemcerts 'yes'
2022-10-16 08:31:42 +00:00
```