Wstęp
- Czym jest Postfix: http://pl.wikipedia.org/wiki/Postfix
- Postfix - Dovecot - Debian
Autor: vikus
Odnośnik do pliku pdf: http://www.4shared.com/file/107691392/5 ... _v130.html
http://debian.linux.pl/threads/24271-Po ... nstalacji]
Kod: Zaznacz cały
mime_header_checks = regexp:/etc/postfix/mime_header_checks.regexp
Kod: Zaznacz cały
/^\s*Content-(Disposition|Type).*name\s*=\s*"?(.+\.(lnk|asd|hlp|ocx|reg|bat|c[ho]m|cmd|exe|dll|vxd|pif|scr|hta|jse?|sh[mbs]|vb[esx]|ws[fh]|wav|mov|wmf|xl))"?\s*$/
REJECT Attachment type not allowed. File "$2" has the unacceptable extension "$3"
Kod: Zaznacz cały
/name=[^>]*\.(pdf|zip)/ REJECT Attachment type not allowed!
Kod: Zaznacz cały
body_checks = regexp:/etc/postfix/body_checks
Kod: Zaznacz cały
/lol/ REJECT Body Spam Rule - Spadaj Dziadu!
/dupa/ REJECT Body Spam Rule - Spadaj Dziadu!
Kod: Zaznacz cały
header_checks = regexp:/etc/postfix/header_checks
Kod: Zaznacz cały
/^Subject: .*ass*./ REJECT Head Spam Rule - Spadaj dziadu!
/^Subject: .*dick*./ REJECT Head Spam Rule - Spadaj dziadu!
Kod: Zaznacz cały
# Restrykcje - Sprawdzanie poczty na podstawie adresu odbiorcy listu (MAIL FROM):
smtpd_sender_restrictions =
hash:/etc/postfix/sender_checks,
permit_sasl_authenticated,
reject_unknown_sender_domain,
reject_non_fqdn_sender,
reject_unknown_address
Kod: Zaznacz cały
[email][email protected][/email] REJECT a idz w...
gmail.com REJECT a idz w...
Kod: Zaznacz cały
postmap /etc/postfix/sender_checks
Kod: Zaznacz cały
cd /etc/clamav/
wget [url]http://www.sanesecurity.com/clamav/ss-msrbl.txt[/url]
mv ss-msrbl.txt ss-msrbl.sh
chmod +x ss-msrbl.sh
Kod: Zaznacz cały
grep ^PidFile /etc/clamav/clamd.conf
Kod: Zaznacz cały
clamd_pid=/var/run/clamd/clamd.pid
Kod: Zaznacz cały
clamd_pid=/var/run/clamav/clamd.pid
Kod: Zaznacz cały
grep ^User /etc/clamav/clamd.conf
Kod: Zaznacz cały
# Set ClamD user and group accounts.
clam_user="clamav"
clam_group="clamav"
Kod: Zaznacz cały
# Set ClamD user and group accounts.
clam_user="amavis"
clam_group="clamav"
Kod: Zaznacz cały
aptitude install rsync curl
Kod: Zaznacz cały
/etc/clamav/ss-msrbl.sh
Kod: Zaznacz cały
============================================
SaneSecurity phish.ndb Signature File Update
============================================
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
============================================
SaneSecurity scam.ndb Signature File Update
============================================
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
============================================
MSRBL MSRBL-Images.hdb Signature File Update
============================================
Number of files: 1
Number of files transferred: 0
Total file size: 34648 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 35
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 34
Total bytes received: 77
sent 34 bytes received 77 bytes 44.40 bytes/sec
total size is 34648 speedup is 312.14
============================================
MSRBL MSRBL-SPAM.ndb Signature File Update
============================================
Number of files: 1
Number of files transferred: 0
Total file size: 235520 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 33
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 34
Total bytes received: 75
sent 34 bytes received 75 bytes 43.60 bytes/sec
total size is 235520 speedup is 2160.73
Kod: Zaznacz cały
ls -l /var/lib/clamav
Kod: Zaznacz cały
razem 17935
drwxr-xr-x 2 amavis clamav 504 2008-04-04 19:40 daily.inc
-rw-r--r-- 1 amavis clamav 11347852 2008-01-27 21:28 main.cvd
-rw------- 1 amavis clamav 364 2008-04-04 19:34 mirrors.dat
-rw-r--r-- 1 amavis clamav 34648 2008-04-04 19:25 MSRBL-Images.hdb
-rw-r--r-- 1 amavis clamav 31765 2008-04-04 19:40 MSRBL-Images.hdb-bak
-rw-r--r-- 1 amavis clamav 235520 2008-03-28 15:42 MSRBL-SPAM.ndb
-rw-r--r-- 1 amavis clamav 235359 2008-03-29 02:30 MSRBL-SPAM.ndb-bak
-rw-r--r-- 1 amavis clamav 1453797 2008-04-04 19:40 phish.ndb
-rw-r--r-- 1 amavis clamav 1453604 2008-04-04 19:40 phish.ndb-bak
-rw-r--r-- 1 amavis clamav 241303 2008-04-04 18:33 phish.ndb.gz
-rw-r--r-- 1 amavis clamav 1505443 2008-04-04 19:40 scam.ndb
-rw-r--r-- 1 amavis clamav 1504524 2008-04-04 19:40 scam.ndb-bak
-rw-r--r-- 1 amavis clamav 286650 2008-04-04 18:33 scam.ndb.gz
Kod: Zaznacz cały
0 4 * * * root /etc/clamav/ss-msrbl.sh &>/dev/null
Kod: Zaznacz cały
aptitude install altermime
Kod: Zaznacz cały
useradd -r -c "Postfix Filters" -d /var/spool/filter filter
Kod: Zaznacz cały
mkdir -p /var/spool/filter
Kod: Zaznacz cały
chmod 750 /var/spool/filter && chown filter:filter /var/spool/filter
Kod: Zaznacz cały
cp /usr/share/doc/altermime/examples/postfix_filter.sh /etc/postfix/disclaimer
Kod: Zaznacz cały
chmod 750 /etc/postfix/disclaimer && chgrp filter /etc/postfix/disclaimer
Kod: Zaznacz cały
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
DOMAIN="test.com"
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15
# Start processing.
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }
cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }
grep "From:" in.$$ | grep -i $DOMAIN > /dev/null
let R=$?
if [ $R -eq 0 ]; then
/usr/bin/altermime --input=in.$$ \
--disclaimer=/etc/postfix/disclaimer.txt \
--disclaimer-html=/etc/postfix/disclaimer.txt \
--xheader="X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm" || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
$SENDMAIL "$@" <in.$$
exit $?
Kod: Zaznacz cały
cp /usr/share/doc/altermime/examples/disclaimer.txt /etc/postfix/disclaimer.txt
Kod: Zaznacz cały
nano /etc/postfix/master.cf
Kod: Zaznacz cały
#
# Postnik master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
#========================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
#========================================================
smtp inet n - - - - smtpd
-o content_filter=dfilt:
[...]
Kod: Zaznacz cały
[...]
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}
Kod: Zaznacz cały
#
# Postnik master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
#========================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
#========================================================
smtp inet n - - - - smtpd
-o content_filter=dfilt:
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}
Kod: Zaznacz cały
/etc/init.d/postfix restart
Kod: Zaznacz cały
/etc/postfix/disclaimer
Kod: Zaznacz cały
/etc/postfix/disclaimer.txt