#!/bin/sh ########################################################################### ## Copyright (C) Wizardry and Steamworks 2022 - License: GNU GPLv3 ## ########################################################################### # This script intends to be ran from crontab every day and will set the # # wireless password to the current date in YYYYMMDD format and its intent # # is to provide a "guest" network whilst still providing encryption. # ########################################################################### ########################################################################### ## CONFIGURATION ## ########################################################################### # Space separated list of wireless SSIDs for which to set the sliding key. SET_SSID='mywifi' ########################################################################### ## INTERNALS ## ########################################################################### PASSWORD=`date +%Y%m%d | \ openssl dgst -md4 -hex | \ awk '{ print $2 }' | cut -c 1-8` i=0 for SET in $SET_SSID; do while :; do SSID=`uci get wireless.@wifi-iface[$i].ssid 2>&1` if [ "$?" = 1 ]; then break fi if [ "$SSID" = "$SET" ]; then echo "Updating sliding key for $SSID..." # Set the sliding key. uci set wireless.@wifi-iface[$i].key="$PASSWORD" # Commit wireless configuration. uci commit wireless # Reload the wifi subsystem. wifi reload fi let "i = i + 1" done done