Community discussions

 
bridgh20
just joined
Topic Author
Posts: 20
Joined: Sat Sep 27, 2008 7:55 pm
Location: South Texas

Need to hire script consultant

Tue Nov 20, 2018 12:42 am

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.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1303
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Need to hire script consultant

Tue Nov 20, 2018 9:30 am

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
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
bridgh20
just joined
Topic Author
Posts: 20
Joined: Sat Sep 27, 2008 7:55 pm
Location: South Texas

Re: Need to hire script consultant

Tue Nov 20, 2018 4:17 pm

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.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1303
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Need to hire script consultant

Tue Nov 20, 2018 4:35 pm

The script I posted, did it now work?
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
bridgh20
just joined
Topic Author
Posts: 20
Joined: Sat Sep 27, 2008 7:55 pm
Location: South Texas

Re: Need to hire script consultant

Tue Nov 20, 2018 5:33 pm

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
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1303
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Need to hire script consultant

Tue Nov 20, 2018 6:15 pm

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 {}
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
User avatar
Steveocee
Forum Guru
Forum Guru
Posts: 1110
Joined: Tue Jul 21, 2015 10:09 pm
Location: UK
Contact:

Re: Need to hire script consultant

Wed Nov 21, 2018 4:20 pm

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.
Steve "Steveocee" Carter
PC Gamer, Airsofter, MikroTik Nerd
My Website - My MikroTik Tutorials

Who is online

Users browsing this forum: MSN [Bot] and 5 guests