|
Rozmiar: 6981
Komentarz: * zmiana opisu dla bytea; dodanie konfiguracji dla postfix/transport
|
Rozmiar: 7566
Komentarz: + purge
|
| Usunięcia zostały oznaczone w ten sposób. | Dodatki zostały oznaczone w ten sposób. |
| Linia 222: | Linia 222: |
= Czyszczenie bazy danych ze starych wpisów = Aby nie dopuścić do przepełnienia bazy danych, dspam oferuje dwa skrypty, które należy uruchamiać w porach nocnych (może w ramach periodic??). Skrypty mogą powodować obciążenie serwera, stąd zalecenie na godziny nocne. == purge-pe.sql == Skrypt do uruchomienie, jeżeli użytkownicy mogą ustawiać swoje preferencje dla dspam. == purge.sql == Skrypt do uruchomienia, jeżeli ustawienia są tylko globalne. Więcej informacji można znaleźć w dokumentacji: '''/usr/local/share/doc/dspam/pgsql_drv.txt'''. |
Spis Treści
Uruchomienie filtrowania poczty za pomocą dspam
Dspam to alternatywa do bogofiltra czy mocno rozbudowanego spamd oraz amavisd-new. Dspam potrafi przekazać maila do sprawdzenia do silnika antywirusowego ClamAV, tak więc dla postfixa jest tylko jeden content_filter.
Zainstalowanie dspam
Wszystko zostało przedstawione w etapie instalacji serwera pocztowego
Przygotowanie bazy danych
Kolejnym krokiem jest przygotowanie bazy danych (PostgreSQL):
createuser -U pgsql -DERS dspam
createdb -U pgsql -E UTF8 -O dspam dspam_db
createlang -U pgsql plpgsql dspam_db
Wgranie schematu do bazy danych
Jest gotowy skrypt SQLowy, który pozwala na założenie bazy danych dla dspam:
cat /usr/local/share/examples/dspam/pgsql/pgsql_objects.sql | psql -U pgsql dspam_db
cat /usr/local/share/examples/dspam/pgsql/virtual_users.sql | psql -U pgsql dspam_db
Zmiana właściciela obiektów w bazie danych
echo '\dt' | psql -U pgsql dspam_db | awk '/public/ {print "ALTER TABLE",$3,"OWNER TO dspam;";}' | psql -U pgsql dspam_db
echo '\ds' | psql -U pgsql dspam_db | awk '/public/ {print "ALTER SEQUENCE",$3,"OWNER TO dspam;";}' | psql -U pgsql dspam_db
Konfigurowanie dspam.conf
Plik konfiguracyjny to /usr/local/etc/dspam.conf:
# Katalog domowy do przechowywania wszelkich danych
#
Home /var/db/dspam
# Sterownik do bazy danych (zgodnie z wyborem przy instalacji)
#
StorageDriver /usr/local/lib/dspam/libpgsql_drv.so
# Agent do dostarczenia poczty po sprawdzeniu poczty
#
#TrustedDeliveryAgent "/usr/libexec/mail.local"
TrustedDeliveryAgent "/usr/local/cyrus/bin/deliver $u"
# sposób alternatywny:
#
DeliveryHost 127.0.0.1
DeliveryPort 10026
DeliveryIdent dspam
DeliveryProto SMTP
# co zrobić, jak się nie uda przekazać do kwarantanny
#
OnFail error
# zaufani użytkownicy
#
Trust root
Trust dspam
Trust apache
Trust mail
Trust mailnull
Trust smmsp
Trust daemon
#Trust nobody
#Trust majordomo
# sposób samonauczania
#
TrainingMode teft
TestConditionalTraining on
# dodatki
#
Feature whitelist
# algortym nauki
#
Algorithm graham burton
# rozbieranie maila na czynniki pierwsze - sposób sprawdzania
#
Tokenizer chain
# PValue: Specify the technique used for calculating Probability Values,
# overriding any defaults configured in the build. These options are:
PValue bcr
# statystyki
#
WebStats on
# ImprobabilityDrive: Calculate odds-ratios for ham/spam, and add to
# X-DSPAM-Improbability headers
#
ImprobabilityDrive on
Preference "trainingMode=TEFT" # { TOE | TUM | TEFT | NOTRAIN } -> default:teft
Preference "spamAction=tag" # { quarantine | tag | deliver } -> default:quarantine
Preference "spamSubject=[SPAM]" # { string } -> default:[SPAM]
Preference "statisticalSedation=5" # { 0 - 10 } -> default:0
Preference "enableBNR=on" # { on | off } -> default:off
Preference "enableWhitelist=on" # { on | off } -> default:on
Preference "signatureLocation=message" # { message | headers } -> default:message
Preference "tagSpam=on" # { on | off }
Preference "tagNonspam=off" # { on | off }
Preference "showFactors=off" # { on | off } -> default:off
Preference "optIn=off" # { on | off }
Preference "optOut=off" # { on | off }
Preference "whitelistThreshold=10" # { Integer } -> default:10
Preference "makeCorpus=off" # { on | off } -> default:off
Preference "storeFragments=off" # { on | off } -> default:off
Preference "localStore=" # { on | off } -> default:username
Preference "processorBias=on" # { on | off } -> default:on
Preference "fallbackDomain=off" # { on | off } -> default:off
Preference "trainPristine=off" # { on | off } -> default:off
Preference "optOutClamAV=off" # { on | off } -> default:off
Preference "ignoreRBLLookups=off" # { on | off } -> default:off
Preference "RBLInoculate=off" # { on | off } -> default:off
# nadpisywanie preferencji przez użytkowników
#
AllowOverride enableBNR
AllowOverride enableWhitelist
AllowOverride fallbackDomain
AllowOverride ignoreGroups
AllowOverride ignoreRBLLookups
AllowOverride localStore
AllowOverride makeCorpus
AllowOverride optIn
AllowOverride optOut
AllowOverride optOutClamAV
AllowOverride processorBias
AllowOverride RBLInoculate
AllowOverride showFactors
AllowOverride signatureLocation
AllowOverride spamAction
AllowOverride spamSubject
AllowOverride statisticalSedation
AllowOverride storeFragments
AllowOverride tagNonspam
AllowOverride tagSpam
AllowOverride trainPristine
AllowOverride trainingMode
AllowOverride whitelistThreshold
AllowOverride dailyQuarantineSummary
# ustawienia do bazy danych PostgreSQL
PgSQLServer /tmp
#PgSQLPort
PgSQLUser dspam
PgSQLPass _haslo_do_zmiany_
PgSQLDb dspam_db
PgSQLUIDInSignature on
PgSQLVirtualTable dspam_virtual_uids
PgSQLVirtualUIDField uid
PgSQLVirtualUsernameField username
HashRecMax 98317
HashAutoExtend on
HashMaxExtents 0
HashExtentSize 49157
HashPctIncrease 10
HashMaxSeek 10
HashConnectionCache 10
Notifications off
PurgeSignatures 14 # Stale signatures
PurgeNeutral 90 # Tokens with neutralish probabilities
PurgeUnused 90 # Unused tokens
PurgeHapaxes 30 # Tokens with less than 5 hits (hapaxes)
PurgeHits1S 15 # Tokens with only 1 spam hit
PurgeHits1I 15 # Tokens with only 1 innocent hit
LocalMX 127.0.0.1
SystemLog on
UserLog on
TrackSources spam
Opt out
# przekazywanie poczty do antywirusa
#
ClamAVPort 3310
ClamAVHost 127.0.0.1
ClamAVResponse accept
# -- CLIENT / SERVER --
#
ServerMode auto
ServerPass.Relay1 "secret"
ServerParameters "--deliver=innocent -d %u"
ServerDomainSocketPath "/var/run/dspam.sock"
ProcessorURLContext on
ProcessorBias on
StripRcptDomain off
## EOF
Utworzenie użytkownika na potrzeby postfixa
pw add user dspam -g mail -d /var/db/dspam -s /sbin/nologin
Dopisanie potrzebnych wpisów w transport.px
W celu dobrego działania nauki dspam konieczne jest dopisanie poniższych linijek w transport.px
# --- dspam ------------------------------------------------------ # spam.spam dspam-retrain:spam ham.ham dspam-retrain:innocent
Czyszczenie bazy danych ze starych wpisów
Aby nie dopuścić do przepełnienia bazy danych, dspam oferuje dwa skrypty, które należy uruchamiać w porach nocnych (może w ramach periodic??). Skrypty mogą powodować obciążenie serwera, stąd zalecenie na godziny nocne.
purge-pe.sql
Skrypt do uruchomienie, jeżeli użytkownicy mogą ustawiać swoje preferencje dla dspam.
purge.sql
Skrypt do uruchomienia, jeżeli ustawienia są tylko globalne.
Więcej informacji można znaleźć w dokumentacji: /usr/local/share/doc/dspam/pgsql_drv.txt.
