ubuntu:squid:authenticate_using_active_directory
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
ubuntu:squid:authenticate_using_active_directory [2019/12/10 00:59] – created peter | ubuntu:squid:authenticate_using_active_directory [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ubuntu - Squid - Authenticate using Active Directory ====== | ====== Ubuntu - Squid - Authenticate using Active Directory ====== | ||
- | Introduction | + | ===== Introduction |
- | This wiki page covers setup of a Squid proxy which will seamlessly integrate with Active Directory using Kerberos, NTLM and basic authentication for clients not authenticated via Kerberos or NTLM. | + | Setup of a Squid proxy which will seamlessly integrate with Active Directory using Kerberos, NTLM and basic authentication for clients not authenticated via Kerberos or NTLM. |
- | | + | If you are running Debian or would like more verbose instructions including access groups this [[http://wiki.bitbinary.com/index.php/ |
- | If you are running Debian or would like more verbose instructions including access groups this link may be of interest. | + | ---- |
- | Example Environment | + | ===== Example Environment |
the following examples are utilised, you should update any configuration examples with your clients domain, hostnames, IP's etc. where necessary. | the following examples are utilised, you should update any configuration examples with your clients domain, hostnames, IP's etc. where necessary. | ||
Line 29: | Line 29: | ||
HOSTNAME = dc2.example.local | HOSTNAME = dc2.example.local | ||
- | Prerequisites | + | ---- |
+ | |||
+ | ===== Prerequisites | ||
Client Windows Computers need to have Enable Integrated Windows Authentication ticked in Internet Options ⇒ Advanced settings. | Client Windows Computers need to have Enable Integrated Windows Authentication ticked in Internet Options ⇒ Advanced settings. | ||
- | DNS Configuration | + | ---- |
- | On the Windows DNS server add a new A record entry for the proxy server' | + | ===== DNS Configuration ===== |
+ | |||
+ | On the Windows DNS server add a new A record entry for the proxy server' | ||
Edit the file according to your network. | Edit the file according to your network. | ||
+ | <file bash / | ||
domain example.local | domain example.local | ||
search example.local | search example.local | ||
nameserver 192.168.0.1 | nameserver 192.168.0.1 | ||
nameserver 192.168.0.2 | nameserver 192.168.0.2 | ||
+ | </ | ||
Ping a internal and external hostname to ensure DNS is operating. | Ping a internal and external hostname to ensure DNS is operating. | ||
+ | <code bash> | ||
ping dc1.example.local -c 4 && ping google.com -c 4 | ping dc1.example.local -c 4 && ping google.com -c 4 | ||
+ | </ | ||
Check you can reverse lookup the Windows Server and the local proxy ip from the Windows DNS. | Check you can reverse lookup the Windows Server and the local proxy ip from the Windows DNS. | ||
+ | <code bash> | ||
dig -x 192.168.0.1 | dig -x 192.168.0.1 | ||
dig -x 192.168.0.10 | dig -x 192.168.0.10 | ||
+ | </ | ||
The ANSWER SECTION should contain the the DNS name of dc1.example.local and squidproxy.example.local. | The ANSWER SECTION should contain the the DNS name of dc1.example.local and squidproxy.example.local. | ||
Line 58: | Line 68: | ||
Important: If either lookup fails do not proceed until fixed or authentication may fail. | Important: If either lookup fails do not proceed until fixed or authentication may fail. | ||
- | NTP Configuration | + | ---- |
+ | |||
+ | ===== NTP Configuration | ||
+ | |||
+ | Time needs to be synchronized with Windows Domain Controllers for authentication, | ||
- | Time needs to be syncronised with Windows Domain Controllers for authentication, | + | ---- |
- | Install and Configure Kerberos | + | ===== Install and Configure Kerberos |
Install Kerberos packages - on Debian these are krb5-user libkrb53 | Install Kerberos packages - on Debian these are krb5-user libkrb53 | ||
Line 68: | Line 82: | ||
Edit the file / | Edit the file / | ||
+ | <WRAP warning> | ||
Important: If you only have 1 Domain Controller remove the additional kdc entry from the [realms] section, or add any additional DC's. | Important: If you only have 1 Domain Controller remove the additional kdc entry from the [realms] section, or add any additional DC's. | ||
+ | </ | ||
Depending on your Domain Controller' | Depending on your Domain Controller' | ||
+ | <file bash / | ||
[libdefaults] | [libdefaults] | ||
default_realm = EXAMPLE.LOCAL | default_realm = EXAMPLE.LOCAL | ||
Line 100: | Line 117: | ||
.example.local = EXAMPLE.LOCAL | .example.local = EXAMPLE.LOCAL | ||
example.local = EXAMPLE.LOCAL | example.local = EXAMPLE.LOCAL | ||
+ | </ | ||
+ | <WRAP important> | ||
Important notice: One should use " | Important notice: One should use " | ||
+ | </ | ||
Example error messages regarding this issue may look like this: | Example error messages regarding this issue may look like this: | ||
+ | < | ||
ERROR: Negotiate Authentication validating user. Error returned 'BH gss_accept_sec_context() failed: Unspecified GSS failure. | ERROR: Negotiate Authentication validating user. Error returned 'BH gss_accept_sec_context() failed: Unspecified GSS failure. | ||
+ | </ | ||
- | Install Squid 3 | + | ---- |
+ | |||
+ | ===== Install Squid 3 ===== | ||
We install squid 3 now as we need the squid3 directories available. Squid configuration takes places after authentication is configured. On Debian install the squid3 ldap-utils packages. | We install squid 3 now as we need the squid3 directories available. Squid configuration takes places after authentication is configured. On Debian install the squid3 ldap-utils packages. | ||
- | Authentication | + | ---- |
+ | |||
+ | ===== Authentication | ||
The Proxy uses 4 methods to authenticate clients, Negotiate/ | The Proxy uses 4 methods to authenticate clients, Negotiate/ | ||
- | Kerberos | + | ---- |
+ | |||
+ | ==== Kerberos | ||
Kerberos utilises msktutil an Active Directory keytab manager (I presume the name is abbreviated for " | Kerberos utilises msktutil an Active Directory keytab manager (I presume the name is abbreviated for " | ||
Line 123: | Line 151: | ||
Initiate a kerberos session to the server with administrator permissions to add objects to AD, update the username where necessary. msktutil will use it to create our kerberos computer object in Active directory. | Initiate a kerberos session to the server with administrator permissions to add objects to AD, update the username where necessary. msktutil will use it to create our kerberos computer object in Active directory. | ||
+ | <code bash> | ||
kinit administrator | kinit administrator | ||
+ | </ | ||
It should return without errors. You can see if you succesfully obtained a ticket with: | It should return without errors. You can see if you succesfully obtained a ticket with: | ||
+ | <code bash> | ||
klist | klist | ||
+ | </ | ||
Now we configure the proxy' | Now we configure the proxy' | ||
Line 139: | Line 171: | ||
Execute the msktutil command as follows: | Execute the msktutil command as follows: | ||
+ | <code bash> | ||
msktutil -c -b " | msktutil -c -b " | ||
--computer-name SQUIDPROXY-K --upn HTTP/ | --computer-name SQUIDPROXY-K --upn HTTP/ | ||
+ | </ | ||
Important: If you are using a Server 2008 domain then add --enctypes 28 at the end of the command | Important: If you are using a Server 2008 domain then add --enctypes 28 at the end of the command | ||
Line 148: | Line 182: | ||
Set the permissions on the keytab so squid can read it. | Set the permissions on the keytab so squid can read it. | ||
+ | <code bash> | ||
chgrp proxy / | chgrp proxy / | ||
chmod g+r / | chmod g+r / | ||
+ | </ | ||
Destroy the administrator credentials used to create the account. | Destroy the administrator credentials used to create the account. | ||
+ | <code bash> | ||
kdestroy | kdestroy | ||
+ | </ | ||
On the Windows Server reset the Computer Account in AD by right clicking on the SQUIDPROXY-K Computer object and select "Reset Account", | On the Windows Server reset the Computer Account in AD by right clicking on the SQUIDPROXY-K Computer object and select "Reset Account", | ||
+ | <code bash> | ||
msktutil --auto-update --verbose --computer-name squidproxy-k | msktutil --auto-update --verbose --computer-name squidproxy-k | ||
+ | </ | ||
Note: Even though the account was added in capital letters, the --auto-update in msktutil requires the --computer-name to be lower case. | Note: Even though the account was added in capital letters, the --auto-update in msktutil requires the --computer-name to be lower case. | ||
Line 165: | Line 205: | ||
Add the following to cron so it can automatically updates the computer account in active directory when it expires (typically 30 days). Pipe it through logger so I can see any errors in syslog if necessary. As stated msktutil uses the default / | Add the following to cron so it can automatically updates the computer account in active directory when it expires (typically 30 days). Pipe it through logger so I can see any errors in syslog if necessary. As stated msktutil uses the default / | ||
+ | <code bash> | ||
00 4 * | 00 4 * | ||
+ | </ | ||
Edit squid3' | Edit squid3' | ||
Line 173: | Line 215: | ||
Add the following configuration to / | Add the following configuration to / | ||
+ | <code bash> | ||
KRB5_KTNAME=/ | KRB5_KTNAME=/ | ||
export KRB5_KTNAME | export KRB5_KTNAME | ||
+ | </ | ||
- | NTLM | + | ---- |
+ | |||
+ | ===== NTLM ===== | ||
Install Samba and Winbind. On Debian install samba winbind samba-common-bin | Install Samba and Winbind. On Debian install samba winbind samba-common-bin | ||
Line 182: | Line 228: | ||
Stop the samba and winbind daemons and edit / | Stop the samba and winbind daemons and edit / | ||
+ | <file bash / | ||
workgroup = EXAMPLE | workgroup = EXAMPLE | ||
security = ads | security = ads | ||
Line 191: | Line 238: | ||
winbind enum users = yes | winbind enum users = yes | ||
winbind enum groups = yes | winbind enum groups = yes | ||
+ | </ | ||
Now join the proxy to the domain. | Now join the proxy to the domain. | ||
Line 291: | Line 339: | ||
https:// | https:// | ||
+ | |||
+ | http:// | ||
ubuntu/squid/authenticate_using_active_directory.1575939543.txt.gz · Last modified: 2020/07/15 09:30 (external edit)