tech:filtrage_web_avec_squidguard
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| tech:filtrage_web_avec_squidguard [2025/06/01 16:02] – Jean-Baptiste | tech:filtrage_web_avec_squidguard [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Filtrage web avec SquidGuard | ||
| + | |||
| + | Listes : | ||
| + | * https:// | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | cache_peer localhost parent 8118 0 default no-query no-digest no-netdb-exchange | ||
| + | acl all src all | ||
| + | acl manager proto cache_object | ||
| + | acl localhost src 127.0.0.1/ | ||
| + | acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 | ||
| + | acl localnet src 10.0.0.0/ | ||
| + | acl localnet src 172.16.0.0/ | ||
| + | acl localnet src 192.168.0.0/ | ||
| + | acl SSL_ports port 443 # https | ||
| + | acl SSL_ports port 563 # snews | ||
| + | acl SSL_ports port 873 # rsync | ||
| + | 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 # | ||
| + | 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 Safe_ports port 631 # cups | ||
| + | acl Safe_ports port 873 # rsync | ||
| + | acl Safe_ports port 901 # SWAT | ||
| + | acl Safe_ports port 9920 # JIRA | ||
| + | acl purge method PURGE | ||
| + | acl CONNECT method CONNECT | ||
| + | http_access allow manager localhost | ||
| + | http_access deny manager | ||
| + | http_access allow purge localhost | ||
| + | http_access deny purge | ||
| + | http_access deny !Safe_ports | ||
| + | http_access deny CONNECT !SSL_ports | ||
| + | http_access allow localhost | ||
| + | http_access deny all | ||
| + | icp_access allow localnet | ||
| + | icp_access deny all | ||
| + | http_port 3128 | ||
| + | hierarchy_stoplist cgi-bin ? | ||
| + | access_log / | ||
| + | refresh_pattern ^ftp: | ||
| + | refresh_pattern ^gopher: | ||
| + | refresh_pattern -i (/ | ||
| + | refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880 | ||
| + | refresh_pattern . 0 20% 4320 | ||
| + | acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9] | ||
| + | upgrade_http0.9 deny shoutcast | ||
| + | acl apache rep_header Server ^Apache | ||
| + | broken_vary_encoding allow apache | ||
| + | extension_methods REPORT MERGE MKACTIVITY CHECKOUT | ||
| + | hosts_file /etc/hosts | ||
| + | coredump_dir / | ||
| + | |||
| + | header_access From deny all | ||
| + | header_access Server deny all | ||
| + | # | ||
| + | header_access Link deny all | ||
| + | header_access Cache-Control deny all | ||
| + | header_access Proxy-Connection deny all | ||
| + | header_access X-Cache deny all | ||
| + | header_access X-Cache-Lookup deny all | ||
| + | header_access Via deny all | ||
| + | header_access Forwarded-For deny all | ||
| + | header_access X-Forwarded-For deny all | ||
| + | header_access Pragma deny all | ||
| + | header_access Keep-Alive deny all | ||
| + | header_access Referer deny all | ||
| + | |||
| + | redirect_program / | ||
| + | redirect_children 10 | ||
| + | |||
| + | never_direct allow all | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~bash | ||
| + | # | ||
| + | # CONFIG FILE FOR SQUIDGUARD | ||
| + | # | ||
| + | |||
| + | dbhome / | ||
| + | logdir / | ||
| + | |||
| + | src allusers { | ||
| + | ip 127.0.0.1/ | ||
| + | } | ||
| + | |||
| + | |||
| + | dest white { | ||
| + | domainlist | ||
| + | urllist | ||
| + | log dest_white.log | ||
| + | } | ||
| + | |||
| + | dest adblock { | ||
| + | expressionlist | ||
| + | log dest_adblock.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | |||
| + | dest adult1 { | ||
| + | domainlist tlse/ | ||
| + | urllist tlse/ | ||
| + | expressionlist tlse/ | ||
| + | log dest_adult1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | |||
| + | dest gambling1 | ||
| + | { | ||
| + | domainlist | ||
| + | urllist | ||
| + | log dest_gambling1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest phishing1 | ||
| + | { | ||
| + | domainlist | ||
| + | urllist | ||
| + | log dest_phishing1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest publicite1 | ||
| + | { | ||
| + | domainlist | ||
| + | urllist | ||
| + | expressionlist | ||
| + | log dest_publicite1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest malware1 | ||
| + | { | ||
| + | domainlist | ||
| + | urllist | ||
| + | expressionlist | ||
| + | log dest_malware1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest marketingware1 | ||
| + | { | ||
| + | domainlist | ||
| + | urllist | ||
| + | log dest_marketingware1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest dating1 | ||
| + | { | ||
| + | domainlist | ||
| + | urllist | ||
| + | log dest_dating1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest mobile1 | ||
| + | { | ||
| + | domainlist | ||
| + | urllist | ||
| + | log dest_mobile1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest social1 | ||
| + | { | ||
| + | domainlist | ||
| + | log dest_social1.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest ads2 | ||
| + | { | ||
| + | | ||
| + | urllist | ||
| + | log dest_ads2.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest gambling2 | ||
| + | { | ||
| + | | ||
| + | | ||
| + | log dest_gambling2.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest porn2 | ||
| + | { | ||
| + | | ||
| + | | ||
| + | log dest_porn2.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest spyware2 | ||
| + | { | ||
| + | | ||
| + | | ||
| + | log dest_spyware2.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest suspect2 | ||
| + | { | ||
| + | | ||
| + | | ||
| + | log dest_suspect2.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest adult3 | ||
| + | { | ||
| + | domainlist isak/ | ||
| + | urllist isak/ | ||
| + | log dest_adult3.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest ads3 | ||
| + | { | ||
| + | domainlist isak/ | ||
| + | urllist isak/ | ||
| + | log dest_ads3.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest gambling3 | ||
| + | { | ||
| + | domainlist isak/ | ||
| + | urllist isak/ | ||
| + | log dest_gambling3.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest phishing3 | ||
| + | { | ||
| + | domainlist isak/ | ||
| + | urllist isak/ | ||
| + | log dest_phishing3.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest spyware3 | ||
| + | { | ||
| + | domainlist isak/ | ||
| + | log dest_spyware3.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest mobile3 | ||
| + | { | ||
| + | domainlist isak/ | ||
| + | urllist isak/ | ||
| + | log dest_mobile3.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | dest jibe | ||
| + | { | ||
| + | domainlist jibe/ | ||
| + | urllist jibe/ | ||
| + | log dest_jibe.log | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | acl { | ||
| + | allusers { | ||
| + | pass white !gambling1 !gambling2 !gambling3 !phishing1 !phishing3 !publicite1 !ads2 !ads3 !malware1 !spyware2 !spyware3 !marketingware1 !suspect2 !mobile1 !mobile3 !jibe any | ||
| + | redirect | ||
| + | } | ||
| + | |||
| + | default { | ||
| + | pass none | ||
| + | } | ||
| + | } | ||
| + | |||
| + | ~~~ | ||
| + | |||
| + | |||
| + | `squid-install.sh` | ||
| + | ~~~bash | ||
| + | #! /bin/bash | ||
| + | |||
| + | mkdir -p / | ||
| + | mkdir -p / | ||
| + | mkdir -p / | ||
| + | |||
| + | # Creation fichiers | ||
| + | echo "\ | ||
| + | video.google.com | ||
| + | mts1.google.com | ||
| + | mts0.google.com | ||
| + | maps.google.com | ||
| + | mt0.google.com | ||
| + | mt1.google.com | ||
| + | code.google.com" | ||
| + | |||
| + | echo "\ | ||
| + | www.google.com/ | ||
| + | |||
| + | touch / | ||
| + | |||
| + | echo "\ | ||
| + | facebook.com | ||
| + | facebook.net | ||
| + | fbcdn.com | ||
| + | fbcdn.net | ||
| + | fbshare.me | ||
| + | twitter.com | ||
| + | twimg.com | ||
| + | addthis.com | ||
| + | google-analytics.com | ||
| + | google.fr | ||
| + | google.com | ||
| + | 1e100.net | ||
| + | googleapis.com | ||
| + | gmodules.com | ||
| + | stats.buzzea.com | ||
| + | data.gosquared.com | ||
| + | d1l6p2sc9645hc.cloudfront.net | ||
| + | d1ros97qkrwjf5.cloudfront.net | ||
| + | fstatic.iadvize.com | ||
| + | flux.com | ||
| + | meetic-partners.com | ||
| + | stats.wattimpact.com | ||
| + | els.a4.tl | ||
| + | radar.cedexis.com | ||
| + | greatviews.de | ||
| + | get.adobe.com | ||
| + | # | ||
| + | ie.microsoft.com | ||
| + | windowsupdate.microsoft.com | ||
| + | update.microsoft.com | ||
| + | download.windowsupdate.com | ||
| + | live.com | ||
| + | latestdl.info | ||
| + | # | ||
| + | traficmax.com | ||
| + | atdmt.com | ||
| + | r.msn.com | ||
| + | #msn.com | ||
| + | yesmessenger.com | ||
| + | yes-messenger.com | ||
| + | sexe4x.com | ||
| + | clic.ws | ||
| + | publicite-sexe.com | ||
| + | adtech.de | ||
| + | adultfriendfinder.com | ||
| + | datasecureprocess.com | ||
| + | tvwebgay.com | ||
| + | partie-membres.com | ||
| + | piximedia.fr | ||
| + | piximedia.com | ||
| + | tns-counter.ru | ||
| + | mc.yandex.ru | ||
| + | direction-x.com | ||
| + | empiredusexe.com | ||
| + | thumbs-share.com | ||
| + | the-adult-company.com | ||
| + | plugin-x.com | ||
| + | xcams.com | ||
| + | lescelibataires.net | ||
| + | sexxxtape.net | ||
| + | vador.com | ||
| + | pub.oumma.com | ||
| + | acces-charme.com | ||
| + | pornattitude.com" | ||
| + | |||
| + | echo "\ | ||
| + | clck.yandex.com/ | ||
| + | fr.search.yahoo.com/ | ||
| + | wwwimages.adobe.com/ | ||
| + | www.adobe.com/ | ||
| + | www.topachat.com/ | ||
| + | go-mono.com/ | ||
| + | www.microsoft.com/ | ||
| + | go.microsoft.com/ | ||
| + | yandex.st/ | ||
| + | |||
| + | # Droits fichiers | ||
| + | chown proxy: / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | `squid-update.sh` | ||
| + | ~~~bash | ||
| + | #! /bin/bash | ||
| + | |||
| + | # Definition des variables | ||
| + | squiddb="/ | ||
| + | tmp_folder="/ | ||
| + | lst_logs_dest=" | ||
| + | |||
| + | cd $tmp_folder | ||
| + | |||
| + | exec 2> | ||
| + | #exec 1> | ||
| + | |||
| + | # Fin normal | ||
| + | fin_ok() { | ||
| + | echo " | ||
| + | cat $tmp_folder/ | ||
| + | exit 0 | ||
| + | } | ||
| + | |||
| + | # Fin erreur | ||
| + | fin_err() { | ||
| + | echo -e " | ||
| + | cat $tmp_folder/ | ||
| + | exit 1 | ||
| + | } | ||
| + | |||
| + | # Cleanning des Logs | ||
| + | clean() { | ||
| + | rm -f / | ||
| + | rm -f / | ||
| + | rm -f / | ||
| + | rm -f / | ||
| + | echo "" | ||
| + | echo "" | ||
| + | echo "" | ||
| + | echo "" | ||
| + | echo "" | ||
| + | echo "" | ||
| + | for fic in $lst_logs_dest | ||
| + | do | ||
| + | echo "" | ||
| + | done | ||
| + | } | ||
| + | |||
| + | # Téléchargement des blacklists et expressions régulière (adblock) | ||
| + | download() { | ||
| + | #wget -nv -N http:// | ||
| + | wget -nv -N ftp:// | ||
| + | wget -nv -N http:// | ||
| + | wget -nv -N http:// | ||
| + | } | ||
| + | |||
| + | # Décompression des lists | ||
| + | uncompress() { | ||
| + | tar xzf tlse.tar.gz && rm -rf / | ||
| + | tar xzf mesd.tar.gz && rm -rf / | ||
| + | tar xzf isak.tar.gz && rm -rf / | ||
| + | } | ||
| + | |||
| + | # Mise à jour | ||
| + | update() { | ||
| + | #/ | ||
| + | #cat $tmp_folder/ | ||
| + | squidGuard -C all; | ||
| + | } | ||
| + | |||
| + | # Définition des droits | ||
| + | droits() { | ||
| + | chown -R proxy:proxy / | ||
| + | chown -R proxy:proxy / | ||
| + | chmod -R 760 / | ||
| + | } | ||
| + | |||
| + | |||
| + | ##### DEBUT | ||
| + | |||
| + | clean || fin_err; | ||
| + | echo -e "1. Cleanning des Logs \t\t\t\t [OK]"; | ||
| + | |||
| + | download || fin_err; | ||
| + | echo -e "2. Téléchargement des listes \t\t\t [OK]"; | ||
| + | |||
| + | uncompress || fin_err; | ||
| + | echo -e "3. Décompression des listes \t\t\t [OK]"; | ||
| + | |||
| + | update || fin_err; | ||
| + | echo -e "4. Mise à jour \t\t\t\t\t [OK]"; | ||
| + | |||
| + | droits || fin_err; | ||
| + | echo -e "5. Définition des droits sur les fichiers \t [OK]\n"; | ||
| + | |||
| + | killall -1 squid; | ||
| + | |||
| + | fin_ok; | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Autre système de filtrage : | ||
| + | * stay focused | ||
| + | * detoxify | ||
| + | * bulldog blocker | ||
| + | * pluckeye | ||
| + | |||
| + | |||
| + | |||
