Debian_Mail_server.html   [plain text]


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2K.1beta (1.48)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Debian GNU/Linux Mail Server</TITLE>
<META NAME="description" CONTENT="Debian GNU/Linux Mail Server">
<META NAME="keywords" CONTENT="Debian_Mail_server">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">

</HEAD>

<BODY >
<P>

<P>

<P>

<P>
<H1 ALIGN="CENTER">Debian GNU/Linux Mail Server</H1>
<P ALIGN="CENTER"><STRONG>Dennis Leeuw</STRONG></P>
<P ALIGN="CENTER"><STRONG>Versie 0.2.0</STRONG></P>

<P>

<H1><A NAME="SECTION00100000000000000000">
1. Mail User Agent</A>
</H1>

<P>
The MUA is the program that a user uses to read his or her mail. Some
examples: pine, mutt or Netscape (on Windows Outlook). The MUA can
use several protocols to fetch the mail. The most used services are
POP3, IMAP, but SMTP is also possible.

<P>

<H1><A NAME="SECTION00110000000000000000">
1.1 popping mail:</A>
</H1>

<P>
All incoming mail for a user is stored in one file in /var/spool/mail/&lt;username&gt;.
You could read your mail with more or less, but that is not very comfortable.
The most secure way of using pop3 is by using pop3 over SSL. This
way you get a SSH like pop3 system.

<P>

<H3><A NAME="SECTION00110100000000000000">
1.1.0.1 Installation</A>
</H3>

<P>

<DL COMPACT>
<DT>
<DD>apt-get&nbsp;install&nbsp;courier-pop-ssl
</DD>
</DL>
<P>

<H3><A NAME="SECTION00110200000000000000">
1.1.0.2 Configuration</A>
</H3>

<P>
The configuration can be found in /etc/courier/.

<P>
[META] needs more docu about interfaces to run on and protocols/ports
to use.

<P>

<H1><A NAME="SECTION00200000000000000000">
2. Mail Transfer Agent</A>
</H1>

<P>
The MTA is a program that sends mail from one server to another. This
is done through the SMTP protocol. On Debian the default MTA is Exim,
however there are several GNU/Linux servers that contain this functionality
like: sendmail, postfix and qmail.

<P>
I like postfix so let's start with that one.

<P>

<H1><A NAME="SECTION00210000000000000000">
2.1 postfix</A>
</H1>

<P>

<H2><A NAME="SECTION00211000000000000000">
2.1.1 Installation</A>
</H2>

<P>

<DL COMPACT>
<DT>
<DD>apt-get&nbsp;install&nbsp;postfix
</DD>
</DL>Choose no configuration when asked for configuration.

<P>

<H2><A NAME="SECTION00212000000000000000">
2.1.2 configuration</A>
</H2>

<P>
The postfix configuration files can be found in /etc/postfix/.

<P>
The most important file is main.cf. Elements in this file that need
special attention:

<P>

<DL COMPACT>
<DT>
<DD>myhostname&nbsp;=&nbsp;mail.domain.com

<P>
mydestination&nbsp;=&nbsp;$myhostname,&nbsp;localhost.$mydomain,&nbsp;$mydomain

<P>
mynetworks&nbsp;=&nbsp;192.168.1.0/24,&nbsp;127.0.0.0/8

<P>
relay_domains&nbsp;=&nbsp;$mydomain
<P>
home_mailbox&nbsp;=&nbsp;Maildir/
</DD>
</DL>
<P>

<H2><A NAME="SECTION00213000000000000000">
2.1.3 Test</A>
</H2>

<P>
Test the configuration with telnet:

<P>

<DL COMPACT>
<DT>
<DD>telnet&nbsp;localhost&nbsp;25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;from&nbsp;the&nbsp;local&nbsp;machine

<P>
telnet&nbsp;smtp.domein.nl&nbsp;25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;from&nbsp;a&nbsp;Internet&nbsp;machine

<P>
telnet&nbsp;192.168.1.1&nbsp;25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;from&nbsp;an&nbsp;internal&nbsp;machine
</DD>
</DL>Use the following procedure:

<P>

<DL COMPACT>
<DT>
<DD>helo&nbsp;domein.org

<P>
mail&nbsp;from:&nbsp;user@domein.org

<P>
rcpt&nbsp;to:&nbsp;user@domein.nl

<P>
data

<P>
.

<P>
quit
</DD>
</DL>
<P>

<H1><A NAME="SECTION00300000000000000000">
3. Mail Delivery Agent</A>
</H1>

<P>
The MDA is a program that incoming mail from the MTA accepts and it
stores in the users mailbox, Local Delivery. The program is on almost
any GNU/Linux systeem procmail. We use the functionality within postfix.

<P>

<H1><A NAME="SECTION00320000000000000000">
3.2 Fetchmail</A>
</H1>

<P>
It might be that you have some pop3 mail accounts on other servers
or providers. To get that mail on your local system you could use
fetchmail.

<P>

<H2><A NAME="SECTION00321000000000000000">
3.2.1 Installation</A>
</H2>

<P>

<DL COMPACT>
<DT>
<DD>apt-get&nbsp;install&nbsp;fetchmail
</DD>
</DL>
<P>

<H2><A NAME="SECTION00322000000000000000">
3.2.2 Configuration</A>
</H2>

<P>
A sample configuration file:

<P>

<DL COMPACT>
<DT>
<DD>poll&nbsp;pop.provider.net&nbsp;proto&nbsp;pop3

<P>
&nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;&#34;jsmith&#34;,&nbsp;with&nbsp;password&nbsp;secret1,&nbsp;is&nbsp;&#34;johans&#34;&nbsp;here;
</DD>
</DL>
<P>

<H1><A NAME="SECTION00400000000000000000">
4. Virus checking</A>
</H1>

<P>

<H1><A NAME="SECTION00410000000000000000">
4.1 Clam Antivirus</A>
</H1>

<P>

<H2><A NAME="SECTION00411000000000000000">
4.1.1 Installation</A>
</H2>

<P>
Get the source from http://www.konarski.edu.pl/~zolw.
Read the documentation, which is very good, or do:

<P>

<DL COMPACT>
<DT>
<DD>groupadd&nbsp;clamav

<P>
useradd&nbsp;-g&nbsp;clamav&nbsp;-s&nbsp;/bin/false&nbsp;-c&nbsp;``Clam&nbsp;Antivirus''&nbsp;clamav
</DD>
</DL>To build the software do:

<P>

<DL COMPACT>
<DT>
<DD>./configure&nbsp;-prefix=/usr/local

<P>
make

<P>
make&nbsp;install
</DD>
</DL>
<P>

<H2><A NAME="SECTION00412000000000000000">
4.1.2 Help Out!</h2>
<p>The biggest challenge for an open source virus scanner is the virus signature database. The Clamav writer has written een great tool called sigtool. It is able to create a signature from a virus file with the help of another anti-virus program that detects the virus.</p>

<p>If you find a virus that is not detected by clamscan, but is detected by another virus scanner, do the following:<br>
<tt>
sigtool -s &lt;string of virus-scanner that finds the virus, when it detects it&gt; -f &lt;file that contains the virus&gt; -c &lt;how the virus-scanner should be executed&gt;</tt>

<P>This creates a signature file. Which should be added to the clamav database. And the next time a virus passes by it will be detected by clamscan.</p>



<P>

<H1><A NAME="SECTION00420000000000000000">
4.2 AMAVIS</A>
</H1>

<P>

<H2><A NAME="SECTION00421000000000000000">
4.2.1 Installation</A>
</H2>

<P>

<DL COMPACT>
<DT>
<DD>groupadd&nbsp;vscan

<P>
useradd&nbsp;-g&nbsp;vscan&nbsp;-s&nbsp;/bin/false&nbsp;-c&nbsp;``Amavis''&nbsp;vscan
</DD>
</DL>Compile this from source http://www.amavis.org/. Use amavis-perl-11.tar.gz

<P>
Before you can use AMAVIS you first need a couple of perl modules:

<P>

<DL COMPACT>
<DT>
<DD>apt-get&nbsp;install&nbsp;libmime-perl&nbsp;libunix-syslog-perl&nbsp;&#92;

<P>
libemail-valid-perl&nbsp;libconvert-uulib-perl&nbsp;&#92;

<P>
libconvert-tnef-perl&nbsp;libarchive-tar-perl&nbsp;&#92;

<P>
libarchive-zip-perl&nbsp;libcompress-zlib-perl
</DD>
</DL>And some tools:

<P>

<DL COMPACT>
<DT>
<DD>apt-get&nbsp;install&nbsp;file&nbsp;bzip2&nbsp;lha&nbsp;unarj&nbsp;unrar&nbsp;unzoo
</DD>
</DL>
<P>

<H3><A NAME="SECTION00421100000000000000">
4.2.1.1 Arc521</A>
</H3>

<P>
Then there is arc, which is not GNU/Linux ready yet. So download the
source and do the following:

<P>

<DL COMPACT>
<DT>
<DD>mkdir&nbsp;temp

<P>
cd&nbsp;temp

<P>
tar&nbsp;zxvf&nbsp;../arc521.tar.Z
</DD>
</DL>Edit arcdos.c and comment the struct timeval (don't do this on RH6.2 machines):

<P>

<DL COMPACT>
<DT>
<DD>/*struct&nbsp;timeval&nbsp;{&nbsp;/*&nbsp;man&nbsp;page&nbsp;said&nbsp;&lt;sys/types.h&gt;,&nbsp;but&nbsp;it&nbsp;*/&nbsp;

<P>
/*&nbsp;long&nbsp;tv_sec;&nbsp;/*&nbsp;really&nbsp;seems&nbsp;to&nbsp;be&nbsp;in&nbsp;&lt;sys/time.h&gt;,&nbsp;*/&nbsp;

<P>
/*&nbsp;long&nbsp;tv_usec;&nbsp;/*&nbsp;but&nbsp;why&nbsp;bother...&nbsp;*/&nbsp;

<P>
/*};*/
</DD>
</DL>Edit tmclock.c to look like this:

<P>

<DL COMPACT>
<DT>
<DD>#if&nbsp;BSD

<P>
#include&nbsp;&lt;sys/time.h&gt;

<P>
#include&nbsp;&lt;time.h&gt;

<P>
int&nbsp;daylight;

<P>
#else

<P>
#include&nbsp;&lt;time.h&gt;

<P>
#endif
</DD>
</DL>I have send these changes to the maintainer of arc, so the next release
might show better GNU/Linux support.

<P>

<DL COMPACT>
<DT>
<DD>make

<P>
cp&nbsp;arc&nbsp;/usr/local/bin
<p>
cp&nbsp;arc.1&nbsp;/usr/local/man/man1/
</DD>
</DL>
<P>

<H3><A NAME="SECTION00421200000000000000">
4.2.1.2 Compile AMAVIS</A>
</H3>

<P>
Compile AMAVIS:

<P>

<DL COMPACT>
<DT>
<DD>patch&nbsp;-p1&nbsp;&lt;&nbsp;../clamav-<I>&lt;version&gt;</I>/support/amavis/clamavis.patch

<P>
find&nbsp;.&nbsp;-exec&nbsp;touch&nbsp;01010000&nbsp;{}&nbsp;&#92;;

<P>
./configure --enable-smtp --with-smtp-port=10025 --enable-postfix

<P>
make

<P>
make&nbsp;install
</DD>
</DL>
<P>

<H2><A NAME="SECTION00422000000000000000">
4.2.2 AMAVIS and Postfix</A>
</H2>

<P>
Add to /etc/postfix/main.cf:

<P>

<DL COMPACT>
<DT>
<DD>content_filter&nbsp;=&nbsp;vscan:
</DD>
</DL>Adjust /etc/postfix/master.cf:

<P>

<DL COMPACT>
<DT>
<DD>vscan&nbsp;unix&nbsp;-&nbsp;n&nbsp;n&nbsp;-&nbsp;10&nbsp;pipe&nbsp;user=vscan

<DL COMPACT>
<DT>
<DD>argv=/usr/sbin/amavis&nbsp;${sender}&nbsp;${recipient}
</DD>
</DL>localhost:10025&nbsp;inet&nbsp;n&nbsp;-&nbsp;n&nbsp;-&nbsp;-&nbsp;smtpd&nbsp;-o&nbsp;content_filter=
</DD>
</DL>
<P>

<H2><A NAME="SECTION00423000000000000000">
4.2.3 Test</A>
</H2>

<P>
Send an e-mail with the Eicar string to test the anti-virus functionality.

<P>

<DL COMPACT>
<DT>
<DD>X5O!P%@AP[4&#92;PZX54(P)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

<P>
</DD>
</DL>
<P>

<H1><A NAME="SECTION00500000000000000000">
About this document ...</A>
</H1>
 <STRONG>Debian GNU/Linux Mail Server</STRONG><P>
This document was generated using the
<A HREF="http://www-texdev.mpce.mq.edu.au/l2h/docs/manual/"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A> translator Version 2K.1beta (1.48)
<P>
Copyright &#169; 1993, 1994, 1995, 1996,
<A HREF="http://cbl.leeds.ac.uk/nikos/personal.html">Nikos Drakos</A>, 
Computer Based Learning Unit, University of Leeds.
<BR>
Copyright &#169; 1997, 1998, 1999,
<A HREF="http://www.maths.mq.edu.au/~ross/">Ross Moore</A>, 
Mathematics Department, Macquarie University, Sydney.
<P>
The command line arguments were: <BR>
 <STRONG>latex2html</STRONG> <TT>-no_subdir -split 0 -show_section_numbers /tmp/lyx_tmpdir30758nJeXv/lyx_tmpbuf3075QAkyC5/Debian_Mail_server.tex</TT>
<P>
The translation was initiated by Dennis Leeuw on 2002-05-28<HR>
<!--Navigation Panel-->
<IMG WIDTH="81" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next_inactive"
 SRC="/usr/share/latex2html/icons/nx_grp_g.png"> 
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="/usr/share/latex2html/icons/up_g.png"> 
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="/usr/share/latex2html/icons/prev_g.png">   
<BR>
<!--End of Navigation Panel-->
<ADDRESS>
Dennis Leeuw
2002-05-28
</ADDRESS>
</BODY>
</HTML>