Configuring A Squid Server To Authenticate Off Active Directory
Configuring A Squid Server To Authenticate Off Active Directory
Warning: Any example presented here is provided "as-is" with no support or guarantee of
suitability. If you have any further questions about these examples please email the squid-users
mailing list.
Contents
Basic Concepts
In this example, a Squid installation will use the Samba ntlm_auth helper to authenticate against
an Windows Active Directory. The server will be joined to the Active Directory domain and
other services can use the ntlm_auth helper to authenticate users (but be out of the scope of this
document.)
Environment
Windows Server 2003 AD
Ubuntu Dapper installation
Squid-2.6
Kerberos 5
Samba + Winbind
NTP server running on AD controller
Packages to install
samba (3)
ntp-server (Kerberos requires time-synchronised machines)
krb5-doc, krb5-config, krb5-user, libkerb53, libkadm55 (Kerberos related user libraries)
winbind
Files to modify
/etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/ksadmind.log
[libdefaults]
default_realm = DOMAIN.COM.AU.
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
forwardable = yes
default_tgs_enctypes = DES-CBC-CRC DES-CBC-MD5 RC4-HMAC
default_tkt_enctypes = DES-CBC-CRC DES-CBC-MD5 RC4-HMAC
preferred_enctypes = DES-CBC-CRC DES-CBC-MD5 RC4-HMAC
[realms]
DOMAIN.COM.AU = {
kdc = ad-master.domain.com.au.:88
admin_server = ad-master.domain.com.au.:749
default_domain = domain.
}
[domain_realm]
.domain. = DOMAIN.COM.AU.
domain. = DOMAIN.COM.AU.
[kdc]
profile = /var/kerberos/krb5kdc/kdc.conf
[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false
}
/etc/samba.smb.conf
[global]
netbios name = SERVERNAME
workgroup = DOMAIN
realm = DOMAIN.COM.AU
server string = Domain Proxy Server
encrypt passwords = yes
security = ADS
password server = ad-master.domain.com.au
log level = 3
log file = /var/log/samba/%m.log
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
printcap name = /etc/printcap
preferred master = No
dns proxy = No
ldap ssl = no
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind use default domain = yes
cups options = raw
/var/kerberos/krb5kdc/kdc.conf
[kdcdfefaults]
acl_file = /var/kerberos/krb5kdc/kadm5.acl
dict_file = /usr/share/dict/words
admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
v4_mode = noreauth
[libdefaults]
default_realm = DOMAIN.
[realms]
DOMAIN. = {
master_key_type = des-cbc-crc
supported_enctypes = des3-hmac-sha1:normal arcfour-hmac:normal
des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal des-cbc-crc:v4 des-
cbc-crc:afs3
}
/var/kerberos/krb5kdc/kadm5.acl
*/[email protected] *
eg
kinit [email protected].
You may need to do this a couple of times - it may take a while and fail; so try it once again.
eg
This will also take some time and may need to be repeated. It should eventually tell you that the
server successfully joined the domain.
# /etc/init.d/samba restart
# /etc/init.d/winbind restart
'wbinfo' can tell you whether winbind has successfully negotiated and joined the network:
ntlm_auth requires access to the privileged winbind pipe in order to function properly. You
enable this access by adding the security user Squid runs as to the winbindd_priv group.
the default user Squid is bundled as nobody though some distribution packages are
built with squid or proxy or other similar low-access user.
Squid Configuration
As Samba-3.x has it's own authentication helper there is no need to build any of the Squid
authentication helpers for use with Samba-3.x (and the helpers provided by Squid won't work if
you do). You do however need to enable support for the NTLM scheme if you plan on using this.
Also you may want to use the wbinfo_group helper for group lookups
--enable-auth="ntlm,basic"
--enable-external-acl-helpers="wbinfo_group"
Before going further, test basic Squid functionality. Make sure squid is functioning without
requiring authorization.
Testing the winbind ntlm helper is not really possible from the command line, but the winbind
basic authenticator can be tested like any other basic helper. Make sure to run the test as your
cache_effective_user
# /usr/local/bin/ntlm_auth --helper-protocol=squid-2.5-basic
mydomain+myuser mypasswd
OK
The helper should return "OK" if given a valid username/password. + is the domain separator
set in your smb.conf
squid.conf Settings
Add the following to enable both the winbind basic and ntlm authenticators. IE will use ntlm and
everything else basic:
If no usernames appear in access.log and/or no password dialogs appear in either browser, then
the acl/http_access portions of squid.conf are not correct.
Note that when using NTLM authentication, you will see two "TCP_DENIED/407" entries in
access.log for every request. This is due to the challenge-response process of NTLM.