Search squid archive

Re: Problems authenticating against A.D.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/10/2013 2:19 p.m., Luke Pascoe wrote:
Hi all,

I've been banging my head against an auth issue with Squid3 for some
time now, I'm hoping someone here will be able to shine a light on it.

I have installed squid 3 (3.1.20) on Debian 7 (using the Debian package)

I've configured it according to the wiki doc:
http://wiki.squid-cache.org/ConfigExamples/Authenticate/WindowsActiveDirectory

For the most part, this configuration works great. Browsing through a
browser and most applications works fine using SSO.

Indicating that it is unlikely a proxy issue. But it might still be proxy related if the particular apps in question are relying on something unusual in the protocol.

However, some applications fail to authenticate correctly. Notably,
windows update and Microsoft Lync. These attempt to auth using the
logged in user account, fail, then pop up an authentication dialog.
Putting correct credentials into the dialog doesn't work either.

Every test I've run suggests that each of the components are working
correctly. Kerberos is configured correctly, squid_kerb_auth works,
ntlm_auth works as does wbinfo.

TCPDumps of sessions that work (through a browser, IE, Chrome, FF all
work) and ones that don't (Windows update) appear pretty much the
same. In both cases the server provides a challenge and the client
responds (dumps available if you want them)

Here's what I see in cache.log for a successful auth:

2013/10/10 14:02:11| negotiate_wrapper: Got 'YR
TlRMTVNTUAABAAAAl4II4gAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==' from squid
(length: 59).
2013/10/10 14:02:11| negotiate_wrapper: Decode
'TlRMTVNTUAABAAAAl4II4gAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==' (decoded
length: 40).
2013/10/10 14:02:11| negotiate_wrapper: received type 1 NTLM token
2013/10/10 14:02:11| negotiate_wrapper: Return 'TT
TlRMTVNTUAACAAAADgAOADgAAAAVgoniTIZLWbbwZ5wAAAAAAAAAAHAAcABGAAAABgEAAAAAAA9QAEEAQwBJAEYASQBDAAIADgBQAEEAQwBJAEYASQBDAAEADABCAEEAQwBPAE8ATgAEABoAcABhAGMAaQBmAGkAYwAuAGwAbwBjAGEAbAADACgAYgBhAGMAbwBvAG4ALgBwAGEAYwBpAGYAaQBjAC4AbABvAGMAYQBsAAAAAAA=
'
2013/10/10 14:02:11| negotiate_wrapper: Got 'KK
TlRMTVNTUAADAAAAGAAYAIgAAAAYABgAoAAAAA4ADgBYAAAADAAMAGYAAAAWABYAcgAAABAAEAC4AAAAFYKI4gYBsR0AAAAPLtwz2n5LAwh+0a8fdq1dRVAAQQBDAEkARgBJAEMAbgBiAG8AdwBrAGUASABTAE4AWgAtAE4AQgBPAFcASwBFAHv2o2FAquhEAAAAAAAAAAAAAAAAAAAAAMG+Tip01j5dx+x1+2hdSAjkN+OskudoRIttHfifAVCtWaNrbmpBARM='
from squid (length: 271).
2013/10/10 14:02:11| negotiate_wrapper: Decode
'TlRMTVNTUAADAAAAGAAYAIgAAAAYABgAoAAAAA4ADgBYAAAADAAMAGYAAAAWABYAcgAAABAAEAC4AAAAFYKI4gYBsR0AAAAPLtwz2n5LAwh+0a8fdq1dRVAAQQBDAEkARgBJAEMAbgBiAG8AdwBrAGUASABTAE4AWgAtAE4AQgBPAFcASwBFAHv2o2FAquhEAAAAAAAAAAAAAAAAAAAAAMG+Tip01j5dx+x1+2hdSAjkN+OskudoRIttHfifAVCtWaNrbmpBARM='
(decoded length: 200).
2013/10/10 14:02:11| negotiate_wrapper: received type 3 NTLM token
2013/10/10 14:02:11| negotiate_wrapper: Return 'AF = nbowke'

And here's what I see for a failed auth:

2013/10/10 14:02:11| negotiate_wrapper: Got 'YR
TlRMTVNTUAABAAAAl4II4gAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==' from squid
(length: 59).
2013/10/10 14:02:11| negotiate_wrapper: Decode
'TlRMTVNTUAABAAAAl4II4gAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==' (decoded
length: 40).
2013/10/10 14:02:11| negotiate_wrapper: received type 1 NTLM token
2013/10/10 14:02:11| negotiate_wrapper: Return 'TT
TlRMTVNTUAACAAAADgAOADgAAAAVgoniHY15O8+h+dcAAAAAAAAAAHAAcABGAAAABgEAAAAAAA9QAEEAQwBJAEYASQBDAAIADgBQAEEAQwBJAEYASQBDAAEADABCAEEAQwBPAE8ATgAEABoAcABhAGMAaQBmAGkAYwAuAGwAbwBjAGEAbAADACgAYgBhAGMAbwBvAG4ALgBwAGEAYwBpAGYAaQBjAC4AbABvAGMAYQBsAAAAAAA=
'
2013/10/10 14:02:11| negotiate_wrapper: Got 'YR
TlRMTVNTUAADAAAAGAAYAIIAAAAYABgAmgAAAA4ADgBYAAAADAAMAGYAAAAQABAAcgAAABAAEACyAAAAFYKI4gYBsR0AAAAPfygaAzoaCa6+fpmNu2/r21AAQQBDAEkARgBJAEMAZABqAG8AaABuAHMASABBAE0AVgBFAFQAMAAyAOAyYXzujroFAAAAAAAAAAAAAAAAAAAAAFQceVB4lD50mtMNAiSke4gMxp1YqbAVMGv56F/9kmCz3UFpS+lKfgo='
from squid (length: 263).
2013/10/10 14:02:11| negotiate_wrapper: Decode
'TlRMTVNTUAADAAAAGAAYAIIAAAAYABgAmgAAAA4ADgBYAAAADAAMAGYAAAAQABAAcgAAABAAEACyAAAAFYKI4gYBsR0AAAAPfygaAzoaCa6+fpmNu2/r21AAQQBDAEkARgBJAEMAZABqAG8AaABuAHMASABBAE0AVgBFAFQAMAAyAOAyYXzujroFAAAAAAAAAAAAAAAAAAAAAFQceVB4lD50mtMNAiSke4gMxp1YqbAVMGv56F/9kmCz3UFpS+lKfgo='
(decoded length: 194).
2013/10/10 14:02:11| negotiate_wrapper: received type 3 NTLM token
2013/10/10 14:02:11| negotiate_wrapper: Return 'NA =
NT_STATUS_INVALID_PARAMETER'

The only difference I see there is that negotiate_wrapper gives the
prefix "KK" for the successful response, but "YR" for the failed one.
Is it possible negotiate_wrapper is incorrectly classifying the
response?

This explains the KK/YR and rest of the helper protocol you are seeing:
http://wiki.squid-cache.org/Features/AddonHelpers#Negotiate_and_NTLM_Scheme

YR is given when a user sends a new connection without credentials, or if limits areound the re-use of an existing connection token have been exceeded. Normally Type 1 tokens being used to generate Type 2 tokens (from Squid to client).

KK is given when a Negotiate/NTLM handshake is being completed, or on Negotiate/Kerberos handshakes. Normally Type 3 tokens being validated.

I've Googled the crap out of this and haven't found anything useful.

Any suggestions of things I can test, please let me know, I've
completely run out of ideas.

I suggest upgrading your Squid to the 3.3 package available from the sid repository. That can be used on Debian 7 without much trouble and will solve a lot of issues in the 3.1 versions older Debian have.

Thanks.

squid.conf:
------------------------------
----------------
visible_hostname bacoon.pacific.local
err_html_text http://serviceplus/CAisd/pdmweb.exe

### negotiate kerberos and ntlm authentication
auth_param negotiate program /usr/local/bin/negotiate_wrapper -d
--ntlm /usr/bin/ntlm_auth --diagnostics
--helper-protocol=squid-2.5-ntlmssp --domain=PACIFIC --kerberos
/usr/lib/squid3/squid_kerb_auth -d -s GSS_C_NO_NAME
auth_param negotiate children 256
auth_param negotiate keep_alive off

### pure ntlm authentication
auth_param ntlm program /usr/bin/ntlm_auth --diagnostics
--helper-protocol=squid-2.5-ntlmssp --domain=PACIFIC
auth_param ntlm children 256
auth_param ntlm keep_alive off

### provide basic authentication via ldap for clients not
authenticated via kerberos/ntlm
auth_param basic program /usr/lib/squid3/squid_ldap_auth -R -b
"dc=pacific,dc=local" -D bacoon-squid@pacific.local -W
/etc/squid3/ldappass.txt -f sAMAccountName=%s -h hector.pacific.local
auth_param basic children 256
auth_param basic realm Internet Proxy
auth_param basic credentialsttl 5 minute

### ldap authorisation
external_acl_type memberof %LOGIN /usr/lib/squid3/squid_ldap_group -R
-K -b "dc=pacific,dc=local" -D bacoon-squid@pacific.local -W
/etc/squid3/ldappass.txt -f
"(&(objectclass=person)(sAMAccountName=%v)(memberof=cn=%g,ou=Security,ou=Groups,dc=pacific,dc=local))"
-h hector.pacific.local
external_acl_type member2 %LOGIN /usr/lib/squid3/squid_ldap_group -R
-K -b "dc=pacific,dc=local" -D bacoon-squid@pacific.local -W
/etc/squid3/ldappass.txt -f
"(&(objectclass=person)(sAMAccountName=%v)(memberof=cn=%g,ou=Security,ou=Groups,dc=pacific,dc=local))"
-h hector.pacific.local

These two external_acl_type have identical parameters. You can drop one and use the other in its place in all "acl" line definitions.

### Use Goblin as upstream cache, don't cache locally
cache_peer goblin.pacific.local parent 3128 3130 default
cache deny all

### acl for proxy auth and ldap authorizations
acl auth proxy_auth REQUIRED
#   aclname             acltype  typename activedirectorygroup
acl RestrictedAccess    external memberof "/etc/squid3/access_restricted"
acl StandardAccess      external memberof "/etc/squid3/access_standard"
acl FullAccess          external memberof "/etc/squid3/access_full"
acl DomAdmins           external member2 "/etc/squid3/access_admins"

acl whitelist_noauth_dom        dstdomain
"/etc/squid3/whitelist_noauth_domains"
acl whitelist_noauth_url        url_regex -i
"/etc/squid3/whitelist_noauth_urls"
acl whitelist_standard_dom      dstdomain
"/etc/squid3/whitelist_standard_domains"
acl whitelist_standard_url      url_regex -i
"/etc/squid3/whitelist_standard_urls"
acl whitelist_restricted_dom    dstdomain
"/etc/squid3/whitelist_restricted_domains"
acl whitelist_restricted_url    url_regex -i
"/etc/squid3/whitelist_restricted_urls"
acl whitelist_full_dom          dstdomain
"/etc/squid3/whitelist_full_domains"
acl whitelist_full_url          url_regex -i
"/etc/squid3/whitelist_full_urls"

acl StreamingRequest            req_mime_type -i
"/etc/squid3/acl_streaming_mimetypes"
acl StreamingReply              rep_mime_type -i
"/etc/squid3/acl_streaming_mimetypes"

### squid defaults
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl localstuff-nets dst 172.31.0.0/16
acl localstuff-domains dstdomain .pacific.local
acl localstuff-domains dstdomain .hsp.local
acl management src 172.16.0.0/12
acl management src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl SSL_ports port 443
acl Safe_ports port 80          # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl Safe_ports port 70          # gopher
acl Safe_ports port 210         # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280         # http-mgmt
acl Safe_ports port 488         # gss-http
acl Safe_ports port 591         # filemaker
acl Safe_ports port 777         # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost

### http_access rules
# enforce authentication, order of rules is important for authorization levels
http_access allow whitelist_noauth_dom
http_access allow whitelist_noauth_url
# Emergency allow all when things get broken:
#http_access allow all
http_access deny !auth
http_access allow FullAccess
http_access allow DomAdmins
http_access deny StreamingRequest all

Streaming Request is a simple ACL. It does not need to use the "all" hack to suppress any special handling.
   http_access deny StreamingRequest

http_access allow RestrictedAccess whitelist_restricted_dom
http_access allow RestrictedAccess whitelist_restricted_url
# Standard users can see everything restricted users can see, + more
http_access allow StandardAccess whitelist_restricted_dom
http_access allow StandardAccess whitelist_restricted_url
http_access allow StandardAccess whitelist_standard_dom
http_access allow StandardAccess whitelist_standard_url

NP: the whitelist_* ACLs are slightly slow, but not as slow as the external lokup types. If you reverse the order of these ACLs on each line you can reduce the load on your backend authentication systems.

eg:
  http_access allow whitelist_restricted_dom RestrictedAccess
  http_access allow whitelist_restricted_url RestrictedAccess
 ...

# DO NOT REMOVE THE FOLLOWING LINE
http_access deny all

http_reply_access deny RestrictedAccess StreamingReply all
http_reply_access deny StandardAccess StreamingReply all

You can simplify and slightly improve speed by removing the "all" on above http_reply_access lines.

StreamingReply is a non-auth ACL type. By existing after the auth-related ACL test it performs the same suppression as the "all" hack on these lines is designed to do.

Also, what is supposed to happen for all those whitelist_noauth_dom and whitelist_noauth_url transactions? they may very well match these reply rules, and *will* be forced to authenticate before reply delivery due to the *Acces ACL tests being run.

I think you possibly want to add these at the top of your http_reply_access list:
  http_reply_access allow whitelist_noauth_dom
  http_reply_access allow whitelist_noauth_url


### Always use goblin, except for local stuff
never_direct deny localstuff-nets
never_direct deny localstuff-domains
never_direct allow all

### SNMP
acl snmp_public snmp_community public
snmp_port 3401
snmp_access allow snmp_public management
snmp_access deny all

### logging
# don't log allowedsites, prioritysites, AnonymousAccess
#access_log /var/log/squid3/access.log squid !allowedsites
!prioritysites !AnonymousAccess

### SquidGuard
url_rewrite_program /usr/bin/squidGuard
url_rewrite_children 50
url_rewrite_access deny localstuff-nets
url_rewrite_access deny localstuff-domains
url_rewrite_access deny whitelist_restricted_dom
url_rewrite_access deny whitelist_restricted_url
url_rewrite_access deny whitelist_standard_dom
url_rewrite_access deny whitelist_standard_url
url_rewrite_access deny whitelist_full_dom
url_rewrite_access deny whitelist_full_url
url_rewrite_access deny DomAdmins
url_rewrite_access allow FullAccess
# If you're wondering why only FullAccess is allowed above, noone
except FullAccess should even gete to SquidGuard. The default is allow
anyway.

I'm wondering why you still have squidGuard?
 What is it doing that cannot be done in Squid ACLs?

Amos




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux