		MTA tips

------------------------------------------------------------I	Sendmail

1	Sendmail specific topics
1.1	Delete "owner-ml: xxx@yyy.co.jp" in /etc/aliases ?
II	Postfix

2	Postfix
2.1	control postfix

3	POP before SMTP with Postfix
3.1	install postfix
3.2	install DRAC (Dynamic Relay Authorization Control)
Appendix A	C Wrapper
Appendix A.1	C wrapper (when :include: does not work)
Appendix A.2	C wrapper program fml on 4.3BSD
Appendix B.1	:include: file
------------------------------------------------------------


I	Sendmail
1	Sendmail specific topics

1.1	Delete "owner-ml: xxx@yyy.co.jp" in /etc/aliases ?

It is better not to delete it, since it has special meaning.

II	Postfix
2	Postfix

	http://www.postfix.org/

2.1	control postfix

To suspend smtp delivery:

    postconf -e defer_transports=smtp; postfix reload

To enable smtp delivery:

    postconf -e defer_transports=; postfix reload; postfix flush

3	POP before SMTP with Postfix

3.1	install postfix

3.2	install DRAC (Dynamic Relay Authorization Control)

	http://mail.cc.umanitoba.ca/drac/index.html

see INSTALL of drac and make drac and qpopper

3. modify postfix /etc/postfix/main.cf.

        smtpd_recipient_restrictions =
            permit_mynetworks
            check_client_access hash:/etc/mail/dracd
            check_relay_domains
            reject

4. mkdir /etc/mail. 

dracd users the directory "/etc/mail".

5. run "rpc.dracd" as a daemon.

[description]

Appendix A	C Wrapper

Appendix A.1	C wrapper (when :include: does not work)

When :include: statement does not work e.g. on old sendmail, you can
use C wrapper. C wrapper uses setuid(). Please pay attention to use
it. 

makefml newml creates examples of C wrappers, fmlwrapper.c, . "make"
in $DIR.  Please check them and compile it under the ML's owner (NOT
POSIX). On POSIX or not, please see the following sections. fmlwrapper.c is
for delivery program,  is for command program.

Example:

	% cd /var/spool/ml/elena
	% make fml
	cc  -o fml fmlwrapper.c
	chmod 4755 fml
	cc  -DCTLADDR -o fml-ctl fmlwrapper.c
	chmod 4755 fml-ctl

(It is preferable to do "chmod 4555")

After compiling, install fml, fml-c to somewhere only root can access.

* Description

[fmlwrapper.c]

  execl("_EXEC_DIR_/fml.pl", /* where is fml.pl */
	"(fml)", 
	"_ML_DIR_/_ML_", /* where is config.ph */
	"_EXEC_DIR_", /* library of fml package */
#ifdef CTLADDR
	"--ctladdr", /* --ctladdr, command mode */
#endif
	NULL);

  exit(0);

Appendix A.2	C wrapper program fml on 4.3BSD

If :include: statement is not used, you can use C wrapper program. 
C wrapper does setuid() and runs

	/usr/local/fml/fml.pl $DIR $LIBDIR

You can create C wrapper programs by

	% make fml 

Please see previous sections.

Appendix B.1	:include: file

How to kick off "fml.pl" is 

	fml.pl $DIR $LIBDIR

	$DIR	"ML's HOME directory, location of config.ph and so on
	$LIBDIR	library path (if needed)

MTA runs this command and injects mail to it. That is 

	| fml.pl $DIR $LIBDIR

Consider Elena mailing list setting. Sendmail reads the content of
/var/spool/ml/Elena/include (file to include) and checks the owner of
the file. Sendmail runs "|/usr/local/fml/fml.pl /var/spool/ml/elena "
(precisely e.g. sh -c "|/usr/local/fml/fml.pl /var/spool/ml/elena ")
as the owner process and passes mail for Elena to it.

   [/etc/aliases]

	Elena: :include:/var/spool/ml/Elena/include
	owner-Elena: fukachan
	Elena-request: fukachan
	Elena-admin: fukachan

   [/var/spool/ml/Elena/include]

	"|/usr/local/fml/fml.pl /var/spool/ml/elena "

Please see troubleshoot 10 for OS dependence.


		INDEX

fml                                        ...   Appendix A.1 Appendix A.2 
fmlwrapper.c                               ...   Appendix A.1 Appendix A.2 
