pfSense Gold Subscription

Author Topic: Captive Portal on External Server??  (Read 5378 times)

0 Members and 1 Guest are viewing this topic.

Offline rahulmkhj

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Captive Portal on External Server??
« on: February 08, 2012, 06:34:27 am »
Hello Everyone!

I want to put my captive portal pages i.e. splash, login form etc. on some external web server and when user tries to connect redirect them to that (login page on external server) instead of one hosted on pfsense itself. Is that possible??

Thank you,

Rahul

Offline wallabybob

  • Hero Member
  • *****
  • Posts: 5262
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #1 on: February 08, 2012, 04:20:02 pm »
I expect its possible.

What should happen if the external server is unavailable?

Who does the authentication - pfSense or external server? If pfSense, how will you pass the login parameters back to pfSense securely? If external server, how will you pass the authentication result back to pfSense securely?

What "problem" are you trying to solve by doing this? There might be simpler ways of achieving a "similar enough" outcome.

Offline rahulmkhj

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #2 on: May 13, 2012, 04:56:57 am »
Hey,
Sorry for my late reply.

If external server is not available, it ll just not redirect anywhere.. (I'll manage redundant web servers for that ).
authentication will be done by external stand alone radius server only. pfsense is to act as controller only & act upon attributes received from RADIUS server. login parameters can be passed over 443 (https://) or we can MD5 them if on 80(http://).

What I'm trying to do is: we do have a panel for network operators to manage their respective users, and I want to offer them ability to customize login page for their users from within the same panel. That, i think, is not possible.. when hosted on pfsense itself.

Thank you,

Offline miken32

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • Twitter
    • View Profile
    • Website
Re: Captive Portal on External Server??
« Reply #3 on: June 08, 2012, 01:04:25 pm »
This is one of a number of features missing from pfSense to make managing large numbers of servers easier! Imagine having to upload a new HTML file to 50 boxes and you see how tedious it might get.

OP: has a feature request been submitted for this?

Offline dhatz

  • Hero Member
  • *****
  • Posts: 1002
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #4 on: June 08, 2012, 01:13:31 pm »
This is one of a number of features missing from pfSense to make managing large numbers of servers easier!

I believe there is an upcoming product called pfCenter that will take care of this.

Offline dseira

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #5 on: June 19, 2012, 06:53:02 am »
I have the same problem.

 I've made a index.php that redirect to the external page. This external page has the login form (username/password), the problem is that I don't know how to send the user values to the pfSense for make the authentication.


Are there any way to implement this feature in pfSense 2.0? Is it possible?

Thanks.

Offline mdmogren

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #6 on: September 11, 2012, 02:36:33 am »
I came up with this to use an external splash page:

1) Make sure to add the host where you're going to host your page to Allowed Hostnames

2) Use this code to redirect and pass the variables, (I only passed a few here that I needed, you can add more using the same method) the only downside is that if a user has JavaScript disabled in their browser they will have to click a button to load the page...

Make you you replace "http://www.myserver.com/splashpage.php" with the URL you want to redirect to.

Code: [Select]
<script>
document.write('<style>.noscript { display:none }</style>');
</script>
<form action="http://www.myserver.com/splashpage.php" method="post" id="redirectform">
<input type="hidden" name="client_mac" value="$CLIENT_MAC$">
<input type="hidden" name="client_ip" value="$CLIENT_IP$">
<input name="action" type="hidden" value="$PORTAL_ACTION$">
<input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$">
<span class="noscript">Javascript is disabled, click to
<input name="submitx" type="submit" value="Continue" />
</span>
</form>
<script type="text/javascript">
    function doredirect () {
        var frm = document.getElementById("redirectform");
        frm.submit();
    }
    window.onload = doredirect;
</script>

3) You'll then be able to pull on the variables from $_POST on your new page.
Example code for your external page:

Code: [Select]
<form method="post" action="<?php echo $_POST['action']; ?>">
   <input name="auth_user" type="text">
   <input name="auth_pass" type="password">
   <input name="redirurl" type="hidden" value="<?php echo $_POST['redirurl']; ?>">
   <input name="accept" type="submit" value="Log In">
</form>

Offline Caffeine311

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #7 on: November 19, 2012, 03:43:07 pm »
I'm having some trouble with what you posted mdmogren. It redirects to the external portal just fine, but it doesn't seem to want to pass the login information back to pfsense to complete the radius authentication. Am I missing something for radius? No matter what I input for the user/pass, when I click "login" it instantly redirects to the external portals domain followed by "/$PORTAL_ACTION$?auth_user=test&auth_pass=1234&accept=LOGIN"

Code: [Select]
<form action="$PORTAL_ACTION$" align="center"><br />
<img src="../../hotel.png" width="400" height="400" title="" alt="" /><br />
<br /><input name="auth_user" type="text" /><input name="auth_pass" type="password" /><input name="accept" type="submit" value="LOGIN" /></form>

I'm sure i'm missing something stupid. I'm just learning HTML/PHP. I can make everything work if I upload portal directly to pfsense, just not using the external portal which is what I need.

Thanks in advance for any advice.

Offline harshkukreja

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #8 on: July 19, 2013, 02:58:36 pm »
Hi!!

Am also getting the same error while using external portal server for captive portal authentication. Please help if anyone get it resolved

Offline lsense

  • Jr. Member
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Captive Portal on External Server??
« Reply #9 on: July 29, 2013, 04:49:49 am »
try to put variables names within # instead of $ :

"$PORTAL_ACTION$"  -> "#PORTAL_ACTION#"