Blue Flower

Bill

Bill

Create /var/qmail/control/databytes and then within the file specify the maximum size of the message you want to allow in bytes. If you want to limit messages to roughly 10 megabytes then you would put 10000000 in the file, or you can use google so you can get the size right on the money.

# chmod 644 /var/qmail/control/databytes
# chown root:qmail  /var/qmail/control/databytes
# qmailctl restart

In order to view logs with timestamps, run this command:

tai64nlocal < /var/log/qmail/qmail-send/current

for more about multilog please take a look at

http://qmail.jms1.net/logfiles.shtml

Monday, 06 July 2015 00:53

Signal 11 errors in qmail-smtpd

If you start seeing Status 11 errors to pop up in qmail-smtpd whenever a message came in from a domain, The SPF records uses colons for delimiters instead of spaces, so the lack of spaces, and possibly other syntax problems, in an SPF record will cause smtpd to exit abnormally and put the status 11 message in your qmail-smtpd log and a signal 11 error in /var/log/messages. I worked around this problem by adding:

206.246.124.31:allow,SPFBEHAVIOR="0"

in /etc/tcp.smtp

Special thanks to Lonnie Burgess

Monday, 06 July 2015 00:52

Qmail-Remove

Stolen from http://www.linuxmagic.com/opensource/qmail/qmail-remove/

Qmail-Remove will remove messages containing a particular string from your Qmail queue.

Why?:

This is a useful thing to do in a number of situations. For instance, if you are hit with a spamming attack, you can temporarily instate a second Qmail installation (once the spam run is finished), allow it to take over mail receipt, and then use this tool to clean the offending mails out of the queue before switching over to the main Qmail installation once again.

Occasionally, viruses will get past scanners before the signatures get updated; if they exist in large numbers, it is often practical to stop the Qmail install briefly in order to clean out all messages containing a signature related to the virus.

Whatever the reason to pull items from your mail queue, this program will delete them in such a manner that will let you restore them easily.

"Removed" Emails:

Mails are *not* deleted from the queue! They are only stored, temporarily, in $qmail-queue/yanked/, where you can view them individually and restore them back to the queue manually. There is currently no support for restoring them automatically.

By default, Qmail-Remove assumes that your Qmail queue is stored in /var/qmail/queue, but this can be changed with a command line option. Similarly, Qmail-Remove assumes that your queue "split" is 23 by default, among other things.

See Qmail-Remove -h for more commandline options.

WARNING: YOU MUST STOP QMAIL BEFORE USING THIS PROGRAM.

http://www.goodcleanemail.com/files/tarballs/qmail-remove-0.95.tar.gz

Monday, 06 July 2015 00:45

Configuring POP3D-SSL

This HOWTO covers the configuration of Courier pop3d with SSL. This HOWTO assumes you have installed Courier's IMAP/POP3 installation.

Please note that paths may vary from distro to distro

# cp /usr/local/etc/pop3d-ssl.dist /usr/local/etc/pop3d-ssl
# cp /usr/local/etc/pop3d.dist /usr/local/etc/pop3d

Modify /usr/local/etc/pop3d-ssl so it includes the below lines.

POP3DSSLSTART=YES
TLS_CERTFILE=/usr/local/share/pop3d.pem

Create the pop3d-ssl cert by running the following command.

# /usr/local/sbin/mkpop3dcert

Create the pop3d-ssl start script and start pop3d-ssl, by running the below commands.

# cp /usr/local/libexec/pop3d-ssl.rc /usr/local/etc/rc.d/init.d/pop3s
# /usr/local/etc/rc.d/pop3s start

Add the last line above to /etc/rc.local to ensure pop3d-ssl starts at boot.

Installing your SSL Certificate into Outlook or Outlook Express

The PEM file holds your certificate and your private key. Split them into
two files using a text editor and copy commands:
cp blah.pem usercert.pem
cp blah.pem userkey.pem

In usercert.pem delete the section for the private key
(marked with ---- BEGIN RSA PRIVATE KEY ---- and ---- END RSA PRIVATE KEY ----)

In userkey.pem delete everything but the private key

To convert the current .pem to a readable format so Outlook can import it, we use this method:

From .pem to .p12

openssl pkcs12 -export -out cert.p12 -inkey ./userkey.pem -in ./usercert.pem


It will ask you to enter your PEM pass phrase twice. Enter both correctly and you will now have a .p12 file!

Monday, 06 July 2015 00:45

Unable to write pipe error

SMTP Daemon Cannot Start in Solaris

Change in the run scritps

QMAILDUID=`/usr/bin/id -u qmaild`
NOFILESGID=`/usr/bin/id -g qmaild`

BY

QMAILDUID=`/usr/xpg4/bin/id -u qmaild`
NOFILESGID=`/usr/xpg4/bin/id -g qmaild`

ERROR II

POP3 & SMTP Validation say "Unable to Write Pipe"

Check in run Scripts the system home of the vpopmail user

Special thanks to Jorge Grosso

Monday, 06 July 2015 00:43

Setting a default Domain

Modify or create /var/qmail/control/defaultdomain and /home/vpopmail/etc/defaultdomain to specify your default domain. This will allow your users to just use their username to login rather than their entire email address.

Monday, 06 July 2015 00:43

How to blacklist domains

The file "/var/qmail/control/badmailfrom" is used by qmail-smtpd to reject certain email addresses or domains in the envelope. lines in this file may look like " This email address is being protected from spambots. You need JavaScript enabled to view it. ", or "@evil.com" to block the entire domain.

if you create this file, make sure to IMMEDIATELY do "chmod 644" on it so that qmail-smtpd can read it. creating or changing this file does not necessitate restarting qmail or the smtp service, but if any messages try to come in during the time between when you create the file and when you set the permissions on it, those message will be refused with the error message "unable to read controls".

however, this only checks the ENVELOPE sender- whatever the sending machine puts in the MAIL FROM: command. it doesn't look at the "From:" header inside the message. spammers will often use different email addresses for their envelope senders and their "From:" headers- but there are times when legitimate users do it as well, which means this is not a reliable flag for spam.

To check based on header values, you may want to look at writing some custom spamassassin rules so that mail with "From:" headers from these domains will be considered spam.

Most reasons why you don't see images in qmailadmin is because the images are generally not where they are supposed to be. The easy fix for this is to look at /var/log/apache-error.log and see exactly where Apache is looking for those images.
Then copy /downloads/qmailrocks/qmailadmin-x.x.x/images/ (copy the entire images folder) to the place where Apache is looking for those images.

Visitor Comments:

Comment #1 (Posted by DanThis )

For me, this problem occurred because I followed the QMR installation to the letter.
In step 13 (Installing Squirrelmail), the instructions say to edit httpd.conf to define a VirtualHost with your IP address, and to make the DocumentRoot inside your webmail directory. This causes any request to your system to default to that VirtualHost, and that DocumentRoot. Instead, define your VirtualHost with your FQDN, and that should resolve the issue, since the /images folder for qmailadmin will resolve correctly when you visit the qmailadmin page.

For those that are interested, I've found making the following changes
works well.  Since qmailrocks sets up the qmailstats to run once a
day, I changed it to only look at the last days worth (the only way
this works is if you set multilog to rotate the logs (according to its
log size) no more than once a day.

edit the /var/qmail/qmailstats script (which should be in the
/etc/crontab to run once daily) by changing the line:

cat /var/log/qmail/qmail-send/* /var/log/qmail/qmail-pop3d/*
/var/log/qmail/qmail/qmail-smtpd/* | tai64n2tai | awk
'{$1=substr($1,1,index($1,".")+6);print}' | matchup > $QMAILSTATS
5>/dev/null

to:

cat /var/log/qmail/qmail-send/current
/var/log/qmail/qmail-pop3d/current
/var/log/qmail/qmail/qmail-smtpd/current | tai64n2tai | awk
'{$1=substr($1,1,index($1,".")+6);print}' | matchup > $QMAILSTATS
5>/dev/null

What this does it tells the qmailanalog to only look at the log files
that haven't been rotated yet.  Next, add the following line to the
very bottom of the script:

svc -h /service/qmail-smtpd/log /service/qmail-pop3d/log /service/qmail-send/log

I believe -a will work as well, but since I don't understand what it
does and I know the -h works, that's what I'm using.

This forces multilog to rotate the logs whether they need it or not.
If you have multilog set to rotate large files (for my small server
100k is ample), then you'll end up with a rotation once a day and your
qmailstats email (once a day) will reflect only the previous 24 hours.

DISCLAIMER: This may undo multilogs excellent method of using only a
certain amount of disk space for logs, so...  Keep an eye on your logs
and make sure you have enough history for your liking and not taking
up too much disk space.  Tweak the multilog settings (found in
/service/foo/log/run ) accordingly.  As always make backups of
everything before editing, and take my advice with great skepticism

Special thanks to Silver Fox

Page 9 of 14