Next Previous Contents

9. Setting up Servers

9.1 How do I run qmail-smtpd under tcpserver?

inetd is barfing at high loads, cutting off service for ten-minute stretches. I'd also like better connection logging.

Answer:

  1. Install the ucspi-tcp package, ( http://pobox.com/~djb/ucspi-tcp.html.)
  2. Remove the smtp line from /etc/inetd.conf,
  3. and put the line
    tcpserver -v -u 7770 -g 2108 0 smtp /var/qmail/bin/qmail-smtpd \
    2>&1 | /var/qmail/bin/splogger smtpd 3 &
    
    into your system boot scripts. Replace 7770 with your qmaild uid, and replace 2108 with your nofiles gid. Don't forget the &. The change will take effect at your next reboot.

By default, tcpserver allows at most 40 simultaneous qmail-smtpd processes. To raise this limit to 400, use tcpserver -c 400. To keep track of who's connecting and for how long, run (on two lines)

tcpserver -v -u 7770 -g 2108 0 smtp /var/qmail/bin/qmail-smtpd \
2>&1 | /var/qmail/bin/splogger smtpd 3 &

9.2 How do I allow selected clients to send outgoing messages through my SMTP server?

qmail-smtpd is giving the error sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) for messages to any domain not listed in /var/qmail/control/rcpthosts.

Answer:

This answer assumes that you are running qmail-smtpd under tcpserver, see question How do I run qmail-smtpd under tcpserver?.

Create /etc/tcp.smtp containing

1.2.3.6:allow,RELAYCLIENT=""
127.:allow,RELAYCLIENT=""

to authorize relaying from clients with IP addresses 1.2.3.6 and 127.*.

Run

 
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

Insert

-x /etc/tcp.smtp.cdb

after tcpserver in your system boot scripts. The change will take effect at your next reboot.

If you make any changes to /etc/tcp.smtp, you must run

tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

again. You do not have to restart tcpserver.

9.3 How do I fix up messages from dumb SMTP clients?

This answer assumes that you are running qmail-smtpd under tcpserver, as in question How do I run qmail-smtpd under tcpserver? and have also set up tcpserver to allow those clients to relay, see question How do I allow selected clients to send outgoing messages through my SMTP server?.

Three steps.

  1. Put
    fixme:fixup
    
    into /var/qmail/control/virtualdomains, and tell qmail to read it as in question How do I tell qmail to read locals and virtualdomains?.
  2. Put
    | bouncesaying 'Permission denied' [ "@$HOST" != "@fixme" ]
    | qmail-inject -f "$SENDER" -- "$DEFAULT"
    
    into ~alias/.qmail-fixup-default. Insert @fixme into RELAYCLIENT in the appropriate lines in /etc/tcp.smtp:
    1.2.3.6:allow,RELAYCLIENT="@fixme"
    
  3. Finally, run
    tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
    
    to tell tcpserver about the change. You do not have to restart tcpserver.

An alternative answer is to use the experimental ofmipd program in the mess822 package, http://pobox.com/~djb/mess822.html. ofmipd includes an integrated From-rewriting database and more powerful hostname rewriting features than qmail-inject.

9.4 How do I send messages by SMTP to an authorized dialup host when it makes an SMTP connection?

I've heard about ETRN and AutoTURN.

Answer:

This answer assumes that you are running qmail-smtpd under tcpserver, see question How do I run qmail-smtpd under tcpserver?.

Install serialmail ( http://pobox.com/~djb/serialmail.html and read /usr/local/doc/serialmail/AUTOTURN.

AutoTURN works with clients that send ETRN. It also works with clients that don't send ETRN.

9.5 How do I set up qmail-pop3d?

My old POP server works with mbox delivery; I'd like to switch to maildir delivery.

Answer:

Install ucspi-tcp ( http://pobox.com/~djb/ucspi-tcp.html) and checkpassword ( http://pobox.com/~djb/checkpwd.html.) Put

tcpserver 0 110 /var/qmail/bin/qmail-popup YOURHOST \
/bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir &

(on two lines) into your system boot scripts; replace YOURHOST with your host's fully qualified domain name. Set up Maildir delivery for any user who wants to read mail via POP. The new service will start after you reboot.

Security note: You should do this only within a secure network; otherwise an eavesdropper can steal passwords.

There are several programs that can be substituted for checkpassword. See http://pobox.com/~djb/qmail/toaster.html for more information.

9.6 How do I set up qmail-qmqpd?

I'd like to allow fast queueing of outgoing mail from authorized clients.

Answer:

Install ucspi-tcp, http://pobox.com/~djb/ucspi-tcp.html. Create /etc/qmqp.tcp in tcprules format to allow connections from authorized hosts. For example, if queueing is allowed from 1.2.3.*:

1.2.3.:allow
:deny

Convert /etc/qmqp.tcp to /etc/qmqp.cdb:

 
tcprules /etc/qmqp.cdb /etc/qmqp.tmp < /etc/qmqp.tcp

Put the line

 
tcpserver -x /etc/qmqp.cdb -u 7770 -g 2108 0 628 /var/qmail/bin/qmail-qmqpd &

into your system boot scripts; replacing 7770 and 2108 with the qmaild uid and nofiles gid. See question How do I run qmail-smtpd under tcpserver? for more details.

9.7 How do I set up qmail-qmtpd?

Install ucspi-tcp, http://pobox.com/~djb/ucspi-tcp.html. Put the line

tcpserver -u 7770 -g 2108 0 209 /var/qmail/bin/qmail-qmtpd &

into your system boot scripts; replace 7770 with your qmaild uid, and replace 2108 with your nofiles gid. Don't forget the &. The new service will start after you reboot.

9.8 How do I record all incoming SMTP traffic?

This answer assumes that you are running qmail-smtpd under tcpserver, explained in question How do I run qmail-smtpd under tcpserver? , using tcpserver 0.84 or above, with tcpserver's connection messages being sent to syslog.

Simply insert recordio before qmail-smtpd. SMTP traffic will be sent to syslog.


Next Previous Contents