We are needing a script added to our config file for the Mikrotik routers we sell to our WISP and Cable System customers. Needs to pull part of the serial number and create a unique SSID and adds the serial number to the Security Profile WPA2 preshared key. Please IM or email me admin@cobasystems.net. Thanks in advance.
You mean some like this?
:local serial ([/system routerboard get serial-number])
/interface wireless security-profiles add authentication-types=wpa2-psk \
management-protection=allowed mode=dynamic-keys name=Serial \
supplicant-identity=MikroTik wpa2-pre-shared-key=$serial
This gives:
/interface wireless security-profiles export
# nov/20/2018 08:41:03 by RouterOS 6.43.4
# software id = 76GC-9ZXX
#
# model = RouterBOARD 941-2nD
# serial number = 661607CXXXXX
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
add authentication-types=wpa2-psk management-protection=allowed mode=dynamic-keys \
name=Serial supplicant-identity=MikroTik wpa2-pre-shared-key=661607CXXXXX
Thanks to all that submitted the security profile script, lots of good folks here. But none of the emails we received addressed the dynamic SSID incorporating a portion of the serial number.
The script I posted, did it now work?
Sorry no.
[admin@MikroTik] > :local serial ([/system routerboard get serial-number])
[admin@MikroTik] >
[admin@MikroTik] > /interface wireless security-profiles add authentication-types=
wpa2-psk
... management-protection=allowed mode=dynamic-keys name=Serial
... supplicant-identity=MikroTik wpa2-pre-shared-key=$serial
failure: WPA2 pre-shared key needs to be 8 to 64 characters
In script it works, but If you like to cut and past it to the terminal, you need two wrap it with {}
So this should work with copy paste to terminal:
{
:local serial ([/system routerboard get serial-number])
/interface wireless security-profiles add authentication-types=wpa2-psk \
management-protection=allowed mode=dynamic-keys name=Serial \
supplicant-identity=MikroTik wpa2-pre-shared-key=$serial
}
For test, you can use this to get the serial number:
:put [/system routerboard get serial-number]
No need to wrap one line with {}
I’ve dropped you an email. My extract has probably 95% of what you need, just need to change the line that grabs the MAC address to grab the SN and you should be good to go.