Koozali.org: home of the SME Server

Squid + Ldap

Offline nicolatiana

  • *
  • 724
  • +0/-0
Squid + Ldap
« on: May 26, 2008, 05:53:54 PM »
Sono riuscito a configurare squid per autenticare gli utenti passando attraverso Active Directory (Pdc Windows 2003 Server esistente) via Ldap verificando l'appartenenza dell'utente ad uno di due gruppi (uno autorizzato ad uscire sul web e l'altro no). Il tutto si traduce nella comparsa di un popup che richiede l'introduzione delle credenziali registrate su AD. Il tutto funziona bene.
Qualcuno sa se è possibile rendere la cosa totalmente trasparente, verificando le credenziali dell'utente così come ha avuto accesso al client senza richieste  ulteriori ?

Saluti

Nicola
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Squid + Ldap
« Reply #1 on: May 26, 2008, 07:17:45 PM »
Sorry do not speak Italian, used Google's translation engine, perhaps this is a pointer: http://tldp.org/HOWTO/TransparentProxy-5.html
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Squid + Ldap
« Reply #2 on: May 26, 2008, 09:37:35 PM »
Hi Cactus.. you are everywhere, don't you? :-)

before Nicola puts his hands on masq files as you suggest, I ask him to explain in better way WHAT he has done and HOW ;-)

Ciao

Stefano

p.s. per Nicola.. spiega un po' come sei riuscito a fare la cosa e vediamo se riusciamo ad esserti di aiuto, anche se ho idea che non sia fattibile..

Offline nicolatiana

  • *
  • 724
  • +0/-0
Re: Squid + Ldap
« Reply #3 on: May 26, 2008, 09:50:00 PM »
Questo è lo squid.conf che autentica attraverso ldap (nota: non badate ai path perchè questa è la versione che uso con sles 10  8)) e richiede le credenziali all'utente e lo fa passare se appartiene al gruppo "siweb" e non lo fa passare se appartiene a "noweb". Lo ho fatto con ldap che è un po' più universale e mi permette di dialogare anche con il mondo Netware Oes.
Sospetto anch'io che non si possa fare ma la documentazione di squid è un po' corposa e non sono riuscito a digerirmela ancora tutta.

Saluti

Nicola

Quote
auth_param basic program /usr/sbin/squid_ldap_auth -R -b "dc=labdomain,dc=local" -D "cn=Administrator,cn=Users,dc=labdomain,dc=local" -w "nicola" -f sAMAccountName=%s -h 192.168.0.203
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 5 minutes

external_acl_type InetGroup %LOGIN /usr/sbin/squid_ldap_group -R -b "dc=labdomain,dc=local" -D "cn=Administrator,cn=Users,dc=labdomain,dc=local" -w "nicola" -f "(&(objectclass=person)(sAMAccountName=%v)(memberOf=cn=%a,cn=users,dc=labdomain,dc=local))" -h 192.168.0.203

external_acl_type InetDenyGroup %LOGIN /usr/sbin/squid_ldap_group -R -b "dc=labdomain,dc=local" -D "cn=Administrator,cn=Users,dc=labdomain,dc=local" -w "nicola" -f "(&(objectclass=person)(sAMAccountName=%v)(memberOf=cn=%a,cn=users,dc=labdomain,dc=local))" -h 192.168.0.203

acl localnet proxy_auth REQUIRED src 192.168.0.0/24
acl all src 0.0.0.0/0.0.0.0
acl localhost src 127.0.0.1/255.255.255.255

acl InetAccess external InetGroup siweb
acl InetDeny external InetDenyGroup noweb

http_access allow InetAccess
http_access deny InetDeny
http_access deny all
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Squid + Ldap
« Reply #4 on: May 26, 2008, 10:05:01 PM »
ciao e grazie per la celere risposta..

potresti metterla giù anche in inglese per Cactus (vorrai mica che se la traduca con google :-))?

io intanto mi documento

Ciao

Stefano

P.s. se ti interessa. il mio account messenger è li ;-)

Offline nicolatiana

  • *
  • 724
  • +0/-0
Re: Squid + Ldap
« Reply #5 on: May 27, 2008, 08:54:09 AM »
For Cactus  :-D

Look at the previous reply with my squid.conf quote.

This is the squid.conf authenticating through ldap (do not care path because this is a sles 10 configuration) and is requiring username and password through a popup window: users belonging to "siweb" AD group are allowed e those belonging to "noweb" not. Made with ldap to have something more universal able to speak with Netware Oes. This is working fine.
Now I try to understand if this can be completely transparent, i.e. without a popup but simply checking the current loggedin username group.
I suspect this is not possible without a single-sign-on like instrument but I'm not so expert with squid to understand it.

Saluti

Nicola
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Squid + Ldap
« Reply #6 on: May 27, 2008, 09:00:20 AM »
Ciao Nicola

se non ho capito male il server w2k3 è il DC per il dominio, sme lo usi solo come gateway/proxy.. giusto?

sme è inserito in dominio?

ciao
Stefano

p.s. ti sei creato dei template personalizzati per squid? se si, li condivideresti? se non altro potrei chiedere l'inclusione7inserimento di alcuni valori per il db per squid in modo da implementare la cosa semplicemente con i soliti comandi..

tia

Offline nicolatiana

  • *
  • 724
  • +0/-0
Re: Squid + Ldap
« Reply #7 on: May 27, 2008, 09:14:16 AM »
Si la macchina SME o SLES viaggia per i fatti suoi e non è inserita nel dominio. I dati utente vengono rilevati facendo una query su ldap con un qualsiasi utente autorizzato del dominio. Buona norma creare un utente apposta visto che la passwd in squid.conf è in chiaro.

L'unico template che ho di squid è quello per gestire Windowsupdate che peraltro ho scopiazzato e modificato poc(hissimo) da un post sul forum.
Comunque é:

Quote
#------------------------------------------------------------
#              !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://wiki.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
# 05refreshpattern
# cp 05refreshpattern /etc/e-smith/templates/etc/squid/squid.conf/
# expand-template /etc/squid/squid.conf
# squid -k reconfigure

hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 16 MB
maximum_object_size 1280096 KB
cache_dir ufs /var/spool/squid 3000 16 256

# various windows versions
refresh_pattern http://.*\.windowsupdate\.microsoft\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://.*\.update\.microsoft\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://download\.microsoft\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://windowsupdate\.microsoft\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://office\.microsoft\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://w?xpsp[0-9]\.microsoft\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://w2ksp[0-9]\.microsoft\.com/ 0 80% 20160 reload-into-ims

# and some other windows updaters
refresh_pattern http://download\.macromedia\.com/ 0 80% 20160 reload-into-ims
refresh_pattern ftp://ftp\.nai\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://ftp\.software\.ibm\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://.*\.grisoft\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://download\.lavasoft\.de*/ 0 80% 20160 reload-into-ims
refresh_pattern ftp://ftp\.nai\.com/ 0 80% 20160 reload-into-ims

# repositories
refresh_pattern http://.*\.archive\.ubuntu\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://www\.getautomatix\.com/ 0 80% 20160 reload-into-ims
refresh_pattern http://wine\.budgetdedicated\.com/ 0 80% 20160 reload-into-ims


acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localsrc src 127.0.0.1 192.168.0.0/255.255.252.0
acl localdst dst 127.0.0.1 192.168.0.0/255.255.252.0
acl SSL_ports port 443 563
acl Safe_ports port 21 70 80 81 119 210 443 563 980 1024-65535
acl CONNECT method CONNECT
acl webdav method PROPFIND TRACE PURGE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK
pid_filename /var/log/squid/squid.pid
append_domain .studiolabdomain.it
cache_mgr admin@studiolabdomain.it
ftp_user nobody@studiolabdomain.it
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
http_access allow manager localsrc
http_access deny manager

http_access deny CONNECT !SSL_ports
http_access allow localsrc
http_access deny all

httpd_accel_host virtual
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
icp_access allow all
miss_access allow all

store_avg_object_size 3 KB
always_direct allow webdav
always_direct allow all
---end of file---

Saluti

Nicola
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Squid + Ldap
« Reply #8 on: May 27, 2008, 09:16:58 AM »
ciao

ritengo che se sme fosse inserito in dominio probabilmente non chiederebbe i dati di autenticazione

una prova con una macchina virtuale la farei

my 2€c
Stefano

Offline nicolatiana

  • *
  • 724
  • +0/-0
Re: Squid + Ldap
« Reply #9 on: June 09, 2008, 07:29:12 PM »
Non sono riuscito ancora a fare il test con SME. Sulla macchina del cliente e nel mio lab con SLES 10 (immesso nel dominio) funziona con alcune avvertenze:
- gli utenti autorizzati passano e basta; agli utenti non autorizzati viene presentata una richiesta di autenticazione: vista la manualistica di squid questo comportamento non mi risulta che sia mutabile;
- gli utenti devono essere tutti assegnati ad uno di due gruppi (autorizzati - bloccati) su cui viene fatto il controllo;
- deve essere impostata l'autenticazione integrata in IE;
- l'autenticazione NON può funzionare con un sistema di transaprent proxying (verificato nella manualistica di squid).

Vedere http://www.rogerfavero.it/index.php?mod=linux&Id=1&page=7 (un howto ben fatto).

Attenzione ai permessi di accesso alla cartella: /var/run/samba/winbind_privileged squid deve poterci scrivere

Con LDAP funziona come detto ma richiede sempre le credenziali.

Saluti

Nicola
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline luca219

  • ****
  • 80
  • +0/-0
Re: Squid + Ldap
« Reply #10 on: July 02, 2008, 12:12:48 PM »
vorrei chiedere a nenonano come si può inserire sme server in un dominio microsoft.

grazie

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Squid + Ldap
« Reply #11 on: July 02, 2008, 01:40:34 PM »
vorrei chiedere a nenonano come si può inserire sme server in un dominio microsoft.
grazie

ciao..

ho cercato un po' qui nel forum ma non sono riuscito a trovare quanto ricordo di aver visto

comunque google mi ha dato questo http://lists.contribs.org/pipermail/devinfo/2003-January/004909.html

è per la v. 5.6 o 6.. dovrai testarla

HTH
ciao
Stefano

Offline luca219

  • ****
  • 80
  • +0/-0
Re: Squid + Ldap
« Reply #12 on: July 02, 2008, 04:26:27 PM »
grazie

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Squid + Ldap
« Reply #13 on: July 03, 2008, 10:58:30 AM »
ciao

sotto la spinta di un altro post mi sono un po' documentato..

se devi fare il join ad un dominio NT4 o w2k NON AD le istruzioni che ti ho indicato dovrebbero funzionare senza problemi..

se invece devi fare il join ad un dominio AD allora no, le cose sono decisamente più complesse..

per avere info dai un'occhiata qui: http://www.enterprisenetworkingplanet.com/netos/article.php/3487081, qui http://www.brentnorris.net/samba2005.html e qui http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/domain-member.html

HTH
Ciao
Stefano