A "KISS" wifi manager script to push /etc/config/wireless using a central mgmt server

Hi,

I've made a keep it simple and stupid bash script to generate the /etc/config/wireless config files for multiple access points in a business environment and help to push this change out to the devices automatically.

Benefits using the script:

  • A git documentation compatible, granular set of files containing radio and wifi-iface definition for every single radio and WiFi SSID you have to provide in your environment.
  • "Auto-upload" of the generated wireless config files to the devices - or "dry" run mode
  • If you need, for example, to change a PSK on a SSID provided by 5 APs you just edit the wifi-iface/[name_of_ssid] template in one place on your mgmt server and then push changes to all APs by executing
  • "Turn off SSIDs temporarily at night" via cron supported, see example further down.
  • "HA integration" supported, the script can be called from FHEM, iobroker or whatever with the disable-ssid|enable-ssid [SSID] parameters to turn service/guest WiFi on/off on-demand.
# Only generate config files, look with git diff at them if everything is like you want it.
sh /srv/wifimgr/wifimgr.sh dry
#
# Generate and apply the new config to all of your APs
sh /srv/wifimgr/wifimgr.sh

To adjust and use the script according to your needs, you need to do the following simple, quick steps:

  • If you have a TP-Link Archer C7v2|5 (like me), you only need to adjust your country code in the "radio-iface/...radio0", "radio-iface/...radio1" files. If not, copy the radio0/1 parts over from your current /etc/config/wireless of your device.

  • Then, edit "wifi-iface/10-wifi-guest" : e.g. rename it to "corp-ssid" and set encryption and PSK within the file.

  • If you need more SSIDs, just copy the template, e.g. to "wifi-iface/20-wifi-corp" and adjust the values.

I'll later take time to document advanced features. The script can also do cool things like "If you generate config for AP with name 'upstairs', then leave out 'list maclist 'xxxxx''.

You can also use this script from a scheduled cron job on your mgmt server. I personally use it for turning some WiFi SSIDs off at night when I don't need them. In this case, you'd use the "option disable 'x'" instead of setting '1' or '0' explicitly and then call the script like this from "/etc/cron.d/":

# Turn night mode on - disable 'x' marked SSIDs "at night"
sh /srv/wifimgr/wifimgr.sh night
#
# Turn night mode off - Re-enable 'x' marked SSIDs "in the morning"
sh /srv/wifimgr/wifimgr.sh

Example for CLI usage to just turn off/on a certain SSID from the whole set:

sh /srv/wifimgr/wifimgr.sh disable-ssid maintenance-wifi
sh /srv/wifimgr/wifimgr.sh enable-ssid maintenance-wifi
4 Likes

You forgot to publish a link to your script source code.

It’s been years and I do not use it any longer here as is was replaced. If you really need it, contact me via DM please, I’ll send you a copy.