Table of Contents

About

In practical scenarios it is sometimes useful to have partial access is granted to a network system. One such scenario are guest wireless networks that prove useful in isolating wireless clients from the network, allowing the owner to not reveal the real wireless password but at the same time permitting connecting clients to access the Internet.

This tutorial covers the implementation of sliding key for the wireless password that will be updated every day depending on a preconfigured algorithm. Trivially, the algorithm becomes part of the secret such that any variation is possible.

Adding an OpenWrt Wireless Network

Opening up the page at NetworkWireless will reveal the radios available for the OpenWrt device along with the already configured networks underneath each radio. Pressing the Add button will allow an additional network to be aded and configured

Setup

chmod +x /usr/local/sbin/wireless-sliding-password
opkg update
opkg install micrond
0 0 * * * /usr/local/sbin/wireless-sliding-password >/dev/null 2>&1

How It Works

Every day at midnight, the script will run and update the password for the networks specified by their SSID within the script on the configuration line ``SET_SSID``.

Code

wireless-sliding-password
#!/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

Hardware Displays

In case the password changes daily the owner would have to relay the current password to any guests. However, one interesting turn, depending on the OpenWrt device, would be to attach an LCD/LED to display the password on (or next to the router itself).

On Security...

The scheme provides the following differences to a standard guest network: