📄 linux-qmail.html
字号:
<BR><FONT FACE="Arial,Helvetica">Note: rcpthosts may include wildcards:
e.g. .heaven.af.mil</FONT></UL>
<H4>
<FONT FACE="Arial,Helvetica">.qmail files</FONT></H4>
<FONT FACE="Arial,Helvetica">There are five types of line in a .qmail file:</FONT>
<BLOCKQUOTE>
<LI>
<FONT FACE="Arial,Helvetica">#comment</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"> |program to execute</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"> [&]forwarding email address
# & need if username does not begin with an alphanumeric character</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"> ./mailbox deliver to a single mail <B>file</B>
(Mbox)</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"> ./maidir/ deliver to a mail <B>directory</B>
(Maildir)</FONT></LI>
</BLOCKQUOTE>
<FONT FACE="Arial,Helvetica"><B>Notes</B>:</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica">.qmail files cannot be group or world writable.</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica">qmail-local is invoked with a set of command
line parameters that are then makes available to any programs invoked in
.qmail (e.g. $SENDER)</FONT></LI>
</UL>
<H4>
<FONT FACE="Arial,Helvetica">Handling aliases</FONT></H4>
<FONT FACE="Arial,Helvetica">There are basically two ways of handling the
incoming mail names and routing them to local user names.</FONT>
<H5>
<FONT FACE="Arial,Helvetica">Delivery by the alias user</FONT></H5>
<FONT FACE="Arial,Helvetica">qmail by default can only recognise and deliver
to system user names (sim & lies in this case). It does, however,
also postulate a set of related email addresses for each user of the form
user-<I>ext</I>. For any such address, qmail-local - which is the
qmail component responsible for final mail delivery - looks in ~/.qmail-ext
for delivery instructions. If no .qmail-ext file is found (or the
file exists but is empty), default delivery is to the file ~/Mailbox (unless
.qmail-default states otherwise??).</FONT>
<P><FONT FACE="Arial,Helvetica">Addresses which do not map to a specific
user (ignoring the "-ext" as necessary) are handled by the special alias
user. Recall, how during the installation procedure, .qmail files
were put in ~alias for root, postmaster and ... When alias is invoked,
qmail-local looks for a .qmail-username file for details of how to forward
the mail to a local user.</FONT>
<P><FONT FACE="Arial,Helvetica">It follows that the apparent solution to
our objective is an ~alias/.qmail-simon.hampton file with "sim" as the
only contents (without quotations). In practice, the file needs to
be called ~alias/.qmail-simon:hampton <A HREF="ftp://koobera.math.uic.edu/www/qmail/faq/incominguser.html#alias-dots">as
qmail requires "."s to be ":"</A>s in such instances, but apart from that
it is done.</FONT>
<H5>
<FONT FACE="Arial,Helvetica">Configuring users/assign</FONT></H5>
<FONT FACE="Arial,Helvetica">Arbitrary addresses can be assigned to specific
users using qmail-users. This is necessary, for instance, for my
incoming mail to simon.hampton (if you do not have a . in the name, it
may work with the alias solution)</FONT>
<P><FONT FACE="Arial,Helvetica">/var/qmail/users/assign (See <A HREF="http://qmail.digibel.be/man/man9/qmail-users.html">http://qmail.digibel.be/man/man9/qmail-users.html</A>
for format)</FONT>
<BLOCKQUOTE>=simon.hampton:sim:1002:100:/home/sim:::
<BR>=liesbeth.devriendt:lies:1004:100:/home/lies:::
<BR>.</BLOCKQUOTE>
<FONT FACE="Arial,Helvetica">Do not forget to run /var/qmail/bin/qmail-newu
afterwards to convert assign to the necessary binary file, cdb.</FONT>
<P><FONT FACE="Arial,Helvetica">As an alternative qmail-pw2u can build
a list for you from your /etc/password file.</FONT>
<H4>
<FONT FACE="Arial,Helvetica">Outgoing mails (qmail as a relay)</FONT></H4>
<H5>
<FONT FACE="Arial,Helvetica">Mail headers</FONT></H5>
<FONT FACE="Arial,Helvetica">qmail is not great at rewriting headers on
outgoing mail, but these can probably be setup in mail client directly.
If however you leave the from address as sim (to facilitate correspondance
between users) in the mail client</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica">add the default domain to be appended to outgoing
mail in /var/qmail/control/defaultdomain</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica">Users can also modify their From: headers
by using environment variables in .bash-profile</FONT></LI>
<BR><FONT FACE="Arial,Helvetica">export QMAILHOST=some.domain</FONT>
<BR><FONT FACE="Arial,Helvetica">export QMAILNAME=Peter Samuel</FONT>
<BR><FONT FACE="Arial,Helvetica">export QMAILUSER=Peter.Samuel</FONT>
<BR><FONT FACE="Arial,Helvetica">export QMAILINJECT=f</FONT>
<BR><FONT FACE="Arial,Helvetica">This becomes:</FONT>
<BR><FONT FACE="Arial,Helvetica">From: Peter Samuel <Peter.Samuel@some.domain></FONT></UL>
<H5>
<FONT FACE="Arial,Helvetica">Setting up a mailhost</FONT></H5>
<FONT FACE="Arial,Helvetica">A mailhost is a machine that will perform
all the local deliveries for a site. It accepts mail from users throughout
the local network and from external</FONT>
<BR><FONT FACE="Arial,Helvetica">sources. All mail for local delivery
(domain specified in control/locals) is directed to the relevant postbox,
while the rest is passed to the relevant gateway.</FONT>
<P><FONT FACE="Arial,Helvetica">The main configuration files are therefore:</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica">/var/qmail/control/locals : lists all local
domains</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica">control/smtproutes : <A HREF="http://qmail-docs.surfdirect.com.au/docs/qmail-1.03-man/man8/qmail-remote.html">See
man pages for format</A></FONT></LI>
</UL>
<FONT FACE="Arial,Helvetica">Seeting up a mailhost can expose you to security
concerns by creating an "open relay". The following provide guides
of the relatively complex process of howto to relay selectively:</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica">Chris Johnson's <A HREF="http://www.palomine.net/qmail/relaying.html">qmail
newbie's guide to relaying</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica">Michael Samuel's <A HREF="http://qmail-docs.surfdirect.com.au/docs/qmail-antirelay.html">How
to Configure Qmail to be a Selective Relay</A></FONT></LI>
</UL>
<FONT FACE="Arial,Helvetica">Don't forget to set up mail client to pass
outgoing mails to sendmail,</FONT>
<H4>
<FONT FACE="Arial,Helvetica">Restarting qmail</FONT></H4>
<FONT FACE="Arial,Helvetica">Many parts of qmail do not reread their configuration
files once started (unlike, for example, the <A HREF="samba.htm">samba</A>
server). Rebooting will lead the new configuration to be loaded,
but there are way of avoiding this time consuming activity.</FONT>
<H5>
<FONT FACE="Arial,Helvetica">Following changes to ..</FONT></H5>
<FONT FACE="Arial,Helvetica">From section 4.7 of the <A HREF="http://metalab.unc.edu/LDP/HOWTO/Mail-HOWTO-4.html">mail-HOWTO</A>,
we have</FONT>
<BLOCKQUOTE><TT>killall [-HUP] inetd; init 1</TT></BLOCKQUOTE>
<H5>
<FONT FACE="Arial,Helvetica">Following changes to ....</FONT></H5>
<FONT FACE="Arial,Helvetica"><A HREF="ftp://koobera.math.uic.edu/www/qmail/faq/admin.html#restart">qmail-send</A></FONT>
<H4>
<FONT FACE="Arial,Helvetica">Acknowledgements</FONT></H4>
<FONT FACE="Arial,Helvetica">In addition to the sources mentioned above,
I was helped through this complex process by the following excellent sources:</FONT>
<UL>
<LI>
<FONT FACE="Arial,Helvetica">The powerpoint presentation at the <A HREF="http://www.nrg4u.com/">The
Big Picture</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="ftp://ftp.uniq.com.au/pub/tutorials/qmail-auug98.pdf">Peter
Samuel's qmail tutorial</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="http://www.qmail.org/man/index.html">The
man pages in HTML</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="http://qmail-docs.surfdirect.com.au/docs.html">Qmail
documentation project</A></FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="http://www-archive.ornl.gov:8000/">Search
the mailing list archive</A></FONT></LI>
</UL>
<H3>
<A NAME="hostname"></A><FONT FACE="Arial,Helvetica">Hostname</FONT></H3>
<FONT FACE="Arial,Helvetica">qmail relies absolutely on thecomputers hostname
being setup correctly. hostname -f should report the fully qualified
domain name, and this can also be found in /etc/HOSTNAME. Some configuration
help can be found in the Networking-HOWTO, and for the record the 3 key
files should have the following basic elements.</FONT>
<BR>
<TABLE BORDER COLS=3 WIDTH="100%" >
<TR>
<TD><B><FONT FACE="Arial,Helvetica">/etc/hosts</FONT></B></TD>
<TD><B><FONT FACE="Arial,Helvetica">/etc/hosts.conf</FONT></B></TD>
<TD><B><FONT FACE="Arial,Helvetica">/etc/resolv.conf</FONT></B></TD>
</TR>
<TR VALIGN=TOP>
<TD><FONT FACE="Arial,Helvetica">127.0.0.1 localhost</FONT>
<BR><FONT FACE="Arial,Helvetica">[other home LAN hosts]</FONT></TD>
<TD><FONT FACE="Arial,Helvetica">order hosts, bind</FONT>
<BR><FONT FACE="Arial,Helvetica">multi on</FONT></TD>
<TD><FONT FACE="Arial,Helvetica">domain maths.wu.edu.au </FONT>
<BR><FONT FACE="Arial,Helvetica">search maths.wu.edu.au wu.edu.au </FONT>
<BR><FONT FACE="Arial,Helvetica">nameserver 192.168.10.1 </FONT>
<BR><FONT FACE="Arial,Helvetica">nameserver 192.168.12.1</FONT></TD>
</TR>
</TABLE>
<P><FONT FACE="Arial,Helvetica"><B>Note</B>: linuxconf is capable of editing
most of these files</FONT>
<H3>
<FONT FACE="Arial,Helvetica">Other programs</FONT></H3>
<UL>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="http://www.sendmail.org/">Sendmail</A>:
the ubiquitous MTA, but difficult to configure,and reputedly not secure.</FONT></LI>
<LI>
<FONT FACE="Arial,Helvetica"><A HREF="http://www.procmail.org/">Procmail</A>:
a powerful mail delivery agent capable of much finer analysis and distribution
of incoming mails.</FONT></LI>
</UL>
<HR><B><FONT FACE="Arial,Helvetica"><FONT SIZE=-1>Copyright © 1999
<A HREF="mailto:simon.hampton@tvd.be">Simon
Hampton</A>. All rights reserved. Permission to use, distribute, and copy
this document is hereby granted. You may modify this document as long as
credit to me is given and I am informed of the changes.</FONT></FONT></B>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -