[RISOLTO] Configurazione di squid per whitelist....

Salve!
Gentile forum ho la necessità di creare una whitelist sulla mia macchina, la quale permetta di navigare alla stessa ed alle eventuali mi net i soli siti specificati in un file. Inutile dire che ho modificato il file “squid.info” ed al riavvio dello stesso ricevo un messaggio di errore.
Riporto maggiori informazioni qui sotto:

  1. il contenuto del file “squid.info”:

Recommended minimum configuration:

Example rule allowing access from your local networks.

Adapt to list your (internal) IP networks from where browsing

should be allowed

acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines

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

Recommended minimum Access Permission configuration:

Deny requests to certain unsafe ports

http_access deny !Safe_ports

Deny CONNECT to other than secure SSL ports

http_access deny CONNECT !SSL_ports

Only allow cachemgr access from localhost

http_access allow localhost manager
http_access deny manager

We strongly recommend the following be uncommented to protect innocent

web applications running on the proxy server who think the only

one who can access services on “localhost” is a local user

#http_access deny to_localhost

INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

Example rule allowing access from your local networks.

Adapt localnet in the ACL section to list your (internal) IP networks

from where browsing should be allowed

http_access allow localnet
#http_access allow localhost

And finally deny all other access to this proxy

http_access deny all

Squid normally listens to port 3128

http_port 8080

Uncomment and adjust the following to add a disk cache directory.

cache_dir ufs /var/spool/squid 100 16 256

Leave coredumps in the first cache dir

coredump_dir /var/spool/squid

Add any of your own refresh_pattern entries above these.

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

#MIE REGOLE
ACL whitelist dstdomain “/root/whitelist”
http_access allow whitelist

Dopo aver aggiunto le righe “MIE REGOLE” e riavviato il proxy con : systemctl restart squid ricevo il seguente errore:


  1. Errore dopo il riavvio di squid:
    [root@localhost ~]# systemctl restart squid
    Job for squid.service failed because the control process exited with error code. See “systemctl status squid.service” and “journalctl -xe” for details.

  1. utilizzando il comando “systemctl status squid” ottengo il seguente output:

dic 27 10:58:14 localhost.localdomain squid[3616]: Bungled /etc/squid/squid.conf line 81: http_access all…list
dic 27 10:58:14 localhost.localdomain squid[3616]: FATAL: Bungled /etc/squid/squid.conf line 81: http_acc…list
dic 27 10:58:14 localhost.localdomain squid[3616]: Squid Cache (Version 3.5.10): Terminated abnormally.
dic 27 10:58:14 localhost.localdomain squid[3616]: CPU Usage: 0.036 seconds = 0.024 user + 0.012 sys
dic 27 10:58:14 localhost.localdomain squid[3616]: Maximum Resident Size: 45104 KB
dic 27 10:58:14 localhost.localdomain squid[3616]: Page faults with physical i/o: 0
dic 27 10:58:14 localhost.localdomain systemd[1]: squid.service: Control process exited, code=exited status=1
dic 27 10:58:14 localhost.localdomain systemd[1]: Failed to start Squid caching proxy.
dic 27 10:58:14 localhost.localdomain systemd[1]: squid.service: Unit entered failed state.
dic 27 10:58:14 localhost.localdomain systemd[1]: squid.service: Failed with result ‘exit-code’.

Spero in un aiuto risolutivo!

Grazie a tutto il forum.

E’ possibile che non sia corretta questa linea di configurazione:

http_access allow whitelist

L’errore è proprio in quella linea ossia la 81.

In questa http://www.webdnstools.com/articles/squid-proxy-whitelist infatti indica come configurare la whitelist in squid.
Ho dato una letta veloce, spero sia quello che ti serve.

Oppure ancora più semplicemente la tua whitelist non è composta correttamente o non ha i permessi corretti di lettura (ad esempio).
Direi di iniziare a verificare queste cose.

Ok !
Il problema dell’errore l’ho superato:
ACL whitelist dstdomain “/root/whitelist” sostituito con:
acl whitelist dstdomain “/root/whitelist”

Questione di case sensitive.

Il problema adesso è che dovrebbe consentire solo il traffico verso il sito contenuto nel file “whitelis”.
Invece, sia con la stessa macchina del server, sia da pc remoto continua a navigare dove stracazzolina gli pare!!!

:gratt:

ci puoi inviare l’output dei seguenti comandi:

cat /root/whitelist ls -lart /root/whitelist

UTPUT

[root@localhost ~]# cat /root/whitelist
.ansa.it
ansa.it
http://www.ansa.it


[root@localhost ~]# ls -lart /root/whitelist
-rwxrwxrwx. 1 root root 29 27 dic 15.29 /root/whitelist

Nel file /root/whitelist prova ad inserire solo la riga:

.ansa.it

Reload di squid e riprova

EDIT.

Prova ad aggiungere quest’ultima riga “http_access deny all”:

#MIE REGOLE ACL whitelist dstdomain "/root/whitelist" http_access allow whitelist http_access deny all

Reload di squid e riprova

Fatto! Continua comunque a navigare ovunque sia da locale che da remoto…

:gratt:

Non so se hai fatto in tempo a leggere quest’ultima modifica:

Prova ad aggiungere quest’ultima riga “http_access deny all”:

#MIE REGOLE acl whitelist dstdomain "/root/whitelist" http_access allow whitelist http_access deny all

Reload di squid e riprova

Fatto!
Niente. Continua agliosa…
Come aggiorno il pacchetto ACL?

“ACL” non è un pacchetto è l’acronimo di Lista di controllo degli accessi.

Puoi inviare l’output di:

squid.info

Inoltre domanda scontata, hai impostato il proxy sul browser della postazioni da cui vuoi navigare?

OUTPU squid.info:

Recommended minimum configuration:

Example rule allowing access from your local networks.

Adapt to list your (internal) IP networks from where browsing

should be allowed

acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines

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

Recommended minimum Access Permission configuration:

Deny requests to certain unsafe ports

http_access deny !Safe_ports

Deny CONNECT to other than secure SSL ports

http_access deny CONNECT !SSL_ports

Only allow cachemgr access from localhost

http_access allow localhost manager
http_access deny manager

We strongly recommend the following be uncommented to protect innocent

web applications running on the proxy server who think the only

one who can access services on “localhost” is a local user

#http_access deny to_localhost

INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

Example rule allowing access from your local networks.

Adapt localnet in the ACL section to list your (internal) IP networks

from where browsing should be allowed

http_access allow localnet
#http_access allow localhost

And finally deny all other access to this proxy

http_access deny all

Squid normally listens to port 3128

http_port 8080

Uncomment and adjust the following to add a disk cache directory.

cache_dir ufs /var/spool/squid 100 16 256

Leave coredumps in the first cache dir

coredump_dir /var/spool/squid

Add any of your own refresh_pattern entries above these.

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

#MIE REGOLE
#acl whitelist dstdomain .whitelist.com .goodsite.com .partnerssite.com

acl whitelist dstdomain “/root/whitelist”
http_access allow whitelist
http_access deny all

Altra cosa, provi a navigare da una postazione differente da dov’è installato il server squid oppure è la stessa?

Allora, ho installato squid sulla macchina dalla quale scrivo ed ho configurato il browser “firefox” di questa stessa macchina con ip 192.168.1.100:8080.
Ho un pc remoto con un browser configurato nello stesso modo.

Giusto per… se mando squid in stop i browser non navigano più.

Guarda, non so se può essere utile , ma ho sniffato i pakketti , collegandomi alla paggina web del ruter . Non compare mai la porta 8080.

Mah, forse il problema è nell instradamento dei pakketti . eppure se spengo squid il browser non naviga.

Ho provato anche con i tag di restrizione:
acl whitelist url_regex “/root/whitelist”
http_access deny whitelist

Insomma frafra il mio server squid se ne sbatte riccamente i co***oni! :wall:

Credo di aver risolto. Finalmente la black list va!!!
Domani provo la whitelist e poi scrivo il perche non funziona , e una breve guida se tutto fila liscio. Devo fare prima dei test

Ciao!

Buona sera!
Ok ;ho risolto il problema da me.
Ho creato un file che è ingrado di svolgere le funzioni di bloccare uno o piu siti rendendo navigabili tutti gli altri, oppure di renderne navigabile solo uno e infine di bloccare i siti che contengono una data parola nel proprio URL.
Al momento ha il difetto di riuscire a richiedere la password quando si usa il file per la funzione di blacklist e di blocco delle parole. Ma non chiede l’autenticazione quando si utilizza la funzione di whitelist. Magari se qualcuno di voi ne capisce un po di linux potrebbe farci un ritocchino e comunicarcelo.
Quindi per chi ha installato squid su fedora23 è vuole rendere lo stesso più utile vi posto lo script da inserire in un nuovo file “squid.conf”

squid.conf:

[code]# ALCUNE NOTE ED ISTRUZIONI (Kondor marcello2222)

Questo file di SQUID è in grado di, svolgere funzione di BLAKLIST , BLOCCARE PAROLE ed è capace di

navigare in WHITELIST.

NOTA: se decidi di usare la WHITELIST devi commentare tutte le righe del blocco istruzioni “FUNZIONE1” e

viceversa.

Devi creare i file contenenti gli indirizzi web e le parole.

Per creare la password usa: htpasswd -c [percorso nome del file] [nome dell’utente]

FINE NOTA

http_port 8080
visible_hostname Server Prova BANCA

cache_mem 64 MB
maximum_object_size_in_memory 64 KB
maximum_object_size 512 MB
maximum_object_size 0 KB
cache_swap_low 90
cache_swap_high 95
cache_dir ufs /var/spool/squid 2848 16 256
cache_access_log /var/log/squid/access.log
refresh_pattern ^ftp: 15 20% 2280
refresh_pattern ^gopher: 15 0% 2280
refresh_pattern . 15 20% 2280

acl retelocale src 192.168.1.0/24
http_access deny !retelocale

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

FUNZIONE 1

ZONA BLOCCO PAROLE########################################

#acl bloccoparole dstdom_regex “/etc/squid/LISTE/bloccoparole”
#http_access deny bloccoparole

ZONA BLACK LIST

#acl blacklist url_regex -i “/etc/squid/LISTE/blacklist”
#http_access deny blacklist
############################################################

ZONA WHITELIST

acl whitelist dstdomain “/etc/squid/LISTE/whitelist”
http_access allow whitelist
http_access deny all

ZONA PER AUTENTICAZIONE UTENTE

auth_param basic realm (QUESTO E UN TEST SQUID)
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/squid_pass$
acl autenticazione proxy_auth REQUIRED
http_access allow autenticazione

http_access allow localhost
http_access allow retelocale
http_access deny all
[/code]