Você está na página 1de 13

Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

Virtualization Poll

Options For This Howto


VMware Images:

V irtual U s ers A nd
D omains With
P os tfix, C ourier,
M ySQ L A nd
SquirrelM ail
(U buntu 8 .0 4
L T S) (5 2 4 .9 M B)
(0 5 /1 5 /2 0 0 8 )

V M ware I mage
I mport G uide
L is t of all V M ware
I mages
Free Support
P aid Support

Navigation
H owtos
L inux
C entO S
D ebian
Fedora
Kernel
M andriva
P C L inuxO S
SuSE
U buntu

1 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

A pac he
Bac kup
C ontrol P anels
DNS
D es ktop
E mail
A nti-Spam/V irus
P os tfix
P roc mail
Sendmail
FT P
H igh-A vailability
L ighttpd
M onitoring
M ySQ L
P rogramming
C /C ++
P HP
Samba
Sec urity
A nti-Spam/V irus
V irtualization
O ther
FreeBSD
C ommerc ial
M ini-H owtos
Forums
C ontribute
Subs c ription
L ogin
Site M ap/RSS Feeds

User login
U s ername:

P as s word:

Remember M e?

C reate a new ac c ount


Reques t new pas s word

2 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

Ads by Google
Postf ix
X300 Linux
Qmail Amav is
Qmail Spam

Who's online
T here are c urrently 9 us ers and 2 7 6 3 gues ts online.

HowtoForge Forums
Sell C vv G ood and
fres h, pleas e
purc has e my :X
s ell C vv G ood and
fres h, pleas e
purc has e my :X
how to run
inotifywait
bac kground
Res tarting O penBSD
Sec ure Shell
s erver s s hd
L inux ldap bind
windows ad
L dap from windows
to linux
pos tfix/s quirrelma
il with plugin ...
G odaddy and
N ames ervers
H ow to Run a V ideo
at the s tart
unattended?
L oc al T es ting
Server Setup

News
D is tro Review: O penSU SE 1 1 .2
KD E C ommunity Forums A nnounc e the C ontinuation of Klas s room
D RM C hange C ontinues T o C aus e D ebate
T he P erfec t D es ktop - Fedora 1 2 i6 8 6 (G N O M E )
Stream mus ic wireles s ely us ing P uls eA udio s erver
M us ic A lbum C overs A nd P ic ture P reviews A s Folder T humbnails I n N autilus
L inux M int 8 final releas ed
Finding files and doc uments with Rec oll

3 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

When O pen Sourc e M eets C los ed M inds


Strange I deas A bout Freedom of Speec h

more

Recent comments
boot problem after ins tall php5 pakage
1 4 hours 5 3 min ago
T hanks man
1 4 hours 5 9 min ago
s quiremail not working
1 5 hours 2 5 min ago
Re: Sec urity c ons ideration - D N S
1 9 hours 7 min ago
Re: C hillifire™ H ots pot s olution - Run one hots pot or an entir
1 9 hours 2 6 min ago
openvz
2 2 hours 3 3 min ago
problems with pam
1 day 5 hours ago
Re: When I ins talled and s tarted
1 day 1 5 hours ago
Re: s ubvers ion tutoria;
2 days 3 hours ago
thanks everything woked
2 days 3 hours ago

Newsletter
Subscribe to
HowtoForge
Newsletter
and s tay informed
about our lates t
H O WT O s and
projec ts .
enter email address

(T o uns ubs c ribe


from our news letter,
vis it this link.)

Syndicate

4 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

H owtoForge Feed for Fac ebook®


"Facebook" is a registered trademark of Facebook, Inc. All rights reserved.

English | Deutsch | Site Map/RSS Feeds | Advertise

Profe s s ional Linux Laptop


Linux on M6400, E6500, E6400, E4200 Fedora, Ubuntu, RHEL, Debian, Slack
www.EmperorLinux.com

You are here: Home » Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Ubuntu 8.04 LTS) » Virtual Users
And Domains With Postfix, Courier, MySQL And SquirrelMail (Ubuntu 8.04 LTS) - Page 3

Do you like HowtoForge? Please consider supporting us by becoming a


subscriber.
Submitted by falko (Contact Author) (Forums) on Tue, 2008-05-20 17:21. ::
LinuxLIVE for Linux PCs
Suspe nd-R e sum e , Sha ring, Mo bility 0

Se ssio n tweet
w w w .starnet.com T o ins tall amavis d- new, s pamas s as s in and
24/7 My SQL Support c lamav, run the following c ommand:
Dia gno stics, T uning
T ro uble sho o ting by R e co gnize d My apt-get install amavisd-new spamassassin clamav
SQ L Ex pe rts clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl
w w w .Percona.com libnet-snpp-perl libnet-telnet-perl nomarch lzop
My SQL Reporting Tool pax
Affo rda ble bro wse r ba se d re po rt,
cha rt & m a il m e rge to o l fo r My SQ L A fterwards we mus t c onfigure amavis d- new. T he
w w w .qlrmanager.com
c onfiguration is s plit up in various files whic h res ide
in the /etc/amavis/conf.d direc tory. T ake a look at
eac h of them to bec ome familiar with the
c onfiguration. M os t s ettings are fine, however we mus t modify three files :

Firs t we mus t enable C lamA V and SpamA s s as s in in /etc/amavis/conf.d/15-content_filter_mode by


unc ommenting the @bypass_virus_checks_maps and the @bypass_spam_checks_maps lines :

vi /etc/amavis/conf.d/15-content_filter_mode

T he file s hould look like this :

5 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

use strict;

# You can modify this file to re-enable SPAM checking t


# and to re-enable antivirus checking.

#
# Default antivirus checking mode
# Uncomment the two lines below to enable it back
#

@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$

#
A nd then you s hould take a look at the s pam s ettings and the ac tions for s pam- /virus - mails in
/etc/amavis/conf.d/20-debian_defaults. T here's no need to c hange anything if the default s ettings
are ok for you. T he file c ontains many explanations s o there's no need to explain the s ettings here:

vi /etc/amavis/conf.d/20-debian_defaults

[...]
$QUARANTINEDIR = "$MYHOME/virusmails";
$quarantine_subdir_levels = 1; # enable quarantine dir

$log_recip_templ = undef; # disable by-recipient lev


$DO_SYSLOG = 1; # log via syslogd (preferr
$syslog_ident = 'amavis'; # syslog ident tag, prepen
$syslog_facility = 'mail';
$syslog_priority = 'debug'; # switch to info to drop d

$enable_db = 1; # enable use of BerkeleyDB


$enable_global_cache = 1; # enable use of libdb-base

$inet_socket_port = 10024; # default listening socket

Finally, edit /etc/amavis/conf.d/50-user and add the line $pax='pax'; in the middle:

vi /etc/amavis/conf.d/50-user

6 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

use strict;

#
# Place your configuration directives here. They will
# earlier files.
#
# See /usr/share/doc/amavisd-new/ for documentation and
# the directives you can use in this file
#

$pax='pax';

#------------ Do not modify anything below this line --


1; # ensure a defined return

A fterwards , run thes e c ommands to add the clamav us er to the amavis group and to res tart
amavis d- new and C lamA V :

adduser clamav amavis


/etc/init.d/amavis restart
/etc/init.d/clamav-daemon restart
/etc/init.d/clamav-freshclam restart

N ow we have to c onfigure P os tfix to pipe inc oming email through amavis d- new:

postconf -e 'content_filter = amavis:[127.0.0.1]:10024'


postconf -e 'receive_override_options = no_address_mappings'

A fterwards append the following lines to /etc/postfix/master.cf:

vi /etc/postfix/master.cf

7 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

[...]
amavis unix - - - - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes

127.0.0.1:10025 inet n - - - - smtpd


-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetwor
-o mynetworks=127.0.0.0/8
T hen res tart P os tfix:

/etc/init.d/postfix restart

N ow run

netstat -tap

and you s hould s ee P os tfix (master) lis tening on port 2 5 (smtp) and 1 0 0 2 5 , and amavis d- new on
port 1 0 0 2 4 :

root@server1:/etc/postfix# netstat -tap


Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost.localdo:10024 *:* LISTEN 15645/amavisd (mast
tcp 0 0 localhost.localdo:10025 *:* LISTEN 16677/master
tcp 0 0 localhost.localdo:mysql *:* LISTEN 6177/mysqld
tcp 0 0 *:www *:* LISTEN 5367/apache2
tcp 0 0 *:smtp *:* LISTEN 16677/master
tcp6 0 0 [::]:imaps [::]:* LISTEN 14020/couriertcpd
tcp6 0 0 [::]:pop3s [::]:* LISTEN 14088/couriertcpd
tcp6 0 0 [::]:pop3 [::]:* LISTEN 14051/couriertcpd
tcp6 0 0 [::]:imap2 [::]:* LISTEN 13983/couriertcpd
tcp6 0 0 [::]:ssh [::]:* LISTEN 4006/sshd
tcp6 0 52 server1.example.com:ssh 192.168.0.210%8191:3340 ESTABLISHED 4059/0
root@server1:/etc/postfix#

Razor, P yzor and D C C are s pamfilters that us e a c ollaborative filtering network. T o ins tall Razor
and P yzor, run

apt-get install razor pyzor

8 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

D C C is n't available in the U buntu 8 .0 4 repos itories , s o we ins tall it as follows :

cd /tmp
wget http://launchpadlibrarian.net/11564361/dcc-server_1.3.42-5_i386.deb
wget http://launchpadlibrarian.net/11564359/dcc-common_1.3.42-5_i386.deb
dpkg -i dcc-common_1.3.42-5_i386.deb
dpkg -i dcc-server_1.3.42-5_i386.deb

N ow we have to tell SpamA s s as s in to us e thes e three programs . E dit /etc/spamassassin/local.cf


and add the following lines to it:

vi /etc/spamassassin/local.cf

[...]
#dcc
use_dcc 1
dcc_path /usr/bin/dccproc

#pyzor
use_pyzor 1
pyzor_path /usr/bin/pyzor

#razor
use_razor2 1
razor_config /etc/razor/razor-agent.conf

#bayes
use_bayes 1
T hen we mus t enable the D C C plugin in SpamA s s as s in. O pen /etc/spamassassin/v310.pre and
unc omment the loadplugin Mail::SpamAssassin::Plugin::DCC line:

vi /etc/spamassassin/v310.pre

[...]
# DCC - perform DCC message checks.
#
# DCC is disabled here because it is not open source.
# license for more details.
#
loadplugin Mail::SpamAssassin::Plugin::DCC
[...]

Y ou c an c hec k your SpamA s s as s in c onfiguration by exec uting:

9 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

spamassassin --lint

I t s houldn't s how any errors .

Res tart amavis d- new afterwards :

/etc/init.d/amavis restart

N ow we update our SpamA s s as s in rules ets as follows :

sa-update --no-gpg

We c reate a c ron job s o that the rules ets will be updated regularly. Run

crontab -e

to open the c ron job editor. C reate the following c ron job:

23 4 */2 * * /usr/bin/sa-update --no-gpg &> /dev/null

T his will update the rules ets every s ec ond day at 4 .2 3 h.

I f you want to get notific ations about all the email ac c ounts that are over quota, then do this :

cd /usr/local/sbin/
wget http://puuhis.net/vhcs/quota.txt
mv quota.txt quota_notify
chmod 755 quota_notify

O pen /usr/local/sbin/quota_notify and edit the variables at the top. Further down in the file
(towards the end) there are two lines where you s hould add a % s ign:

vi /usr/local/sbin/quota_notify

10 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

[...]
my $POSTFIX_CF = "/etc/postfix/main.cf";
my $MAILPROG = "/usr/sbin/sendmail -t";
my $WARNPERCENT = 80;
my @POSTMASTERS = ('postmaster@yourdomain.tld');
my $CONAME = 'My Company';
my $COADDR = 'postmaster@yourdomain.tld';
my $SUADDR = 'postmaster@yourdomain.tld';
my $MAIL_REPORT = 1;
my $MAIL_WARNING = 1;
[...]
print "Subject: WARNING: Your mailbox is $lu
[...]
print "Your mailbox: $luser is $lusers{$luse
[...]
Run

crontab -e

to c reate a c ron job for that s c ript:

0 0 * * * /usr/local/sbin/quota_notify &> /dev/null

8 .0 4 L T S) - P age 2 8 .0 4 L T S) - P age 4

T his page is lic ens ed under a C reative C ommons L ic ens e.

add c omment | view as pdf | print: this | all page(s ) |

11 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

V irtual U s ers A nd D omains With P os tfix, C ourier, M ySQ L A nd SquirrelM ail (M andriva 2 0 0 8 .1 )
V irtual U s ers A nd D omains With P os tfix, C ourier A nd M ySQ L (C entO S 5 .1 )
V irtual U s ers A nd D omains With P os tfix, C ourier A nd M ySQ L (U buntu 7 .1 0 )
V irtual U s ers A nd D omains With P os tfix, C ourier A nd M ySQ L (Fedora 8 )

Pleas e do not us e the comment function to as k for help! I f you need help, pleas e us e our forum.
Comments will be publis hed after adminis trator approval.

Connection refused when sending mails


Submitted by Fred (not registered) on Wed, 2009-10-28 10:58.

I got an error when I wanted to send mail, even to an internal account.

I checked the conf again and again until I discvered that amavis was not activated (with netstat -tap).

When I tried to launch amavis I got the following error :

Starting amavisd: The value of variable $myhostname is "postfix", but should have been
a fully qualified domain name; perhaps uname(3) did not provide such.
You must explicitly assign a FQDN of this host to variable $myhostname
in /etc/amavis/conf.d/05-node_id, or fix what uname(3) provides as a host's
network name!

I checked my hostname and realized it was not correctly configured.


I jut set it to mail.mydomain.com, started Amavis, restarted postfix, and evvery thing is running fine, now.

reply | view as pdf

64bit DCC
Submitted by Eric Thelin (not registered) on Mon, 2009-03-02 05:05.

For a 64bit server use these urls in step 10 to get DCC instead of the ones listed.

http://launchpadlibrarian.net/11565554/dcc-server_1.3.42-5_amd64.deb

http://launchpadlibrarian.net/11565552/dcc-common_1.3.42-5_amd64.deb

reply | view as pdf

Sponsored Links: Unified Communications: Thoughts, Strategies and Predictions


Join the discussion.
www.seamlessenterprise.com

IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com

Wireless & Wireline Integration


Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com

12 of 13 11/30/09 12:04
Virtual Users And Domains With Postfix, Courier, ... http://www.howtoforge.com/virtual-users-domains-...

Unified Communications 2009


Join the Discussion. Now.
www.seamlessenterprise.com

Red Hat Virtual Experience - a free virtual event. Dec. 9th

13 of 13 11/30/09 12:04

Você também pode gostar