Forum Discussion
LordTanamo_3750
Nimbostratus
May 14, 2009Filter users authenticatiing via NTLM (MOSS) by domain name
Hello,
I was asked to filter certain users by their domain name (domain2\user or user@domain2) which are prohibited to connect to MOSS from the public internet, even though they may connect to the same backend server on a different VS within the corporate network.
There are two VS, both terminate SSL sessions and passing the traffic to the same pool that contains by now only one SharePoint MOSS server, which is member of domain1. There is a trust-relationship between domain 1 and 2.
The MOSS site offers Integrated Windows Authentication (merely NTLM) in order to have LAN-users automatically authenticated and prompt internet users for their credentials. The same LAN users (domain2) are not supposed to access the MOSS site from the public internet on VS. On the other hand certain partners that reside in domain1 may access this site.
I don’t want to setup ACA with LDAP, because users from outside would have to authenticate twice, which is not very fancy. Unfortunately it is not possible to offer a different authentication scheme or set up two MOSS site because then our security officer would go nuts or the URL for internal and external users are not exchangeable. My primary goal is to filter the users from doamin2 when they try to access the VS for public internet users. This works well when I set up MOSS to Basic-Authentication only.
Here is my iRule:
when HTTP_REQUEST {
if { [HTTP::username] matches_regex {([Dd][Oo][Mm][Aa][Ii][Nn]2\\|@[Dd][Oo][Mm][Aa][Ii][Nn]2)} } {
HTTP::respond 200 content {
Apology Page
You are not allowed to authenticate from the public internet
}
} else {
pool Pool_MOSS
}
}
Or
when HTTP_REQUEST {
if { [HTTP::username] matches_regex {([Dd][Oo][Mm][Aa][Ii][Nn]2\\|@[Dd][Oo][Mm][Aa] [Ii][Nn]2)} } {
HTTP::respond 401
} else {
pool Pool_MOSS
}
}
When I run wireshark with unencrypted traffic connecting straight to MOSS without LB I can see the domain name being sent by the client within the NTLMSSP haeader. Is there anyway to . I really tried my best to get this running with http::collect or tcp::collect, but this is tedious and there are also examples for SSL::collect. Also I would prefer sending a HTTP::respond 401 or HTTP::respond 200 content … instead of selecting a different pool, but anyhow my example does not work. Is there any way to get to see the domain name data sent by the client and to filter users that belong to a certain domain2.
when CLIENTSSL_HANDSHAKE {
SSL::collect
}
when CLIENTSSL_DATA {
if { [SSL::payload] matches_regex {([Dd][Oo][Mm][Aa][Ii][Nn]2\\|@[Dd][Oo][Mm][Aa] [Ii][Nn]2)} } {
pool Pool_Error-Page
} else {
pool Pool_MOSS
}
}
Anyone has an idea? I would really appreciate some help. I've also attached a screenshot of my wireshark.
Kind regards
Jackson
- hoolio
Cirrostratus
Hi Jackson,when HTTP_REQUEST { Check for Authorization header value starting with NTLM before trying to parse the request. if {[string tolower [HTTP::header Authorization]] starts_with "ntlm"}{ ...
if {[string match -nocase "*domain2*" [b64decode [getfield [HTTP::header Authorization] " " 2]]]}{ Request was using a domain2 account
Parse the type code (01, 02, 03) in order to determine the message type and corresponding domain name check http://www.innovation.ch/personal/ronald/ntlm.html binary scan [b64decode [getfield [HTTP::header Authorization] " " 2]] H16H2H* unused1 type_code unused2 log local0. "Type: $type_code"
- LordTanamo_3750
Nimbostratus
Thanks Aaron,when HTTP_REQUEST { Check for Authorization header value starting with NTLM before trying to parse the request. if {[string tolower [HTTP::header Authorization]] starts_with "ntlm"}{ if { [b64decode [getfield [HTTP::header Authorization] " " 2]] matches_regex {([Tt].[Ee].[Ss].[Tt].[Dd].[Oo].[Mm].[Aa].[Ii].[Nn])} } { HTTP::respond 200 content { Apology Page You are not allowed to authenticate as your user belongs to testdomain ... } } }}
- hoolio
Cirrostratus
Hi Jackson,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects