www.computing-tips.net - Tips to help you in your computing life




Subscribe to our RSS FEED


Home | Software | Blog |

Article by: Charles M.
Last Modified: 2016-03-05 10:57:58


Solution: M0n0wall Captive Portal Logout URL e.g. http://192.168.1.1/logout

Monowall Captive portal logout

First of all, this howto is not detailed and assumes one nows how to work with PHP (Learn PHP in 17 Hours), Mysql and linux. If not, you can still read through to get the general idea. I will be working on the finer details later - so please keep on checking.

Second, see Freeradius mysql MAC authentication using m0n0wall as NAS for initial configuration before proceeding.

The Issue

M0n0wall is a FreeBSD firewall created by Manuel Kasper with many features. Of interest to us it the captive portal feature. If you would like to see full feature list and stuff that M0n0wall can do for you, you can visit http://m0n0.ch/wall/features.php.

Basically, I run a billing system for my clients. I use an old PC (pentium II) which runs the M0n0wall NAS. I run a seperate Radius server installed with Fedorah 12, Mysql 5.1 and Freeradius 2.0.

Having worked with M0n0wall for a while now, I find it excellent for my Captive Portal requirements, except one thing! The logout process. When a user logs in, the captive portal produces a pop-up logout window so that when the user wants to logout, he/she will click a button on the pop window. The problem is, if a user has a pop-up blocker software installed or he/she accidentally closes the logout pop-up window, he may never be able to logout and his credit will slowly ran out until he reaches the configured idle-timoute period. I needed a solution for that and posted a feature request here, but its not one of the priorities there ;)

This is my personal solution that I use. It may not be the best and infact some of the methods are really crude but the bottom line is it works well for me

Solution: Logout URL - my way!

I did a little bit of study on the source html code of the logout popup window and noticed that, if I could recreate it when I use opens a special logout url then that would be it!

<FORM METHOD="POST" ACTION="http://10.10.10.50:8000/" NAME="LogoutForm">
<INPUT NAME="logout_id" TYPE="hidden" VALUE="3a3829ac3dfe4e8d">
<INPUT NAME="logout" TYPE="submit" VALUE="Logout" style="font-size: 14pt"> <font color='white'<b> <---- Deconnexion!!!</b></font>
</FORM>

I searched for the "logout_id" value "3a3829ac3dfe4e8d" in the accouting table -radacct- of Mysql database  nd found out that its the "acctsessionid" column. Also found out that, its the newest column for that user!  The IP, 10.10.10.50 is the LAN ip of Monowall . So whats needed is only to alter the acctsessionid in red above for any user who wants to be logged out and display the logout form !
The problem that followed was to  identify which user was requesting logout, then search for his acctsessionid and constitute a logout form for him/her to click to logout.

M0n0wall Logout Implimentation example

In this example, the radius server that  has apache webserver configured has an IP address 192.168.1.1 and the M0n0wall LAN ip is 10.10.10.50.

  • User wishing to logout opens http://192.168.1.1/logout
  • A 'login' screen appears and the user logs in with his username and password . NB: this is NOT the captive portal login screen by M0n0wall. (this is the only way to know the client to be logged out)
'Login' infor to collect user credentials
  • User is validated and the newest actsessionid is queried from the database. I use the query:

"SELECT radacctid, AcctStartTime,  acctsessionid FROM `radacct` WHERE  nasporttype IS NOT NULL and username = '". mysql_real_escape_string($myuser) ."' ORDER BY `radacct`.`RadAcctId` DESC LIMIT 0 , 1";
  •  With the returned value I consititute a logout form replacing the acctsessionid whe the resulting value from the above query.

Now the user needs to click logout and is logged out!
You can also use the window to report to the user his/her balance.

Online Store Idea

Share this Article As I was doing this, I realised I could sell small things like CDs, my funny video clips, GSM air time, among other revenue generating items on the logout form. A User logging out, is able to see items that I am selling and on click, he is asked to confirm if he or she would like to purchase the item. Once confirmed, item is charged on his balance . My currency is in minutes. If you bill your clients per Megabyte, then your currency will in in Megabytes.

By adding a record of the expense in Minutes (seconds actually) or Megabytes in  radacct table in Mysql, you can reduce user's online time. M0n0wall has a nice Captive portal feature for reauthenticating every minute. Using this feature, a user can be kicked if he/she purchases an item while online and runs out of balance.  In the example below, as user called 'louis' purchased an item code-named 'BIG_BABY' - actually a short funny clip that my sister did, at the cost of  1,500 seconds of his online time!

Monowal Logout store 'checkout'

Hope this helps someone. I will try to add more details later.





Share

Related Links:

Reader Comments

[2010-08-30] Kanuty says:
Please send me full code. I dn\'t know much in PHP. Need M0n0wall

[2011-01-27] Cibu says:
I found a solution within m0n0wall: I added to * the captive-code disconnection capability for IP * my redirection-page and my main-guest-page a generic logout-button logout by static URL is not possible without reducing security or bigger changes.

[2011-11-23] anania says:
how do i create monowall login page

[2017-01-15] Vicfdiwci says:
#life#is#now#true# essay book in english free download pdf free will writing service edinburgh civil war quiz for 5th graders essay on the uses and abuses of cell phone argumentative essay powerpoint calendar template writing a business plan for a non profit directions essay on judaism christianity and islam five year career plan essays johnny carson biography book discussion questions process essay how to make a friend research paper on hamlet's insanity fernando ortega biography writing samples ap english argument essay jedi alexander graham bell biography kim kardashian hypothesis lesson plans elementary starlito biography usher writing a appeal letter for school emersons essay on friendship Statement Writer personal statement for pharmacy assistant black writing paper gel penspaper writing service canada richard sherman biography david venable qvc married how long is a 800 word essay blessing of hard working essay essay prompts for literature algebra 2 chapter 7 help mary mcleod bethune biography meaning sample argument essay contests literary analysis on hills like white elephants teenage depression free essay conduct disorder case study video games a mothers saying for her son's wedding abortion argument essay about drinking age jayceon terrell taylor biography zinedine zidane Cheap Dissertations personal statement for university dentistry research paper on financial analysis pdf chris quilala biography channel schedule ignou assignments m.com 1st year in hindi clerk cover letter online how to write extended response ess paul rusesabagina biography in context Buy Coursework erik larson biography frank sinatra discussion questions boy in the striped pajamas movie thomas tull biography book report ideas dog accidentally ate valium Homeworkhelpforme Com mla format for 4 or more authors species richness and productivity hypothesis best way to end a cover letter police officer checking research papers selena gomez zimbio oedipus rex arrogance essay jacoby ellsbury biography david venable qvc married hr generalist cover letter quote claude monet biography writing project management cover letter quality engineer cause and effect essay topics immigration fernando valenzuela biography demi lovato format for college admission essay contest 2014 civil engineering cover letter unemployed essay a day in the park hepatitis b case study dissertation essay about the movie beowulf s utah univ tara lipinski biography langston hughes Pay Assignment example of persuasive letter for elementary students textbook solutions college station tx essay i am tomorrow leader esl teacher cover letter for resume writing contests for 14 year olds example writing sample for job compare and contrast essay examples for kids rubric for argumentative essay pdf how to create a good cover letter body sample hayley williams biography books for kids referencing an essay from a book how to create a resume cover letter examples maintenance smu bsc it assignment answers buffalo case studies chemistry research thesis in project management cover letter journal submission by amy waldman persuasive essay on no smoking a tale of two cities book 2 chapter 14 definition essay for heroism good cover letter for administrative assistant position legal essay on patriotism report writing on internship how to write an effective cover letter key points mountain dew case study research design resident advisor essay science coursework 2013 speech essay format uclan dissertation binding tudors season 4 episode 2 formal essay numbers transition words for argumentative essays depot work from home yummy mummy guidelines for writing a composition on arbortion sotomayor biography activities weather report this is this what are the two parts of a body paragraph descriptive type question paper for sbi po anthropological anthropology essay history motive romantic sensibility the devil and tom walker thesis statements my personal rules for dating essay make your research paper longer wallis simpson biography frank sinatra

Post your Comments


Your Name:
Email Address:
Comment:
Bot Check: CAPTCHA Image
Enter the word on image above

No Comments
Home | Privacy | Contact | Disclaimer | Windows Xp
Copyright @ 2010

HostGator promo