Community discussions

MikroTik App
 
sandip08
just joined
Topic Author
Posts: 10
Joined: Wed Apr 04, 2007 2:04 pm

problem in authentication using radius server in mikrotik

Sun May 25, 2014 5:18 pm

I want to authenticate each connected user using wired connection. So i use Freeradius server along with mikrotik.
I want to make a simple change. I don't want to use default authentication page provided by mikrotik, apart from it i want to use my own mechanism that request to authenticate to mikrotik.

Example of scenario

My application to authenticate ==> Mikrotik ==> Radius server


Kindly guide me that is it possible or not??
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Sun May 25, 2014 5:27 pm

I want to authenticate each connected user using wired connection. So i use Freeradius server along with mikrotik.
I want to make a simple change. I don't want to use default authentication page provided by mikrotik, apart from it i want to use my own mechanism that request to authenticate to mikrotik.

Example of scenario

My application to authenticate ==> Mikrotik ==> Radius server


Kindly guide me that is it possible or not??
If you think it is a simple change, it is not a problem. What is your planned mechanism?

Are you using the hotspot to regulate access to the internet?
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 12:40 pm

i m also facing the same problem.

Let me make it clear.

i have created my authentication module in "JAVA" and its a desktop based application. So now i want to send a authentication request to mikrotik. So is it possible? i don't want to use default browser based authentication script provided by mikrotik when we are using hotspot.

In short i want to provide internet access after authentication using my desktop based Login module.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 3:14 pm

If the Java app works like a web client, it should be possible. I'm not saying it would be easy.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 3:56 pm

hey SurferTim

let me tell you my configuration,
i connect a laptop with my authentication application installed to mikrotik on ether1 and on ether9 i connect my freeradius server.
now my authentication module works fine when i request from my laptop to freeradius server.
But my question is how to notify mikrotik about rejection or acceptance of authentication request made by client so that it client can access internet??
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 4:04 pm

You must authenticate through the Mikrotik router. The router must connect to the radius server, get the authentication and return that result to your Java app through a port 80 connection.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 4:08 pm

@SurferTim : so you mean its possible to authenticate using desktop based application to mikrotik??
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 4:12 pm

@SurferTim : so you mean its possible to authenticate using desktop based application to mikrotik??
Of course! Internet Explorer is a desktop app. Chrome is a desktop app. Firefox is a desktop app. Your Java app must emulate those apps to login.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 4:24 pm

@SurferTim : another question is that, mikrotik provides faclility to change look and feel of browser based authentication page.. ri8?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 4:28 pm

Your app need not respond to the "look and feel" stuff. Just the forms. All those web browsers are not returning the "look and feel" stuff to the router, just to you so the display will be pretty. I recommend using http-pap as a login-by setting to start. That way your app doesn't need to do the javascript challenge processing.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 4:34 pm

@SurferTim : do you have any idea that what short of code i should make to send authentication request from my java application??
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 4:37 pm

I'm not sure. I haven't tried it. If you are not using the login-by=http-chap setting, it shouldn't be too bad. Open a port 80 connection to the router, then send a form with the user/password to the correct "page" and wait for a response.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 5:36 pm

@SurferTim : thnx for the help.. If you can tell me the procedure of browser based authentication which is used mikrotik in detail then it can help me a lot..
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 6:14 pm

I enabled my hotspot and tried to login. Then I did a "view source" of the login page (login.html). Here is mine shortened to just the stuff you need. If you are using login-by=http-pap, then this is the form you must submit to the router:
<form name=login action="http://192.168.1.1/login" method="post">
   <input type="hidden" name="dst" value="">
   <input type="hidden" name="popup" value="false">
   <input name="username" type="text" value="myusername">
   <input name="password" type="password" value="mypassword">
   <input type="submit" value="Login">
</form>
The 192.168.1.1 is the router hotspot interface ip in my case. The page is "/login". I entered values for the username and password in the code above. Then wait for the response and see if it worked.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 6:50 pm

ok. let me check that it works for me or not. Do you think that by providing simply username and password using a form we can authenticate our self to mikrotik?
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Mon May 26, 2014 7:08 pm

ok. let me check that it works for me or not. Do you think that by providing simply username and password using a form we can authenticate our self to mikrotik?
It appears so. That is what that form does if using login-by=http-pap.

If you use login-by=http-chap, all bets are off. The chap challenge must be a current value sent by the router embedded in the login page, and the password encrypted with it using MD5. Then the username, encrypted password, and the chap challenge must be sent to the router for authentication.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 10:55 am

can you please send whole code of your mikrotik login page? it will help me lot. i mean i want whole code of login page itself so that i can modify my login page accordingly.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 12:20 pm

@SurferTim : i have tried your suggestion in my local wifi connection and it works great, But if you can provide me full source code which is available when we right click on login page and click on "view page source" then i can make sure that your suggested approach can work work in mikrotik or not.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 2:29 pm

That code was produced by the standard login.html page from my router. I removed the stuff that applied to the login-by=http-chap and the formatting part. Look in your router under /file. It should be in a directory called hotspot/login.html.

The code I posted above was taken from a "view source" to get the ip and page.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 3:08 pm

ya you are ri8. But currently i don't have mikrotik router. So i did my testing on D-link router. it works well. But i want to check make sure for mikrotik it will work as well. So if you can provide me that kind of stuff then it will be better for me.
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 3:16 pm

ya you are ri8. But currently i don't have mikrotik router. So i did my testing on D-link router. it works well. But i want to check make sure for mikrotik it will work as well. So if you can provide me that kind of stuff then it will be better for me.
That doesn't make sense. How can you test a Mikrotik hotspot login on a D-Link router?

But despite that, it works here on my Mikrotik router.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 6:20 pm

i will not check it on D-link but after implementing it i will concern you to help me..can you do this for me??
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 7:29 pm

If I can, I will help.
 
Archit
just joined
Posts: 13
Joined: Mon May 26, 2014 12:25 pm

Re: problem in authentication using radius server in mikroti

Tue May 27, 2014 9:59 pm

thnx for ur support it helps me a lot.

Who is online

Users browsing this forum: deadmaus911, flapviv, Techsystem and 109 guests