LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   tmda HOWTO (https://www.linuxquestions.org/questions/linux-software-2/tmda-howto-469292/)

szandor 07-31-2006 01:54 AM

tmda HOWTO
 
Tagged Message Delivery Agent

Ok, first, I'm new to setting up mail so this may be sloppy but it's for people who use sendmail, procmail, have their own mail server for simple personal correspondence and need a quick guide to setting up a simple SPAM solution and don't want to sort out all the info from http://tmda.net.

Second, if anyone has more in depth knowledge of tmda, please give suggestions. I.e., I have 2 users I set up TMDA for. Is there a global directory I can use for all users as opposed to creating individual ~/.tmda directories?

You need:
http://tmda.net/releases/stable/tmda-1.0.3.tgz
python 2.1 or higher

Once tmda and python are installed, create the following directories and files for the user.


DIR
/home/$USER/.tmda/

Files
/home/$USER/.tmda/config
/home/$USER/.tmda/filters/incoming
/home/$USER/.tmda/lists/whitelist
/home/$USER/.procmailrc

Generate your tmda key:

tmda-keygen > /home/$USER/.tmda/crypt_key ; chmod 400 /home/$USER/.tmda/crypt_key

Then create your /home/$USER/.tmda/config

# -*- python -*-

# See http://tmda.net/config-vars.html for descriptions of all
# the available options.
#
# NOTE: ~/.tmda/config must be chmod 400 or chmod 600 !

MAIL_TRANSFER_AGENT = "sendmail"

RECIPIENT_DELIMITER = "+"

DELIVERY = "/var/spool/mail/$USER"

And then your /home/$USER/.procmailrc (NOTE: the next two lines are important)

# Uncomment this for users without valid shells in /etc/passwd.
# SHELL=/bin/sh

# Set the necessary environment variables.
EXTENSION="$1"
:0
* EXTENSION ?? .
{
DELIMITER="+"
}
RECIPIENT="$LOGNAME$DELIMITER$EXTENSION@$HOST"
SENDER=`formail -x Return-Path | sed 's/[<>]//g;s/^[ ]*//'`

# Run the message through tmda-filter.
:0 w
| /usr/bin/tmda-filter

# Take the exit code from TMDA.
EXITCODE=$?

# TMDA takes care of final delivery
DEFAULT=/dev/null

If you want to create a whitelist of email addresses you definitely want to receive email from, do:

echo from-file ~/.tmda/lists/whitelist ok > /home/$USER/.tmda/filters/incoming

and then add your email addresses on separate lines in your:

/home/$USER/.tmda/lists/whitelist

Emails that are sent from people not in your whitelist will receive a confirmation email that they need to reply to in order for you to get their email. Those in your whitelist will go directly to your inbox.

Again this is a quick run through to get it going. I spent an hour or so trying to get everything sorted out and working. Hope it helps someone.


All times are GMT -5. The time now is 12:05 AM.