Autenticazione NTLM in Squid

From RVM Wiki
Revision as of 17:51, 24 November 2005 by Gabriele.vivinetto (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


E' possibile usare l'autenticazione Windows per accedere trasparentemente a Squid, con Internet Explorer senza che venga richiesta la password, e con richiesta di utente e password per altri browser.

Configurazione di Squid

Inserire le seguenti direttive in /etc/squid.conf nelle posizioni indicate dai commenti presenti nel file (leggi: le direttive devono essere nell'ordine indicato, altrimenti squid non parte):

auth_param ntlm program /usr/lib/squid/ntlm_auth DOMINIO/SERVER_PDC DOMINIO/SERVER_BDC
auth_param ntlm children 10 
auth_param ntlm max_challenge_reuses 2 
auth_param ntlm max_challenge_lifetime 15 minutes 
auth_param ntlm use_ntlm_negotiate off
# queste direttive configurano l'external authenticator NTLM
#...
#...
acl wuagent browser Windows Update Control
acl wuagent browser Microsoft WU Client/2.0
acl wuagent browser Microsoft BITS/6.6
acl wuagent browser Industry Update Control
acl wu dstdomain .microsoft.com .windowsupdate.com .windows.com .public-trust.com
acl naiagent browser McAfee AutoUpdate
acl nai dstdomain .nai.com
acl java_jvm browser Java/1.4
acl java_jvm browser Java/1.5
# queste direttive definiscono delle acl
#...
#...
acl Authenticated proxy_auth REQUIRED
acl Lan_1 src 192.168.0.0/255.255.255.0
# queste direttive definiscono che l'autenticazione è obbligatoria e definiscono la lan autorizzata
#...
#...
http_access allow wuagent wu
http_access allow naiagent nai
http_access allow java_jvm
# windowsupdate, l'update di mcafee antivirus, e Java, possono uscire sena autenticazione (WU non usa ntlm, e nemmeno NAI, così come il Java, che potrebbe dare un errore di java.lang.nullPointerException)
#...
#...
http_access allow Lan_1 Authenticated
# tutti i client della Lan si devono autenticare
#...

Verificare che la macchina su cui gira squid risolva il nome SERVER_PDC:

ping SERVER_PDC

Se così non fosse, modificare la configurazione DNS o aggiungere la relativa voce in /etc/hosts.

Test Configurazione

Riavviare squid

/etc/init.d/squid stop ;  /etc/init.d/squid start

Verificare che non ci siano errori:

tail /var/log/squid/cache.log

2005/09/22 16:43:26| Done reading /var/spool/squid swaplog (11254 entries)
2005/09/22 16:43:26| Finished rebuilding storage from disk.
2005/09/22 16:43:26|     11254 Entries scanned
2005/09/22 16:43:26|         0 Invalid entries.
2005/09/22 16:43:26|         0 With invalid flags.
2005/09/22 16:43:26|     11254 Objects loaded.
2005/09/22 16:43:26|         0 Objects expired.
2005/09/22 16:43:26|         0 Objects cancelled.
2005/09/22 16:43:26|         0 Duplicate URLs purged.
2005/09/22 16:43:26|         0 Swapfile clashes avoided.
2005/09/22 16:43:26|   Took 0.5 seconds (22411.0 objects/sec).
2005/09/22 16:43:26| Beginning Validation Procedure
2005/09/22 16:43:26|   Completed Validation Procedure
2005/09/22 16:43:26|   Validated 11254 Entries
2005/09/22 16:43:26|   store_swap_size = 92156k
2005/09/22 16:43:27| storeLateRelease: released 0 objects

E che sia attivo:

pstree -p 
...
        ??squid(5286)???squid(5288)???ntlm_auth(5290)
        ?                           ??ntlm_auth(5291)
        ?                           ??ntlm_auth(5292)
        ?                           ??ntlm_auth(5293)
        ?                           ??ntlm_auth(5294)
        ?                           ??ntlm_auth(5295)
        ?                           ??ntlm_auth(5296)
        ?                           ??ntlm_auth(5297)
        ?                           ??ntlm_auth(5298)
        ?                           ??ntlm_auth(5299)
        ?                           ??unlinkd(5300)
...

Loggarsi da una macchina windows, autenticandosi nel dominio.

Impostare il proxy

Dovrebbe essere possibile navigare immediatamente

Se invece si prova ad utilizare Mozilla, viene richiesta l'autenticazione. In questo caso inserire username e password del proprio login di rete.

Per la gestione dei problemi con Java: Problemi comuni con NTLM - Java runtime

NTLM Authentication - Squid Book