[squid-users] Problems authenticating against A.D.

From: Luke Pascoe <luke_at_osnz.co.nz>
Date: Thu, 10 Oct 2013 14:19:45 +1300

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.

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?

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.

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_at_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_at_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_at_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

### 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
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
# DO NOT REMOVE THE FOLLOWING LINE
http_access deny all

http_reply_access deny RestrictedAccess StreamingReply all
http_reply_access deny StandardAccess StreamingReply all

### 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.

### Antivirus
icap_enable on
icap_send_client_ip on
icap_send_client_username on
#icap_client_username_encode off
icap_client_username_header X-Authenticated-User
#icap_preview_enable on
#icap_preview_size 1024
icap_service service_req reqmod_precache bypass=1
icap://localhost:1344/squidclamav
adaptation_access service_req allow all
icap_service service_resp respmod_precache bypass=1
icap://localhost:1344/squidclamav
adaptation_access service_resp allow all

### squid Debian defaults
http_port 3128
icp_port 3130
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320

Thanks

Luke Pascoe

E luke_at_osnz.co.nz

P +64 (9) 296 2961
M +64 (27) 426 6649
W www.osnz.co.nz

24 Wellington St
Papakura
Auckland, 2110
New Zealand
Received on Thu Oct 10 2013 - 01:19:52 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 10 2013 - 12:00:05 MDT