Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Debian Lenny) - Page 3

9 Install amavisd-new, SpamAssassin, And ClamAV

To install amavisd-new, spamassassin and clamav, run the following command:

apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax

Afterwards we must configure amavisd-new. The configuration is split up in various files which reside in the /etc/amavis/conf.d directory. Take a look at each of them to become familiar with the configuration. Most settings are fine, however we must modify three files:

First we must enable ClamAV and SpamAssassin in /etc/amavis/conf.d/15-content_filter_mode by uncommenting the @bypass_virus_checks_maps and the @bypass_spam_checks_maps lines:

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

The file should look like this:

use strict;

# You can modify this file to re-enable SPAM checking through spamassassin
# 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, \$bypass_virus_checks_re);


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

@bypass_spam_checks_maps = (
   \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);

1;  # ensure a defined return

And then you should take a look at the spam settings and the actions for spam-/virus-mails in /etc/amavis/conf.d/20-debian_defaults. There's no need to change anything if the default settings are ok for you. The file contains many explanations so there's no need to explain the settings here:

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

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

$log_recip_templ = undef;    # disable by-recipient level-0 log entries
$DO_SYSLOG = 1;              # log via syslogd (preferred)
$syslog_ident = 'amavis';    # syslog ident tag, prepended to all messages
$syslog_facility = 'mail';
$syslog_priority = 'debug';  # switch to info to drop debug output, etc

$enable_db = 1;              # enable use of BerkeleyDB/libdb (SNMP and nanny)
$enable_global_cache = 1;    # enable use of libdb-based cache if $enable_db=1

$inet_socket_port = 10024;   # default listening socket

$sa_spam_subject_tag = '***SPAM*** ';
$sa_tag_level_deflt  = 2.0;  # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 6.31; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 6.31; # triggers spam evasive actions
$sa_dsn_cutoff_level = 10;   # spam level beyond which a DSN is not sent
[...]
$final_virus_destiny      = D_DISCARD;  # (data not lost, see virus quarantine)
$final_banned_destiny     = D_BOUNCE;   # D_REJECT when front-end MTA
$final_spam_destiny       = D_BOUNCE;
$final_bad_header_destiny = D_PASS;     # False-positive prone (for spam)
[...]

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

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

use strict;

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

$pax='pax';

#------------ Do not modify anything below this line -------------
1;  # ensure a defined return

Afterwards, run these commands to add the clamav user to the amavis group and to restart amavisd-new and ClamAV:

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

Now we have to configure Postfix to pipe incoming email through amavisd-new:

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

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

vi /etc/postfix/master.cf

[...]
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_mynetworks,reject
        -o mynetworks=127.0.0.0/8
        -o strict_rfc821_envelopes=yes
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_bind_address=127.0.0.1

Then restart Postfix:

/etc/init.d/postfix restart

Now run

netstat -tap

and you should see Postfix (master) listening on port 25 (smtp) and 10025, and amavisd-new on port 10024:

server1:/etc/courier# 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.localdoma:800 *:*                     LISTEN      5288/famd
tcp        0      0 localhost.localdo:10024 *:*                     LISTEN      20746/amavisd (mast
tcp        0      0 localhost.localdo:10025 *:*                     LISTEN      21718/master
tcp        0      0 localhost.localdo:mysql *:*                     LISTEN      4559/mysqld
tcp        0      0 *:58219                 *:*                     LISTEN      1486/rpc.statd
tcp        0      0 *:sunrpc                *:*                     LISTEN      1475/portmap
tcp        0      0 *:ssh                   *:*                     LISTEN      1709/sshd
tcp        0      0 *:smtp                  *:*                     LISTEN      21718/master
tcp        0    148 server1.example.com:ssh localhost:3389          ESTABLISHED 2055/0
tcp6       0      0 [::]:imaps              [::]:*                  LISTEN      18254/couriertcpd
tcp6       0      0 [::]:pop3s              [::]:*                  LISTEN      18282/couriertcpd
tcp6       0      0 [::]:pop3               [::]:*                  LISTEN      18265/couriertcpd
tcp6       0      0 [::]:imap2              [::]:*                  LISTEN      18237/couriertcpd
tcp6       0      0 [::]:www                [::]:*                  LISTEN      4818/apache2
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      1709/sshd
server1:/etc/courier#

 

10 Install Razor, Pyzor And DCC And Configure SpamAssassin

Razor, Pyzor and DCC are spamfilters that use a collaborative filtering network. To install Razor and Pyzor, run

apt-get install razor pyzor

DCC isn't available in the Debian Lenny repositories, so we install it as follows:

cd /tmp
wget http://www.dcc-servers.net/dcc/source/dcc-dccproc.tar.Z
tar xzvf dcc-dccproc.tar.Z
cd dcc-dccproc-1.3.102
./configure --with-uid=amavis
make
make install
chown -R amavis:amavis /var/dcc
ln -s /var/dcc/libexec/dccifd /usr/local/bin/dccifd

Now we have to tell SpamAssassin to use these three programs. Edit /etc/spamassassin/local.cf and add the following lines to it:

vi /etc/spamassassin/local.cf

[...]
#dcc
use_dcc 1
dcc_path /usr/local/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
use_bayes_rules 1
bayes_auto_learn 1

Then we must enable the DCC plugin in SpamAssassin. Open /etc/spamassassin/v310.pre and uncomment 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.  See the DCC
# license for more details.
#
loadplugin Mail::SpamAssassin::Plugin::DCC
[...]

You can check your SpamAssassin configuration by executing:

spamassassin --lint

It shouldn't show any errors.

Restart amavisd-new afterwards:

/etc/init.d/amavis restart

Now we update our SpamAssassin rulesets as follows:

sa-update --no-gpg

(Next we are going to create a cron job. By default, the crontab -e command launches the nano editor on Debian Lenny. If you are used to vi, you might want to change this:

update-alternatives --config editor

Select your favourite editor:

server1:/tmp/dcc-dccproc-1.3.102# update-alternatives --config editor

There are 4 alternatives which provide `editor'.

  Selection    Alternative
-----------------------------------------------
          1    /bin/ed
*+        2    /bin/nano
          3    /usr/bin/vim.tiny
          4    /usr/bin/vim.nox

Press enter to keep the default[*], or type selection number:
 <-- 4
Using '/usr/bin/vim.nox' to provide 'editor'.
server1:/tmp/dcc-dccproc-1.3.102#

)

We create a cron job so that the rulesets will be updated regularly. Run

crontab -e

to open the cron job editor. Create the following cron job:

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

This will update the rulesets every second day at 4.23h.

 

11 Quota Exceedance Notifications

If you want to get notifications about all the email accounts 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

Open /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 should add a % sign:

vi /usr/local/sbin/quota_notify

[...]
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 $lusers{$luser}% full.\n";
[...]
           print "Your mailbox: $luser is $lusers{$luser}% full.\n\n";
[...]

Run

crontab -e

to create a cron job for that script:

0 0 * * * /usr/local/sbin/quota_notify &> /dev/null
Share this page:

45 Comment(s)

Add comment

Comments

From: at: 2009-03-12 04:20:33

how can i write one script after user run this script they log in to root user?

 This script contain username and password of root.

 

 

From: sektalah at: 2010-06-22 14:10:31

Help me please...

How to integrated with postfixadmin...

 I'm try and ...

Error connection DROPED by IMAP

Thank's 

From: rieschl at: 2009-04-11 21:32:28

You should consider changing the permission of the "/etc/postfix/sasl/smtpd.conf" and "/etc/pam.d/smtp" files (chmod o= [filename]) so that the mysql mail-admin-password is not world-readable.

From: at: 2009-11-15 09:10:49

On Mail Clients (Outlook etc.) can the option SMTP Authentification not be activated. Is that correct?

From: Anonymous at: 2010-03-08 17:45:07

cuando entro por el telnet al puerto 25 me da el siguiente error:

 Trying 192.168.1.4...
Connected to 192.168.1.4.
Escape character is '^]'.
+OK Hello there.
user eduardo
+OK Password required.
pass eduardo
-ERR Login failed.

 he seguido el tutorial al pie de la letra, incluso lo hice dos veces, pero me sigue dando error

¿que puedo hacer?

From: Anonymous at: 2010-03-08 15:57:51

seguí los pasos al pie de la letra, pero cuando hago lo siguiente: Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. +OK Hello there. user eduardo +OK Password required. pass eduardo -ERR Login failed. ¿que puedo hacer? Saludos

From: Anonymous at: 2009-03-09 14:02:55

pls update dcc-dccproc

cd dcc-dccproc-1.3.103 acctually

From: White at: 2009-08-27 20:13:48

cd dcc-dccproc-1.3.102 this is now cd dcc-dccproc-1.3.115

 Falko it may be worth placing a note in the instructions that say check to see what level this program is and update the text prior to entering it into the shell.

White

From: hstoellinger at: 2009-11-17 10:19:22

cd dcc-dccproc-1.3.102 this is now cd dcc-dccproc-1.3.116

From: at: 2009-11-11 16:17:12

Please, someone, post the quota.txt file here, the website is no longer available

From: at: 2009-11-15 08:57:08

Hope, that helps:

 

#!/usr/bin/perl -w

# Author <jps@tntmax.com>
#
# This script assumes that virtual_mailbox_base in defined
# in postfix's main.cf file. This directory is assumed to contain
# directories which themselves contain your virtual user's maildirs.
# For example:
#
# -----------/
#            |
#            |
#    home/vmail/domains/
#        |          |
#        |          |
#  example.com/  foo.com/
#                   |
#                   |
#           -----------------
#           |       |       |
#           |       |       |
#         user1/   user2/  user3/
#                           |
#                           |
#                        maildirsize
#

use strict;

my $POSTFIX_CF = "/etc/postfix/main.cf";
my $MAILPROG = "/usr/sbin/sendmail -t";
my $WARNPERCENT = 80;
my @POSTMASTERS = ('postmaster@domain.tld');
my $CONAME = 'My Company';
my $COADDR = 'postmaster@domain.tld';
my $SUADDR = 'postmaster@domain.tld';
my $MAIL_REPORT = 1;
my $MAIL_WARNING = 1;

#get virtual mailbox base from postfix config
open(PCF, "< $POSTFIX_CF") or die $!;
my $mboxBase;
while (<PCF>) {
   next unless /virtual_mailbox_base\s*=\s*(.*)\s*/;
   $mboxBase = $1;
}
close(PCF);

#assume one level of subdirectories for domain names
my @domains;
opendir(DIR, $mboxBase) or die $!;
while (defined(my $name = readdir(DIR))) {
   next if $name =~ /^\.\.?$/;        #skip '.' and '..'
   next unless (-d "$mboxBase/$name");
   push(@domains, $name);
}
closedir(DIR);
#iterate through domains for username/maildirsize files
my @users;
chdir($mboxBase);
foreach my $domain (@domains) {
        opendir(DIR, $domain) or die $!;
        while (defined(my $name = readdir(DIR))) {
           next if $name =~ /^\.\.?$/;        #skip '.' and '..'
           next unless (-d "$domain/$name");
      push(@users, {"$name\@$domain" => "$mboxBase/$domain/$name"});
        }
}
closedir(DIR);

#get user quotas and percent used
my (%lusers, $report);
foreach my $href (@users) {
   foreach my $user (keys %$href) {
      my $quotafile = "$href->{$user}/maildirsize";
      next unless (-f $quotafile);
      open(QF, "< $quotafile") or die $!;
      my ($firstln, $quota, $used);
      while (<QF>) {
         my $line = $_;
              if (! $firstln) {
                 $firstln = 1;
                 die "Error: corrupt quotafile $quotafile"
                    unless ($line =~ /^(\d+)S/);
                 $quota = $1;
            last if (! $quota);
            next;
         }
         die "Error: corrupt quotafile $quotafile"
            unless ($line =~ /\s*(-?\d+)/);
         $used += $1;
      }
      close(QF);
      next if (! $used);
      my $percent = int($used / $quota * 100);
      $lusers{$user} = $percent unless not $percent;
   }
}

#send a report to the postmasters
if ($MAIL_REPORT) {
   open(MAIL, "| $MAILPROG");
   select(MAIL);
   map {print "To: $_\n"} @POSTMASTERS;
   print "From: $COADDR\n";
   print "Subject: Daily Quota Report.\n";
   print "DAILY QUOTA REPORT:\n\n";
   print "----------------------------------------------\n";
   print "| % USAGE |            ACCOUNT NAME          |\n";
   print "----------------------------------------------\n";
   foreach my $luser ( sort { $lusers{$b} <=> $lusers{$a} } keys %lusers ) {
      printf("|   %3d   | %32s |\n", $lusers{$luser}, $luser);
      print "---------------------------------------------\n";
   }
        print "\n--\n";
        print "$CONAME\n";
        close(MAIL);
}

#email a warning to people over quota
if ($MAIL_WARNING) {
        foreach my $luser (keys (%lusers)) {
           next unless $lusers{$luser} >= $WARNPERCENT;       # skip those under quota
           open(MAIL, "| $MAILPROG");
           select(MAIL);
           print "To: $luser\n";
      map {print "BCC: $_\n"} @POSTMASTERS;
           print "From: $SUADDR\n";
           print "Subject: WARNING: Your mailbox is $lusers{$luser}% full.\n";
           print "Reply-to: $SUADDR\n";
           print "Your mailbox: $luser is $lusers{$luser}% full.\n\n";
           print "Once your e-mail box has exceeded your monthly storage quota\n";
      print "your monthly billing will be automatically adjusted.\n";
      print "Please consider deleting e-mail and emptying your trash folder to clear some space.\n\n";
           print "Contact <$SUADDR> for further assistance.\n\n";
           print "Thank You.\n\n";
           print "--\n";
           print "$CONAME\n";
           close(MAIL);
        }
}

From: Den at: 2010-06-02 08:35:20

That helps a lot!

Thanks :)

Den

From: Anonymous at: 2009-10-21 07:45:34

Can sombody send me quota.txt or post some other link cose this isnt working

From: Marco at: 2009-10-01 12:36:19

The quata.txt page you mention is not there anymore (http://puuhis.net/vhcs/quota.txt).

By the way: this is a great tutorial!

Best regards.
Marco

From: timv at: 2010-11-22 08:00:08

Here is the info for quota.txt as the link in the document is dead.

 

11 Quota Exceedance Notifications

If you want to get notifications about all the email accounts that are over quota, then do this:

cd /usr/local/sbin/
nano quota.txt

#!/usr/bin/perl -w

# Author <jps@tntmax.com>
#
# This script assumes that virtual_mailbox_base in defined
# in postfix's main.cf file. This directory is assumed to contain
# directories which themselves contain your virtual user's maildirs.
# For example:
#
# -----------/
#            |
#            |
#    home/vmail/domains/
#        |          |
#        |          |
#  example.com/  foo.com/
#                   |
#                   |
#           -----------------
#           |       |       |
#           |       |       |
#         user1/   user2/  user3/
#                           |
#                           |
#                        maildirsize
#

use strict;

my $POSTFIX_CF = "/etc/postfix/main.cf";
my $MAILPROG = "/usr/sbin/sendmail -t";
my $WARNPERCENT = 80;
my @POSTMASTERS = ('postmaster@domain.tld');
my $CONAME = 'My Company';
my $COADDR = 'postmaster@domain.tld';
my $SUADDR = 'postmaster@domain.tld';
my $MAIL_REPORT = 1;
my $MAIL_WARNING = 1;

#get virtual mailbox base from postfix config
open(PCF, "< $POSTFIX_CF") or die $!;
my $mboxBase;
while (<PCF>) {
   next unless /virtual_mailbox_base\s*=\s*(.*)\s*/;
   $mboxBase = $1;
}
close(PCF);

#assume one level of subdirectories for domain names
my @domains;
opendir(DIR, $mboxBase) or die $!;
while (defined(my $name = readdir(DIR))) {
   next if $name =~ /^\.\.?$/;        #skip '.' and '..'
   next unless (-d "$mboxBase/$name");
   push(@domains, $name);
}
closedir(DIR);
#iterate through domains for username/maildirsize files
my @users;
chdir($mboxBase);
foreach my $domain (@domains) {
        opendir(DIR, $domain) or die $!;
        while (defined(my $name = readdir(DIR))) {
           next if $name =~ /^\.\.?$/;        #skip '.' and '..'
           next unless (-d "$domain/$name");
      push(@users, {"$name\@$domain" => "$mboxBase/$domain/$name"});
        }
}
closedir(DIR);

#get user quotas and percent used
my (%lusers, $report);
foreach my $href (@users) {
   foreach my $user (keys %$href) {
      my $quotafile = "$href->{$user}/maildirsize";
      next unless (-f $quotafile);
      open(QF, "< $quotafile") or die $!;
      my ($firstln, $quota, $used);
      while (<QF>) {
         my $line = $_;
              if (! $firstln) {
                 $firstln = 1;
                 die "Error: corrupt quotafile $quotafile"
                    unless ($line =~ /^(\d+)S/);
                 $quota = $1;
            last if (! $quota);
            next;
         }
         die "Error: corrupt quotafile $quotafile"
            unless ($line =~ /\s*(-?\d+)/);
         $used += $1;
      }
      close(QF);
      next if (! $used);
      my $percent = int($used / $quota * 100);
      $lusers{$user} = $percent unless not $percent;
   }
}

#send a report to the postmasters
if ($MAIL_REPORT) {
   open(MAIL, "| $MAILPROG");
   select(MAIL);
   map {print "To: $_\n"} @POSTMASTERS;
   print "From: $COADDR\n";
   print "Subject: Daily Quota Report.\n";
   print "DAILY QUOTA REPORT:\n\n";
   print "----------------------------------------------\n";
   print "| % USAGE |            ACCOUNT NAME          |\n";
   print "----------------------------------------------\n";
   foreach my $luser ( sort { $lusers{$b} <=> $lusers{$a} } keys %lusers ) {
      printf("|   %3d   | %32s |\n", $lusers{$luser}, $luser);
      print "---------------------------------------------\n";
   }
        print "\n--\n";
        print "$CONAME\n";
        close(MAIL);
}

#email a warning to people over quota
if ($MAIL_WARNING) {
        foreach my $luser (keys (%lusers)) {
           next unless $lusers{$luser} >= $WARNPERCENT;       # skip those under quota
           open(MAIL, "| $MAILPROG");
           select(MAIL);
           print "To: $luser\n";
      map {print "BCC: $_\n"} @POSTMASTERS;
           print "From: $SUADDR\n";
           print "Subject: WARNING: Your mailbox is $lusers{$luser}% full.\n";
           print "Reply-to: $SUADDR\n";
           print "Your mailbox: $luser is $lusers{$luser}% full.\n\n";
           print "Once your e-mail box has exceeded your monthly storage quota\n";
      print "your monthly billing will be automatically adjusted.\n";
      print "Please consider deleting e-mail and emptying your trash folder to clear some space.\n\n";
           print "Contact <$SUADDR> for further assistance.\n\n";
           print "Thank You.\n\n";
           print "--\n";
           print "$CONAME\n";
           close(MAIL);
        }
}
 

From: LightVision at: 2011-01-26 04:03:45

Those who are using your tutorial with copy and paste will stuck with vim and the certainly woul'nt know how to use it.

Default editor should be left as it is, in Debian: nano; advanced users would know how to change it anyway.

Besides the fact that I alway use dpkg -P vim-tiny vim-common tasksel tasksel-data and other few packages which are never used in a server.


In Debian Lenny 5.0.3 $pax='pax'; is enabled by default so it isn't necesary to include in /etc/amavis/conf.d/50-user


Two questions:

-For what is the cron? Ok, update database but with what and for what?

-How clamav update it's virus database ?


Thank You

From: Anonymous at: 2009-05-01 07:24:00

Hi, is it possible to put more than 1 address in field "destination" of  forwardings table? it doesn't seem to work. Can you help me?

 Very good work! thk

 

 

From: Anonymous at: 2009-09-15 07:43:25

You don't add several to the destination, you just insert a second row with all fields the same, but the destination differing.

 

from/to:

test@test.com/destination@test.com

test@test.com/otherdestination@test.com

 

If, for example, only the destination differs, you still insert a row for each unique forwarding.

 

Tim

From: Karolis Tamutis at: 2010-01-04 20:35:33

Please save yourself some frustration and know that passwords encrypted with crypt are salted, up to 8 characters long.

You may enter 9+ char password into PMA which would discard everything after 8th char, this can lead to some weird scenarions, like users being able to authenticate with other users passwords (which match up to 8 first chars).

In short: be aware of the 8 char limit, users with MySQL setup passwords such as 123456781 and 123456782 will be able to authenticate with either password.

From: at: 2010-02-01 14:42:16

If I setup as a local user an email like user@gmail.com then when I want to send an email to externaluser@gmail.com, postfix will try to send that email locally, because match gmail.com in mail_domains and it think that that is an internal email...

 Any idea how to solve this problem?

 

Thanks

MiK

From: Anonymous2 at: 2010-02-24 23:39:56

Hey!

When I try to send an email from yahoo/google to the email account which I inserted into the databases, the email isn't delivered.

The mail from yahoo says:

 test@mydomain.com: unknown user: test


From: tomiC at: 2010-09-30 14:57:03

When i try to start postfix /etc/init.d/postfix restart i get the following message in the mail.log

fatal: /etc/postfix/master.cf: line 83: missing "transport type" field

What's the problem?

regards

From: Pete at: 2011-03-08 01:46:54

This is a superb tutorial, I learnt so much from it, and best of all, it works!  Thanks very much for all your time and effort.

From: at: 2009-04-10 05:05:40

If you try to apt-upgrade the system, it will report that postfix and postfix-mysql should be upgraded too. To prevent this from happening you could run the following command (become root first):

 echo postfix hold | dpkg --set-selections && echo postfix-mysql hold | dpkg --set-selections

 This should prevent apt from upgrading the package (with upgrade or dist-upgrade).

 To restore it (when actually a new version comes out) use:

  echo postfix install | dpkg --set-selections && echo postfix-mysql install | dpkg --set-selections

 

From: Cory LYnch at: 2009-11-11 12:15:42

ok so after following this tutorial completely for about an hour or so i finished went and restarted apache noticed the squirrellmail page wasnt loading or any of my other previous functional websites.

the errors apache are spiting at me are:

 [Wed Nov 11 12:01:55 2009] [info] mod_fcgid: Process manager 2031 started
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: insufficient configuration info to establish database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: child spawned but unable to open database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: insufficient configuration info to establish database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: child spawned but unable to open database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: insufficient configuration info to establish database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: child spawned but unable to open database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: insufficient configuration info to establish database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: child spawned but unable to open database link
[Wed Nov 11 12:01:55 2009] [notice] Apache/2.2.9 (Debian) mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations
[Wed Nov 11 12:01:55 2009] [info] Server built: Jul 14 2009 20:03:28
[Wed Nov 11 12:01:55 2009] [debug] prefork.c(1032): AcceptMutex: sysvsem (default: sysvsem)
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: insufficient configuration info to establish database link
[Wed Nov 11 12:01:55 2009] [error] mod_log_sql: child spawned but unable to open database link

if you can help i would greatly appreciate it.

From: admin at: 2009-04-08 08:42:04

You probably made a syntax error when you edited the change_sqlpass configuration file:

http://www.howtoforge.com/forums/showthread.php?t=32673&highlight=syntax+error+squirrelmail

From: at: 2009-09-13 11:16:38

The mistake that I made was here:

$password_update_queries = array('UPDATE users SET password = %4 WHERE email = "%1"');

 

The line in the default config file is split over several lines:

 $password_update_queries = array(

                  'UPDATE users SET password = %4 WHERE email = "%1"'

                   );

 

So blindly copying and pasting resulted in me having a duplicate `);`.

From: Anonymous at: 2009-04-07 23:26:54

I only ran into two small problems:

Problem: postfix/tlsmgr[31109]: warning: request to update table btree:/var/spool/postfix/smtpd_scache in non-postfix directory /var/spool/postfix

Solution: Change both smtp*_tls_session_cache_database in /etc/postfix/main.cf from "$queue_directory" to "$data_directory".

# mkdir /var/spool/postfix/smtp_scache

# mkdir /var/spool/postfix/smptd_scache

# chown -R postfix /var/spool/postfix/smtp_scache

# chown -R postfix /var/spool/postfix/smtpd_scache

----------------------------------

 Problem: Blank page after squirrelmail login.

Solution: Well, it's not really a solution - more of a workaround.   Run /usr/sbin/squirrelmail-configure and remove the change_sqlpass plugin.  If someone discovers a real solution, please post it here.

From: Anonymous at: 2009-07-15 14:03:34

http://www.postfix.org/postconf.5.html#smtp_tls_session_cache_database

"As of version 2.5, Postfix no longer uses root privileges when opening this file. The file should now be stored under the Postfix-owned data_directory. As a migration aid, an attempt to open the file under a non-Postfix directory is redirected to the Postfix-owned data_directory, and a warning is logged."

I believe that /var/spool/postfix is not you data_directory.

From: A Happy Reader at: 2009-03-25 02:33:30

Hello! Your Guide is Great! i managed to put together a mail server! my only tiny problem is whit SquirrelMaill PW change feature. it says  "ERROR Could not make database connection"  So if you could plz help me out. I don't wana rush you its not so big problem :) And Tanks again.!   

From: at: 2009-07-01 11:47:07

Only 1 problem :

ERROR: Connection dropped by IMAP server.

From: hstoellinger at: 2009-11-17 12:03:54

Has anybody found a solution to this issue. The only thing I can think of regarding my own "walk" through this excellent tutorial is that this is my test system I am using a dynamic IP address established by my provider. Therefore I thought that using "localhost" as the FQDN might be appropriate. Is this assumption wrong? I do want to test everything before I go live on my production system.

Again, I don't remember ever going through a better tutorial than this one. Congratulations!

Any help would be greatly appreciated. As usual, I am pressed for time and the mailserver should go online within the coming two weeks.

Regards

H. Stoellinger

From: fulm at: 2009-12-18 13:16:32

someone has a solution to solve the problem?

From: mitja at: 2009-11-20 01:29:49

ERROR: Connection dropped by IMAP server.

 

I get the same problem... Any idea how to solve this? It seems i'm not the only one with the problem

From: Fejame at: 2010-04-27 18:15:30

ERROR: Connection dropped by IMAP server.

login squirrelmail??

 

From: Anonymous at: 2009-09-18 01:24:44

same problem

From: Anonymous at: 2009-08-29 06:57:28

Same problem here

From: Yogalu at: 2010-11-05 14:01:01

Well, i had the same problem as all you guys...

 I did some testing and log checking

 tail -f /var/log/mail.log &

 which kept giving me:

authdaemond: failed to connect to mysql server (server=localhost, userid=mail_admin): Access denied for user 'mail_admin'@'localhost' (using password: YES)

 So in the end (and with a little help from another page) i found out there was a 'SPACE' behind the password in the file  /etc/courier/authmysqlrc

So edit that file, make sure there is no space behind the password and restart the authdaemon

/etc/init.d/courier-authdaemon restart

And try again.

From: ifos at: 2010-07-15 05:32:47

maildirmake /home/vmail/example.com/sales

chown -hR vmail:vmail /home/vmail/example.com/sales

From: catchu at: 2011-04-26 16:50:25

tail -f /var/log/mail.log &

 I found:
failed to connect to mysql server (server=localhost, userid=mail_admin): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

 So I have to excute:
ln -s  /tmp/mysql.sock  /var/run/mysqld/mysqld.sock

But it still doesn't work.

Then:
maildirmake /home/vmail/example.com/sales
chown -hR vmail:vmail /home/vmail/example.com/sales


it works :)

 

THX to ifos & Yogalu.

 

From: Anonymous at: 2010-03-12 09:45:12

Hi,

thanks for this really great howto, I appreciate the work and knowledge given here.

I would like to add two notes:

ClamAV is, as all on-access virus scanners, very ressource intensive. After testing it on a general purpose webserver hosted on vps, I decided to remove it to have more ram for the apache processes.

The command:
postconf -e 'mydestination = server1.example.com, localhost, localhost.localdomain'
did not work in my case.  Yes, I have replaced "server1.example.com" with the correct FQDN. No mail got through postfix and mailboxes were not created, which triggered the Squirrelmail error "Connection dropped by IMAP server". I was able to fix this by altering the command to:
postconf -e 'mydestination = '
Sorry, I don't know why, maybe because of double clarifications of the hostname there and in the database. I use the hostname of the mailserver also in the virtual users database, to create email adresses for this domain. Now it's working.

Thanks again for the great work.

Best Regards
Anonymous

From: catchu at: 2011-04-27 15:12:46

 I couldn't receive mail too and found the following when ’tail -f /var/log/mail.log &‘

warning: do not list domain ltns.info in BOTH mydestination and virtual_mailbox_domains

 Then I modified /etc/postfix/main.cf as you mentioned.  It works.  :)

'mydestination = '

Thank you, and falko's great hwoto.

From: Niklas C Aden at: 2011-01-31 12:07:49

Hey, all is good!

Except one thing, when I try to enter the squirrelmail it just gives me a blank page.

I've checked the apache2 log file and the mail.log file without success, there's simply no error msg when I try to sign in :/
Tried it with 2 different accounts in 2 different domains, just to see what could cause it.

From: michael at: 2011-02-24 17:01:59

Amavis-ng won't scan mails in that configuration. At least not the current version ( amavisd-new-2.6.4 ) on debian squeeze.

As it only scans outgoing mails it needs to determine which domains are local. You need to edit the file /etc/amavis/conf.d/50-user and add the following lines (replacing your password off course):

 @lookup_sql_dsn = (
    ['DBI:mysql:database=mail;host=127.0.0.1;port=3306',
     'mail_admin',
     'mail_admin_password']);

$sql_select_policy = 'SELECT domain FROM domains WHERE CONCAT("@",domain) IN (%k)';


From: dynamike at: 2011-10-05 13:19:33

Hey,

first of all, thank you so much for this great tutorial. My mail infrastructure is up and running.

What I am wondering is how and which server-side filtering solution can be integrated to e.g. move the emails marked as SPAM etc. to specific folders.

Any help more than appreciated.

Cheers,

Dynamike