Page 1 of 1

Need to hire script consultant

Posted: Tue Nov 20, 2018 12:42 am
by bridgh20
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.

Re: Need to hire script consultant

Posted: Tue Nov 20, 2018 9:30 am
by Jotne
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

Re: Need to hire script consultant

Posted: Tue Nov 20, 2018 4:17 pm
by bridgh20
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.

Re: Need to hire script consultant

Posted: Tue Nov 20, 2018 4:35 pm
by Jotne
The script I posted, did it now work?

Re: Need to hire script consultant

Posted: Tue Nov 20, 2018 5:33 pm
by bridgh20
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

Re: Need to hire script consultant

Posted: Tue Nov 20, 2018 6:15 pm
by Jotne
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 {}

Re: Need to hire script consultant

Posted: Wed Nov 21, 2018 4:20 pm
by Steveocee
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.