|
|
#1 (permalink) |
|
Untanglit
Join Date: Apr 2009
Posts: 25
![]() |
As we well know, using these two items together is not supported. The captive portal ALWAYS blocks the website and forces authentication even if the user has already been authenticated through the ADLS.
So, I set out tonight to find out how to bypass that. And I think I have come up with a clever way to do it. I'd like to run it by you guys and see if any people with more knowledge of untangle can point out where there might be problems with this. SO far it appears to work properly. I created two new .php files in the /usr/shared/untangle/web/cpd folder. One called opencpd.php : Code:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
system("/usr/bin/sudo ipset -A cpd-ipv4-authenticated $ip");
system("/usr/bin/sudo ipset -D cpd-ipv4-expired $ip");
?>
Code:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
system("/usr/bin/sudo ipset -D cpd-ipv4-authenticated $ip");
?>
Code:
www-data ALL=NOPASSWD: /usr/sbin/ipset Code:
command2 = "http://" + ServerName + "/cpd/opencpd.php" AJAX.Open "GET", command2 AJAX.Send "" Code:
'Handle or Ignore all errors
On Error Resume Next
If WScript.Arguments.Count = 1 Then
ServerName = WScript.Arguments.Item(0)
Else
ServerName = "10.0.5.250"
End If
'WScript.Echo "ServerName is:"
'WScript.Echo ServerName
Set AJAX = CreateObject("MSXML2.ServerXMLHTTP")
command2 = "http://" + ServerName + "/cpd/closecpd.php"
'WScript.Echo command
AJAX.Open "GET", command2
AJAX.Send ""
I discovered that the Captive Portal places an entry in iptables using ipset that causes an IP address to bypass the captive portal login. It will remove the entry when the session times out or the user logs out. So, I granted apache and my PHP scripts the ability to run the ipset command as root using the sudoers file. Then, I created those two scripts to add an entry using ipset, and to remove an entry using ipset. When the script is called it identifies the IP address of the client and adds an entry for that client to the ipset table associated with captive portal so that it can bypass the portal login. I then modified the login script to call the opencpd.php script and bypass the portal, and I created the logoff script to call closecpd.php to activate the portal again. By using this method I am able to get my users authenticated with the AD login script and they never see a captive portal login. However, users who are not on the domain and do not run the AD login script see the captive portal to authenticate. An extra rack can than be added in policy manager to route all unauthenticated users through a web filter that blocks all access. Forcing everyone to authenticate, either automatically with the login script for computers on the domain, or manually with the captive portal for those that like to come and go with their laptops and other devices. Reporting is handled normally, and users are correctly identified. Anybody see any problems with this? Last edited by appleoddity; 08-25-2010 at 01:48 AM.. |
|
|
|
|
#2 (permalink) |
![]() |
Good to know, i wasn't aware you couldn't use both.
__________________
Def1:Started:UT 7.1 x64 -- Current :UT 9.1 x64| Gigabyte GM-G31 mATX | Intel Q8200 | 8G DDR2 800 | 80G WD | 4x Intel Pro 1000 GT NIC's | Corsair 550W PSU | Norco RPC-250 2U Case | 50mb/50mb | 10 users |
|
|
|
|
#3 (permalink) |
|
Untangler
Join Date: May 2008
URLs submitted: 2
Posts: 57
![]() |
How is this solution working for you? I've been looking to do exactly this, but don't have the neccesary skill
![]() Untangle team, any chance of seeing this (or something similar) folded into the product? Thanks, Tim |
|
|
|
|
#4 (permalink) |
|
Master Untangler
Join Date: Mar 2010
Location: York, NE
Posts: 405
![]() |
I'm looking into a different strategy - use the login script my admin and lab subnet, and captive portal for my student and wireless subnets. There will be no capture rule in captive portal for most users that log in to the domain, and those few that do via wireless will just have to deal with the capture page.
__________________
Three time Microsoft ASP.Net MVP managing an IBM System x3250 / X3440 / 8GB with Untangle 9.1 to protect 40Mbits for 450+ residential college students and associated staff and faculty |
|
|
|
|
#6 (permalink) |
|
Untangle Junkie
![]() Join Date: Nov 2006
Location: San Mateo, CA
URLs submitted: 10
Posts: 10,189
![]() |
It has been.
I dont remember the URL, but you can logout by hitting it.
__________________
Attention: Support and help on the Untangle Forums is provided by volunteers and community members like yourself. If you need Untangle support please call or email support@untangle.com |
|
|
|
|
#7 (permalink) |
|
Master Untangler
Join Date: May 2009
Location: OKC, OK
Posts: 132
![]() |
So Just to be clear. I can just install the rack item for captive portal on my UT box and without any further effort on my part, those people that aren't connected through the AD script will be required to log in through the captive portal, and those that ARE connected through the AD script will never see a difference? If so you guys are awesome! If not you're still awesome but I'm wearing a sad face.
Thanks for your help, BOFH |
|
|
|
|
#8 (permalink) |
|
Untangle Junkie
![]() Join Date: Nov 2006
Location: San Mateo, CA
URLs submitted: 10
Posts: 10,189
![]() |
Sorry, I was talking about the logoff script.
There is still no logon script to my knowledge. btw, just glancing at the code above I can tell you it wont work. It will appear to work but the ipset data will be inconsistent with the database. I guess that isn't the end of the world, but I wouldn't be surprised if you get weird side effects.
__________________
Attention: Support and help on the Untangle Forums is provided by volunteers and community members like yourself. If you need Untangle support please call or email support@untangle.com |
|
|
|
|
#9 (permalink) | |
![]() ![]() Join Date: Jul 2010
Location: sfba
URLs submitted: 1
Posts: 1,035
![]() |
Quote:
|
|
|
|
![]() |
| Thread Tools | |
|
|