Subject: Re: smtpfeed & mailer.conf [was: Re: CVS commit: pkgsrc]
To: None <tech-pkg@netbsd.org>
From: None <itojun@iijlab.net>
List: tech-pkg
Date: 12/28/1999 13:49:08
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <7632.946356509.1@coconut.itojun.org>
Content-Transfer-Encoding: 7bit

>>	smtpfeed wants sendmail with specific patch, so this is a bit
>>	separate problem - pkgsrc/mail/smtpfeed needs to build sendmail
>>	anyways (or make it depend to pkgsrc/mail/wide-patched-sendmail).
>	oops, we already have mail/sendmail...
>	I'll be making mail/wide-sendmail for use with smtpfeed (and IPv6).

	The patch creates mail/wide-sendmail from mail/sendmail.
	Is it better to unify it into mail/sendmail, or should we maintain it
	separately?  For reference documents for WIDE extension is attached.

	Note: most of WIDE changes are imported into sendmail 8.10.

itojun

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <7632.946356509.2@coconut.itojun.org>
Content-Transfer-Encoding: 7bit

diff -cr -x CVS -N sendmail/Makefile wide-sendmail/Makefile
*** sendmail/Makefile	Sat Dec 25 18:20:44 1999
--- wide-sendmail/Makefile	Mon Dec 27 20:42:19 1999
***************
*** 1,10 ****
  # $NetBSD: Makefile,v 1.10 1999/12/01 21:55:12 tron Exp $
  
  DISTNAME=	sendmail.8.9.3
! PKGNAME=	sendmail-8.9.3
  CATEGORIES=	mail
  MASTER_SITES=	ftp://ftp.sendmail.org/pub/sendmail/ \
! 		ftp://ftp.cert.dfn.de/pub/tools/net/sendmail/
  
  MAINTAINER=	packages@netbsd.org
  HOMEPAGE=	http://www.sendmail.org/
--- 1,18 ----
  # $NetBSD: Makefile,v 1.10 1999/12/01 21:55:12 tron Exp $
  
  DISTNAME=	sendmail.8.9.3
! PKGNAME=	wide-sendmail-8.9.3
  CATEGORIES=	mail
  MASTER_SITES=	ftp://ftp.sendmail.org/pub/sendmail/ \
! 		ftp://ftp.cert.dfn.de/pub/tools/net/sendmail/ \
! 		ftp://ftp.kyoto.wide.ad.jp/pub/mail/sendmail/
! 
! PATCH_SITES=	ftp://ftp.kyoto.wide.ad.jp/pub/mail/sendmail/
! PATCHFILES=	sendmail893+3.2W.patch.gz
! PATCH_DIST_ARGS=-d ${WRKSRC}/src -E ${PATCH_DIST_STRIP}
! .if !(defined(PATCH_DEBUG) || defined(PKG_VERBOSE))
! PATCH_DIST_ARGS+=--forward --quiet
! .endif
  
  MAINTAINER=	packages@netbsd.org
  HOMEPAGE=	http://www.sendmail.org/
***************
*** 17,26 ****
  
  MESSAGE_FILE=	${WRKDIR}/MESSAGE
  OBJDIR!=	echo obj.`uname -srm | tr \  .`
! WRKSRC=		${WRKDIR}/${PKGNAME}
  
  .include "../../mk/bsd.prefs.mk"
  
  USE_DB2?=	NO
  
  .if ${USE_DB2} == YES
--- 25,40 ----
  
  MESSAGE_FILE=	${WRKDIR}/MESSAGE
  OBJDIR!=	echo obj.`uname -srm | tr \  .`
! WRKSRC=		${WRKDIR}/${PKGNAME:S/wide-//}
! 
! BUILD_DEFS+=    USE_INET6
  
  .include "../../mk/bsd.prefs.mk"
  
+ .if defined(USE_INET6) && ${USE_INET6} == YES
+ MAKE_ENV+=	CONFIG="-f ${WRKSRC}/site.config-v6"
+ .endif
+ 
  USE_DB2?=	NO
  
  .if ${USE_DB2} == YES
***************
*** 31,36 ****
--- 45,55 ----
  PLIST_SRC=	${WRKDIR}/PLIST
  .else
  MAKE_ENV+=	DB_ENVDEF="" DB_LIBS=""
+ .endif
+ 
+ post-patch:
+ .if defined(USE_INET6) && ${USE_INET6} == YES
+ 	@(cp ${FILESDIR}/site.config-v6 ${WRKSRC})
  .endif
  
  post-build:
diff -cr -x CVS -N sendmail/files/md5 wide-sendmail/files/md5
*** sendmail/files/md5	Thu Apr  8 16:00:33 1999
--- wide-sendmail/files/md5	Mon Dec 27 20:29:01 1999
***************
*** 1,3 ****
! $NetBSD: md5,v 1.1.1.1 1999/04/08 23:00:33 tron Exp $
  
  MD5 (sendmail.8.9.3.tar.gz) = efedacfbce84a71d1cfb0e617b84596e
--- 1,4 ----
! $NetBSD$
  
  MD5 (sendmail.8.9.3.tar.gz) = efedacfbce84a71d1cfb0e617b84596e
+ MD5 (sendmail893+3.2W.patch.gz) = 77e2183c40e304a2b1410a5bb041cd46
diff -cr -x CVS -N sendmail/files/site.config-v6 wide-sendmail/files/site.config-v6
*** sendmail/files/site.config-v6	Wed Dec 31 16:00:00 1969
--- wide-sendmail/files/site.config-v6	Mon Dec 27 20:35:44 1999
***************
*** 0 ****
--- 1 ----
+ PREPENDDEF(`confENVDEF', ``-DNETINET6=1'')

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <7632.946356509.3@coconut.itojun.org>
Content-Transfer-Encoding: 7bit

            Patch kit for R8 sendmail (3.2W) by WIDE Project
							         Mar.6,1998
							  Motonori NAKAMURA
							       WIDE Project
							motonori@wide.ad.jp

INTRODUCTION

This patch-kit provides some enhancement for the sendmail. Please apply
this patch if you want to use "smtpfeed", which is an external SMTP mailer.

Current original sendmail includes many features, especially for Japanese
workstations, which had been offered with patch kit 2.xW by WIDE Project.
Many normal workstations (non-mail-servers), therefore, will not need
features offered by this patch-kit. Be sure on features offered by
this patch-kit if you apply it to the sendmail.


FEATURES

Each features are enabled/disabled with the following flags in conf.h.

 LOGWVERSION
	Configuration information of sendmail at compile time (generated
	by newvers.sh) will be logged with syslog when deamon sendmail
	is started.

 QUICK_RESPONSE
	When sendmail is executed with -odq switch from rmail program,
	bounce mails will also be queued. If feature is enabled, bounce
	mails will not be queued and sent immediately (not well tested).

 MULTI_MAILER
	This feature allows multiple description of the triple in a rule
	for mailer dispatching in ruleset 0 or its sub-rulesets like:
		R$*<@dom>$*	$#smtp$@dom$:$1<@dom>$2 $#uucp$@dom$:$1<@dom>$2
	The above rule will try smtp mailer at first and then try uucp
	mailer if smtp mailer fails.
	Lower number limit of recipients can be defined at *= equate
	in definition line of a mailer which will be used at first.
	If number of recipients is less than the value defined at *=
	equate, first mailer will be skipped without trial.
	Message size limitation defined by M= equate will also be treated
	like the above -- if size of message is larger than the value
	defined, first mailer will be skipped without trial.
	If there is a flag '!' in F= equate, the mailer will be skipped
	when queue processing (in case following mailer is found).
	If there is a flag '-' in F= equate, the following mailer will
	not be used when the mailer (having '-' flag) is tried and
	failed with TEMPFAIL response code.

 CF_ALIASING
	This feature supplies "aliasing" in ruleset 5 (ruleset 5 is
	applied after aliases expansuin).
	The following rule will forward messages for user-a to multiple
	recipients, user-a and user-b. In other words, this feature
	provides aliasing by rules of the sendmail.cf.
		R user-a	$# local $@ alias $: user-a, user-b
	A mailer specified at $# must have 'l' in F= equate (local mailer).
	host portion specified at $@ must be 'alias'.
	You can specify multiple addresses separated with ',' at $:

 DYNAMIC_TOBUF
	Number of recipients passed in a SMTP transaction is limited by
	size of tobuf[] (TOBUFSIZE) with current implementation of the
	sendmail(tobuf[] is used for logging recipients to syslog).
	The DYNAMIC_TOBUF feature uses dynamic allocation technique
	to relax this limitation so that a SMTP transaction not be
	splited into many small transactions which takes long time to
	finish a sequence of deliveries in case the message has many
	recipients on an identical host. Default of the maximum number
	of recipients which can be passed at a time is 100 since it is
	limited up to 100 by RFC821. But you can change the value par
	mailer using &= equate in mailer definition lines.

 MAILER_PREF
	Mailer preference can be defined in configuration file to determine
	order of mailers to be executed. If a message which has multiple
	recipients will be delivered with multiple mailers, order of mailers
	is determined by preference values. For example, if you define 10
	for local mailer and 20 for smtp mailer, delivery with local mailer
	will be done first and then smtp mailer will be used. Preference
	values can be defined at %= equate on mailer definition lines.
	Lower values are more preferred like MX RRs. Default value is 0
	in case %= equate is missing. Negative values can be specified.
	If there is a flag '%' in F= equate of a mailer definition,
	list of destination addresses for the mailer will be sorted by
	domain part. This feature will be effective if number of recipients
	to be processed in one transaction is limited with &= equate.

 CLIENT_SMTP_CONFIG
	3 parameters of client-side SMTP connection can be configured.
	Parameters are:
		FQDN: FQDN used as a hostname with SMTP HELO
		SrcIPaddr: source IP address for client-side SMTP (12.34.56.78)
		SrcPort: source port number for client-side SMTP
	Define these parameters at @= equate on IPC mailer definition lines
	like:
		@=FQDN/SrcIPaddr/SrcPort
	Default value will be used if a parameter omitted.
	When a '@' is specified at FQDN part, a hostname which is resolved
	from source IP address of SMTP connection dynamically is used.
	If any hostname can not be obtained with DNS or etc., [IP.addres]
	notation will be used.
	When a '@' is specified at SrcIPaddr part, an IP address associated
	with FQDN will be used. If multiple IP addresses are defined for the
	FQDN, the first found address will be used.

 CTE8CHECK
	Manage incorrect "Content-Transfer-Encoding: 8bit" header label
	(having such a header without 8bit data in message body).
	To enable this feature, CTE8BitCheck option should be defined in
	configuration file.
		O CTE8BitCheck=correct	(correct CTE label to "7bit")
		O CTE8BitCheck=reject	(reject such messages)

 BOUNCE_REASON
	Show reason of permanent fatal errors on each address reported
	in bounced message.

 OO_NULLSENDER
	Set NULL sender envelope address (<>) on messages delivered to
	the alias entry "owner-owner" to avoid loops.

 MF_SEPARATE
	Even if recipient list of a message includes multiple identical
	address, only one copy of the message will be sent to the address.
	If you define MF_SEPARATE and set flag '+' to a mailer, the
	address will not be unified and equal number of copies will be
	sent to the address.

 MASKED_ADDR
	Traditional class-macro matching in sendmail is just a tokenized
	character string pattern matching. But this type of matching does
	not support masked IP address matching, so you must list up every
	host addresses as elements of a class. It is complicated especially
	for IP address authentication in check_* rulesets.
	If you define MASKED_ADDR, masked IP address matching feature can
	be used. For example, if you describe the following lines in your
	sendmail.cf, an IP address between 172.16.0.0 and 172.31.255.255
	will be matched to $=C in a rule.

		CC _MASKED_ADDRESS_MATCH_
		CC 172.16.0.0/12

	Note that you must include the keyword _MASKED_ADDRESS_MATCH_ to
	a class to enable masked IP address matching for the class.

	If you define MASKED_ADDR, maskedaddr map is also enabled.
	For example, if you create a map file /etc/maskedaddr.map with
	the following content:

		172.16.0.0/12		OK

	and describe the following lines in your sendmail.cf, an IP
	address between 172.16.0.0 and 172.31.255.255 will match to
	the entry in the map file, and the address pattern will be
	changed to "OK".

		Kma maskedaddr -t /etc/maskedaddr.map

		R $-.$-.$-.$-	$: $( ma $1.$2.$3.$4 $)

	This map file is not DB style but TEXT style, so the file will
	be open and read at every matching processing. If you set option
	-t as avobe example, the file will be read only once at startup
	time of sendmail. In this case, you must restart sendmail when
	you modified the map file.

 DEFINE_MAP
	Enables "define" map. If you describe as follows in your sendmail.cf
	file, content of $1 will be defined to macro ${Macro} dynamically.
	/dev/null is just a dummy.

		Kdef define /dev/null

		R $*		$: $(def $1 $@ {Macro} $)

 SPR_CON_CACHE
	This feature supplies connection-caching control par mailer basis.
	You can use mailer flag ';' at F= equate of mailer definition.
	If your set the mailer flag ';', connection-caching feature for
	the mailer is disabled.

 FORWARDPROGCTL
	This feature supplies privilege control on execution of programs
	via ~/.forward file. With this feature, only users defined in
	class macro 'f' can execute programs via ~/.forward. To enable
	this feature you must also define a character '@' in the class
	macro 'f', or every users can execute programs via ~/.forward.

 MAILER_TIMEOUTS
	With this feature, you can control message timeout (how long
	an unsent message will be kept in the mqueue) par mailer basis.
	To specify timeout value for a mailer, use ?= equate like:
		Msmtp ...., ?=7d,....

 CHECK_WARNING
	This enables a feature to control whether a queue-warning
	(unsent yet, but still trying) notification should be sent to
	sender or not. For decision, envelope sender address is processed
	with "check_warning" ruleset and if it reaches to an error mailer,
	a notification will be sent. Of course, notifications to messages
	whose value in Precedence: header field is negative or envelope
	sender address is <> are not sent as before. If "check_warning"
	ruleset is not defined, notifications are sent as before.
	An example of check_warning ruleset:
		Scheck_warning
		R $* - request@$*	$@ OK
		R $* - ctl@$*		$@ OK
		R owner - $*@$*		$@ OK
		R $* @ mydomain		$#error$:warning
		R $*			$@ OK
	Note: in check_warning ruleset, character '-' is also treated as
	an OperaterChar. But it should be surrounded by spaces.


ACKNOWLEDGEMENTS

Development of this patch-kit has been supported by WIDE Project, Kyoto
University, Ritsumeikan University, TDI Co., Ltd., and many contributors.

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <7632.946356509.4@coconut.itojun.org>
Content-Transfer-Encoding: 7bit

IPv6 (IPv4/IPv6 dual-stack) support for sendmail 8.9.x

* How to compile

	1. Create sendmail-8.9.x/BuildTools/Site/site.config.m4 file

	   There are 2 sample files included:
		site.config-v6.kame -- for KAME (http://www.kame.net/)
		site.config-v6.v6d  -- for IPv6 daemon
			(http://onoe2.sm.sony.co.jp/ipv6/index.html)

	   If you do not want to place site.config.m4 file in BuildTools/Site/
	   directory, specify site.config.m4 file with -f switch after
	   "sh Build" like "sh Build -f site.config.m4" at the next step.

	2. Type "sh Build"

	   If you want to edit generated Makefile in obj.*/ before
	   compilation, type "sh Build nocompile" just to generate it,
	   edit it and type "sh Build" again (or type "make" in obj.*/). 

	3. Prepare /etc/sendmail6.cf

	   Patched sendmail will read /etc/sendmail6.cf just for
	   separation from IPv4 version.

* How to start as a daemon which accepts IPv6 connection

	There are some ways to start a daemon sendmail with a IPv6 socket:
	 a) Type "/path/sendmail6 -bd"
	 b) Type "/path/sendmail -bd6"
	 c) Describe "O DaemonPortOptions=Family=inet6" in sendmail6.cf
	    and just type "/path/sendmail -bd"

	Patched sendmail can listen with multiple daemon sockets in a process.
	Family/address/port for a daemon socket can be defined with
	DaemonPortOptions option. One option line corresponds to one daemon
	socket. If your plathome has separated port spaces for IPv4 and IPv6,
	and you must prepare IPv4 socket and IPv6 socket for accept connection
	over both protocols, you can describe as follows in sendmail6.cf:
	
		O DaemonPortOptions=Family=inet
		O DaemonPortOptions=Family=inet6

	If you describe as follows, connections only to specified address
	can be accepted:

		O DaemonPortOptions=Family=inet,Address=127.0.0.1
		O DaemonPortOptions=Family=inet,Address=1.2.3.4
		O DaemonPortOptions=Family=inet6,Address=::1
		O DaemonPortOptions=Family=inet6,Address=3ffe::1


* How to utilize new macro ${family} in your sendmail6.cf file

	If SMTP connection is made over inet6 protocol, a string "IPv6"
	is stored in a new macro ${family}. If SMTP connection is made
	over inet(4) family, a string "IPv4" is stored in it.
	You can refer value of ${family} in your sendmail6.cf file.

	Example 1: you can record used protocol family on Received:
	           header line with the following definition:

	HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
		$.by $j ($v/$Z)$?r with $r$.$?{family}/${family}$. id $i$?u
		for $u; $|;                 ^^^^^^^^^^^^^^^^^^^^^^
		$.$b$?g
		(envelope-from $g)$.

	Example 2: You can switch rules to parse IP address in check_* like
		   as follows:

		R $*			$: $&{family} $| $1
		R IPv4 $| $*		$: $>Check_v4 $1
		R IPv6 $| $*		$: $>Check_v6 $1
		R $* $| $*		$: $>Check_others $1


* Other changes to support IPv6

  - CLIENT_SMTP_CONFIG
	IPv6 addressing supported by @= equate like:
		@=inet6:FQDN/SrcIPaddr/SrcPort
	Traditional IPv4 style @=FQDN/SrcIPaddr/SrcPort will be treated
	as same as @=inet:FQDN/SrcIPaddr/SrcPort.

  - MASKED_ADDR
	IPv6 notation like 3ffe:501::1 also supported.


Enjoy,

- Motonori Nakamura <motonori@wide.ad.jp>

------- =_aaaaaaaaaa0--