Ostatnia zmiana: 10:08 14.11.2009
DG posiada conajmniej (w 90% zastosowań) dwa pliki konfiguracyjne:
- dansguardian.conf - z głównymi ustawieniami serwera,
- dansguardianf1.conf, dansguardianf2.conf, ... - ustawiajęce poziom filtracji dla grupy pierwszej, drugiej, itd (np małe dzieci, dorosła młodzież, grupa użytkowników niefiltrowanych). Ustawiamy tu najważniejszy parametr - "limit nieposłuszeństwa" (naughtyness limit) oraz blokowane poszczególnym grupom kategorie: pornografia, strony z przemocą, gry hazardowe, rasizm. Domyślnie mamy tylko jedną grupę dansguardianf1.conf i to wystarcza.
Musimy dodać polskie dobre i złe frazy/zwroty. Jeśli tego nie zrobimy filtr będzie niepotrzebnie blokował hasła encyklopedyczne jak rozwój płciowy, rak piersi, planowanie rodziny i inne dobre strony. Ważne są w szczególności frazy z weighted_general_polish, do pobrania z goodphrases. Analogicznie polskie frazy pornograficzne weighted_polish z katalogu pornography.
Teraz musimy to jeszcze dopisać do pliku ./lists/weightedphraselist:
#Good Phrases
.Include </etc/dansguardian/lists/phraselists/goodphrases/weighted_general>
.Include </etc/dansguardian/lists/phraselists/goodphrases/weighted_general_portuguese>
.Include </etc/dansguardian/lists/phraselists/goodphrases/weighted_general_polish>
#Pornography
.Include </etc/dansguardian/lists/phraselists/pornography/weighted_spanish>
.Include </etc/dansguardian/lists/phraselists/pornography/weighted_russian>
.Include </etc/dansguardian/lists/phraselists/pornography/weighted_polish>
i restart DansGuardiana. Jeśli się wysypał, prawdopodobnie literówka.
Parametry konfiguracyjne serwera (czyli plik dansguardian.conf).
Parametry ogólne
- reportinglevel = 3
- Raportowanie Blokowanych Stron (nie wpływa na logi)
- -1 = log, but do not block - Stealth mode
- 0 = just say 'Access Denied'
- 1 = report why but not what denied phrase
- 2 = report fully
- 3 = use HTML template file (accessdeniedaddress ignored) - recommended
- language = 'polish'
- wybór języka z katalogu languagedir
- loglevel = 2
- Ustawienia logowania aktywności userów ("szczegółowość logowania")
- 0 = none
- 1 = just denied
- 2 = all text based
- 3 = all requests
- logexceptionhits = 2
- Logowanie wyjątków (exceptionIP, exceptionsite) - Loguj jeśli jakiś wyjątek (użytkownik, ip, URL, fraza) jest dopasowany i strona została wyświetlona. Użyteczne do celów diagnostycznych, np dlaczego strona z pozoru zabroniona przechodzi przez filtr?
- 0 = never log exceptions
- 1 = log exceptions, but do not explicitly mark them as such
- 2 = always log & mark exceptions (default)
- logfileformat = 1
- Format pliku logowania
- 1 = DansGuardian format (space delimited)
- 2 = CSV-style format
- 3 = Squid Log File Format
- 4 = Tab delimited
Ustawienia sieciowe
- filterip =
- Adres IP na którym nasłuchuje DansGuardian. Jeśli puste DansGuardian będzie nasłuchiwał na wszystkich IP. Mogą to być wszystkie karty NIC, pętla lokalna loopback, modem, etc. Zazwyczaj mamy firewalla (iptables), który przed tym broni. Jeśli jednak będziemy chcieli, możemy tutaj ograniczyć nasłuchiwanie do jednego adresu IP. Jeśli chcemy nasłuchiwać na kilku interfejsach, określamy każdy nowy adres IP w nowej linii filterip.
- filterport = 8080
- Port, na którym nasłuchuje DansGuardian
- proxyip = 127.0.0.1
- IP serwera proxy (squida, tinyproxy).Domyślnie jest loopback – czyli ten sam serwer.
- proxyport = 3128
- Port na którym nasłuchuje server proxy (squid, tinyproxy). DansGuardian będzie z niego "pobierał strony".
Różne opcje
- custombannedimagefile = '@DGDATADIR@/transparent1x1.gif'
- usecustombannedimage = on
- Zastępowanie favikony blokowanej strony (ikona z paska adresowego strony www w przeglądarce) -
Ikony blokowanych stron są stosowne do domeny czy URL. Możemy je podmienić. Podajemy ścieżkę do naszej ikony.
- on (default) | off
[zaawansowane]
- filtergroups = 1
- filtergroupslist = '@DGCONFDIR@/lists/filtergroupslist'
- Opcje filtra grup
- Filtrowanych użytkowników możemy podzielić na kilka grup (np w zależności od wieku). „filtergroups” ustawia ilość filtrowanych grup. Filtr grupowy jest zbiorem opcji, reguł filtrowania, którą możemy zastosować do konkretnej grupy użytkowników. Wartość musi być 1 lub więcej. DansGuardian będzie automatycznie szukał pliku dansguardianfN.conf, gdzie N jest numerem filtrowanej grupy. By przydzielić użytkowników do grup używamy opcji „filegroupslist”. Wszyscy użytkownicy domyślnie są w grupie 1. Aby móc odwzorowywać użytkowników do grup, musimy mieć włączony jakiś rodzaj autentyfikacji. Przy wielu grupach wiele kopii list będzie w pamięci RAM, więc używajmy jak najmniej grup jeśli to możliwe. Przykładem grup może być podział na dzieci i młodzież czy userów bez blokowania i blokowanych.
Opcje zaawansowane
[dodatki]
[zaawansowane]
- bannediplist = '@DGCONFDIR@/lists/bannediplist'
- exceptioniplist = '@DGCONFDIR@/lists/exceptioniplist'
- Lokalizacje plików autoryzacji
- showweightedfound = on
- Pokaż wagi znalezionych fraz [opcja przydatna przy ustalaniu wag]
- Jeśli włączone, znalezione frazy przekraczające limit „naughtyness” będą zalogowane, a jeśli poziom rapornowania jest wystarczająco wysoki zostanie wyświetlona strona o zabronionym dostępie. on | off
[dodatkowe]
- weightedphrasemode = 2
- Tryb wyrażeń z wagami. Są 3 możliwe tryby pracy:
- 0 = wyłącz = nie używaj trybu „ważenia fraz” (tylko blacklistę)
- 1 = włącz, normalny
- 2 = włącz, pojedynczy - każdy fraza znaleziona na stronie dodaje swoją
wagę (punkty) tylko raz. Nie dodaje punktów powtarzającej się frazy.
[dodatki]
- urlcachenumber = 1000
- Keszowanie tekstu adresów URL
- Nie sprawdzaj ponownie zawartości strony, aby nie musiały być ponownie skanowane. Liczba keszowanych adresów stron URL.
- 0 = wyłącz (zalecane dla ISP z użytkownikami o różnych przeglądarkach)
- 1000 = rekomendowane dla większej liczby użytkowników
- 5000 = sugerowany maksymalny, górny limit
Używając plugina antywirusa AV ustaw co najmniej 5000.
- urlcacheage = 900
- Czas po którym pamięć cache jest już „nieświeża” i powinna być ingnorowana, w [sekundach]. Po jego upływie ponownie skanuj stronę.
- 0 = nigdy
- 900 = zalecane = 15 mins
[zaawansowane]
- scancleancache = on
- Czyść cache przeskanowanych przez antiwirusa plików
- Domyślnie, aby oszczędzić CPU, pliki przeskanowane oraz pobrane bez wirusów,
wstawiane są do czystej pamięci cache i NIE skanowane ponownie (przez pewien czas).
Jeśli nie chcesz tego wyłącz tę opcję.(on|off) default = on.
[zaawansowane][optymalizacja]
- phrasefiltermode = 2
- Opcje eleganckiego (Smart), surowego (Raw) i "po znacznikach" Meta/Title filtrowana treści
- Smart – podwójne (nadmiarowe) spacje i HTML są usuwane przed filtrowaniem treści. Nie są wię brane pod uwagę. Filtrujemy sam tekst, zawartość strony.
- Raw – surowy kod HTML zawierający meta znaczniki jest wagowo filtrowany. Nie sprawdzamy treści, zawartości strony.
- Meta/Title - tylko znaczniki meta i title (kodu html) są frazowo filtrowane (wersja szybka)
CPU zazwyczaj pracuje efektywniej przy opcjach 0 lub 1, w porównaniu do 2.
- 0 = tylko Raw
- 1 = tylko Smart
- 2 = oba (domyślnie)
- 3 = tylko meta/title
[zaawansowane][problemy] LastFM, logowanie gadu-gadu
- preservecase = 0
- Opcje zmniejszania WIELKICH liter
- Podczas skanowania dokumentu wielkie litery są konwertowana na małe ażeby móc porównać je z frazami. Jednakże może to naruszyć kodowanie Big5 i inne 16-bitowe teksty. Jeśli potrzeba, zabezpieczmy znaki.
- 0 = wymuś zmniejszenie znaków (domyślnie)
- 1 = nie zmieniaj rozmiaru
- 2 = skanuj wpierw zmieniając na małe, potem porównuj również w oryginalnym rozmiarze
- Notatka: Jeśli phrasefiltermode oraz preservecase są oba w trybie 2, przyrównujemy frazy aż 4 razy. Mając dość dużą sieć ( > 50 userów) możesz mieć kłopot, przy filtrowaniu stron w egzotycznych stronach kodowych. Lepiej wtedy uruchomić DG na dwóch osobnych serwerach: pierwszym z preservecase 1 (i możliwie forcequicksearch 1), i listami fraz nie w kodowaniu ASCII/UTF-8; drugi z preservecase 0 oraz kodowaniem list fraz w ASCII/UTF-8.
[zaawansowane]
- hexdecodecontent = off
- Dekodowanie znaków Hex. Jeżeli dokument jest skanowany, może opcjonalnie konwertować %XX do znaków. Jeśli znajdziemy w pobranych odfiltrowanych stronach podobne znaki, możemy włączyć tę opcję Jednakże może to naruszyć kodowanie Big5 i inne 16-bitowe teksty.
on |off (default = off)
[zaawansowane][problemy]
- forcequicksearch = off
- Wymuś raczej szybkie szukanie zamiast algorytmu DFA
- Obecnie zaimplementowany szukający algorytm DFA nie jest zupełnie kompatybilny ze znakami 16-bitowymi, jednak szybciej sprawdza większe listy fraz. Jest używany domyślnie. Jeśli chciałbyś używać większe niż 16-bitowe znaki, włącz tę opcję.
off (default) | on (Big5 compatible)
- reverseaddresslookups = off
- Odwrotne zapytania DNS dla banowanych stron i URLów.
- Jeśli włączone (on) DansGuardian zapyta o odwrotny DNS dla IP (zapyta o adres URL podanego IP). Przeszuka oba w zabronionych stronach i URLach. Chroni to przed wpisaniem wprost do przeglądarki adresu IP z blacklisty. Zmniejsza to nieco szybkość przeszukiwania, poleca się wyłączyć (off) o ile nie posiada się lokalnego keszującego serwera DNS.
- reverseclientiplookups = off
- Odwrotne zapytania DNS dla listy IP klientów blokowanych i wyjątków (exception).
- Jeśli włączone, DansGuardian zapyta o odwrotny DNS dla adresu IP
podłączonego komputera. To znaczy, że możesz wpisywać nazwę hosta - zamiast adresu IP
klienta - w plikach exceptioniplist oraz bannediplist.
If a client computer is matched against an IP given in the lists, then the
IP will be recorded in any log entries; if forward DNS is successful and a
match occurs against a hostname, the hostname will be logged instead.
It will reduce searching speed somewhat so unless you have a local DNS server,
leave it off.
- logclienthostnames = off
- Perform reverse lookups on client IPs for successful requests.
# If set to on, DansGuardian will look up the forward DNS for the IP
# of the connecting computer, and log host names (where available) rather than
# IPs against requests.
# This is not dependent on reverseclientiplookups being enabled; however, if it
# is, enabling this option does not incur any additional forward DNS requests.
- createlistcachefiles = on
- Build bannedsitelist and bannedurllist cache files.
# This will compare the date stamp of the list file with the date stamp of
# the cache file and will recreate as needed.
# If a bsl or bul .processed file exists, then that will be used instead.
# It will increase process start speed by 300%. On slow computers this will
# be significant. Fast computers do not need this option. on | off
- maxuploadsize = -1
- Ustalenie limitu na przesyłane pliki. Zabezpieczenie POST (tylko dla formularzy www z uploadem plików). Nie blokuje formularzy bez type=”file” Opcja służy blokowaniu i ograniczaniu uploadu plików. W kilobajtach.
- -1 – bez blokowania
- 0 – całkowite blokowanie
- liczba większa od 0 (np. 512 = 512kB) to limit
- maxcontentfiltersize = 256
- Maksymalny rozmiar filtrowanej treści
- Czasami zawartość stron jest bardzo duża i może ogromnie obciążyć zasoby pamięci oraz CPU. Dlatego możemy określić limit rozmiaru dokumentów, które są filtrowane i pobierane. Podany rozmiar nie może być większy niż maxcontentramcachescansize. Rozmiar podawany jest w kilobajtach np. 2048 = 2MB
0 – bez limitu
- maxcontentramcachescansize = 2000
- Max content ram cache scan size
# This is only used if you use a content scanner plugin such as AV
# This is the max size of file that DG will download and cache
# in RAM. After this limit is reached it will cache to disk
# This value must be less than or equal to maxcontentfilecachescansize.
# The size is in Kibibytes - eg 10240 = 10Mb
# use 0 to set it to maxcontentfilecachescansize
# This option may be ignored by the configured download manager.
- maxcontentfilecachescansize = 20000
- Max content file cache scan size
# This is only used if you use a content scanner plugin such as AV
# This is the max size file that DG will download
# so that it can be scanned or virus checked.
# This value must be greater or equal to maxcontentramcachescansize.
# The size is in Kibibytes - eg 10240 = 10Mb
- filecachedir = '/tmp'
- Katalog keszowanych plików. Gdzie DG będzie przechowywał skanowane pliki jeśli będą większe niż RAM cache.
- deletedownloadedtempfiles = on
- Delete file cache after user completes download
# When a file gets save to temp it stays there until it is deleted.
# You can choose to have the file deleted when the user makes a sucessful
# download. This will mean if they click on the link to download from
# the temp store a second time it will give a 404 error.
# You should configure something to delete old files in temp to stop it filling up.
# on|off (defaults to on)
- initialtrickledelay = 20
- Initial Trickle delay
# This is the number of seconds a browser connection is left waiting
# before first being sent *something* to keep it alive. The
# *something* depends on the download manager chosen.
# Do not choose a value too low or normal web pages will be affected.
# A value between 20 and 110 would be sensible
# This may be ignored by the configured download manager.
- trickledelay = 10
- Trickle delay
# This is the number of seconds a browser connection is left waiting
# before being sent more *something* to keep it alive. The
# *something* depends on the download manager chosen.
# This may be ignored by the configured download manager.
- downloadmanager = '/etc/dansguardian/downloadmanagers/fancy.conf'
- #downloadmanager = '/etc/dansguardian/downloadmanagers/trickle.conf'
- downloadmanager = '/etc/dansguardian/downloadmanagers/default.conf'
- Download Managers
# These handle downloads of files to be filtered and scanned.
# They differ in the method they deal with large downloads.
# Files usually need to be downloaded 100% before they can be
# filtered and scanned before being sent on to the browser.
# Normally the browser can just wait, but with content scanning,
# for example to AV, the browser may timeout or the user may get
# confused so the download manager has to do some sort of
# 'keep alive'.
#
# There are various methods possible but not all are included.
# The author does not have the time to write them all so I have
# included a plugin systam. Also, not all methods work with all
# browsers and clients. Specifically some fancy methods don't
# work with software that downloads updates. To solve this,
# each plugin can support a regular expression for matching
# the client's user-agent string, and lists of the mime types
# and extensions it should manage.
#
# Note that these are the matching methods provided by the base plugin
# code, and individual plugins may override or add to them.
# See the individual plugin conf files for supported options.
#
# The plugins are matched in the order you specify and the last
# one is forced to match as the default, regardless of user agent
# and other matching mechanisms.
#
- contentscanner = '/etc/dansguardian/contentscanners/clamav.conf'
- #!! Not compiled !! contentscanner = '/etc/dansguardian/contentscanners/clamdscan.conf'
- #!! Unimplemented !! contentscanner = '/etc/dansguardian/contentscanners/kavav.conf'
- #!! Not compiled !! contentscanner = '/etc/dansguardian/contentscanners/kavdscan.conf'
- #contentscanner = '/etc/dansguardian/contentscanners/icapscan.conf'
- #contentscanner = '/etc/dansguardian/contentscanners/commandlinescan.conf'
- Content Scanners (Also known as AV scanners)
# These are plugins that scan the content of all files your browser fetches
# for example to AV scan. The options are limitless. Eventually all of
# DansGuardian will be plugin based. You can have more than one content
# scanner. The plugins are run in the order you specify.
# This is one of the few places you can have multiple options of the same name.
#
# Some of the scanner(s) require 3rd party software and libraries eg clamav.
# See the individual plugin conf file for more options (if any).
#
- contentscannertimeout = 60
- Content scanner timeout
# Some of the content scanners support using a timeout value to stop
# processing (eg AV scanning) the file if it takes too long.
# If supported this will be used.
# The default of 60 seconds is probably reasonable.
- contentscanexceptions = off
- Content scan exceptions
# If 'on' exception sites, urls, users etc will be scanned
# This is probably not desirable behavour as exceptions are
# supposed to be trusted and will increase load.
# Correct use of grey lists are a better idea.
# (on|off) default = off
- #authplugin = '/etc/dansguardian/authplugins/proxy-basic.conf'
- #authplugin = '/etc/dansguardian/authplugins/proxy-digest.conf'
- #authplugin = '/etc/dansguardian/authplugins/proxy-ntlm.conf'
- #authplugin = '/etc/dansguardian/authplugins/ident.conf'
- #authplugin = '/etc/dansguardian/authplugins/ip.conf'
- Auth plugins
# These replace the usernameidmethod* options in previous versions. They
# handle the extraction of client usernames from various sources, such as
# Proxy-Authorisation headers and ident servers, enabling requests to be
# handled according to the settings of the user's filter group.
# Multiple plugins can be specified, and will be queried in order until one
# of them either finds a username or throws an error. For example, if Squid
# is configured with both NTLM and Basic auth enabled, and both the 'proxy-basic'
# and 'proxy-ntlm' auth plugins are enabled here, then clients which do not support
# NTLM can fall back to Basic without sacrificing access rights.
#
# If you do not use multiple filter groups, you need not specify this option.
- recheckreplacedurls = off
- Re-check replaced URLs
# As a matter of course, URLs undergo regular expression search/replace (urlregexplist)
# *after* checking the exception site/URL/regexpURL lists, but *before* checking against
# the banned site/URL lists, allowing certain requests that would be matched against the
# latter in their original state to effectively be converted into grey requests.
# With this option enabled, the exception site/URL/regexpURL lists are also re-checked
# after replacement, making it possible for URL replacement to trigger exceptions based
# on them.
# Defaults to off.
Inne ustawienia
- forwardedfor = off
- Jeśli włączona dodaje X-Forwarded-For: 〈clientip 〉 do nagłówka żądania HTTP. Może to pomóc rozwiązać problem ze stronami, które potrzebują znać prawdziwy adres IP klienta.
- usexforwardedfor = off
- Jeśli włączona używa X-Forwarded-For: 〈clientip〉 do określenia prawdziwego adresu IP klienta. Wykorzystywane jeśli mamy squida między klientami a DansGuardianem i w DG chcemy logować prawdziwe adresy IP klientów.
# Ostrzeżenie - nagłówki są proste do podrobienia. Łatwy spoofing. on | off
Opcje grup wątków (Fork pool options)
- logconnectionhandlingerrors = on
- Jeśli włączone wówczas do syslog logowane będą dodatkowe informacje dotyczące połączeń fork(), accept(), które zwykle mogą być zignorowane.
[zaawansowane][optymalizacja] wydajność
- logchildprocesshandling = off
- Jeśli włączona DG będzie zapisywał do logów każde utworzenie i zniszczenie procesu potomnego, child (nie dotyczy złamanych, crash procesów). Ta informacja będzie pomocna przy zrozumieniu strojenia/tuningu kolejnych parametrów, jednak nie jest ona generalnie przydatna w normalnej pracy.
- maxchildren = 120
- Ustala maksymalną liczbę uruchomionych procesów do obsługi żądań. Zabezpiecza przed atakami DoS. Maksymalna wartość to zazwyczaj 250. Dla dużych sieci możesz spróbować użyć 180
- minchildren = 8
- Ustawia minimalną liczbę uruchomionych procesów, gotowych do obsługi przychodzących żądań. Dla dużych sieci spróbuj 32.
- minsparechildren = 4
- sets the minimum number of processes to be kept ready to handle connections.
# On large sites you might want to try 8.
- preforkchildren = 6
- sets the minimum number of processes to spawn when it runs out
# On large sites you might want to try 10.
- maxsparechildren = 32
- sets the maximum number of processes to have doing nothing.
# When this many are spare it will cull some of them.
# On large sites you might want to try 64.
- maxagechildren = 500
- sets the maximum age of a child process before it croaks it.
# This is the number of connections they handle before exiting.
# On large sites you might want to try 10000.
- maxips = 0
- Sets the maximum number client IP addresses allowed to connect at once.
# Use this to set a hard limit on the number of users allowed to concurrently
# browse the web. Set to 0 for no limit, and to disable the IP cache process.
Opcje procesów
Zmieniaj tylko jeśli naprawdę wiesz co robisz!
Opcje pozwalają uruchomić wiele instancji DansGuardiana na pojedyńczej maszynie.
Pamiętaj aby zmienić też ściężkę do pliku logów.
- ipcfilename = '/tmp/.dguardianipc'
- IPC filename
#
# Defines IPC server directory and filename used to communicate with the log process.
- urlipcfilename = '/tmp/.dguardianurlipc'
- URL list IPC filename
#
# Defines URL list IPC server directory and filename used to communicate with the URL
# cache process.
- ipipcfilename = '/tmp/.dguardianipipc'
# IP list IPC filename
#
# Defines IP list IPC server directory and filename, for communicating with the client
# IP cache process.
- #pidfilename = '@DGPIDDIR@/dansguardian.pid'
- PID filename
#
# Defines process id directory and filename.
- nodaemon = off
- Disable daemoning
# If enabled the process will not fork into the background.
# It is not usually advantageous to do this.
# on|off (defaults to off)
- nologger = off
- Disable logging process
# on|off (defaults to off)
- logadblocks = off
- Enable logging of "ADs" category blocks
# on|off (defaults to off)
- loguseragent = off
- Enable logging of client User-Agent
# Some browsers will cause a *lot* of extra information on each line!
# on|off (defaults to off)
- #daemonuser = 'dansguardian'
- #daemongroup = 'dansguardian'
- Daemon runas user and group
# This is the user that DansGuardian runs as. Normally the user/group nobody.
# Uncomment to use. Defaults to the user set at compile time.
# Temp files created during virus scanning are given owner and group read
# permissions; to use content scanners based on external processes, such as
# clamdscan, the two processes must run with either the same group or user ID.
- softrestart = off
- Soft restart
# When on this disables the forced killing off all processes in the process group.
# This is not to be confused with the -g run time option - they are not related.
# on|off (defaults to off)
- mailer = '/usr/sbin/sendmail -t'
- Mail program
# Path (sendmail-compatible) email program, with options.
# Not used if usesmtp is disabled (filtergroup specific).