Community discussions

MikroTik App
 
andreaciacchini
just joined
Topic Author
Posts: 10
Joined: Tue Mar 10, 2015 12:17 pm

Login page hotspot + mysql

Wed Mar 11, 2015 1:57 pm

Hi guys, i have a MikroTik RB750 and i have one hotspot with this.

I would make sure that the login occurs via a control of the correct fields of a database.
I have done many times this type of control, but only for classical websites.
I tried to sign up to a service that offers me a third-level domain for free, and I have hosted all the files related hotspot.
The problem is that when I connect to the hotspot, in the address bar, I see my third-level domain correctly, but does not open the page login.html on the domain, but it opens the page login.html located in vole " files "of WinBox.
I tried to replace the item "Files" of WinBox login.html the file with a file login.php, but if I do this, the login page by mistake and will not open.

- How can I ensure that, when a user needs to authenticate, not to connect to the page login.html on the router, but the page login.html that I have on the third-level domain.


I also read on the internet, doing research, the FreeRADIUS server, that would work perfectly to what I want.
To make that has a DB, where at every login, it checks if the user and password are entered in the DB, it is mandatory to use a server with FreeRADIUS?
Or I can do it via PHP + myphpadmin (MySql) ??

Thank you very much!
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Login page hotspot + mysql

Wed Mar 11, 2015 2:43 pm

To make that has a DB, where at every login, it checks if the user and password are entered in the DB, it is mandatory to use a server with FreeRADIUS?
Or I can do it via PHP + myphpadmin (MySql) ??
Using FreeRADIUS (or simply any RADIUS server...FreeRADIUS being one that conveniently enough uses a MySQL database) is the best option, yes.

The alternative way is using the API protocol*...

With that approach, you'd authenticate the usual way, and on success, over the API protocol, connect to RouterOS, create a temporary (random) hotspot account, and then redirect to
http://{$hotspot}/login?username={$username}&password={$password}
(ideally, you'd want to modify the hotspot to redirect back to the server on both success and failure, but that's optional)
On logout (via a logout script), remove the user.

That second approach is the only way if you need to authenticate against 3rd parties (e.g. facebook, google).

Whether you use RADIUS or PHP+API, you still need an additional OS to run it on. If the router has enough RAM, you could use MetaRouter/KVM to install a virtual machine with Linux, and set up the MySQL+(FreeRADIUS || Apache+PHP) server there.

* If you go on that route, for PHP, I'd recommend my own API client, from my signature... But I'm biased ;) .
 
andreaciacchini
just joined
Topic Author
Posts: 10
Joined: Tue Mar 10, 2015 12:17 pm

Re: Login page hotspot + mysql

Wed Mar 11, 2015 5:05 pm

Thanks man for your answers.
I can install Linux or Ubuntu in a virtual machine with VMware and install on it freeRADIUS?
Thanks man for your help!
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Login page hotspot + mysql

Wed Mar 11, 2015 5:20 pm

No. Not with VMWare... With MetaROUTER or KVM (these are their own things... though I think KVM can run VMWare HDDs). If you're on a RouterBOARD, it's MetaROUTER, and if you're on x86, it's KVM.

Both of these options are a way to run the server on the router itself. If you have an additional device, you could use it directly (with no VM).
 
andreaciacchini
just joined
Topic Author
Posts: 10
Joined: Tue Mar 10, 2015 12:17 pm

Re: Login page hotspot + mysql

Wed Mar 11, 2015 7:05 pm

How i can install your API to my RB750?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Login page hotspot + mysql

Wed Mar 11, 2015 7:09 pm

I have no idea.

I've never used MetaROUTER myself.

Once you install the OS, Apache and PHP, it's as simple as including the ".phar" file from your PHP file.

How do you reach that point with MetaROUTER, I don't know... Besides, RB750 has only 32MB RAM... That's hardly enough for any Linux+MySQL+PHP to run in addition to RouterOS.

I'd recommend you use a separate device for a web & database server.
 
andreaciacchini
just joined
Topic Author
Posts: 10
Joined: Tue Mar 10, 2015 12:17 pm

Re: Login page hotspot + mysql

Wed Mar 11, 2015 7:13 pm

Thanks for your quick reply. I can easily make that the login involves the control of the correct data on a mysql database ?

I am trying to install FreeRADIUS in ubuntu , I hope to do it!
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Login page hotspot + mysql

Wed Mar 11, 2015 7:17 pm

Thanks for your quick reply. I can easily make that the login involves the control of the correct data on a mysql database ?
Well, I told you the "algorithm" above... You said you've previously implemented login systems with PHP and MySQL... So I'd guess it should be easy for you, yes.
 
beetlejuice81
just joined
Posts: 4
Joined: Wed Jan 20, 2016 9:51 am

Re: Login page hotspot + mysql

Wed Jan 20, 2016 10:04 am

Hi!

I have a question.
To make that has a DB, where at every login, it checks if the user and password are entered in the DB, it is mandatory to use a server with FreeRADIUS?
Or I can do it via PHP + myphpadmin (MySql) ??
Using FreeRADIUS (or simply any RADIUS server...FreeRADIUS being one that conveniently enough uses a MySQL database) is the best option, yes.

The alternative way is using the API protocol*...

With that approach, you'd authenticate the usual way, and on success, over the API protocol, connect to RouterOS, create a temporary (random) hotspot account, and then redirect to
http://{$hotspot}/login?username={$username}&password={$password}
(ideally, you'd want to modify the hotspot to redirect back to the server on both success and failure, but that's optional)
On logout (via a logout script), remove the user.
That second approach is the only way if you need to authenticate against 3rd parties (e.g. facebook, google).
Ok, is it the best approach? Is it possibile to connect with my Freeradius Server with PEAR2_Net_RouterOS API?
How I can store accounting requests in freeradius database of hotspot users, please?

Thank you very much.
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Login page hotspot + mysql

Wed Jan 20, 2016 3:21 pm

Ok, is it the best approach?
That's debatable... It's certainly one approach that works.
Is it possibile to connect with my Freeradius Server with PEAR2_Net_RouterOS API?
No. PEAR2_Net_RouterOS is for connecting to RouterOS, not to FreeRADIUS.

FreeRADIUS uses a separate MySQL database, which you can connect to using PHP's mysqli extension.
How I can store accounting requests in freeradius database of hotspot users, please?
By manipulating the FreeRADIUS database I'd guess.

Who is online

Users browsing this forum: Amazon [Bot], holvoetn, phascogale and 44 guests