diff options
Diffstat (limited to 'debian/examples')
50 files changed, 6292 insertions, 263 deletions
diff --git a/debian/examples/Makefile.in b/debian/examples/Makefile.in index aef3815..08f4d46 100644 --- a/debian/examples/Makefile.in +++ b/debian/examples/Makefile.in @@ -1,3 +1,260 @@ +# Makefile.in generated by automake 1.9.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = examples +DIST_COMMON = $(dist_man_MANS) $(dist_sbin_SCRIPTS) \ + $(nobase_dist_sysconf_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/./build/mkinstalldirs +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" \ + "$(DESTDIR)$(sysconfdir)" +dist_sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(dist_sbin_SCRIPTS) +SOURCES = +DIST_SOURCES = +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(dist_man_MANS) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +nobase_dist_sysconfDATA_INSTALL = $(install_sh_DATA) +DATA = $(nobase_dist_sysconf_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBIAN = @DEBIAN@ +DEBIAN_DH = @DEBIAN_DH@ +DEB_BUILD_ARCH = @DEB_BUILD_ARCH@ +DEB_BUILD_GNU_CPU = @DEB_BUILD_GNU_CPU@ +DEB_BUILD_GNU_SYSTEM = @DEB_BUILD_GNU_SYSTEM@ +DEB_BUILD_GNU_TYPE = @DEB_BUILD_GNU_TYPE@ +DEB_HOST_ARCH = @DEB_HOST_ARCH@ +DEB_HOST_GNU_CPU = @DEB_HOST_GNU_CPU@ +DEB_HOST_GNU_SYSTEM = @DEB_HOST_GNU_SYSTEM@ +DEB_HOST_GNU_TYPE = @DEB_HOST_GNU_TYPE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SM_CPYRT = @SM_CPYRT@ +SM_DATE = @SM_DATE@ +SM_ENABLE_AUTH_FALSE = @SM_ENABLE_AUTH_FALSE@ +SM_ENABLE_AUTH_TRUE = @SM_ENABLE_AUTH_TRUE@ +SM_ENABLE_LDAP_FALSE = @SM_ENABLE_LDAP_FALSE@ +SM_ENABLE_LDAP_TRUE = @SM_ENABLE_LDAP_TRUE@ +SM_ENABLE_TLS_FALSE = @SM_ENABLE_TLS_FALSE@ +SM_ENABLE_TLS_TRUE = @SM_ENABLE_TLS_TRUE@ +SM_MAXVERS = @SM_MAXVERS@ +SM_MINVERS = @SM_MINVERS@ +SM_VERS = @SM_VERS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_version = @ac_version@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +am_version = @am_version@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +buildtree = @buildtree@ +datadir = @datadir@ +docdir = @docdir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sm_auth_lib = @sm_auth_lib@ +sm_badepends = @sm_badepends@ +sm_build_arch = @sm_build_arch@ +sm_custom = @sm_custom@ +sm_databases = @sm_databases@ +sm_date = @sm_date@ +sm_depends = @sm_depends@ +sm_dist_name = @sm_dist_name@ +sm_dist_vers = @sm_dist_vers@ +sm_editmap_envdef = @sm_editmap_envdef@ +sm_editmap_libs = @sm_editmap_libs@ +sm_enable_auth = @sm_enable_auth@ +sm_enable_bind = @sm_enable_bind@ +sm_enable_dev = @sm_enable_dev@ +sm_enable_doc = @sm_enable_doc@ +sm_enable_hesiod = @sm_enable_hesiod@ +sm_enable_ipv6 = @sm_enable_ipv6@ +sm_enable_ldap = @sm_enable_ldap@ +sm_enable_maillock = @sm_enable_maillock@ +sm_enable_milter = @sm_enable_milter@ +sm_enable_ndbm = @sm_enable_ndbm@ +sm_enable_newdb = @sm_enable_newdb@ +sm_enable_nis = @sm_enable_nis@ +sm_enable_nisplus = @sm_enable_nisplus@ +sm_enable_regex = @sm_enable_regex@ +sm_enable_sfio = @sm_enable_sfio@ +sm_enable_shm = @sm_enable_shm@ +sm_enable_tcpd = @sm_enable_tcpd@ +sm_enable_tls = @sm_enable_tls@ +sm_envdef = @sm_envdef@ +sm_features = @sm_features@ +sm_ffr = @sm_ffr@ +sm_hesiod_parms = @sm_hesiod_parms@ +sm_host_arch = @sm_host_arch@ +sm_incdirs = @sm_incdirs@ +sm_ldap_lib = @sm_ldap_lib@ +sm_libmilter_envdef = @sm_libmilter_envdef@ +sm_libmilter_libs = @sm_libmilter_libs@ +sm_libs = @sm_libs@ +sm_libsm_envdef = @sm_libsm_envdef@ +sm_libsm_libs = @sm_libsm_libs@ +sm_libsmdb_envdef = @sm_libsmdb_envdef@ +sm_libsmdb_libs = @sm_libsmdb_libs@ +sm_libsmutil_envdef = @sm_libsmutil_envdef@ +sm_libsmutil_libs = @sm_libsmutil_libs@ +sm_m4_ffr = @sm_m4_ffr@ +sm_mail_local_envdef = @sm_mail_local_envdef@ +sm_mail_local_libs = @sm_mail_local_libs@ +sm_mailstats_envdef = @sm_mailstats_envdef@ +sm_mailstats_libs = @sm_mailstats_libs@ +sm_makemap_envdef = @sm_makemap_envdef@ +sm_makemap_libs = @sm_makemap_libs@ +sm_mapdef = @sm_mapdef@ +sm_newdb_lib = @sm_newdb_lib@ +sm_praliases_envdef = @sm_praliases_envdef@ +sm_praliases_libs = @sm_praliases_libs@ +sm_recommends = @sm_recommends@ +sm_revision = @sm_revision@ +sm_rmail_envdef = @sm_rmail_envdef@ +sm_rmail_libs = @sm_rmail_libs@ +sm_sendmail_envdef = @sm_sendmail_envdef@ +sm_sendmail_libs = @sm_sendmail_libs@ +sm_smrsh_envdef = @sm_smrsh_envdef@ +sm_smrsh_libs = @sm_smrsh_libs@ +sm_suggests = @sm_suggests@ +sm_time = @sm_time@ +sm_utc = @sm_utc@ +sm_vacation_envdef = @sm_vacation_envdef@ +sm_vacation_libs = @sm_vacation_libs@ +sm_version = @sm_version@ +sm_version_beta = @sm_version_beta@ +sm_version_major = @sm_version_major@ +sm_version_math = @sm_version_math@ +sm_version_minor = @sm_version_minor@ +sm_version_r = @sm_version_r@ +sm_version_v = @sm_version_v@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + #!/usr/bin/make -f #------------------------------------------------------------------------------ # vim: syntax=make @@ -18,107 +275,368 @@ # # Richard Nelson <cowboy@debian.org> @sm_date@ @sm_time@ (@sm_utc@) #------------------------------------------------------------------------------ -#SHELL=/bin/sh -x +# +# Shipped programs +# +dist_sbin_SCRIPTS = checksendmail/checksendmail +# +# Shipped manpages +# +dist_man_MANS = checksendmail/checksendmail.8 +# +# Shipped data +# +# Installed example subdirectories +EXAMPLES_DIRS = amavis db dhcp3 \ + ldap logcheck milter network \ + pam.d ppp resolvconf sasl tls -# Include Debian Autoconf settings --include ../build/autoconf.mk +# +# Sigh... I wanted to use sysconf_SCRIPTS, but automake says NO! +nobase_dist_sysconf_DATA = dhcp3/dhclient-exit-hooks.d/sendmail \ + logcheck/ignore.d.paranoid/sendmail \ + logcheck/ignore.d.server/sendmail \ + logcheck/ignore.d.workstation/sendmail \ + logcheck/violations.ignore.d/sendmail \ + network/if-down.d/sendmail network/if-up.d/sendmail pam.d/smtp \ + ppp/ip-down.d/sendmail ppp/ip-up.d/sendmail \ + resolvconf/update-libc.d/sendmail +all: all-am -ALL_SUBDIRS = . amavis db dialup ldap logcheck milter pam sasl tls -DATA_SUBDIRS = amavis db ldap pam sasl tls -SCRIPT_SUBDIRS = dialup +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; -all: +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -clean: - for subdir in ${ALL_SUBDIRS}; do \ - rm -rf $${subdir}/core $${subdir}/*~; \ - done; +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-dist_sbinSCRIPTS: $(dist_sbin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" + @list='$(dist_sbin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(dist_sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ + $(dist_sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \ + else :; fi; \ + done -setup: +uninstall-dist_sbinSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(dist_sbin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ + rm -f "$(DESTDIR)$(sbindir)/$$f"; \ + done +uninstall-info-am: +install-man8: $(man8_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ + done +uninstall-man8: + @$(NORMAL_UNINSTALL) + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ + done +install-nobase_dist_sysconfDATA: $(nobase_dist_sysconf_DATA) + @$(NORMAL_INSTALL) + test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)" + @$(am__vpath_adj_setup) \ + list='$(nobase_dist_sysconf_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__vpath_adj) \ + echo " $(nobase_dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \ + $(nobase_dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \ + done -build-indep: -build-arch: - # - # Debian Local additions / changes - # - # examples/ldap/sendmail.schema.v2 - conditional - # - if (grep -qEe "^#LDAP:[[:space:]]*yes" ../build/site.config.m4); then \ - if [ -e ../../${buildtree}/cf/sendmail.schema ]; then \ - $(INSTALL_DATA) ../../${buildtree}/cf/sendmail.schema \ - ldap/sendmail.schema.v2; \ - fi; \ - fi; +uninstall-nobase_dist_sysconfDATA: + @$(NORMAL_UNINSTALL) + @$(am__vpath_adj_setup) \ + list='$(nobase_dist_sysconf_DATA)'; for p in $$list; do \ + $(am__vpath_adj) \ + echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \ + done +tags: TAGS +TAGS: -install-indep: build-indep -install-arch: build-arch - # - # Debian Local additions / changes - # - # ${sysconfdir}/ppp/ip-{up,down}.d - unconditional - # - $(INSTALL) -d ${sysconfdir}/ppp/ip-up.d; - $(INSTALL_SCRIPT) dialup/ip-up.d \ - ${sysconfdir}/ppp/ip-up.d/sendmail; - $(INSTALL) -d ${sysconfdir}/ppp/ip-down.d; - $(INSTALL_SCRIPT) dialup/ip-down.d \ - ${sysconfdir}/ppp/ip-down.d/sendmail; - # - # ${sysconfdir}/pam.d - unconditional - # - $(INSTALL) -d ${sysconfdir}/pam.d; - $(INSTALL_DATA) pam/* \ - ${sysconfdir}/pam.d; - # - # ${sysconfdir}/logcheck - unconditional - # - (cd logcheck && \ - for file in $$(find . -type d); do \ - $(INSTALL) -d ../${sysconfdir}/logcheck/$$file; \ - done;); - for file in $$(find logcheck -type f -name '*sendmail'); do \ - $(INSTALL_DATA) $$file \ - ${sysconfdir}/logcheck/$$(echo "$$file" \ - | sed -e 's?^.*logcheck/??'); \ - done; - # - # ${datadir}/sendmail/examples - unconditional - # - for subdir in ${DATA_SUBDIRS}; do \ - $(INSTALL) -d ${datadir}/sendmail/examples/$$subdir; \ - find $$subdir -type f ! -name '*.in' | xargs -ri \ - $(INSTALL_DATA) '{}' ${datadir}/sendmail/examples/$$subdir; \ - done; - for subdir in ${SCRIPT_SUBDIRS}; do \ - $(INSTALL) -d ${datadir}/sendmail/examples/$$subdir; \ - find $$subdir -type f ! -name '*.in' | xargs -ri \ - $(INSTALL_SCRIPT) '{}' ${datadir}/sendmail/examples/$$subdir; \ - done; - # Can't simply $(INSTALL) logcheck, has subdirs... - $(INSTALL) -d ${datadir}/sendmail/examples/logcheck; - cp -a logcheck/* \ - ${datadir}/sendmail/examples/logcheck; - # - # ${datadir}/sendmail/examples - conditional - # - if (grep -qEe "^#MILTER:[[:space:]]*yes" ../build/site.config.m4); then \ - $(INSTALL) -d ${datadir}/sendmail/examples/milter; \ - $(INSTALL_DATA) milter/* \ - ${datadir}/sendmail/examples/milter; \ - chmod a+x \ - ${datadir}/sendmail/examples/milter/Makefile; \ - fi; +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/checksendmail $(distdir)/dhcp3/dhclient-exit-hooks.d $(distdir)/logcheck/ignore.d.paranoid $(distdir)/logcheck/ignore.d.server $(distdir)/logcheck/ignore.d.workstation $(distdir)/logcheck/violations.ignore.d $(distdir)/network/if-down.d $(distdir)/network/if-up.d $(distdir)/pam.d $(distdir)/ppp/ip-down.d $(distdir)/ppp/ip-up.d $(distdir)/resolvconf/update-libc.d + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) $(MANS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(sysconfdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic -#------------- -# Below here is fairly generic really +dvi: dvi-am -source diff: - @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false +dvi-am: -build: build-indep build-arch -install: install-indep install-arch -.PHONY: all -.PHONY: setup -.PHONY: clean build build-indep build-arch -.PHONY: install install-indep install-arch -.PHONY: source diff +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-exec-am: install-dist_sbinSCRIPTS \ + install-nobase_dist_sysconfDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +install-info: install-info-am + +install-man: install-man8 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_sbinSCRIPTS uninstall-info-am \ + uninstall-man uninstall-nobase_dist_sysconfDATA + +uninstall-man: uninstall-man8 + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-data-hook install-dist_sbinSCRIPTS install-exec \ + install-exec-am install-exec-hook install-info install-info-am \ + install-man install-man8 install-nobase_dist_sysconfDATA \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-dist_sbinSCRIPTS uninstall-info-am uninstall-man \ + uninstall-man8 uninstall-nobase_dist_sysconfDATA + +# +# Local customisation... not automake friendly +# +install-data-hook: + $(INSTALL) -d ${DESTDIR}${pkgdatadir}/examples; + for dir in ${EXAMPLES_DIRS}; do \ + $(INSTALL) -d ${DESTDIR}${pkgdatadir}/examples/$$dir; \ + find $$dir -type f \ + ! -name '*.in' -a ! -name '*.am' -a ! -name '*.old' \ + | xargs -ri \ + $(INSTALL_DATA) '{}' ${DESTDIR}${pkgdatadir}/examples/'{}'; \ + done; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/milter/Makefile; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/dhcp3/dhclient-exit-hooks.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/network/if-down.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/network/if-up.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/ppp/ip-down.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/ppp/ip-up.d/sendmail; + chmod a+rx ${DESTDIR}${pkgdatadir}/examples/resolvconf/update-libc.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/dhcp3/dhclient-exit-hooks.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/network/if-down.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/network/if-up.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/ppp/ip-down.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/ppp/ip-up.d/sendmail; + chmod a+rx ${DESTDIR}${sysconfdir}/resolvconf/update-libc.d/sendmail; + $(INSTALL_DATA) checksendmail/address.resolve \ + ${DESTDIR}${sysconfdir}/mail/; +install-exec-hook: + sed -e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \ + -e "s?address.resolve?${sysconfdir}/mail/address.resolve?g" \ + checksendmail/checksendmail \ + > ${DESTDIR}${sbindir}/checksendmail; + chmod 0755 ${DESTDIR}${sbindir}/checksendmail; + if [ -f ${top_srcdir}/../${buildtree}/contrib/buildvirtuser ]; then \ + $(INSTALL_SCRIPT) ${top_srcdir}/../${buildtree}/contrib/buildvirtuser \ + ${DESTDIR}${pkgdatadir}; \ + fi; + sed 's?/bin/perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/passwd-to-alias.pl \ + > ${DESTDIR}${pkgdatadir}/examples/passwd-to-alias; + chmod 0755 ${DESTDIR}${pkgdatadir}/examples/passwd-to-alias; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e "s?/etc/sendmail.cf?${sysconfdir}/mail/sendmail.cf?g" \ + ${top_srcdir}/../${buildtree}/contrib/etrn.pl \ + > ${DESTDIR}${sbindir}/etrn; + chmod 0755 ${DESTDIR}${sbindir}/etrn; + if [ -f ${top_srcdir}/../${buildtree}/contrib/etrn.0 ]; then \ + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e 's?etrn(1M)?etrn(8)?g' \ + ${top_srcdir}/../${buildtree}/contrib/etrn.0 \ + > ${DESTDIR}${mandir}/man8/etrn.8; \ + else \ + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e 's?etrn(1M)?etrn(8)?g' \ + ${top_srcdir}/../${buildtree}/contrib/etrn.pl \ + > ${DESTDIR}${mandir}/man8/etrn.8; \ + fi; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/expn.pl \ + > ${DESTDIR}${bindir}/expn; + chmod 0755 ${DESTDIR}${bindir}/expn; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/expn.pl \ + > ${DESTDIR}${mandir}/man1/expn.1; + sed -e 's?/usr/local/bin/perl?/usr/bin/perl?g' \ + -e 's?/usr/sbin/sendmail -q30m -bd?/etc/init.d/sendmail start?g' \ + ${top_srcdir}/../${buildtree}/contrib/smcontrol.pl \ + > ${DESTDIR}${pkgdatadir}/smcontrol.pl; + chmod 0755 ${DESTDIR}${pkgdatadir}/smcontrol.pl; + $(INSTALL_SCRIPT) ${top_srcdir}/../${buildtree}/contrib/doublebounce.pl \ + ${DESTDIR}${pkgdatadir}; + if [ -f ${top_srcdir}/../${buildtree}/contrib/qtool.pl ]; then \ + sed -e 's?/usr/bin/env perl?/usr/bin/perl?g' \ + ${top_srcdir}/../${buildtree}/contrib/qtool.pl \ + > ${DESTDIR}${pkgdatadir}/qtool.pl; \ + chmod 0755 ${DESTDIR}${datadir}/sendmail/qtool.pl; \ + $(INSTALL_DATA) ${top_srcdir}/../${buildtree}/contrib/qtool.8 \ + ${DESTDIR}${mandir}/man8/; \ + fi; +# +# Debian targets, phase out (this needs to be treated as -arch, not -indep) +# +.PHONY: build-indep build-arch +.PHONY: install-indep install-arch +build-indep: +build-arch: +install-indep: install +install-arch: +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/debian/examples/checksendmail/BSDI/BSDI_CONTRIB b/debian/examples/checksendmail/BSDI/BSDI_CONTRIB new file mode 100644 index 0000000..97871d5 --- /dev/null +++ b/debian/examples/checksendmail/BSDI/BSDI_CONTRIB @@ -0,0 +1,18 @@ +Software Package: + checksendmail + +Release/Version: + Dated 7/11/90. + +Retrieved from: + N/A. + +Bug reports: + This software package is maintained by the software contributor, + not BSDI. Please send any bug reports to both support@BSDI.COM + and polk@bsdi.com. + +Comments: + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Modifications to this version made by BSDI: diff --git a/debian/examples/checksendmail/BSDI/Makefile b/debian/examples/checksendmail/BSDI/Makefile new file mode 100644 index 0000000..101ba4e --- /dev/null +++ b/debian/examples/checksendmail/BSDI/Makefile @@ -0,0 +1,15 @@ +# BSDI $Id: Makefile,v 1.3 1995/01/07 05:34:35 donn Exp $ + +MAN8= checksendmail.0 + +all checksendmail: ${MAN8} + +clean depend tags: + +install: maninstall + install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${.CURDIR}/checksendmail.perl ${DESTDIR}${BINDIR}/checksendmail + install -c -o ${BINOWN} -g ${BINGRP} -m 0444 \ + ${.CURDIR}/address.resolve ${DESTDIR}/usr/contrib/lib/ + +.include <bsd.prog.mk> diff --git a/debian/examples/checksendmail/BSDI/address.resolve b/debian/examples/checksendmail/BSDI/address.resolve new file mode 100644 index 0000000..01f3011 --- /dev/null +++ b/debian/examples/checksendmail/BSDI/address.resolve @@ -0,0 +1,27 @@ + +# BSDI $Id: address.resolve,v 1.1.1.1 1994/01/13 21:15:30 polk Exp $ + +# Sample address resolution file for checksendmail(8) + +# local addresses +user +user@hilltop +user@hilltop.BSDI.COM +hilltop!polk + +# within-domain addresses +user@bsdi.com +user@ibapah +user@ibapah.bsdi.com +ibapah!user + +# faraway addresses +user@xxxxxxx.com +user@xxxxxxx.dom +site!user + +# addresses with routing, etc. +site1!site2!user +user@xxxxxxx.dom@bar.dom +site!user@xxxxxxx.dom +site!user@uunet.uu.net diff --git a/debian/examples/checksendmail/BSDI/checksendmail.8 b/debian/examples/checksendmail/BSDI/checksendmail.8 new file mode 100644 index 0000000..b129c35 --- /dev/null +++ b/debian/examples/checksendmail/BSDI/checksendmail.8 @@ -0,0 +1,223 @@ +.\" BSDI $Id: checksendmail.8,v 1.1.1.1 1994/01/13 21:15:31 polk Exp $ +.Dd January 12, 1994 +.Dt CHECKSENDMAIL 8 +.Os +.Sh NAME +.Nm checksendmail +.Nd verify sendmail address transformations. +.Sh SYNOPSIS +.Nm checksendmail +.Op Fl C Ar file.cf +.Op Fl r Ar resolve +.Op Fl T Ar test.address +.Op Fl b Ar sendmail_binary +.Sh DESCRIPTION +.Pp +The +.Nm checksendmail +program is a +.Xr perl +script that aids the testing of +.Xr sendmail 8 's +various configuration files. +.Nm checksendmail +passes typical addresses (supplied in input files) through +.Xr sendmail +and prints the results of the resolution and transformation routines. +.Pp +The input files contain a list of addresses, one per line. +For example: +.Bd -literal -offset indent +user +user@site +user@site.com +.Ed +.Pp +The input file can contain comments started with a +.Em # +and blank lines. +.Sh OPTIONS +.Pp +.Bl -tag -width Fl -compact -offset left +.It Fl C Ar file.cf +Use the +.Xr sendmail +configuration file +.Ar file.cf +instead of the default +.Pa /etc/sendmail.cf +file. +.It Fl r Ar resolve +Use +.Ar resolve +as the input file for the addresses to be used for mail resolving. Defaults +to +.Ar address.resolve . +.It Fl T Ar test.address +Use +.Ar test.address +as the single address to test. Cannot be used in conjunction with +file setting flags. +.It Fl B Ar sendmail_binary +Use the specified +.Ar sendmail_binary +as the path to invoke sendmail (instead of +.Pa /usr/sbin/sendmail ) . +.El +.Sh EXAMPLES +.Pp +The following command will pass the addresses in +.Ar address.resolve +through +.Xr sendmail +using the configuration information in +.Ar myconfig.cf . +.Bd -literal -offset left +example% cat address.resolve +user +user@site +user@site.com +example% checksendmail \-C myconfig.cf +config file: myconfig.cf resolve file: address.resolve +towhom file: address.resolve fromwhom file: address.resolve +Mail address resolution +user --(ether )--> user[rmtc] +user@site --(ether )--> user@site[rmtc] +user@site.com --(ether )--> user@site.com[rmtc] +`To' address transformations for mailer ether: +user ----> user +user@site ----> user@site +user@site.com ----> user@site.com +`From' address transformations for mailer ether: +user ----> user +user@site ----> user +user@site.com ----> user +.Ed +.Pp +The first section of the output shows how the addresses in the input +files are resolved by +.Xr sendmail 8 . +Consider the following output line: +.Pp +.Dl user@site.com --(ether )--> user@site.com[rmtc] +.Pp +The input address +.Em user@site.com +resolves to use the +.Em ether +mailer. That mailer is directed to send the mail to +to the user +.Em user@site.com +at site +.Em rmtc +(as indicated in the square brackets). +.Pp +The two later sections of output show how the addresses specified as +the +.Em To +and +.Em From +address are transformed in the text of the +headers. In the example above, the +.Em To +addresses are untouched. +The +.Em From +addresses, however, all lose their machine information on +the way through the mailer: +.Pp +.Dl user@site ----> user +.Pp +This may be desirable when using a configuration file on a +workstation which is to be hidden as a mailhost from the rest of the +network. +.Pp +The following is a set of addresses used at one site for the purposes of +testing address resolution. Comments after the addresses detail why +particular addresses are present: +.Bl -tag -width "user@machine.com" -compact -offset indent +.It user +Standard trivial address +.It user@rmtc +qualified at one level +.It user@rmtc.central +qualified at two levels +.It user@rmtc.central.sun.com +qualified all the way +.It rmtc!user +local but specified as uucp +.It user@summit +a workstation (normally delivered locally, though) +.It user@summit.central +same but more qualified +.It user@summit.central.sun.com +same but fully qualified +.It summit!user +same but specified as uucp +.It user@prisma +Backward compatibility tests +.It user@prisma.com +.It prisma!user +.It user@central +Superior domain testing +.It user@machine.central +more qualified, but unknown +.It user@summit.central +more qualified and known +.It user@eng +name in faraway domain +.It user@machine.eng +unknown machine in faraway domain +.It user@summit.eng +local machine, far away domain +.It user@hoback +far away machine +.It user@machine +apparently local but unknown machine +.It user@sun.com +Standard trivial address +.It user@machine.dom.sun.com +fully qualified but unknown machine +.It user@foo.com +standard, known, really far away domain +.It user@foo.dom +standard, unknown, really far away domain +.It site!user +Single level uucp +.It site1!site2!user +Double level uucp +.It user@foo.dom@bar.dom +Trickier address +.It site!user@foo.dom +Mixed uucp/domain +.It site!user@uunet.uu.net +Mixed double uucp/domain +.El +.Sh NOTES +Note that +.Nm checksendmail +is a +.Xr perl +script. If your site does not have +.Xr perl 1 , +it can be obtained via anonymous +.Xr ftp +from +.Em ftp.uu.net . +.Pp +.Xr sendmail +requires that the user have access to directory specified by the +.Em OQ +parameter in the configuration file (normally +.Pa /usr/spool/mqueue ) . +.Nm checksendmail +verifies that the user has access to this directory before allowing the +test to continue. +.Sh AUTHORS +.Bd -literal +Gene Kim +Rob Kolstad +Jeff Polk +.Ed +.Sh "SEE ALSO" +.Xr sendmail 8 diff --git a/debian/examples/checksendmail/BSDI/checksendmail.perl b/debian/examples/checksendmail/BSDI/checksendmail.perl new file mode 100644 index 0000000..a8e9e11 --- /dev/null +++ b/debian/examples/checksendmail/BSDI/checksendmail.perl @@ -0,0 +1,377 @@ +#!/usr/bin/perl + +# BSDI $Id: checksendmail.perl,v 1.1.1.1 1994/01/13 21:15:31 polk Exp $ + +# checksendmail +# +# The checksendmail program is a perl script that aids the testing +# of sendmail's various configuration filse. checksendmail +# passes typical addresses (supplied in input files) through +# sendmail and prints the result of the resolution and +# transformation routines. +# +# Gene Kim & Rob Kolstad & Jeff Polk, 7/11/90 + +# -- -C config file +# -- -r resolve_addresses_file +# -- -T test one address +# -- -b sendmail binary + +# XXX deficiencies: ``/etc/sendmail'' should be a parameter + +# defaults: + $resolve = "address.resolve"; + $cffile = "/etc/sendmail.cf"; + $sendmail = "/usr/sbin/sendmail"; + +sub usage { + die "Usage: checksendmail [-C cffile.cf] [-r resolve_addrs_file [-T one\@test.addr\n"; +} + +for (unshift (@ARGV, "XX"); $#ARGV > 0; shift ARGV) { + if ($ARGV[1] eq "-C") + { + shift @ARGV; + if ($#ARGV >= 1) {$cffile = $ARGV[1]; } + else { &usage(); } + } + elsif ($ARGV[1] eq "-r") + { + if ($setfile & 1) { die "Can only set `resolve' once"; } + shift @ARGV; + if ($#ARGV < 1) { &usage(); } + $resolve = $ARGV[1]; + $setfile += 1; + } + elsif ($ARGV[1] eq "-T") + { + if ($setfile) { die "Can't set other files and use -T"; } + shift @ARGV; + if ($#ARGV < 1) { &usage(); } + open (OUT, ">/tmp/csm.in$$") || + die "Can't open >/tmp/csm.in$$"; + $resolve = "/tmp/csm.in$$"; + print OUT "$ARGV[1]\n"; + close (OUT); + $setfile = 7; + } + elsif ($ARGV[1] eq "-b") + { + shift @ARGV; + if ($#ARGV >= 1) {$sendmail = $ARGV[1]; } + else { &usage(); } + } + else { &usage(); } +} + +if (!-e $cffile) { die "Can't find configuration file $cffile\n"; } +if (!-e $resolve) { die "Can't find name file $resolve\n"; } + +# make sure the user can access the ../mqueue directory + +$maildir = `grep ^OQ $cffile`; +chop $maildir; +$maildir =~ s/^OQ//; +if ((!-r $maildir) || (!-x $maildir) || (!-w $maildir)) { + warn "checksendmail: can't access $maildir! trying anyway...\n"; +} + +chop($hostname = `hostname`); +chop($pwd = `pwd`); +print "system: $hostname\t\tcurrent dir: $pwd\n"; +print "config file: $cffile\t\tresolve file: $resolve\n"; + +sub handler { # 1st argument is signal name + local($sig) = @_; + print STDERR "Caught a SIG$sig--shutting down\n"; + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); + exit(0); +} + +$SIG{'INT'} = 'handler'; +$SIG{'QUIT'} = 'handler'; + + +# glean the mailers used from the rule 0 tests + +sub parseresolve +{ + while (<MAIL>) + { + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + if (/^>/) # INPUT LINE! (and last output is done) + { + chop; + if ($prevline) { # OUTPUT LINE! + &printparseresolve; + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + else { chop; } + $prevline = $_; + } + &printparseresolve; +} + +sub printparseresolve { + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; + # Don't strip spaces off error messages + $prevline =~ s/ *([.!%<>]) */$1/g; + $prevline =~ s/ +([;?\$])/$1/g; + $prevline =~ s/([#\@:]) +/$1/g; + +# non-Sun test mode delimiters -> easily-readable style +# Mark Sausville, MIT Media Laboratory, saus@media-lab.media.mit.edu + $prevline =~ s/\^V/\$#/; + $prevline =~ s/\^W/\$@/; + $prevline =~ s/\^X/\$:/; + + #### $#ether$@sun-barr.Ebay.Sun.COM$:site!user@uunet.uu.NET + @t = split( '\$', $prevline); + $address = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 1; $i <= $#t; $i++) + { + if (substr($t[$i], 0, 1) eq ":") + { $address = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "@") + { $remote = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "#") + { $mailer = substr($t[$i], 1,999); + $mailer =~ tr/A-Z/a-z/; } + } + printf("%-27.27s --(%-6.6s)--> %s[%s]\n", $input, $mailer, + $address, $remote); + if ($mailer ne "XXX") { $themailers{$mailer}.="$input ";} +} + +# Parse output of sendmail name resolution + +sub parseaddress +{ +## ADDRESS TEST MODE +## Enter <ruleset> <address> +## > rewrite: ruleset 3 input: "user" + + open(MAIL, $_[0]) || die "Can't open $_[0]...\n"; + local ($k, $address, $prevline, $mailer, $remote, $input); + print $_[1]; # the title + + $done = 0; + while (<MAIL>) + { + if (/^> *$/) { $done = 1; } + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + chop; + if (/^>/) # INPUT LINE! (and last output is done) + { + if ($prevline) { # OUTPUT LINE! + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; +#> rewrite: ruleset 3 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#rewrite: ruleset 8 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#> + printf("%-27.27s ----> %s\n", $input, $prevline); + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + last if $done; + $prevline = $_; + } + close(MAIL); +} + + +# pass names from resolve files to sendmail + +open(IN, $resolve) || die "can't open $resolve\n"; +open(OUT, ">/tmp/csm$$") || die "can't open >/tmp/csm$$\n"; +while (<IN>) +{ + /^$/ && next; + /^#/ && next; + print OUT "3,0 $_"; + chop; + $allinput .= " $_"; +} +close(OUT); +close(IN); +$sendmailprog = "$sendmail -bt -C$cffile < /tmp/csm$$|"; +open(MAIL, $sendmailprog) || die "can't exec $sendmailprog...\n"; +print "Mail address resolution (rule 0)\n\n"; +&parseresolve(); + +# calculate $f + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,4"; + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\n\$f address header transformations\n\n"); + +# Get the R= and S= special rulesets from the configuration + +open(FID, "grep ^M $cffile|"); +while (<FID>) +{ +# Mether, P=[IPC], F=msDFMueCX, S=11, R=21, A=IPC $h + chop; + $thisline = $_; $thisline =~ s/M//; $thisline =~ s/,.*//; + $thisline =~ tr/A-Z/a-z/; + $sendrule = $_; $sendrule =~ s/.*S=//; $sendrule =~ s/,.*//; + if ($sendrule=~q!/!) { + ($esendrule, $hsendrule) = split (q!/!, $sendrule); + } + else { $esendrule = $hsendrule = $sendrule; } + $recvrule = $_; $recvrule =~ s/.*R=//; $recvrule =~ s/,.*//; + if ($recvrule=~q!/!) { + ($erecvrule, $hrecvrule) = split (q!/!, $recvrule); + } + else { $erecvrule = $hrecvrule = $recvrule; } + $esendrules{$thisline} = $esendrule; + $hsendrules{$thisline} = $hsendrule; + $erecvrules{$thisline} = $erecvrule; + $hrecvrules{$thisline} = $hrecvrule; +} +close(FID); + +# pass names from various mailers through sendmail + +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($erecvrules{$i} == 0) { + print "\n\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + @namelist = split(/ /, $allinput); + $rules = "3,2,$erecvrules{$i},4"; + foreach (@namelist) { + print OUT "$rules $_\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(OUT); + $note = ""; + if ($erecvrules{$i} eq $hrecvrules{$i}) { $note = "and header "; } + &parseaddress ("/tmp/csm$$", "\n\n`To' envelope ${note}address transformations for mailer $i [$rules]:\n\n"); +} +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($hrecvrules{$i} == 0) { + print "\n\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + if ($hrecvrules{$i} ne $erecvrules{$i}) { + open (OUT, $sendmailprog); + @namelist = split(/ /, $allinput); + $rules = "3,2,$hrecvrules{$i},4"; + foreach (@namelist) { + print OUT "$rules $_\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\n`To' header address transformations for mailer $i [$rules]:\n\n"); + } +} + +# pass names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($esendrules{$i} == 0) { + print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,$esendrules{$i},4"; + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n\n`From' envelope ${note}address transformations for mailer $i [$rules]:\n\n"); +} +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($hsendrules{$i} == 0) { + print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,$hsendrules{$i},4"; + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\n`From' address header transformations for mailer $i [$rules]:\n\n"); +} +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($esendrules{$i} == 0) { + print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n\n\$g address transformations for mailer $i [$rules]:\n\n"); +} + +unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; +unlink("/tmp/csm.in$$"); + diff --git a/debian/examples/checksendmail/BSDI_CONTRIB b/debian/examples/checksendmail/BSDI_CONTRIB new file mode 100644 index 0000000..97871d5 --- /dev/null +++ b/debian/examples/checksendmail/BSDI_CONTRIB @@ -0,0 +1,18 @@ +Software Package: + checksendmail + +Release/Version: + Dated 7/11/90. + +Retrieved from: + N/A. + +Bug reports: + This software package is maintained by the software contributor, + not BSDI. Please send any bug reports to both support@BSDI.COM + and polk@bsdi.com. + +Comments: + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Modifications to this version made by BSDI: diff --git a/debian/examples/checksendmail/address.resolve b/debian/examples/checksendmail/address.resolve new file mode 100644 index 0000000..2de8a60 --- /dev/null +++ b/debian/examples/checksendmail/address.resolve @@ -0,0 +1,15 @@ +# addresses to be delivered locally +root +postmaster +user +user@mailhub +user@mailhub.gadget.com +user@gadget.com + +# Addresses to be forwarded with SMTP to firewall +user@firewall +user@firewall.gadget.com + +# Addresses to be forwarded with SMTP to harker.com +user@harker.com +harker!user diff --git a/debian/examples/checksendmail/checksendmail b/debian/examples/checksendmail/checksendmail new file mode 100644 index 0000000..349d025 --- /dev/null +++ b/debian/examples/checksendmail/checksendmail @@ -0,0 +1,868 @@ +#!/usr/bin/perl + +# BSDI $Id: checksendmail.perl,v 1.1.1.1 1994/01/13 21:15:31 polk Exp $ + +# checksendmail +# +# The checksendmail program is a perl script that aids the testing +# of sendmail's various configuration filse. checksendmail +# passes typical addresses (supplied in input files) through +# sendmail and prints the result of the resolution and +# transformation routines. +# +# Gene Kim & Rob Kolstad & Jeff Polk, 7/11/90 +# Modified by Robert Harker, 11/14/00 + +# -- -a show aliasing of local addresses +# -- -d preceed each line with ruleset sequence summary +# -- -C config_file +# -- -b sendmail_binary +# -- -l log_file of results of tests +# -- -r resolve_addresses_file +# -- -T test one address + +# defaults: + $resolve = "address.resolve"; + $cffile = "/etc/mail/sendmail.cf"; + +# Pre-create tmp files (so can use safely) + use Fcntl; + foreach ("/tmp/csm$$", "/tmp/csm.in$$") { + die "Can't pre-create $_" + unless sysopen(T,$_,O_RDWR|O_CREAT|O_EXCL,0600) + and close(T); + }; + +sub usage { + die "Usage: checksendmail [-C cffile.cf] [-b sendmail_binary] [-l log_file]\n\t\t\t\t[-a] [-d] [-r resolve_addrs_file || -T one\@test.addr]\n$errormsg\n"; +} + +for (unshift (@ARGV, "XX"); $#ARGV > 0; shift ARGV) { + if ($ARGV[1] eq "-C") + { + if ($setcffile & 1) { die "Can only set `cffile.cf' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$cffile = $ARGV[1]; } + else { + $errormsg = "No sendmail.cf file given for -C flag\n"; + &usage(); + } + $setcffile += 1; + } + elsif ($ARGV[1] eq "-r") + { + if ($setfile & 1) { die "Can only set `resolve' once"; } + shift @ARGV; + if ($#ARGV < 1) { + $errormsg = "No resolve_addrs_file given for -r flag\n"; + &usage(); + } + $resolve = $ARGV[1]; + $setfile += 1; + } + elsif ($ARGV[1] eq "-T") + { + if ($setfile) { die "Can't set other files and use -T"; } + shift @ARGV; + if ($#ARGV < 1) { + $errormsg = "No one\@test.addr given for -T flag\n"; + &usage(); + } + open (OUT, ">/tmp/csm.in$$") || + die "Can't open >/tmp/csm.in$$"; + $resolve = "/tmp/csm.in$$"; + print OUT "$ARGV[1]\n"; + close (OUT); + $setfile = 7; + } + elsif ($ARGV[1] eq "-b") + { + if ($setbin & 1) { die "Can only set `sendmail_binary' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$sendmail = $ARGV[1]; } + else { + $errormsg = "No sendmail_binary file given for -b flag\n"; + &usage(); + } + $setbin += 1; + } + elsif ($ARGV[1] eq "-l") + { + if ($setlog & 1) { die "Can only set `log_file' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$logfile = $ARGV[1]; } + else { + $errormsg = "No log_file file given for -l flag\n"; + &usage(); + } + $setlog += 1; + } + elsif ($ARGV[1] eq "-a") + { + $doaliasing += 1; + } + elsif ($ARGV[1] eq "-d") + { + $dorspath += 1; + } + else { &usage(); } +} + +# Figure out where the sendmail binary is +if (! $setbin & 1) { + foreach $i ("/usr/sbin/sendmail", "/usr/libexec/sendmail", "/usr/lib/sendmail") + { + # test if binary exists and is executable + if ((-e $i) && (-x $i)) { + $sendmail = $i; + last; + } + } +} + + +# Figure out the version of sendmail and the location of the sendmail.cf file +# sendmail -d0.10 -bv root +# ("-bv root" is just to give sendmail something to chew on) + +$binversion = `$sendmail -d0.10 -bv root | grep "^Version "`; +chop $binversion; +$binversion =~ s/^Version //; + +# Get the major relase number from the sendmail version +$binver = $binversion; +$binver =~ s/^8\.//; +$binver =~ s/\..+//; + +# if the cf file was not set on the command line, +# find out where the binary looks for it +if ( ! -e $cffile ) { + $cffile = `$sendmail -d0.10 -bv root | grep "Def Conf file:"`; + chop $cffile; + $cffile =~ s/ //g; + $cffile =~ s/ //g; + $cffile =~ s/^DefConffile://; +} + +if (!-e $cffile) { die "Can't find configuration file $cffile\n"; } + +if (!-e $resolve) { die "Can't find name file $resolve\n"; } + +# Figure out the version of the sendmail.cf file +# Look for the V line +$cfversion = `grep "^V" $cffile`; +chop $cfversion; +# if $cfversion is empty, then the configuration is sendmail 5, not sendmail 8 +$cfversion =~ s/^$/V0/; + +# Get the version number from the V line +$cfver = $cfversion; +$cfver =~ s/^V//; +$cfver =~ s'/.+''; + +# check that the binary is a higher version than config file +if ( $binver < $cfver + 1) { + die "$cffile version ($cfversion) is more advanced than $sendmail version ($binversion)\n"; +} + +# figure out where the mqueue directory is +if ( $cfver <= 6 ) { + $maildir = `grep "^OQ" $cffile`; + chop $maildir; + $maildir =~ s/^OQ//; +} else { + $maildir = `grep "^O QueueDirectory" $cffile`; + chop $maildir; + $maildir =~ s/^O QueueDirectory=//; +} + +# make sure the user can access the ../mqueue directory +if ((!-r $maildir) || (!-x $maildir) || (!-w $maildir)) { + if ($doaliasing & 1) { + die "checksendmail: can't access $maildir! can't use checksendmail's -a flag\n"; + } else { + warn "checksendmail: can't access $maildir! trying anyway...\n"; + } +} + +chop($hostname = `hostname`); +chop($pwd = `pwd`); +print "system: $hostname\t\tcurrent dir: $pwd\n"; +print "resolve file: $resolve\n"; +print "sendmail binary: $sendmail\t\tsendmail version: $binversion\n"; +print "config file: $cffile\t\tconfig file version: $cfversion\n\n"; +if ($setlog & 1) { + print "log file: $logfile\n\n"; + # now print to the log file + open (LOG , ">$logfile") || die "Can't open >$logfile"; + print LOG "system: $hostname\t\tcurrent dir: $pwd\n"; + print LOG "resolve file: $resolve\n"; + print LOG "sendmail binary: $sendmail\t\tsendmail version: $binversion\n"; + print LOG "config file: $cffile\t\tconfig file version: $cfversion\n"; + print LOG "log file: $logfile\n\n"; +} + +sub handler { # 1st argument is signal name + local($sig) = @_; + print STDERR "Caught a SIG$sig--shutting down\n"; + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); + if ($setlog & 1) { + close(LOG); + } + exit(0); +} + +$SIG{'INT'} = 'handler'; +$SIG{'QUIT'} = 'handler'; + + + +# glean the mailers used from the rule 0 tests + +sub parseresolve +{ + while (<MAIL>) + { + # now print to the log file + if ($setlog & 1) { + print LOG $_; + } + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + if (/^Warning: .cf file is out of date/) { next; } + + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if (/^>/) # INPUT LINE! (and last output is done) + { + chop; + if ($prevline) { # OUTPUT LINE! + &printparseresolve; + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + else { chop; } + $prevline = $_; + } else { + # format of /parse output is: + # Parsing envelope recipient address + # rewrite: ruleset 3 input: harker @ harker . com + if ($prevrule eq "Parsing envelope recipient address\n" ) + { + chop; + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + $prevrule = $_; + } + elsif (/^mailer /) + { + $prevrule = $_; + &printparseresolve; + } + else + { + $prevrule = $_; + } + } + } + #&printparseresolve; +} + +sub printparseresolve { + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($input eq "") { return;} + + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; + # Don't strip spaces off error messages + $prevline =~ s/ *([.!%<>]) */$1/g; + $prevline =~ s/ +([;?\$])/$1/g; + $prevline =~ s/([#\@:]) +/$1/g; + +# non-Sun test mode delimiters -> easily-readable style +# Mark Sausville, MIT Media Laboratory, saus@media-lab.media.mit.edu + $prevline =~ s/\^V/\$#/; + $prevline =~ s/\^W/\$@/; + $prevline =~ s/\^X/\$:/; + + #### $#ether$@sun-barr.Ebay.Sun.COM$:site!user@uunet.uu.NET + @t = split( '\$', $prevline); + $address = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 1; $i <= $#t; $i++) + { + if (substr($t[$i], 0, 1) eq ":") + { $address = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "@") + { $remote = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "#") + { $mailer = substr($t[$i], 1,999); + $mailer =~ tr/A-Z/a-z/; } + } + } else { + # the binary is at least 8.7 then use result of /parse + chop; + s/,//g; + + # mailer esmtp, host harker.com., user harker@harker.com + @t = split( ' ', $_); + $address = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 0; $i <= $#t; $i++) + { + if ($t[$i] eq "user") + { $address = $t[++$i]; } + if ($t[$i] eq "host") + { $remote = $t[++$i]; } + if ($t[$i] eq "mailer") + { $mailer = $t[++$i]; + $mailer =~ tr/A-Z/a-z/; } + } + } + printf("%-27.27s --(%-6.6s)--> %s[%s]\n", $input, $mailer, + $address, $remote); + # now print to the log file + if ($setlog & 1) { + printf LOG ("%-27.27s --(%-6.6s)--> %s[%s]\n\n", $input, $mailer, + $address, $remote); + } + + if ($doaliasing & 1) { + # If the address resolved to the local mailer, + # then expand the username as an alias + if ( $mailer eq "local") + { + $setalias = $aliasfound = 0; + $laddress = $address; + $sendmailprog = "$sendmail -bv -C$cffile $laddress|"; + open(LOCAL, $sendmailprog) || + die "can't exec $sendmailprog...\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "\n$sendmailprog\n"; + } + while (<LOCAL>) + { + # now print to the log file + if ($setlog & 1) { + print LOG $_; + } + chop; + if (/unknown/) + { + $aliasfound = 1; + printf("\t\t aliased to --(error )--> %s\n", $_); + # now print to the log file + if ($setlog & 1) { + printf LOG ("\t\t aliased to --(error )--> %s\n\n", $_); + } + next; + } + s/,//g; + @l = split( ' ', $_); + $aladdress = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 1; $i <= $#l; $i++) + { + # ./sendmail -bv -C./sendmail.cf j.murphy + # j.murphy@pop.mcit.com... deliverable: mailer mciesmtp, + # host pop.mcit.com, user j.murphy@pop.mcit.com + if ($l[$i] eq "user") { $aladdress = $l[++$i]; } + if ($l[$i] eq "host") { $remote = $l[++$i]; } + if ($l[$i] eq "mailer") { $mailer = $l[++$i]; } + } + if (("$laddress" eq "$aladdress") && ($aliasfound == 0)) { + $selfalias = 1; + next; + } + printf("\t\t aliased to --(%-6.6s)--> %s[%s]\n", + $mailer, $aladdress, $remote); + # now print to the log file + if ($setlog & 1) { + printf LOG ("\t\t aliased to --(%-6.6s)--> %s[%s]\n\n", + $mailer, $aladdress, $remote); + } + if ("$laddress" ne "$aladdress") { + $aliasfound = 1; + $envsenderaddrs .= " $aladdress"; + } + if ($mailer ne "XXX") { $themailers{$mailer}=1;} + } + close(LOCAL); + if ($selfalias == 1 && $aliasfound == 1) { + printf("\t\t aliased to --(%-6.6s)--> %s[%s]\n", + $mailer, $aladdress, $remote); + # now print to the log file + if ($setlog & 1) { + printf LOG ("\t\t aliased to --(%-6.6s)--> %s[%s]\n\n", + $mailer, $aladdress, $remote); + } + } + # now print a blank line to the log file + if ($setlog & 1) { + print LOG "\n"; + } + } else { + $envsenderaddrs .= " $address"; + } + } + + if ($mailer ne "XXX") { $themailers{$mailer}.="$input ";} +} + +# Parse output of sendmail name resolution + +sub parseaddress +{ +## ADDRESS TEST MODE +## Enter <ruleset> <address> +## > rewrite: ruleset 3 input: "user" + + open(MAIL, $_[0]) || die "Can't open $_[0]...\n"; + local ($k, $address, $prevline, $mailer, $remote, $input); + print $_[1]; # the title + # now print to the log file + if ($setlog & 1) { + print LOG "\n$_[1]"; # the title + } + + $done = 0; + while (<MAIL>) + { + # now print to the log file + if ($setlog & 1) { + print LOG $_; + } + if (/^> *$/) { $done = 1; } + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + if (/^Warning: .cf file is out of date/) { next; } + if (/^$/) { next; } + chop; + # rewrite $rules to be just a slash if it starts with a / + $rules =~ s'/.+'/'; + # if the binary is less than 8.7 then use result of ruleset 4 + if ( $binver <= 6 || $rules ne "/" ) { + if (/^>/) # INPUT LINE! (and last output is done) + { + if ($prevline) { # OUTPUT LINE! + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; +#> rewrite: ruleset 3 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#rewrite: ruleset 8 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#> + printf("%s%-24.24s ----> %s\n", $rspath, $input, $prevline); + # now print to the log file + if ($setlog & 1) { + printf LOG ("%s%-24.24s ----> %s\n", $rspath, $input, $prevline); + } + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + last if $done; + $prevline = $_; + } else { + # format of /try output is: + # Trying envelope recipient address harker for mailer esmtp + # ... + # Rcode = 0, addr = harker@mailhub.gadget.com + # remove extra ">" from "> >" lines + s/^> >/>/; + if (/^> Trying/) # INPUT LINE! (and last output is done) + { + chop; + s/> Trying .+ address //; + s/ for mailer .+//; + s/ //g; + s/"//g; + $input = $_; + $prevrule = $_; + } + elsif (/^Rcode = /) + { + $prevrule = $_; + # Rcode = 0, addr = harker@mailhub.gadget.com + s/^Rcode = .+ addr = //; + printf("%s%-24.24s ----> %s\n", $rspath, $input, $_); + # now print to the log file + if ($setlog & 1) { + printf LOG ("%s%-24.24s ----> %s\n\n", $rspath, $input, $_); + } + } + else + { + $prevrule = $_; + } + } + } + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; + } + close(MAIL); +} + + +# if the binary is less than 8.7 then use result of ruleset 4 +if ( $binver <= 6 ) { + print "Mail address resolution (rule 0)\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "Mail address resolution (rule 0)\n"; + } +} else { + print "Mail address resolution (/parse)\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "Mail address resolution (/parse)\n"; + } +} +# pass names from resolve files to sendmail + +open(IN, $resolve) || die "can't open $resolve\n"; +open(OUT, ">/tmp/csm$$") || die "can't open >/tmp/csm$$\n"; +while (<IN>) +{ + /^$/ && next; + /^#/ && next; + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver == 5 ) { + $rules = "0 $_"; + } elsif ( $binver <= 6 ) { + $rules = "3,0 $_"; + } else { + $rules = "/parse $_"; + } + print OUT $rules; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules"; + } + chop; + $allinput .= " $_"; +} + $allinput =~ s/^ //; +close(OUT); +close(IN); +$sendmailprog = "$sendmail -bt -C$cffile < /tmp/csm$$|"; +open(MAIL, $sendmailprog) || die "can't exec $sendmailprog...\n"; +&parseresolve(); + +# calculate $f + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + open (IN, $resolve); + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "1,4"; + } else { + $rules = "3,1,4"; + } + if ($dorspath & 1) { $rspath = "\$f: "; } + + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $address\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; # stuff last line into sendmail + } + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\$f address header transformations\n"); + +# Get the R= and S= special rulesets from the configuration +# now print to the log file +if ($setlog & 1) { + print LOG "\nGet the R= and S= mailer specific rulesets\n"; +} + +open(FID, "grep ^M $cffile|"); +while (<FID>) +{ +# Mether, P=[IPC], F=msDFMueCX, S=11, R=21, A=IPC $h + chop; + $thisline = $_; + $thisline =~ s/M//; + $thisline =~ s/,.*//; + $thisline =~ tr/A-Z/a-z/; + $sendrule = $_; + $sendrule =~ s/.*S=//; + $sendrule =~ s/,.*//; + if ($sendrule=~q!/!) { + ($esendrule, $hsendrule) = split (q!/!, $sendrule); + } else { + $esendrule = $hsendrule = $sendrule; + } + $recvrule = $_; + $recvrule =~ s/.*R=//; + $recvrule =~ s/,.*//; + if ($recvrule=~q!/!) { + ($erecvrule, $hrecvrule) = split (q!/!, $recvrule); + } else { + $erecvrule = $hrecvrule = $recvrule; + } + $esendrules{$thisline} = $esendrule; + $hsendrules{$thisline} = $hsendrule; + $erecvrules{$thisline} = $erecvrule; + $hrecvrules{$thisline} = $hrecvrule; + # now print to the log file + if ($setlog & 1) { + print LOG "mailer: $thisline\t->\tesendrule = $esendrule, hsendrule = $hsendrule, + erecvrule = $erecvrule, hrecvrule = $hrecvrule\n"; + } +} +# now print to the log file +if ($setlog & 1) { + print LOG "\n"; +} +close(FID); + +# pass envelope recipient names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i ER: "; } + + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($erecvrules{$i} == 0) { + print "\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$erecvrules{$i},4"; + } else { + $rules = "3,2,$erecvrules{$i},4"; + } + } else { + print OUT "/tryflags ER\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags ER\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; # stuff last line into the log + } + close(OUT); + $note = ""; + if ($erecvrules{$i} eq $hrecvrules{$i}) { $note = "and header "; } + &parseaddress ("/tmp/csm$$", "\n`To' envelope ${note}address transformations for mailer $i [$rules]:\n"); +} + +# pass header recipient names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i HR: "; } + + # only run the header ruleset if the mailer uses split env/hdr rulesets + if ($hrecvrules{$i} ne $erecvrules{$i}) { + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($hrecvrules{$i} == 0) { + print "\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$hrecvrules{$i},4"; + } else { + $rules = "3,2,$hrecvrules{$i},4"; + } + } else { + print OUT "/tryflags HR\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags HR\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; # stuff last line into the log + } + close(OUT); + &parseaddress ("/tmp/csm$$", "\n`To' header address transformations for mailer $i [$rules]:\n"); + } +} + +# pass envelope sender names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i ES: "; } + + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($esendrules{$i} == 0) { + print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$esendrules{$i},4"; + } else { + $rules = "3,2,$esendrules{$i},4"; + } + } else { + print OUT "/tryflags ES\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags ES\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n`From' envelope ${note}address transformations for mailer $i [$rules]:\n"); +} + +# pass header sender names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i HS: "; } + + # only run the header ruleset if the mailer uses split env/hdr rulesets + if ($hsendrules{$i} ne $esendrules{$i}) { + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($hsendrules{$i} == 0) { + print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$hsendrules{$i},4"; + } else { + $rules = "3,2,$hsendrules{$i},4"; + } + } else { + print OUT "/tryflags HS\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags HR\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n`From' address header transformations for mailer $i [$rules]:\n"); + } +} + +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "\$g: "; } + + # if the binary is 8.9 or below then check if the mailer + # specific ruleset exists + if ( $binver <= 9 ) { + # if the binary is less than 8.7 then use result of ruleset 0 + if ($esendrules{$i} == 0) { + print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + } else { + $rules = "3,1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + } + open (IN, $resolve); + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n\$g address transformations for mailer $i [$rules]:\n"); +} + +unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; +unlink("/tmp/csm.in$$"); + +exit; diff --git a/debian/examples/checksendmail/checksendmail-BSDI.patch b/debian/examples/checksendmail/checksendmail-BSDI.patch new file mode 100644 index 0000000..35b4b2e --- /dev/null +++ b/debian/examples/checksendmail/checksendmail-BSDI.patch @@ -0,0 +1,1240 @@ +diff -c 'BSDI/checksendmail.perl' 'checksendmail' +Index: ./BSDI/checksendmail.perl +Prereq: 1.1.1.1 +*** ./BSDI/checksendmail.perl Mon Jan 15 12:49:25 2001 +--- ./checksendmail Mon Apr 14 15:57:56 2003 +*************** +*** 4,45 **** + + # checksendmail + # +! # The checksendmail program is a perl script that aids the testing + # of sendmail's various configuration filse. checksendmail + # passes typical addresses (supplied in input files) through + # sendmail and prints the result of the resolution and + # transformation routines. + # + # Gene Kim & Rob Kolstad & Jeff Polk, 7/11/90 + +! # -- -C config file + # -- -r resolve_addresses_file + # -- -T test one address +- # -- -b sendmail binary +- +- # XXX deficiencies: ``/etc/sendmail'' should be a parameter + + # defaults: + $resolve = "address.resolve"; +! $cffile = "/etc/sendmail.cf"; +! $sendmail = "/usr/sbin/sendmail"; + + sub usage { +! die "Usage: checksendmail [-C cffile.cf] [-r resolve_addrs_file [-T one\@test.addr\n"; + } + + for (unshift (@ARGV, "XX"); $#ARGV > 0; shift ARGV) { + if ($ARGV[1] eq "-C") + { + shift @ARGV; + if ($#ARGV >= 1) {$cffile = $ARGV[1]; } +! else { &usage(); } + } + elsif ($ARGV[1] eq "-r") + { + if ($setfile & 1) { die "Can only set `resolve' once"; } + shift @ARGV; +! if ($#ARGV < 1) { &usage(); } + $resolve = $ARGV[1]; + $setfile += 1; + } +--- 4,62 ---- + + # checksendmail + # +! # The checksendmail program is a perl script that aids the testing + # of sendmail's various configuration filse. checksendmail + # passes typical addresses (supplied in input files) through + # sendmail and prints the result of the resolution and + # transformation routines. + # + # Gene Kim & Rob Kolstad & Jeff Polk, 7/11/90 ++ # Modified by Robert Harker, 11/14/00 + +! # -- -a show aliasing of local addresses +! # -- -d preceed each line with ruleset sequence summary +! # -- -C config_file +! # -- -b sendmail_binary +! # -- -l log_file of results of tests + # -- -r resolve_addresses_file + # -- -T test one address + + # defaults: + $resolve = "address.resolve"; +! $cffile = "/etc/mail/sendmail.cf"; +! +! # Pre-create tmp files (so can use safely) +! use Fcntl; +! foreach ("/tmp/csm$$", "/tmp/csm.in$$") { +! die "Can't pre-create $_" +! unless sysopen(T,$_,O_RDWR|O_CREAT|O_EXCL,0600) +! and close(T); +! }; + + sub usage { +! die "Usage: checksendmail [-C cffile.cf] [-b sendmail_binary] [-l log_file]\n\t\t\t\t[-a] [-d] [-r resolve_addrs_file || -T one\@test.addr]\n$errormsg\n"; + } + + for (unshift (@ARGV, "XX"); $#ARGV > 0; shift ARGV) { + if ($ARGV[1] eq "-C") + { ++ if ($setcffile & 1) { die "Can only set `cffile.cf' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$cffile = $ARGV[1]; } +! else { +! $errormsg = "No sendmail.cf file given for -C flag\n"; +! &usage(); +! } +! $setcffile += 1; + } + elsif ($ARGV[1] eq "-r") + { + if ($setfile & 1) { die "Can only set `resolve' once"; } + shift @ARGV; +! if ($#ARGV < 1) { +! $errormsg = "No resolve_addrs_file given for -r flag\n"; +! &usage(); +! } + $resolve = $ARGV[1]; + $setfile += 1; + } +*************** +*** 47,53 **** + { + if ($setfile) { die "Can't set other files and use -T"; } + shift @ARGV; +! if ($#ARGV < 1) { &usage(); } + open (OUT, ">/tmp/csm.in$$") || + die "Can't open >/tmp/csm.in$$"; + $resolve = "/tmp/csm.in$$"; +--- 64,73 ---- + { + if ($setfile) { die "Can't set other files and use -T"; } + shift @ARGV; +! if ($#ARGV < 1) { +! $errormsg = "No one\@test.addr given for -T flag\n"; +! &usage(); +! } + open (OUT, ">/tmp/csm.in$$") || + die "Can't open >/tmp/csm.in$$"; + $resolve = "/tmp/csm.in$$"; +*************** +*** 57,91 **** + } + elsif ($ARGV[1] eq "-b") + { + shift @ARGV; + if ($#ARGV >= 1) {$sendmail = $ARGV[1]; } +! else { &usage(); } + } + else { &usage(); } + } + + if (!-e $cffile) { die "Can't find configuration file $cffile\n"; } + if (!-e $resolve) { die "Can't find name file $resolve\n"; } + +! # make sure the user can access the ../mqueue directory + +! $maildir = `grep ^OQ $cffile`; +! chop $maildir; +! $maildir =~ s/^OQ//; + if ((!-r $maildir) || (!-x $maildir) || (!-w $maildir)) { +! warn "checksendmail: can't access $maildir! trying anyway...\n"; + } + + chop($hostname = `hostname`); + chop($pwd = `pwd`); + print "system: $hostname\t\tcurrent dir: $pwd\n"; +! print "config file: $cffile\t\tresolve file: $resolve\n"; + + sub handler { # 1st argument is signal name + local($sig) = @_; + print STDERR "Caught a SIG$sig--shutting down\n"; + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); + exit(0); + } + +--- 77,215 ---- + } + elsif ($ARGV[1] eq "-b") + { ++ if ($setbin & 1) { die "Can only set `sendmail_binary' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$sendmail = $ARGV[1]; } +! else { +! $errormsg = "No sendmail_binary file given for -b flag\n"; +! &usage(); +! } +! $setbin += 1; +! } +! elsif ($ARGV[1] eq "-l") +! { +! if ($setlog & 1) { die "Can only set `log_file' once"; } +! shift @ARGV; +! if ($#ARGV >= 1) {$logfile = $ARGV[1]; } +! else { +! $errormsg = "No log_file file given for -l flag\n"; +! &usage(); +! } +! $setlog += 1; +! } +! elsif ($ARGV[1] eq "-a") +! { +! $doaliasing += 1; +! } +! elsif ($ARGV[1] eq "-d") +! { +! $dorspath += 1; + } + else { &usage(); } + } + ++ # Figure out where the sendmail binary is ++ if (! $setbin & 1) { ++ foreach $i ("/usr/sbin/sendmail", "/usr/libexec/sendmail", "/usr/lib/sendmail") ++ { ++ # test if binary exists and is executable ++ if ((-e $i) && (-x $i)) { ++ $sendmail = $i; ++ last; ++ } ++ } ++ } ++ ++ ++ # Figure out the version of sendmail and the location of the sendmail.cf file ++ # sendmail -d0.10 -bv root ++ # ("-bv root" is just to give sendmail something to chew on) ++ ++ $binversion = `$sendmail -d0.10 -bv root | grep "^Version "`; ++ chop $binversion; ++ $binversion =~ s/^Version //; ++ ++ # Get the major relase number from the sendmail version ++ $binver = $binversion; ++ $binver =~ s/^8\.//; ++ $binver =~ s/\..+//; ++ ++ # if the cf file was not set on the command line, ++ # find out where the binary looks for it ++ if ( ! -e $cffile ) { ++ $cffile = `$sendmail -d0.10 -bv root | grep "Def Conf file:"`; ++ chop $cffile; ++ $cffile =~ s/ //g; ++ $cffile =~ s/ //g; ++ $cffile =~ s/^DefConffile://; ++ } ++ + if (!-e $cffile) { die "Can't find configuration file $cffile\n"; } ++ + if (!-e $resolve) { die "Can't find name file $resolve\n"; } + +! # Figure out the version of the sendmail.cf file +! # Look for the V line +! $cfversion = `grep "^V" $cffile`; +! chop $cfversion; +! # if $cfversion is empty, then the configuration is sendmail 5, not sendmail 8 +! $cfversion =~ s/^$/V0/; +! +! # Get the version number from the V line +! $cfver = $cfversion; +! $cfver =~ s/^V//; +! $cfver =~ s'/.+''; +! +! # check that the binary is a higher version than config file +! if ( $binver < $cfver + 1) { +! die "$cffile version ($cfversion) is more advanced than $sendmail version ($binversion)\n"; +! } +! +! # figure out where the mqueue directory is +! if ( $cfver <= 6 ) { +! $maildir = `grep "^OQ" $cffile`; +! chop $maildir; +! $maildir =~ s/^OQ//; +! } else { +! $maildir = `grep "^O QueueDirectory" $cffile`; +! chop $maildir; +! $maildir =~ s/^O QueueDirectory=//; +! } + +! # make sure the user can access the ../mqueue directory + if ((!-r $maildir) || (!-x $maildir) || (!-w $maildir)) { +! if ($doaliasing & 1) { +! die "checksendmail: can't access $maildir! can't use checksendmail's -a flag\n"; +! } else { +! warn "checksendmail: can't access $maildir! trying anyway...\n"; +! } + } + + chop($hostname = `hostname`); + chop($pwd = `pwd`); + print "system: $hostname\t\tcurrent dir: $pwd\n"; +! print "resolve file: $resolve\n"; +! print "sendmail binary: $sendmail\t\tsendmail version: $binversion\n"; +! print "config file: $cffile\t\tconfig file version: $cfversion\n\n"; +! if ($setlog & 1) { +! print "log file: $logfile\n\n"; +! # now print to the log file +! open (LOG , ">$logfile") || die "Can't open >$logfile"; +! print LOG "system: $hostname\t\tcurrent dir: $pwd\n"; +! print LOG "resolve file: $resolve\n"; +! print LOG "sendmail binary: $sendmail\t\tsendmail version: $binversion\n"; +! print LOG "config file: $cffile\t\tconfig file version: $cfversion\n"; +! print LOG "log file: $logfile\n\n"; +! } + + sub handler { # 1st argument is signal name + local($sig) = @_; + print STDERR "Caught a SIG$sig--shutting down\n"; + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); ++ if ($setlog & 1) { ++ close(LOG); ++ } + exit(0); + } + +*************** +*** 93,157 **** + $SIG{'QUIT'} = 'handler'; + + + # glean the mailers used from the rule 0 tests + + sub parseresolve + { + while (<MAIL>) + { +! if (/^ADDRESS TEST MODE/) { next; } +! if (/^Enter <ruleset>/) { next; } +! if (/^>/) # INPUT LINE! (and last output is done) +! { +! chop; +! if ($prevline) { # OUTPUT LINE! + &printparseresolve; +! } +! s/> *[0-9,]* *//g; +! s/.*input: *//; +! s/ //g; +! s/"//g; +! $input = $_; +! } +! else { chop; } +! $prevline = $_; + } +! &printparseresolve; + } + + sub printparseresolve { +! $prevline =~ s/.*returns: *//; +! $prevline =~ s/"//g; +! $prevline =~ s/ //g; +! # Don't strip spaces off error messages +! $prevline =~ s/ *([.!%<>]) */$1/g; +! $prevline =~ s/ +([;?\$])/$1/g; +! $prevline =~ s/([#\@:]) +/$1/g; + + # non-Sun test mode delimiters -> easily-readable style + # Mark Sausville, MIT Media Laboratory, saus@media-lab.media.mit.edu +! $prevline =~ s/\^V/\$#/; +! $prevline =~ s/\^W/\$@/; +! $prevline =~ s/\^X/\$:/; +! +! #### $#ether$@sun-barr.Ebay.Sun.COM$:site!user@uunet.uu.NET +! @t = split( '\$', $prevline); +! $address = "XXX"; +! $remote = "XXX"; +! $mailer = "XXX"; +! for ($i = 1; $i <= $#t; $i++) +! { +! if (substr($t[$i], 0, 1) eq ":") +! { $address = substr($t[$i], 1,999); } +! if (substr($t[$i], 0, 1) eq "@") +! { $remote = substr($t[$i], 1,999); } +! if (substr($t[$i], 0, 1) eq "#") +! { $mailer = substr($t[$i], 1,999); +! $mailer =~ tr/A-Z/a-z/; } +! } +! printf("%-27.27s --(%-6.6s)--> %s[%s]\n", $input, $mailer, +! $address, $remote); +! if ($mailer ne "XXX") { $themailers{$mailer}.="$input ";} + } + + # Parse output of sendmail name resolution +--- 217,426 ---- + $SIG{'QUIT'} = 'handler'; + + ++ + # glean the mailers used from the rule 0 tests + + sub parseresolve + { + while (<MAIL>) + { +! # now print to the log file +! if ($setlog & 1) { +! print LOG $_; +! } +! if (/^ADDRESS TEST MODE/) { next; } +! if (/^Enter <ruleset>/) { next; } +! if (/^Warning: .cf file is out of date/) { next; } +! +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ( $binver <= 6 ) { +! if (/^>/) # INPUT LINE! (and last output is done) +! { +! chop; +! if ($prevline) { # OUTPUT LINE! +! &printparseresolve; +! } +! s/> *[0-9,]* *//g; +! s/.*input: *//; +! s/ //g; +! s/"//g; +! $input = $_; +! } +! else { chop; } +! $prevline = $_; +! } else { +! # format of /parse output is: +! # Parsing envelope recipient address +! # rewrite: ruleset 3 input: harker @ harker . com +! if ($prevrule eq "Parsing envelope recipient address\n" ) +! { +! chop; +! s/> *[0-9,]* *//g; +! s/.*input: *//; +! s/ //g; +! s/"//g; +! $input = $_; +! $prevrule = $_; +! } +! elsif (/^mailer /) +! { +! $prevrule = $_; + &printparseresolve; +! } +! else +! { +! $prevrule = $_; +! } +! } + } +! #&printparseresolve; + } + + sub printparseresolve { +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ( $binver <= 6 ) { +! if ($input eq "") { return;} +! +! $prevline =~ s/.*returns: *//; +! $prevline =~ s/"//g; +! $prevline =~ s/ //g; +! # Don't strip spaces off error messages +! $prevline =~ s/ *([.!%<>]) */$1/g; +! $prevline =~ s/ +([;?\$])/$1/g; +! $prevline =~ s/([#\@:]) +/$1/g; + + # non-Sun test mode delimiters -> easily-readable style + # Mark Sausville, MIT Media Laboratory, saus@media-lab.media.mit.edu +! $prevline =~ s/\^V/\$#/; +! $prevline =~ s/\^W/\$@/; +! $prevline =~ s/\^X/\$:/; +! +! #### $#ether$@sun-barr.Ebay.Sun.COM$:site!user@uunet.uu.NET +! @t = split( '\$', $prevline); +! $address = "XXX"; +! $remote = "XXX"; +! $mailer = "XXX"; +! for ($i = 1; $i <= $#t; $i++) +! { +! if (substr($t[$i], 0, 1) eq ":") +! { $address = substr($t[$i], 1,999); } +! if (substr($t[$i], 0, 1) eq "@") +! { $remote = substr($t[$i], 1,999); } +! if (substr($t[$i], 0, 1) eq "#") +! { $mailer = substr($t[$i], 1,999); +! $mailer =~ tr/A-Z/a-z/; } +! } +! } else { +! # the binary is at least 8.7 then use result of /parse +! chop; +! s/,//g; +! +! # mailer esmtp, host harker.com., user harker@harker.com +! @t = split( ' ', $_); +! $address = "XXX"; +! $remote = "XXX"; +! $mailer = "XXX"; +! for ($i = 0; $i <= $#t; $i++) +! { +! if ($t[$i] eq "user") +! { $address = $t[++$i]; } +! if ($t[$i] eq "host") +! { $remote = $t[++$i]; } +! if ($t[$i] eq "mailer") +! { $mailer = $t[++$i]; +! $mailer =~ tr/A-Z/a-z/; } +! } +! } +! printf("%-27.27s --(%-6.6s)--> %s[%s]\n", $input, $mailer, +! $address, $remote); +! # now print to the log file +! if ($setlog & 1) { +! printf LOG ("%-27.27s --(%-6.6s)--> %s[%s]\n\n", $input, $mailer, +! $address, $remote); +! } +! +! if ($doaliasing & 1) { +! # If the address resolved to the local mailer, +! # then expand the username as an alias +! if ( $mailer eq "local") +! { +! $setalias = $aliasfound = 0; +! $laddress = $address; +! $sendmailprog = "$sendmail -bv -C$cffile $laddress|"; +! open(LOCAL, $sendmailprog) || +! die "can't exec $sendmailprog...\n"; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "\n$sendmailprog\n"; +! } +! while (<LOCAL>) +! { +! # now print to the log file +! if ($setlog & 1) { +! print LOG $_; +! } +! chop; +! if (/unknown/) +! { +! $aliasfound = 1; +! printf("\t\t aliased to --(error )--> %s\n", $_); +! # now print to the log file +! if ($setlog & 1) { +! printf LOG ("\t\t aliased to --(error )--> %s\n\n", $_); +! } +! next; +! } +! s/,//g; +! @l = split( ' ', $_); +! $aladdress = "XXX"; +! $remote = "XXX"; +! $mailer = "XXX"; +! for ($i = 1; $i <= $#l; $i++) +! { +! # ./sendmail -bv -C./sendmail.cf j.murphy +! # j.murphy@pop.mcit.com... deliverable: mailer mciesmtp, +! # host pop.mcit.com, user j.murphy@pop.mcit.com +! if ($l[$i] eq "user") { $aladdress = $l[++$i]; } +! if ($l[$i] eq "host") { $remote = $l[++$i]; } +! if ($l[$i] eq "mailer") { $mailer = $l[++$i]; } +! } +! if (("$laddress" eq "$aladdress") && ($aliasfound == 0)) { +! $selfalias = 1; +! next; +! } +! printf("\t\t aliased to --(%-6.6s)--> %s[%s]\n", +! $mailer, $aladdress, $remote); +! # now print to the log file +! if ($setlog & 1) { +! printf LOG ("\t\t aliased to --(%-6.6s)--> %s[%s]\n\n", +! $mailer, $aladdress, $remote); +! } +! if ("$laddress" ne "$aladdress") { +! $aliasfound = 1; +! $envsenderaddrs .= " $aladdress"; +! } +! if ($mailer ne "XXX") { $themailers{$mailer}=1;} +! } +! close(LOCAL); +! if ($selfalias == 1 && $aliasfound == 1) { +! printf("\t\t aliased to --(%-6.6s)--> %s[%s]\n", +! $mailer, $aladdress, $remote); +! # now print to the log file +! if ($setlog & 1) { +! printf LOG ("\t\t aliased to --(%-6.6s)--> %s[%s]\n\n", +! $mailer, $aladdress, $remote); +! } +! } +! # now print a blank line to the log file +! if ($setlog & 1) { +! print LOG "\n"; +! } +! } else { +! $envsenderaddrs .= " $address"; +! } +! } +! +! if ($mailer ne "XXX") { $themailers{$mailer}.="$input ";} + } + + # Parse output of sendmail name resolution +*************** +*** 162,202 **** + ## Enter <ruleset> <address> + ## > rewrite: ruleset 3 input: "user" + +! open(MAIL, $_[0]) || die "Can't open $_[0]...\n"; +! local ($k, $address, $prevline, $mailer, $remote, $input); +! print $_[1]; # the title + + $done = 0; +! while (<MAIL>) +! { + if (/^> *$/) { $done = 1; } +! if (/^ADDRESS TEST MODE/) { next; } +! if (/^Enter <ruleset>/) { next; } +! chop; +! if (/^>/) # INPUT LINE! (and last output is done) +! { +! if ($prevline) { # OUTPUT LINE! +! $prevline =~ s/.*returns: *//; +! $prevline =~ s/"//g; +! $prevline =~ s/ //g; + #> rewrite: ruleset 3 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" + #rewrite: ruleset 8 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" + #> +! printf("%-27.27s ----> %s\n", $input, $prevline); +! } +! s/> *[0-9,]* *//g; +! s/.*input: *//; +! s/ //g; +! s/"//g; +! $input = $_; +! } +! last if $done; +! $prevline = $_; +! } + close(MAIL); + } + + + # pass names from resolve files to sendmail + + open(IN, $resolve) || die "can't open $resolve\n"; +--- 431,540 ---- + ## Enter <ruleset> <address> + ## > rewrite: ruleset 3 input: "user" + +! open(MAIL, $_[0]) || die "Can't open $_[0]...\n"; +! local ($k, $address, $prevline, $mailer, $remote, $input); +! print $_[1]; # the title +! # now print to the log file +! if ($setlog & 1) { +! print LOG "\n$_[1]"; # the title +! } + + $done = 0; +! while (<MAIL>) +! { +! # now print to the log file +! if ($setlog & 1) { +! print LOG $_; +! } + if (/^> *$/) { $done = 1; } +! if (/^ADDRESS TEST MODE/) { next; } +! if (/^Enter <ruleset>/) { next; } +! if (/^Warning: .cf file is out of date/) { next; } +! if (/^$/) { next; } +! chop; +! # rewrite $rules to be just a slash if it starts with a / +! $rules =~ s'/.+'/'; +! # if the binary is less than 8.7 then use result of ruleset 4 +! if ( $binver <= 6 || $rules ne "/" ) { +! if (/^>/) # INPUT LINE! (and last output is done) +! { +! if ($prevline) { # OUTPUT LINE! +! $prevline =~ s/.*returns: *//; +! $prevline =~ s/"//g; +! $prevline =~ s/ //g; + #> rewrite: ruleset 3 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" + #rewrite: ruleset 8 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" + #> +! printf("%s%-24.24s ----> %s\n", $rspath, $input, $prevline); +! # now print to the log file +! if ($setlog & 1) { +! printf LOG ("%s%-24.24s ----> %s\n", $rspath, $input, $prevline); +! } +! } +! s/> *[0-9,]* *//g; +! s/.*input: *//; +! s/ //g; +! s/"//g; +! $input = $_; +! } +! last if $done; +! $prevline = $_; +! } else { +! # format of /try output is: +! # Trying envelope recipient address harker for mailer esmtp +! # ... +! # Rcode = 0, addr = harker@mailhub.gadget.com +! # remove extra ">" from "> >" lines +! s/^> >/>/; +! if (/^> Trying/) # INPUT LINE! (and last output is done) +! { +! chop; +! s/> Trying .+ address //; +! s/ for mailer .+//; +! s/ //g; +! s/"//g; +! $input = $_; +! $prevrule = $_; +! } +! elsif (/^Rcode = /) +! { +! $prevrule = $_; +! # Rcode = 0, addr = harker@mailhub.gadget.com +! s/^Rcode = .+ addr = //; +! printf("%s%-24.24s ----> %s\n", $rspath, $input, $_); +! # now print to the log file +! if ($setlog & 1) { +! printf LOG ("%s%-24.24s ----> %s\n\n", $rspath, $input, $_); +! } +! } +! else +! { +! $prevrule = $_; +! } +! } +! } +! # now print to the log file +! if ($setlog & 1) { +! print LOG "\n"; +! } + close(MAIL); + } + + ++ # if the binary is less than 8.7 then use result of ruleset 4 ++ if ( $binver <= 6 ) { ++ print "Mail address resolution (rule 0)\n"; ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "Mail address resolution (rule 0)\n"; ++ } ++ } else { ++ print "Mail address resolution (/parse)\n"; ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "Mail address resolution (/parse)\n"; ++ } ++ } + # pass names from resolve files to sendmail + + open(IN, $resolve) || die "can't open $resolve\n"; +*************** +*** 205,377 **** + { + /^$/ && next; + /^#/ && next; +! print OUT "3,0 $_"; + chop; + $allinput .= " $_"; + } + close(OUT); + close(IN); + $sendmailprog = "$sendmail -bt -C$cffile < /tmp/csm$$|"; + open(MAIL, $sendmailprog) || die "can't exec $sendmailprog...\n"; +- print "Mail address resolution (rule 0)\n\n"; + &parseresolve(); + + # calculate $f + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + open (IN, $resolve); +! $rules = "3,1,4"; + while (<IN>) { +! chop; +! /^$/ && next; +! /^#/ && next; + $address = $_; +! print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); +! &parseaddress ("/tmp/csm$$", "\n\n\$f address header transformations\n\n"); + + # Get the R= and S= special rulesets from the configuration + + open(FID, "grep ^M $cffile|"); + while (<FID>) + { + # Mether, P=[IPC], F=msDFMueCX, S=11, R=21, A=IPC $h + chop; +! $thisline = $_; $thisline =~ s/M//; $thisline =~ s/,.*//; + $thisline =~ tr/A-Z/a-z/; +! $sendrule = $_; $sendrule =~ s/.*S=//; $sendrule =~ s/,.*//; +! if ($sendrule=~q!/!) { +! ($esendrule, $hsendrule) = split (q!/!, $sendrule); +! } +! else { $esendrule = $hsendrule = $sendrule; } +! $recvrule = $_; $recvrule =~ s/.*R=//; $recvrule =~ s/,.*//; +! if ($recvrule=~q!/!) { +! ($erecvrule, $hrecvrule) = split (q!/!, $recvrule); +! } +! else { $erecvrule = $hrecvrule = $recvrule; } + $esendrules{$thisline} = $esendrule; + $hsendrules{$thisline} = $hsendrule; + $erecvrules{$thisline} = $erecvrule; + $hrecvrules{$thisline} = $hrecvrule; + } + close(FID); + +! # pass names from various mailers through sendmail +! + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! if ($erecvrules{$i} == 0) { +! print "\n\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } +- open (OUT, $sendmailprog); + @namelist = split(/ /, $allinput); +- $rules = "3,2,$erecvrules{$i},4"; + foreach (@namelist) { +! print OUT "$rules $_\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(OUT); + $note = ""; + if ($erecvrules{$i} eq $hrecvrules{$i}) { $note = "and header "; } +! &parseaddress ("/tmp/csm$$", "\n\n`To' envelope ${note}address transformations for mailer $i [$rules]:\n\n"); + } + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! if ($hrecvrules{$i} == 0) { +! print "\n\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; +! next; +! } + if ($hrecvrules{$i} ne $erecvrules{$i}) { +! open (OUT, $sendmailprog); +! @namelist = split(/ /, $allinput); +! $rules = "3,2,$hrecvrules{$i},4"; +! foreach (@namelist) { +! print OUT "$rules $_\n"; +! } +! print OUT "\n"; # stuff last line into sendmail +! close(OUT); +! &parseaddress ("/tmp/csm$$", "\n\n`To' header address transformations for mailer $i [$rules]:\n\n"); + } + } + +! # pass names from various mailers through sendmail + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! if ($esendrules{$i} == 0) { +! print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } +- open (OUT, $sendmailprog); +- open (IN, $resolve); +- $rules = "3,1,$esendrules{$i},4"; +- while (<IN>) { +- chop; +- /^$/ && next; +- /^#/ && next; +- $address = $_; +- print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} +! &parseaddress ("/tmp/csm$$", "\n\n`From' envelope ${note}address transformations for mailer $i [$rules]:\n\n"); + } + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +- if ($hsendrules{$i} == 0) { +- print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; +- next; +- } + open (OUT, $sendmailprog); +! open (IN, $resolve); +! $rules = "3,1,$hsendrules{$i},4"; +! while (<IN>) { +! chop; +! /^$/ && next; +! /^#/ && next; +! $address = $_; +! print OUT "$rules $address\n"; + } +- print OUT "\n"; # stuff last line into sendmail +- close(IN); +- close(OUT); +- &parseaddress ("/tmp/csm$$", "\n\n`From' address header transformations for mailer $i [$rules]:\n\n"); + } + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! if ($esendrules{$i} == 0) { +! print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } +- open (OUT, $sendmailprog); + open (IN, $resolve); +- $rules = "3,1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + while (<IN>) { +! chop; +! /^$/ && next; +! /^#/ && next; + $address = $_; +! print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} +! &parseaddress ("/tmp/csm$$", "\n\n\$g address transformations for mailer $i [$rules]:\n\n"); + } + + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); + +--- 543,868 ---- + { + /^$/ && next; + /^#/ && next; +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ( $binver == 5 ) { +! $rules = "0 $_"; +! } elsif ( $binver <= 6 ) { +! $rules = "3,0 $_"; +! } else { +! $rules = "/parse $_"; +! } +! print OUT $rules; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "$rules"; +! } + chop; + $allinput .= " $_"; + } ++ $allinput =~ s/^ //; + close(OUT); + close(IN); + $sendmailprog = "$sendmail -bt -C$cffile < /tmp/csm$$|"; + open(MAIL, $sendmailprog) || die "can't exec $sendmailprog...\n"; + &parseresolve(); + + # calculate $f + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + open (IN, $resolve); +! # sendmail 5 automatically runs ruleset 3 +! if ( $binver == 5 ) { +! $rules = "1,4"; +! } else { +! $rules = "3,1,4"; +! } +! if ($dorspath & 1) { $rspath = "\$f: "; } +! + while (<IN>) { +! chop; +! /^$/ && next; +! /^#/ && next; + $address = $_; +! print OUT "$rules $address\n"; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "$rules $address\n"; +! } + } + print OUT "\n"; # stuff last line into sendmail ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "\n"; # stuff last line into sendmail ++ } + close(IN); + close(OUT); +! &parseaddress ("/tmp/csm$$", "\n\$f address header transformations\n"); + + # Get the R= and S= special rulesets from the configuration ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "\nGet the R= and S= mailer specific rulesets\n"; ++ } + + open(FID, "grep ^M $cffile|"); + while (<FID>) + { + # Mether, P=[IPC], F=msDFMueCX, S=11, R=21, A=IPC $h + chop; +! $thisline = $_; +! $thisline =~ s/M//; +! $thisline =~ s/,.*//; + $thisline =~ tr/A-Z/a-z/; +! $sendrule = $_; +! $sendrule =~ s/.*S=//; +! $sendrule =~ s/,.*//; +! if ($sendrule=~q!/!) { +! ($esendrule, $hsendrule) = split (q!/!, $sendrule); +! } else { +! $esendrule = $hsendrule = $sendrule; +! } +! $recvrule = $_; +! $recvrule =~ s/.*R=//; +! $recvrule =~ s/,.*//; +! if ($recvrule=~q!/!) { +! ($erecvrule, $hrecvrule) = split (q!/!, $recvrule); +! } else { +! $erecvrule = $hrecvrule = $recvrule; +! } + $esendrules{$thisline} = $esendrule; + $hsendrules{$thisline} = $hsendrule; + $erecvrules{$thisline} = $erecvrule; + $hrecvrules{$thisline} = $hrecvrule; ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "mailer: $thisline\t->\tesendrule = $esendrule, hsendrule = $hsendrule, ++ erecvrule = $erecvrule, hrecvrule = $hrecvrule\n"; ++ } ++ } ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "\n"; + } + close(FID); + +! # pass envelope recipient names from various mailers through sendmail + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! open (OUT, $sendmailprog); +! if ($dorspath & 1) { $rspath = "$i ER: "; } +! +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ( $binver <= 6 ) { +! if ($erecvrules{$i} == 0) { +! print "\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; ++ } ++ # sendmail 5 automatically runs ruleset 3 ++ if ( $binver == 5 ) { ++ $rules = "2,$erecvrules{$i},4"; ++ } else { ++ $rules = "3,2,$erecvrules{$i},4"; ++ } ++ } else { ++ print OUT "/tryflags ER\n"; ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "/tryflags ER\n"; ++ } ++ $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { +! print OUT "$rules $_\n"; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "$rules $_\n"; +! } + } + print OUT "\n"; # stuff last line into sendmail ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "\n"; # stuff last line into the log ++ } + close(OUT); + $note = ""; + if ($erecvrules{$i} eq $hrecvrules{$i}) { $note = "and header "; } +! &parseaddress ("/tmp/csm$$", "\n`To' envelope ${note}address transformations for mailer $i [$rules]:\n"); + } ++ ++ # pass header recipient names from various mailers through sendmail + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! open (OUT, $sendmailprog); +! if ($dorspath & 1) { $rspath = "$i HR: "; } +! +! # only run the header ruleset if the mailer uses split env/hdr rulesets + if ($hrecvrules{$i} ne $erecvrules{$i}) { +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ( $binver <= 6 ) { +! if ($hrecvrules{$i} == 0) { +! print "\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; +! next; +! } +! # sendmail 5 automatically runs ruleset 3 +! if ( $binver == 5 ) { +! $rules = "2,$hrecvrules{$i},4"; +! } else { +! $rules = "3,2,$hrecvrules{$i},4"; +! } +! } else { +! print OUT "/tryflags HR\n"; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "/tryflags HR\n"; +! } +! $rules = "/try $i"; +! } +! @namelist = split(/ /, $allinput); +! foreach (@namelist) { +! print OUT "$rules $_\n"; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "$rules $_\n"; +! } +! } +! print OUT "\n"; # stuff last line into sendmail +! # now print to the log file +! if ($setlog & 1) { +! print LOG "\n"; # stuff last line into the log +! } +! close(OUT); +! &parseaddress ("/tmp/csm$$", "\n`To' header address transformations for mailer $i [$rules]:\n"); + } + } + +! # pass envelope sender names from various mailers through sendmail + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! open (OUT, $sendmailprog); +! if ($dorspath & 1) { $rspath = "$i ES: "; } +! +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ( $binver <= 6 ) { +! if ($esendrules{$i} == 0) { +! print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; ++ } ++ # sendmail 5 automatically runs ruleset 3 ++ if ( $binver == 5 ) { ++ $rules = "2,$esendrules{$i},4"; ++ } else { ++ $rules = "3,2,$esendrules{$i},4"; ++ } ++ } else { ++ print OUT "/tryflags ES\n"; ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "/tryflags ES\n"; ++ } ++ $rules = "/try $i"; ++ } ++ @namelist = split(/ /, $allinput); ++ foreach (@namelist) { ++ print OUT "$rules $_\n"; ++ # now print to the log file ++ if ($setlog & 1) { ++ print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} +! &parseaddress ("/tmp/csm$$", "\n`From' envelope ${note}address transformations for mailer $i [$rules]:\n"); + } ++ ++ # pass header sender names from various mailers through sendmail + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); +! if ($dorspath & 1) { $rspath = "$i HS: "; } +! +! # only run the header ruleset if the mailer uses split env/hdr rulesets +! if ($hsendrules{$i} ne $esendrules{$i}) { +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ( $binver <= 6 ) { +! if ($hsendrules{$i} == 0) { +! print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; +! next; +! } +! # sendmail 5 automatically runs ruleset 3 +! if ( $binver == 5 ) { +! $rules = "2,$hsendrules{$i},4"; +! } else { +! $rules = "3,2,$hsendrules{$i},4"; +! } +! } else { +! print OUT "/tryflags HS\n"; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "/tryflags HR\n"; +! } +! $rules = "/try $i"; +! } +! @namelist = split(/ /, $allinput); +! foreach (@namelist) { +! print OUT "$rules $_\n"; +! # now print to the log file +! if ($setlog & 1) { +! print LOG "$rules $_\n"; +! } +! } +! print OUT "\n"; # stuff last line into sendmail +! close(IN); +! close(OUT); +! &parseaddress ("/tmp/csm$$", "\n`From' address header transformations for mailer $i [$rules]:\n"); + } + } ++ + foreach $i (keys %themailers) + { + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; +! open (OUT, $sendmailprog); +! if ($dorspath & 1) { $rspath = "\$g: "; } +! +! # if the binary is 8.9 or below then check if the mailer +! # specific ruleset exists +! if ( $binver <= 9 ) { +! # if the binary is less than 8.7 then use result of ruleset 0 +! if ($esendrules{$i} == 0) { +! print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; ++ } ++ } ++ # sendmail 5 automatically runs ruleset 3 ++ if ( $binver == 5 ) { ++ $rules = "1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? ++ } else { ++ $rules = "3,1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + } + open (IN, $resolve); + while (<IN>) { +! chop; +! /^$/ && next; +! /^#/ && next; + $address = $_; +! print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} +! &parseaddress ("/tmp/csm$$", "\n\$g address transformations for mailer $i [$rules]:\n"); + } + + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); + ++ exit; diff --git a/debian/examples/checksendmail/checksendmail-harker.patch b/debian/examples/checksendmail/checksendmail-harker.patch new file mode 100644 index 0000000..879e188 --- /dev/null +++ b/debian/examples/checksendmail/checksendmail-harker.patch @@ -0,0 +1,22 @@ +diff -c 'harker/checksendmail' 'checksendmail' +Index: ./harker/checksendmail +Prereq: 1.1.1.1 +*** ./harker/checksendmail Mon Apr 14 15:44:43 2003 +--- ./checksendmail Mon Apr 14 15:57:56 2003 +*************** +*** 25,30 **** +--- 25,38 ---- + $resolve = "address.resolve"; + $cffile = "/etc/mail/sendmail.cf"; + ++ # Pre-create tmp files (so can use safely) ++ use Fcntl; ++ foreach ("/tmp/csm$$", "/tmp/csm.in$$") { ++ die "Can't pre-create $_" ++ unless sysopen(T,$_,O_RDWR|O_CREAT|O_EXCL,0600) ++ and close(T); ++ }; ++ + sub usage { + die "Usage: checksendmail [-C cffile.cf] [-b sendmail_binary] [-l log_file]\n\t\t\t\t[-a] [-d] [-r resolve_addrs_file || -T one\@test.addr]\n$errormsg\n"; + } diff --git a/debian/examples/checksendmail/checksendmail.8 b/debian/examples/checksendmail/checksendmail.8 new file mode 100644 index 0000000..229f229 --- /dev/null +++ b/debian/examples/checksendmail/checksendmail.8 @@ -0,0 +1,246 @@ +.\" BSDI $Id: checksendmail.8,v 1.1.1.1 1994/01/13 21:15:31 polk Exp $ +.Dd November 14, 2000 +.Dt CHECKSENDMAIL 8 +.Os +.Sh NAME +.Nm checksendmail +.Nd verify sendmail address transformations. +.Sh SYNOPSIS +.Nm checksendmail +.Op Fl a +.Op Fl d +.Op Fl b +.Op Fl C Ar file.cf +.Op Fl b Ar sendmail_binary +.Op Fl l Ar log_file +.Op Fl r Ar resolve +.Op Fl T Ar test.address + +.Sh DESCRIPTION +.Pp +The +.Nm checksendmail +program is a +.Xr perl +script that aids the testing of +.Xr sendmail 8 's +various configuration files. +.Nm checksendmail +passes typical addresses (supplied in input files) through +.Xr sendmail +and prints the results of the resolution and transformation routines. +.Pp +The input files contain a list of addresses, one per line. +For example: +.Bd -literal -offset indent +user +user@site +user@site.com +.Ed +.Pp +The input file can contain comments started with a +.Em # +and blank lines. +.Sh OPTIONS +.Pp +.Bl -tag -width Fl -compact -offset left +.It Fl a +Show aliasing of local addresses in +mail address resolution phase of testing +.It Fl d +Preceed each address translation line with ruleset sequence summary +.It Fl C Ar file.cf +Use the +.Xr sendmail +configuration file +.Ar file.cf +instead of the default +.Pa /etc/sendmail.cf +file. +.It Fl b Ar sendmail_binary +Use the specified +.Ar sendmail_binary +as the path to invoke sendmail (instead of +.Pa /usr/sbin/sendmail ) . +.It Fl l Ar log_file +Log +.Xr sendmail +address test mode debugging output to +.Ar log_file +.It Fl r Ar resolve +Use +.Ar resolve +as the input file for the addresses to be used for mail resolving. Defaults +to +.Ar address.resolve . +.It Fl T Ar test.address +Use +.Ar test.address +as the single address to test. Cannot be used in conjunction with +file setting flags. +.El +.Sh EXAMPLES +.Pp +The following command will pass the addresses in +.Ar address.resolve +through +.Xr sendmail +using the configuration information in +.Ar myconfig.cf . +.Bd -literal -offset left +example% cat address.resolve +user +user@site +user@site.com + +example% checksendmail \-C myconfig.cf +system: myhost.gadget.com current dir: /tmp/Checksendmail +resolve file: address.resolve +sendmail binary: /usr/sbin/sendmail sendmail version: 8.9.3 +config file: /etc/sendmail.cf config file version: V8/Berkeley + +Mail address resolution +user --(ether )--> user[rmtc] +user@site --(ether )--> user@site[rmtc] +user@site.com --(ether )--> user@site.com[rmtc] + +`To' address transformations for mailer ether: +user ----> user +user@site ----> user@site +user@site.com ----> user@site.com + +`From' address transformations for mailer ether: +user ----> user +user@site ----> user +user@site.com ----> user +.Ed +.Pp +The first section of the output shows how the addresses in the input +files are resolved by +.Xr sendmail 8 . +Consider the following output line: +.Pp +.Dl user@site.com --(ether )--> user@site.com[rmtc] +.Pp +The input address +.Em user@site.com +resolves to use the +.Em ether +mailer. That mailer is directed to send the mail to +to the user +.Em user@site.com +at site +.Em rmtc +(as indicated in the square brackets). +.Pp +The two later sections of output show how the addresses specified as +the +.Em To +and +.Em From +address are transformed in the text of the +headers. In the example above, the +.Em To +addresses are untouched. +The +.Em From +addresses, however, all lose their machine information on +the way through the mailer: +.Pp +.Dl user@site ----> user +.Pp +This may be desirable when using a configuration file on a +workstation which is to be hidden as a mailhost from the rest of the +network. +.Pp +The following is a set of addresses used at one site for the purposes of +testing address resolution. Comments after the addresses detail why +particular addresses are present: +.Bl -tag -width "user@machine.com" -compact -offset indent +.It user +Standard trivial address +.It user@rmtc +qualified at one level +.It user@rmtc.central +qualified at two levels +.It user@rmtc.central.sun.com +qualified all the way +.It rmtc!user +local but specified as uucp +.It user@summit +a workstation (normally delivered locally, though) +.It user@summit.central +same but more qualified +.It user@summit.central.sun.com +same but fully qualified +.It summit!user +same but specified as uucp +.It user@prisma +Backward compatibility tests +.It user@prisma.com +.It prisma!user +.It user@central +Superior domain testing +.It user@machine.central +more qualified, but unknown +.It user@summit.central +more qualified and known +.It user@eng +name in faraway domain +.It user@machine.eng +unknown machine in faraway domain +.It user@summit.eng +local machine, far away domain +.It user@hoback +far away machine +.It user@machine +apparently local but unknown machine +.It user@sun.com +Standard trivial address +.It user@machine.dom.sun.com +fully qualified but unknown machine +.It user@foo.com +standard, known, really far away domain +.It user@foo.dom +standard, unknown, really far away domain +.It site!user +Single level uucp +.It site1!site2!user +Double level uucp +.It user@foo.dom@bar.dom +Trickier address +.It site!user@foo.dom +Mixed uucp/domain +.It site!user@uunet.uu.net +Mixed double uucp/domain +.El +.Sh NOTES +Note that +.Nm checksendmail +is a +.Xr perl +script. If your site does not have +.Xr perl 1 , +it can be obtained via anonymous +.Xr ftp +from +.Em ftp.uu.net . +.Pp +.Xr sendmail +requires that the user have access to directory specified by the +.Em OQ +parameter in the configuration file (normally +.Pa /usr/spool/mqueue ) . +.Nm checksendmail +verifies that the user has access to this directory before allowing the +test to continue. +.Sh AUTHORS +.Bd -literal +Gene Kim +Rob Kolstad +Jeff Polk +.Ed +.Pp +Modified by Robert Harker +.Sh "SEE ALSO" +.Xr sendmail 8 diff --git a/debian/examples/checksendmail/checksendmail.perl b/debian/examples/checksendmail/checksendmail.perl new file mode 100644 index 0000000..a8e9e11 --- /dev/null +++ b/debian/examples/checksendmail/checksendmail.perl @@ -0,0 +1,377 @@ +#!/usr/bin/perl + +# BSDI $Id: checksendmail.perl,v 1.1.1.1 1994/01/13 21:15:31 polk Exp $ + +# checksendmail +# +# The checksendmail program is a perl script that aids the testing +# of sendmail's various configuration filse. checksendmail +# passes typical addresses (supplied in input files) through +# sendmail and prints the result of the resolution and +# transformation routines. +# +# Gene Kim & Rob Kolstad & Jeff Polk, 7/11/90 + +# -- -C config file +# -- -r resolve_addresses_file +# -- -T test one address +# -- -b sendmail binary + +# XXX deficiencies: ``/etc/sendmail'' should be a parameter + +# defaults: + $resolve = "address.resolve"; + $cffile = "/etc/sendmail.cf"; + $sendmail = "/usr/sbin/sendmail"; + +sub usage { + die "Usage: checksendmail [-C cffile.cf] [-r resolve_addrs_file [-T one\@test.addr\n"; +} + +for (unshift (@ARGV, "XX"); $#ARGV > 0; shift ARGV) { + if ($ARGV[1] eq "-C") + { + shift @ARGV; + if ($#ARGV >= 1) {$cffile = $ARGV[1]; } + else { &usage(); } + } + elsif ($ARGV[1] eq "-r") + { + if ($setfile & 1) { die "Can only set `resolve' once"; } + shift @ARGV; + if ($#ARGV < 1) { &usage(); } + $resolve = $ARGV[1]; + $setfile += 1; + } + elsif ($ARGV[1] eq "-T") + { + if ($setfile) { die "Can't set other files and use -T"; } + shift @ARGV; + if ($#ARGV < 1) { &usage(); } + open (OUT, ">/tmp/csm.in$$") || + die "Can't open >/tmp/csm.in$$"; + $resolve = "/tmp/csm.in$$"; + print OUT "$ARGV[1]\n"; + close (OUT); + $setfile = 7; + } + elsif ($ARGV[1] eq "-b") + { + shift @ARGV; + if ($#ARGV >= 1) {$sendmail = $ARGV[1]; } + else { &usage(); } + } + else { &usage(); } +} + +if (!-e $cffile) { die "Can't find configuration file $cffile\n"; } +if (!-e $resolve) { die "Can't find name file $resolve\n"; } + +# make sure the user can access the ../mqueue directory + +$maildir = `grep ^OQ $cffile`; +chop $maildir; +$maildir =~ s/^OQ//; +if ((!-r $maildir) || (!-x $maildir) || (!-w $maildir)) { + warn "checksendmail: can't access $maildir! trying anyway...\n"; +} + +chop($hostname = `hostname`); +chop($pwd = `pwd`); +print "system: $hostname\t\tcurrent dir: $pwd\n"; +print "config file: $cffile\t\tresolve file: $resolve\n"; + +sub handler { # 1st argument is signal name + local($sig) = @_; + print STDERR "Caught a SIG$sig--shutting down\n"; + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); + exit(0); +} + +$SIG{'INT'} = 'handler'; +$SIG{'QUIT'} = 'handler'; + + +# glean the mailers used from the rule 0 tests + +sub parseresolve +{ + while (<MAIL>) + { + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + if (/^>/) # INPUT LINE! (and last output is done) + { + chop; + if ($prevline) { # OUTPUT LINE! + &printparseresolve; + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + else { chop; } + $prevline = $_; + } + &printparseresolve; +} + +sub printparseresolve { + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; + # Don't strip spaces off error messages + $prevline =~ s/ *([.!%<>]) */$1/g; + $prevline =~ s/ +([;?\$])/$1/g; + $prevline =~ s/([#\@:]) +/$1/g; + +# non-Sun test mode delimiters -> easily-readable style +# Mark Sausville, MIT Media Laboratory, saus@media-lab.media.mit.edu + $prevline =~ s/\^V/\$#/; + $prevline =~ s/\^W/\$@/; + $prevline =~ s/\^X/\$:/; + + #### $#ether$@sun-barr.Ebay.Sun.COM$:site!user@uunet.uu.NET + @t = split( '\$', $prevline); + $address = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 1; $i <= $#t; $i++) + { + if (substr($t[$i], 0, 1) eq ":") + { $address = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "@") + { $remote = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "#") + { $mailer = substr($t[$i], 1,999); + $mailer =~ tr/A-Z/a-z/; } + } + printf("%-27.27s --(%-6.6s)--> %s[%s]\n", $input, $mailer, + $address, $remote); + if ($mailer ne "XXX") { $themailers{$mailer}.="$input ";} +} + +# Parse output of sendmail name resolution + +sub parseaddress +{ +## ADDRESS TEST MODE +## Enter <ruleset> <address> +## > rewrite: ruleset 3 input: "user" + + open(MAIL, $_[0]) || die "Can't open $_[0]...\n"; + local ($k, $address, $prevline, $mailer, $remote, $input); + print $_[1]; # the title + + $done = 0; + while (<MAIL>) + { + if (/^> *$/) { $done = 1; } + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + chop; + if (/^>/) # INPUT LINE! (and last output is done) + { + if ($prevline) { # OUTPUT LINE! + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; +#> rewrite: ruleset 3 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#rewrite: ruleset 8 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#> + printf("%-27.27s ----> %s\n", $input, $prevline); + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + last if $done; + $prevline = $_; + } + close(MAIL); +} + + +# pass names from resolve files to sendmail + +open(IN, $resolve) || die "can't open $resolve\n"; +open(OUT, ">/tmp/csm$$") || die "can't open >/tmp/csm$$\n"; +while (<IN>) +{ + /^$/ && next; + /^#/ && next; + print OUT "3,0 $_"; + chop; + $allinput .= " $_"; +} +close(OUT); +close(IN); +$sendmailprog = "$sendmail -bt -C$cffile < /tmp/csm$$|"; +open(MAIL, $sendmailprog) || die "can't exec $sendmailprog...\n"; +print "Mail address resolution (rule 0)\n\n"; +&parseresolve(); + +# calculate $f + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,4"; + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\n\$f address header transformations\n\n"); + +# Get the R= and S= special rulesets from the configuration + +open(FID, "grep ^M $cffile|"); +while (<FID>) +{ +# Mether, P=[IPC], F=msDFMueCX, S=11, R=21, A=IPC $h + chop; + $thisline = $_; $thisline =~ s/M//; $thisline =~ s/,.*//; + $thisline =~ tr/A-Z/a-z/; + $sendrule = $_; $sendrule =~ s/.*S=//; $sendrule =~ s/,.*//; + if ($sendrule=~q!/!) { + ($esendrule, $hsendrule) = split (q!/!, $sendrule); + } + else { $esendrule = $hsendrule = $sendrule; } + $recvrule = $_; $recvrule =~ s/.*R=//; $recvrule =~ s/,.*//; + if ($recvrule=~q!/!) { + ($erecvrule, $hrecvrule) = split (q!/!, $recvrule); + } + else { $erecvrule = $hrecvrule = $recvrule; } + $esendrules{$thisline} = $esendrule; + $hsendrules{$thisline} = $hsendrule; + $erecvrules{$thisline} = $erecvrule; + $hrecvrules{$thisline} = $hrecvrule; +} +close(FID); + +# pass names from various mailers through sendmail + +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($erecvrules{$i} == 0) { + print "\n\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + @namelist = split(/ /, $allinput); + $rules = "3,2,$erecvrules{$i},4"; + foreach (@namelist) { + print OUT "$rules $_\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(OUT); + $note = ""; + if ($erecvrules{$i} eq $hrecvrules{$i}) { $note = "and header "; } + &parseaddress ("/tmp/csm$$", "\n\n`To' envelope ${note}address transformations for mailer $i [$rules]:\n\n"); +} +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($hrecvrules{$i} == 0) { + print "\n\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + if ($hrecvrules{$i} ne $erecvrules{$i}) { + open (OUT, $sendmailprog); + @namelist = split(/ /, $allinput); + $rules = "3,2,$hrecvrules{$i},4"; + foreach (@namelist) { + print OUT "$rules $_\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\n`To' header address transformations for mailer $i [$rules]:\n\n"); + } +} + +# pass names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($esendrules{$i} == 0) { + print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,$esendrules{$i},4"; + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n\n`From' envelope ${note}address transformations for mailer $i [$rules]:\n\n"); +} +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($hsendrules{$i} == 0) { + print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,$hsendrules{$i},4"; + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\n`From' address header transformations for mailer $i [$rules]:\n\n"); +} +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + if ($esendrules{$i} == 0) { + print "\n\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + open (OUT, $sendmailprog); + open (IN, $resolve); + $rules = "3,1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n\n\$g address transformations for mailer $i [$rules]:\n\n"); +} + +unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; +unlink("/tmp/csm.in$$"); + diff --git a/debian/examples/checksendmail/harker/address.resolve b/debian/examples/checksendmail/harker/address.resolve new file mode 100644 index 0000000..2de8a60 --- /dev/null +++ b/debian/examples/checksendmail/harker/address.resolve @@ -0,0 +1,15 @@ +# addresses to be delivered locally +root +postmaster +user +user@mailhub +user@mailhub.gadget.com +user@gadget.com + +# Addresses to be forwarded with SMTP to firewall +user@firewall +user@firewall.gadget.com + +# Addresses to be forwarded with SMTP to harker.com +user@harker.com +harker!user diff --git a/debian/examples/checksendmail/harker/checksendmail b/debian/examples/checksendmail/harker/checksendmail new file mode 100644 index 0000000..6a265bd --- /dev/null +++ b/debian/examples/checksendmail/harker/checksendmail @@ -0,0 +1,860 @@ +#!/usr/bin/perl + +# BSDI $Id: checksendmail.perl,v 1.1.1.1 1994/01/13 21:15:31 polk Exp $ + +# checksendmail +# +# The checksendmail program is a perl script that aids the testing +# of sendmail's various configuration filse. checksendmail +# passes typical addresses (supplied in input files) through +# sendmail and prints the result of the resolution and +# transformation routines. +# +# Gene Kim & Rob Kolstad & Jeff Polk, 7/11/90 +# Modified by Robert Harker, 11/14/00 + +# -- -a show aliasing of local addresses +# -- -d preceed each line with ruleset sequence summary +# -- -C config_file +# -- -b sendmail_binary +# -- -l log_file of results of tests +# -- -r resolve_addresses_file +# -- -T test one address + +# defaults: + $resolve = "address.resolve"; + $cffile = "/etc/mail/sendmail.cf"; + +sub usage { + die "Usage: checksendmail [-C cffile.cf] [-b sendmail_binary] [-l log_file]\n\t\t\t\t[-a] [-d] [-r resolve_addrs_file || -T one\@test.addr]\n$errormsg\n"; +} + +for (unshift (@ARGV, "XX"); $#ARGV > 0; shift ARGV) { + if ($ARGV[1] eq "-C") + { + if ($setcffile & 1) { die "Can only set `cffile.cf' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$cffile = $ARGV[1]; } + else { + $errormsg = "No sendmail.cf file given for -C flag\n"; + &usage(); + } + $setcffile += 1; + } + elsif ($ARGV[1] eq "-r") + { + if ($setfile & 1) { die "Can only set `resolve' once"; } + shift @ARGV; + if ($#ARGV < 1) { + $errormsg = "No resolve_addrs_file given for -r flag\n"; + &usage(); + } + $resolve = $ARGV[1]; + $setfile += 1; + } + elsif ($ARGV[1] eq "-T") + { + if ($setfile) { die "Can't set other files and use -T"; } + shift @ARGV; + if ($#ARGV < 1) { + $errormsg = "No one\@test.addr given for -T flag\n"; + &usage(); + } + open (OUT, ">/tmp/csm.in$$") || + die "Can't open >/tmp/csm.in$$"; + $resolve = "/tmp/csm.in$$"; + print OUT "$ARGV[1]\n"; + close (OUT); + $setfile = 7; + } + elsif ($ARGV[1] eq "-b") + { + if ($setbin & 1) { die "Can only set `sendmail_binary' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$sendmail = $ARGV[1]; } + else { + $errormsg = "No sendmail_binary file given for -b flag\n"; + &usage(); + } + $setbin += 1; + } + elsif ($ARGV[1] eq "-l") + { + if ($setlog & 1) { die "Can only set `log_file' once"; } + shift @ARGV; + if ($#ARGV >= 1) {$logfile = $ARGV[1]; } + else { + $errormsg = "No log_file file given for -l flag\n"; + &usage(); + } + $setlog += 1; + } + elsif ($ARGV[1] eq "-a") + { + $doaliasing += 1; + } + elsif ($ARGV[1] eq "-d") + { + $dorspath += 1; + } + else { &usage(); } +} + +# Figure out where the sendmail binary is +if (! $setbin & 1) { + foreach $i ("/usr/sbin/sendmail", "/usr/libexec/sendmail", "/usr/lib/sendmail") + { + # test if binary exists and is executable + if ((-e $i) && (-x $i)) { + $sendmail = $i; + last; + } + } +} + + +# Figure out the version of sendmail and the location of the sendmail.cf file +# sendmail -d0.10 -bv root +# ("-bv root" is just to give sendmail something to chew on) + +$binversion = `$sendmail -d0.10 -bv root | grep "^Version "`; +chop $binversion; +$binversion =~ s/^Version //; + +# Get the major relase number from the sendmail version +$binver = $binversion; +$binver =~ s/^8\.//; +$binver =~ s/\..+//; + +# if the cf file was not set on the command line, +# find out where the binary looks for it +if ( ! -e $cffile ) { + $cffile = `$sendmail -d0.10 -bv root | grep "Def Conf file:"`; + chop $cffile; + $cffile =~ s/ //g; + $cffile =~ s/ //g; + $cffile =~ s/^DefConffile://; +} + +if (!-e $cffile) { die "Can't find configuration file $cffile\n"; } + +if (!-e $resolve) { die "Can't find name file $resolve\n"; } + +# Figure out the version of the sendmail.cf file +# Look for the V line +$cfversion = `grep "^V" $cffile`; +chop $cfversion; +# if $cfversion is empty, then the configuration is sendmail 5, not sendmail 8 +$cfversion =~ s/^$/V0/; + +# Get the version number from the V line +$cfver = $cfversion; +$cfver =~ s/^V//; +$cfver =~ s'/.+''; + +# check that the binary is a higher version than config file +if ( $binver < $cfver + 1) { + die "$cffile version ($cfversion) is more advanced than $sendmail version ($binversion)\n"; +} + +# figure out where the mqueue directory is +if ( $cfver <= 6 ) { + $maildir = `grep "^OQ" $cffile`; + chop $maildir; + $maildir =~ s/^OQ//; +} else { + $maildir = `grep "^O QueueDirectory" $cffile`; + chop $maildir; + $maildir =~ s/^O QueueDirectory=//; +} + +# make sure the user can access the ../mqueue directory +if ((!-r $maildir) || (!-x $maildir) || (!-w $maildir)) { + if ($doaliasing & 1) { + die "checksendmail: can't access $maildir! can't use checksendmail's -a flag\n"; + } else { + warn "checksendmail: can't access $maildir! trying anyway...\n"; + } +} + +chop($hostname = `hostname`); +chop($pwd = `pwd`); +print "system: $hostname\t\tcurrent dir: $pwd\n"; +print "resolve file: $resolve\n"; +print "sendmail binary: $sendmail\t\tsendmail version: $binversion\n"; +print "config file: $cffile\t\tconfig file version: $cfversion\n\n"; +if ($setlog & 1) { + print "log file: $logfile\n\n"; + # now print to the log file + open (LOG , ">$logfile") || die "Can't open >$logfile"; + print LOG "system: $hostname\t\tcurrent dir: $pwd\n"; + print LOG "resolve file: $resolve\n"; + print LOG "sendmail binary: $sendmail\t\tsendmail version: $binversion\n"; + print LOG "config file: $cffile\t\tconfig file version: $cfversion\n"; + print LOG "log file: $logfile\n\n"; +} + +sub handler { # 1st argument is signal name + local($sig) = @_; + print STDERR "Caught a SIG$sig--shutting down\n"; + unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; + unlink("/tmp/csm.in$$"); + if ($setlog & 1) { + close(LOG); + } + exit(0); +} + +$SIG{'INT'} = 'handler'; +$SIG{'QUIT'} = 'handler'; + + + +# glean the mailers used from the rule 0 tests + +sub parseresolve +{ + while (<MAIL>) + { + # now print to the log file + if ($setlog & 1) { + print LOG $_; + } + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + if (/^Warning: .cf file is out of date/) { next; } + + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if (/^>/) # INPUT LINE! (and last output is done) + { + chop; + if ($prevline) { # OUTPUT LINE! + &printparseresolve; + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + else { chop; } + $prevline = $_; + } else { + # format of /parse output is: + # Parsing envelope recipient address + # rewrite: ruleset 3 input: harker @ harker . com + if ($prevrule eq "Parsing envelope recipient address\n" ) + { + chop; + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + $prevrule = $_; + } + elsif (/^mailer /) + { + $prevrule = $_; + &printparseresolve; + } + else + { + $prevrule = $_; + } + } + } + #&printparseresolve; +} + +sub printparseresolve { + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($input eq "") { return;} + + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; + # Don't strip spaces off error messages + $prevline =~ s/ *([.!%<>]) */$1/g; + $prevline =~ s/ +([;?\$])/$1/g; + $prevline =~ s/([#\@:]) +/$1/g; + +# non-Sun test mode delimiters -> easily-readable style +# Mark Sausville, MIT Media Laboratory, saus@media-lab.media.mit.edu + $prevline =~ s/\^V/\$#/; + $prevline =~ s/\^W/\$@/; + $prevline =~ s/\^X/\$:/; + + #### $#ether$@sun-barr.Ebay.Sun.COM$:site!user@uunet.uu.NET + @t = split( '\$', $prevline); + $address = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 1; $i <= $#t; $i++) + { + if (substr($t[$i], 0, 1) eq ":") + { $address = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "@") + { $remote = substr($t[$i], 1,999); } + if (substr($t[$i], 0, 1) eq "#") + { $mailer = substr($t[$i], 1,999); + $mailer =~ tr/A-Z/a-z/; } + } + } else { + # the binary is at least 8.7 then use result of /parse + chop; + s/,//g; + + # mailer esmtp, host harker.com., user harker@harker.com + @t = split( ' ', $_); + $address = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 0; $i <= $#t; $i++) + { + if ($t[$i] eq "user") + { $address = $t[++$i]; } + if ($t[$i] eq "host") + { $remote = $t[++$i]; } + if ($t[$i] eq "mailer") + { $mailer = $t[++$i]; + $mailer =~ tr/A-Z/a-z/; } + } + } + printf("%-27.27s --(%-6.6s)--> %s[%s]\n", $input, $mailer, + $address, $remote); + # now print to the log file + if ($setlog & 1) { + printf LOG ("%-27.27s --(%-6.6s)--> %s[%s]\n\n", $input, $mailer, + $address, $remote); + } + + if ($doaliasing & 1) { + # If the address resolved to the local mailer, + # then expand the username as an alias + if ( $mailer eq "local") + { + $setalias = $aliasfound = 0; + $laddress = $address; + $sendmailprog = "$sendmail -bv -C$cffile $laddress|"; + open(LOCAL, $sendmailprog) || + die "can't exec $sendmailprog...\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "\n$sendmailprog\n"; + } + while (<LOCAL>) + { + # now print to the log file + if ($setlog & 1) { + print LOG $_; + } + chop; + if (/unknown/) + { + $aliasfound = 1; + printf("\t\t aliased to --(error )--> %s\n", $_); + # now print to the log file + if ($setlog & 1) { + printf LOG ("\t\t aliased to --(error )--> %s\n\n", $_); + } + next; + } + s/,//g; + @l = split( ' ', $_); + $aladdress = "XXX"; + $remote = "XXX"; + $mailer = "XXX"; + for ($i = 1; $i <= $#l; $i++) + { + # ./sendmail -bv -C./sendmail.cf j.murphy + # j.murphy@pop.mcit.com... deliverable: mailer mciesmtp, + # host pop.mcit.com, user j.murphy@pop.mcit.com + if ($l[$i] eq "user") { $aladdress = $l[++$i]; } + if ($l[$i] eq "host") { $remote = $l[++$i]; } + if ($l[$i] eq "mailer") { $mailer = $l[++$i]; } + } + if (("$laddress" eq "$aladdress") && ($aliasfound == 0)) { + $selfalias = 1; + next; + } + printf("\t\t aliased to --(%-6.6s)--> %s[%s]\n", + $mailer, $aladdress, $remote); + # now print to the log file + if ($setlog & 1) { + printf LOG ("\t\t aliased to --(%-6.6s)--> %s[%s]\n\n", + $mailer, $aladdress, $remote); + } + if ("$laddress" ne "$aladdress") { + $aliasfound = 1; + $envsenderaddrs .= " $aladdress"; + } + if ($mailer ne "XXX") { $themailers{$mailer}=1;} + } + close(LOCAL); + if ($selfalias == 1 && $aliasfound == 1) { + printf("\t\t aliased to --(%-6.6s)--> %s[%s]\n", + $mailer, $aladdress, $remote); + # now print to the log file + if ($setlog & 1) { + printf LOG ("\t\t aliased to --(%-6.6s)--> %s[%s]\n\n", + $mailer, $aladdress, $remote); + } + } + # now print a blank line to the log file + if ($setlog & 1) { + print LOG "\n"; + } + } else { + $envsenderaddrs .= " $address"; + } + } + + if ($mailer ne "XXX") { $themailers{$mailer}.="$input ";} +} + +# Parse output of sendmail name resolution + +sub parseaddress +{ +## ADDRESS TEST MODE +## Enter <ruleset> <address> +## > rewrite: ruleset 3 input: "user" + + open(MAIL, $_[0]) || die "Can't open $_[0]...\n"; + local ($k, $address, $prevline, $mailer, $remote, $input); + print $_[1]; # the title + # now print to the log file + if ($setlog & 1) { + print LOG "\n$_[1]"; # the title + } + + $done = 0; + while (<MAIL>) + { + # now print to the log file + if ($setlog & 1) { + print LOG $_; + } + if (/^> *$/) { $done = 1; } + if (/^ADDRESS TEST MODE/) { next; } + if (/^Enter <ruleset>/) { next; } + if (/^Warning: .cf file is out of date/) { next; } + if (/^$/) { next; } + chop; + # rewrite $rules to be just a slash if it starts with a / + $rules =~ s'/.+'/'; + # if the binary is less than 8.7 then use result of ruleset 4 + if ( $binver <= 6 || $rules ne "/" ) { + if (/^>/) # INPUT LINE! (and last output is done) + { + if ($prevline) { # OUTPUT LINE! + $prevline =~ s/.*returns: *//; + $prevline =~ s/"//g; + $prevline =~ s/ //g; +#> rewrite: ruleset 3 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#rewrite: ruleset 8 input: "site" "!" "user" "@" "uunet" "." "uu" "." "net" +#> + printf("%s%-24.24s ----> %s\n", $rspath, $input, $prevline); + # now print to the log file + if ($setlog & 1) { + printf LOG ("%s%-24.24s ----> %s\n", $rspath, $input, $prevline); + } + } + s/> *[0-9,]* *//g; + s/.*input: *//; + s/ //g; + s/"//g; + $input = $_; + } + last if $done; + $prevline = $_; + } else { + # format of /try output is: + # Trying envelope recipient address harker for mailer esmtp + # ... + # Rcode = 0, addr = harker@mailhub.gadget.com + # remove extra ">" from "> >" lines + s/^> >/>/; + if (/^> Trying/) # INPUT LINE! (and last output is done) + { + chop; + s/> Trying .+ address //; + s/ for mailer .+//; + s/ //g; + s/"//g; + $input = $_; + $prevrule = $_; + } + elsif (/^Rcode = /) + { + $prevrule = $_; + # Rcode = 0, addr = harker@mailhub.gadget.com + s/^Rcode = .+ addr = //; + printf("%s%-24.24s ----> %s\n", $rspath, $input, $_); + # now print to the log file + if ($setlog & 1) { + printf LOG ("%s%-24.24s ----> %s\n\n", $rspath, $input, $_); + } + } + else + { + $prevrule = $_; + } + } + } + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; + } + close(MAIL); +} + + +# if the binary is less than 8.7 then use result of ruleset 4 +if ( $binver <= 6 ) { + print "Mail address resolution (rule 0)\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "Mail address resolution (rule 0)\n"; + } +} else { + print "Mail address resolution (/parse)\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "Mail address resolution (/parse)\n"; + } +} +# pass names from resolve files to sendmail + +open(IN, $resolve) || die "can't open $resolve\n"; +open(OUT, ">/tmp/csm$$") || die "can't open >/tmp/csm$$\n"; +while (<IN>) +{ + /^$/ && next; + /^#/ && next; + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver == 5 ) { + $rules = "0 $_"; + } elsif ( $binver <= 6 ) { + $rules = "3,0 $_"; + } else { + $rules = "/parse $_"; + } + print OUT $rules; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules"; + } + chop; + $allinput .= " $_"; +} + $allinput =~ s/^ //; +close(OUT); +close(IN); +$sendmailprog = "$sendmail -bt -C$cffile < /tmp/csm$$|"; +open(MAIL, $sendmailprog) || die "can't exec $sendmailprog...\n"; +&parseresolve(); + +# calculate $f + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + open (IN, $resolve); + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "1,4"; + } else { + $rules = "3,1,4"; + } + if ($dorspath & 1) { $rspath = "\$f: "; } + + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $address\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; # stuff last line into sendmail + } + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n\$f address header transformations\n"); + +# Get the R= and S= special rulesets from the configuration +# now print to the log file +if ($setlog & 1) { + print LOG "\nGet the R= and S= mailer specific rulesets\n"; +} + +open(FID, "grep ^M $cffile|"); +while (<FID>) +{ +# Mether, P=[IPC], F=msDFMueCX, S=11, R=21, A=IPC $h + chop; + $thisline = $_; + $thisline =~ s/M//; + $thisline =~ s/,.*//; + $thisline =~ tr/A-Z/a-z/; + $sendrule = $_; + $sendrule =~ s/.*S=//; + $sendrule =~ s/,.*//; + if ($sendrule=~q!/!) { + ($esendrule, $hsendrule) = split (q!/!, $sendrule); + } else { + $esendrule = $hsendrule = $sendrule; + } + $recvrule = $_; + $recvrule =~ s/.*R=//; + $recvrule =~ s/,.*//; + if ($recvrule=~q!/!) { + ($erecvrule, $hrecvrule) = split (q!/!, $recvrule); + } else { + $erecvrule = $hrecvrule = $recvrule; + } + $esendrules{$thisline} = $esendrule; + $hsendrules{$thisline} = $hsendrule; + $erecvrules{$thisline} = $erecvrule; + $hrecvrules{$thisline} = $hrecvrule; + # now print to the log file + if ($setlog & 1) { + print LOG "mailer: $thisline\t->\tesendrule = $esendrule, hsendrule = $hsendrule, + erecvrule = $erecvrule, hrecvrule = $hrecvrule\n"; + } +} +# now print to the log file +if ($setlog & 1) { + print LOG "\n"; +} +close(FID); + +# pass envelope recipient names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i ER: "; } + + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($erecvrules{$i} == 0) { + print "\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$erecvrules{$i},4"; + } else { + $rules = "3,2,$erecvrules{$i},4"; + } + } else { + print OUT "/tryflags ER\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags ER\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; # stuff last line into the log + } + close(OUT); + $note = ""; + if ($erecvrules{$i} eq $hrecvrules{$i}) { $note = "and header "; } + &parseaddress ("/tmp/csm$$", "\n`To' envelope ${note}address transformations for mailer $i [$rules]:\n"); +} + +# pass header recipient names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i HR: "; } + + # only run the header ruleset if the mailer uses split env/hdr rulesets + if ($hrecvrules{$i} ne $erecvrules{$i}) { + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($hrecvrules{$i} == 0) { + print "\nCan't find recv rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$hrecvrules{$i},4"; + } else { + $rules = "3,2,$hrecvrules{$i},4"; + } + } else { + print OUT "/tryflags HR\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags HR\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + # now print to the log file + if ($setlog & 1) { + print LOG "\n"; # stuff last line into the log + } + close(OUT); + &parseaddress ("/tmp/csm$$", "\n`To' header address transformations for mailer $i [$rules]:\n"); + } +} + +# pass envelope sender names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i ES: "; } + + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($esendrules{$i} == 0) { + print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$esendrules{$i},4"; + } else { + $rules = "3,2,$esendrules{$i},4"; + } + } else { + print OUT "/tryflags ES\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags ES\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n`From' envelope ${note}address transformations for mailer $i [$rules]:\n"); +} + +# pass header sender names from various mailers through sendmail +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "$i HS: "; } + + # only run the header ruleset if the mailer uses split env/hdr rulesets + if ($hsendrules{$i} ne $esendrules{$i}) { + # if the binary is less than 8.7 then use result of ruleset 0 + if ( $binver <= 6 ) { + if ($hsendrules{$i} == 0) { + print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "2,$hsendrules{$i},4"; + } else { + $rules = "3,2,$hsendrules{$i},4"; + } + } else { + print OUT "/tryflags HS\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "/tryflags HR\n"; + } + $rules = "/try $i"; + } + @namelist = split(/ /, $allinput); + foreach (@namelist) { + print OUT "$rules $_\n"; + # now print to the log file + if ($setlog & 1) { + print LOG "$rules $_\n"; + } + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + &parseaddress ("/tmp/csm$$", "\n`From' address header transformations for mailer $i [$rules]:\n"); + } +} + +foreach $i (keys %themailers) +{ + $sendmailprog = "|$sendmail -bt -C$cffile > /tmp/csm$$"; + open (OUT, $sendmailprog); + if ($dorspath & 1) { $rspath = "\$g: "; } + + # if the binary is 8.9 or below then check if the mailer + # specific ruleset exists + if ( $binver <= 9 ) { + # if the binary is less than 8.7 then use result of ruleset 0 + if ($esendrules{$i} == 0) { + print "\nCan't find send rule for `$i', skipping this mailer <-------------------\n"; + next; + } + } + # sendmail 5 automatically runs ruleset 3 + if ( $binver == 5 ) { + $rules = "1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + } else { + $rules = "3,1,4,3,1,$hsendrules{$i},4"; # XXX esendrules? book p. 431??? + } + open (IN, $resolve); + while (<IN>) { + chop; + /^$/ && next; + /^#/ && next; + $address = $_; + print OUT "$rules $address\n"; + } + print OUT "\n"; # stuff last line into sendmail + close(IN); + close(OUT); + $note = ""; + if ($esendrules{$i} eq $hsendrles{$i}) {$note = "and header ";} + &parseaddress ("/tmp/csm$$", "\n\$g address transformations for mailer $i [$rules]:\n"); +} + +unlink("/tmp/csm$$") || die "Can't unlink /tmp/csm$$"; +unlink("/tmp/csm.in$$"); + +exit; diff --git a/debian/examples/checksendmail/harker/checksendmail.8 b/debian/examples/checksendmail/harker/checksendmail.8 new file mode 100644 index 0000000..229f229 --- /dev/null +++ b/debian/examples/checksendmail/harker/checksendmail.8 @@ -0,0 +1,246 @@ +.\" BSDI $Id: checksendmail.8,v 1.1.1.1 1994/01/13 21:15:31 polk Exp $ +.Dd November 14, 2000 +.Dt CHECKSENDMAIL 8 +.Os +.Sh NAME +.Nm checksendmail +.Nd verify sendmail address transformations. +.Sh SYNOPSIS +.Nm checksendmail +.Op Fl a +.Op Fl d +.Op Fl b +.Op Fl C Ar file.cf +.Op Fl b Ar sendmail_binary +.Op Fl l Ar log_file +.Op Fl r Ar resolve +.Op Fl T Ar test.address + +.Sh DESCRIPTION +.Pp +The +.Nm checksendmail +program is a +.Xr perl +script that aids the testing of +.Xr sendmail 8 's +various configuration files. +.Nm checksendmail +passes typical addresses (supplied in input files) through +.Xr sendmail +and prints the results of the resolution and transformation routines. +.Pp +The input files contain a list of addresses, one per line. +For example: +.Bd -literal -offset indent +user +user@site +user@site.com +.Ed +.Pp +The input file can contain comments started with a +.Em # +and blank lines. +.Sh OPTIONS +.Pp +.Bl -tag -width Fl -compact -offset left +.It Fl a +Show aliasing of local addresses in +mail address resolution phase of testing +.It Fl d +Preceed each address translation line with ruleset sequence summary +.It Fl C Ar file.cf +Use the +.Xr sendmail +configuration file +.Ar file.cf +instead of the default +.Pa /etc/sendmail.cf +file. +.It Fl b Ar sendmail_binary +Use the specified +.Ar sendmail_binary +as the path to invoke sendmail (instead of +.Pa /usr/sbin/sendmail ) . +.It Fl l Ar log_file +Log +.Xr sendmail +address test mode debugging output to +.Ar log_file +.It Fl r Ar resolve +Use +.Ar resolve +as the input file for the addresses to be used for mail resolving. Defaults +to +.Ar address.resolve . +.It Fl T Ar test.address +Use +.Ar test.address +as the single address to test. Cannot be used in conjunction with +file setting flags. +.El +.Sh EXAMPLES +.Pp +The following command will pass the addresses in +.Ar address.resolve +through +.Xr sendmail +using the configuration information in +.Ar myconfig.cf . +.Bd -literal -offset left +example% cat address.resolve +user +user@site +user@site.com + +example% checksendmail \-C myconfig.cf +system: myhost.gadget.com current dir: /tmp/Checksendmail +resolve file: address.resolve +sendmail binary: /usr/sbin/sendmail sendmail version: 8.9.3 +config file: /etc/sendmail.cf config file version: V8/Berkeley + +Mail address resolution +user --(ether )--> user[rmtc] +user@site --(ether )--> user@site[rmtc] +user@site.com --(ether )--> user@site.com[rmtc] + +`To' address transformations for mailer ether: +user ----> user +user@site ----> user@site +user@site.com ----> user@site.com + +`From' address transformations for mailer ether: +user ----> user +user@site ----> user +user@site.com ----> user +.Ed +.Pp +The first section of the output shows how the addresses in the input +files are resolved by +.Xr sendmail 8 . +Consider the following output line: +.Pp +.Dl user@site.com --(ether )--> user@site.com[rmtc] +.Pp +The input address +.Em user@site.com +resolves to use the +.Em ether +mailer. That mailer is directed to send the mail to +to the user +.Em user@site.com +at site +.Em rmtc +(as indicated in the square brackets). +.Pp +The two later sections of output show how the addresses specified as +the +.Em To +and +.Em From +address are transformed in the text of the +headers. In the example above, the +.Em To +addresses are untouched. +The +.Em From +addresses, however, all lose their machine information on +the way through the mailer: +.Pp +.Dl user@site ----> user +.Pp +This may be desirable when using a configuration file on a +workstation which is to be hidden as a mailhost from the rest of the +network. +.Pp +The following is a set of addresses used at one site for the purposes of +testing address resolution. Comments after the addresses detail why +particular addresses are present: +.Bl -tag -width "user@machine.com" -compact -offset indent +.It user +Standard trivial address +.It user@rmtc +qualified at one level +.It user@rmtc.central +qualified at two levels +.It user@rmtc.central.sun.com +qualified all the way +.It rmtc!user +local but specified as uucp +.It user@summit +a workstation (normally delivered locally, though) +.It user@summit.central +same but more qualified +.It user@summit.central.sun.com +same but fully qualified +.It summit!user +same but specified as uucp +.It user@prisma +Backward compatibility tests +.It user@prisma.com +.It prisma!user +.It user@central +Superior domain testing +.It user@machine.central +more qualified, but unknown +.It user@summit.central +more qualified and known +.It user@eng +name in faraway domain +.It user@machine.eng +unknown machine in faraway domain +.It user@summit.eng +local machine, far away domain +.It user@hoback +far away machine +.It user@machine +apparently local but unknown machine +.It user@sun.com +Standard trivial address +.It user@machine.dom.sun.com +fully qualified but unknown machine +.It user@foo.com +standard, known, really far away domain +.It user@foo.dom +standard, unknown, really far away domain +.It site!user +Single level uucp +.It site1!site2!user +Double level uucp +.It user@foo.dom@bar.dom +Trickier address +.It site!user@foo.dom +Mixed uucp/domain +.It site!user@uunet.uu.net +Mixed double uucp/domain +.El +.Sh NOTES +Note that +.Nm checksendmail +is a +.Xr perl +script. If your site does not have +.Xr perl 1 , +it can be obtained via anonymous +.Xr ftp +from +.Em ftp.uu.net . +.Pp +.Xr sendmail +requires that the user have access to directory specified by the +.Em OQ +parameter in the configuration file (normally +.Pa /usr/spool/mqueue ) . +.Nm checksendmail +verifies that the user has access to this directory before allowing the +test to continue. +.Sh AUTHORS +.Bd -literal +Gene Kim +Rob Kolstad +Jeff Polk +.Ed +.Pp +Modified by Robert Harker +.Sh "SEE ALSO" +.Xr sendmail 8 diff --git a/debian/examples/db/access b/debian/examples/db/access index 9eea701..8bfab0b 100644 --- a/debian/examples/db/access +++ b/debian/examples/db/access @@ -1,88 +1,162 @@ # /etc/mail/access -# Copyright (c) 1998, Richard Nelson <cowboy@debian.org>. +# Copyright (c) 1998,2004 Richard Nelson <cowboy@debian.org>. # Time-stamp: <1998/10/27 10:00:00 cowboy> # GPL'd config file, please feed any gripes, suggestions, etc. to me # # Function: -# Access Control for this smtp server - determines: -# * Who we accept mail from -# * Who we accept relaying from -# * Who we will not send to +# Access Control for this smtp server - determines: +# * Who we accept mail from +# * Who we accept relaying from +# * Who we will not send to # # Usage: -# FEATURE(access_db[, type [-o] /etc/mail/access])dnl -# makemap hash access < access +# FEATURE(access_db[, type [-o] /etc/mail/access])dnl +# makemap hash access < access # # Format: -# lhs: -# email addr <user@[host.domain]> -# domain name unless FEATURE(relay_hosts_only) is used, +# lhs: +# email addr <user@[host.domain]> +# domain name unless FEATURE(relay_hosts_only) is used, # then this is a fqdn - and relay-domains ($=R) # must also be fqdns. -# network number must end on an octet boundary, or +# network number must end on an octet boundary, or # you're stuck going the longwinded way ;-{ -# rhs: -# OK accept mail even if other rules in the -# running ruleset would reject it. -# RELAY Allow domain to relay through your SMTP -# server. RELAY also serves an implicit -# OK for the other checks. -# REJECT reject the sender/recipient with a general -# purpose message that can be customized. -# confREJECT_MSG [550 Access denied] will be issued -# DISCARD discard the message completely using -# the $#discard mailer. -# ### any text where ### is an RFC 821 compliant error code -# and "any text" is a message to return for +# rhs: +# OK accept mail even if other rules in the +# running ruleset would reject it. +# RELAY Allow domain to relay through your SMTP +# server. RELAY also serves an implicit +# OK for the other checks. +# REJECT reject the sender/recipient with a general +# purpose message that can be customized. +# confREJECT_MSG [550 Access denied] will be issued +# DISCARD discard the message completely using +# the $#discard mailer. +# ### any text where ### is an RFC 821 compliant error code +# and "any text" is a message to return for # the command # Examples: -# spammer@aol.com REJECT -# FREE.STEALTH.MAILER@ 550 Spam not accepted +# spammer@aol.com REJECT +# FREE.STEALTH.MAILER@ 550 Spam not accepted # # Notes: -# With FEATURE(blacklist_recipients) this is also possible: -# badlocaluser 550 Mailbox disabled for this username -# host.mydomain.com 550 That host does not accept mail -# user@otherhost.mydomain.com 550 Mailbox disabled for this recipient +# With FEATURE(blacklist_recipients) this is also possible: +# badlocaluser 550 Mailbox disabled for this username +# host.mydomain.com 550 That host does not accept mail +# user@otherhost.mydomain.com 550 Mailbox disabled for this recipient # # Related: -# define(`confREJECT_MSG', `550 Access denied')dnl -# define(`confCR_FILE', `-o /etc/mail/relay-domains')dnl <<- $=R -# FEATURE(relay_hosts_only)dnl -# FEATURE(relay_entire_domain)dnl <<- relays any host in the $=m class -# FEATURE(relay_based_on_MX)dnl <<- relaying for boxes MX'd to you -# FEATURE(blacklist_recipients)dnl -# FEATURE(rbl[,alternate server])dnl -# FEATURE(orbs[,alternate server])dnl <<- Debian addition -# FEATURE(orca[,alternate server])dnl <<- Debian addition -# FEATURE(accept_unqualified_senders)dnl -# FEATURE(accept_unresolvable_domains)dnl +# define(`confREJECT_MSG', `550 Access denied')dnl +# define(`confCR_FILE', `-o /etc/mail/relay-domains')dnl <<- $=R +# FEATURE(relay_hosts_only)dnl +# FEATURE(relay_entire_domain)dnl <<- relays any host in the $=m class +# FEATURE(relay_based_on_MX)dnl <<- relaying for boxes MX'd to you +# FEATURE(blacklist_recipients)dnl +# FEATURE(rbl[,alternate server])dnl +# FEATURE(orbs[,alternate server])dnl <<- Debian addition +# FEATURE(orca[,alternate server])dnl <<- Debian addition +# FEATURE(accept_unqualified_senders)dnl +# FEATURE(accept_unresolvable_domains)dnl # # Local addresses 10.x.x.x, 127.x.x.x, 172.16-31.x.x 192.168.x.x can relay # Note Well! You *must* make sure these address can't be spoofed externally -10 RELAY -127 RELAY -172.16 RELAY -172.17 RELAY -172.18 RELAY -172.19 RELAY -172.20 RELAY -172.21 RELAY -172.22 RELAY -172.23 RELAY -172.24 RELAY -172.25 RELAY -172.26 RELAY -172.27 RELAY -172.28 RELAY -172.29 RELAY -172.30 RELAY -172.31 RELAY -192.168 RELAY -# -# Hosts that are allowed to talk to me +# Note, outbound relaying is controlled by connection and/or auth +# If you're not firewalled, and you don't have a lan, comment these out +# If you're not firewalled, and you have a lan, get firewalled *NOW* +# GreetPause - delay to check for spammers +# Client Connection rate (and #) control +Connect:localhost RELAY +GreetPause:localhost 0 +ClientRate:localhost 0 +ClientConn:localhost 0 +#Connect:10 RELAY +#GreetPause:10 0 +#ClientRate:10 0 +#ClientConn:10 0 +Connect:127 RELAY +GreetPause:127 0 +ClientRate:127 0 +ClientConn:127 0 +Connect:[IPv6:::1] RELAY +GreetPause:[IPv6:::1] 0 +ClientRate:[IPv6:::1] 0 +ClientConn:[IPv6:::1] 0 +#Connect:172.16 RELAY +#Connect:172.17 RELAY +#Connect:172.18 RELAY +#Connect:172.19 RELAY +#Connect:172.20 RELAY +#Connect:172.21 RELAY +#Connect:172.22 RELAY +#Connect:172.23 RELAY +#Connect:172.24 RELAY +#Connect:172.25 RELAY +#Connect:172.26 RELAY +#Connect:172.27 RELAY +#Connect:172.28 RELAY +#Connect:172.29 RELAY +#Connect:172.30 RELAY +#Connect:172.31 RELAY +#Connect:192.168 RELAY +#GreetPause:192.168 0 +#ClientRate:192.168 0 +#ClientConn:192.168 0 +# Defaults +GreetPause: 5000 +ClientRate: 10 +ClientConn: 10 # +# Don't offer AUTH on local network +#SRV_Features:192.168.1 A +# +# Hosts with to allow relaying +# +# +# Hosts that validly forward to me +#GreetPause:<ip> 0 +#ClientRate:<ip> 30 +#ClientConn:<ip> 0 +# +# Whitelisted users +# +Spam:postmaster@ FRIEND +Spam:abuse@ FRIEND +Spam:spam@ FRIEND # # Blacklisted users # -reject@ REJECT +#Connect:rampellsoft.com 554 Email directly, not through didtheyreadit.com +reject@ REJECT +#cyberpromo.com REJECT +#From:MAILER-DAEMON@store2.netvisao.pt REJECT +# +# Block invalid IPs +# +Connect:0 REJECT +Connect:2 REJECT +Connect:5 REJECT +Connect:7 REJECT +Connect:8 REJECT +Connect:23 REJECT +Connect:27 REJECT +Connect:31 REJECT +Connect:36 REJECT +Connect:37 REJECT +Connect:39 REJECT +Connect:41 REJECT +Connect:42 REJECT +Connect:50 REJECT +Connect:71 REJECT +Connect:72 REJECT +Connect:73 REJECT +Connect:74 REJECT +Connect:75 REJECT +Connect:76 REJECT +Connect:77 REJECT +Connect:78 REJECT +Connect:79 REJECT +Connect:169.254 REJECT +Connect:192.0.2 REJECT +Connect:197 REJECT +Connect:224 REJECT +Connect:255 REJECT diff --git a/debian/examples/db/relay-domains b/debian/examples/db/relay-domains index 393f65d..c16b9de 100644 --- a/debian/examples/db/relay-domains +++ b/debian/examples/db/relay-domains @@ -8,6 +8,7 @@ # # Usage: # define(`confCR_FILE', `[-o ]/etc/mail/relay-domains')dnl +# RELAY_DOMAIN_FILE(`/etc/mail/relay-domains %[^\#]')dnl # # Format: # lhs: diff --git a/debian/examples/db/userdb b/debian/examples/db/userdb new file mode 100644 index 0000000..9d4d915 --- /dev/null +++ b/debian/examples/db/userdb @@ -0,0 +1,10 @@ +#User names and the inbound(maildrop)/outbound(mailname) addresses +#dest machine/domain names must also be in sendmail.cG for masquerading +# NOTE: do NOT use FEATURE(stickyhost) with userdb +# NOTE: be carefull with local delivery, defeats plussed users +# +# NOTE: Combined with virtusertable and/or aliases, Genericstable +# can do everything the userdb can and more (and the difference +# is growing bigger). The userdb is basically obsolete. +#:default:mailname badlands.org +#cowboy:mailname cowboy@vnet.ibm.com diff --git a/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.1.old b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.1.old new file mode 100644 index 0000000..ba6b98c --- /dev/null +++ b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.1.old @@ -0,0 +1,158 @@ +#!/bin/sh +# +# This script is called when dhcp connects to the network. +# +# Here is where we'll start sendmail if needed, and will +# run the queue in either case. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# NOTE: The dhcp DNS name is used as the peer name in /etc/mail/peers. +# +# Exit by default, check for validity before commenting out the next line: +exit 0; + +provider_m4='/etc/mail/provider.m4'; +#provider_m4='provider.m4'; +dialup_m4='/etc/mail/dialup.m4'; +#dialup_m4='dialup.m4'; + +update_sendmail() { + # Build a new sendmail.cf from sendmail.mc, including our address. + m4 /etc/mail/sendmail.mc \ + > /etc/mail/sendmail.cf.pnew; + chmod 0644 /etc/mail/sendmail.cf.pnew; + chown mail:mail /etc/mail/sendmail.cf.pnew; + mv -f /etc/mail/sendmail.cf.pnew /etc/mail/sendmail.cf; + + # Purge any latent host status that might cause us to *NOT* send mail + AM='-Am'; + if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then + AM=''; + fi; + sendmail $AM -bH -O Timeout.hoststatus=1s; + + # Start/reload sendmail as needed + /etc/init.d/sendmail reload; # may be up, or down + + # Process the sendmail queue + # (background so as to not defer other ip-up work) + runq & + }; + +update_provider() { + # Add smarthost information (if any)... + # But not if provider.m4 is a link ! + local domain; + domain="$1"; + if [ -f /etc/mail/peers/$domain -a ! -L $provider_m4 ]; then + cat <<-EOT > $provider_m4; + LOCAL_CONFIG + #------------------------------------------------------------ + # + # Dynamic provider updates from $0 + # + # NOTE: the following line *MUST* be in /etc/mail/sendmail.mc + dnl include(\`/etc/mail/provider.m4')dnl + # + # Provider information from /etc/mail/peers/$domain + EOT + cat /etc/mail/peers/$domain >> $provider_m4; + cat <<-EOT >> $provider_m4; + #------------------------------------------------------------ + EOT + fi; + }; + +find_host() { + # Determine our fqdn from our ISP + local addr; + addr="$1"; + maxloop=20; + cntr=0; + host=''; + until (test ! -z "$host"); do + cntr=$(($cntr+1)); + rev=$(host $addr); + host=$(echo "$rev" | grep '^Name:' | awk '{print $2}'); + if [ -z "$host" ]; then + host=${rev##*domain name pointer }; + host=${host%.}; + fi; + test=$(echo $host | cut -d ' ' -f 1); + if [ "$host" != "**" ]; then + break; + elif (($cntr > $maxloop)); then + host=''; + break; + fi; + done; + echo "addr=$addr, name=$host"; + }; + +update_host() { + local host ip; + ip="$1"; + find_host "$ip"; + if [ ! -z "$host" ]; then + cat <<-EOT > $dialup_m4; + LOCAL_CONFIG + #------------------------------------------------------------ + # + # Dynamic host/ip updates from $0 + # + # NOTE: the following line *MUST* be in /etc/mail/sendmail.mc + dnl include(\`/etc/mail/dialup.m4')dnl + # + # Chose one of the following two options: + # * Add our true hostname as a Virtual Host (we'll accept + # mail for it, but keep our local name for SMTP AUTH, etc) + C{VirtHost}$host + # + # * Define our true hostname (from our ISP) - becomes \$j + dnl define(\`confDOMAIN_NAME', \`$host')dnl + # + # Make sure we accept mail as this name (for bounces, etc) + Cw$host + Cw$ip + # Add our hostname to class G for genericstable support + CG$host + #------------------------------------------------------------ + EOT + fi; + }; + +# No need to continue if we're called with an unsupported option +if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \ + && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ] \ + && [ "$reason" != EXPIRE ] && [ "$reason" != FAIL ] + then + return; + fi; + +# Flag to denote changed have been made; +changed=0; + +# If the domain name has changed, update the provider information +if [ "$new_domain_name" != "$old_domain_name" ]; then + changed=1; + update_provider "$new_domain_name"; + fi; + +# If the ip address has changed, update the host information +if [ "$new_ip_address" != "$oldnew_ip_address" ]; then + changed=1; + update_host "$new_ip_address"; + fi; + +# If anything has been changed, update sendmail.cf and reload +if [ $changed -eq 1 ]; then + update_sendmail; + fi; + +exit 0; + diff --git a/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.in b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.in new file mode 100644 index 0000000..0afc701 --- /dev/null +++ b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.in @@ -0,0 +1,49 @@ +#!/bin/sh +# +# This script is called when a dhcp event occurs. +# +# Here is where we'll start/stop sendmail if needed. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# NOTE: The dhcp DNS name is used as the peer name in /etc/mail/peers. +# + +# No need to continue if we're called with an unsupported option +case "$reason" in + EXPIRE|FAIL|RELEASE|STOP) # and TIMEOUT too ?? + ;; + BOUND|RENEW|REBIND|REBOOT|TIMEOUT) + ;; + *) + return; + ;; + esac; + +# Bring in some script functions to handle dynamic configuration +. @datadir@/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$interface" "$reason"; + +# If the domain name has changed, update the provider information +if [ "$new_domain_name" != "$old_domain_name" ]; then + update_provider "$new_domain_name"; + fi; + +# If the ip address has changed, update the host information +if [ "$new_ip_address" != "$oldnew_ip_address" ]; then + update_host "$new_ip_address"; + fi; + +# If anything has been changed, update sendmail.cf and reload +# Actually, we'll delay the reload because we'll be hit in a moment +# to handle the change in /etc/resolv.conf +update_sendmail Delayed; + +return; + diff --git a/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.md5sum b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.md5sum new file mode 100644 index 0000000..d18e257 --- /dev/null +++ b/debian/examples/dhcp3/dhclient-exit-hooks.d/sendmail.md5sum @@ -0,0 +1 @@ +2adc5e32474fb128ee6c7b4425d06a58 sendmail diff --git a/debian/examples/ldap/sendmail.schema.v2 b/debian/examples/ldap/sendmail.schema.v2 index bab47e8..a532f8b 100644 --- a/debian/examples/ldap/sendmail.schema.v2 +++ b/debian/examples/ldap/sendmail.schema.v2 @@ -1,11 +1,11 @@ -# Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers. +# Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers. # All rights reserved. # # By using this file, you agree to the terms and conditions set # forth in the LICENSE file which can be found at the top level of # the sendmail distribution. # -# $Id: sendmail.schema,v 8.14 2001/08/31 17:18:18 gshapiro Exp $ +# $Id: sendmail.schema,v 8.21 2002/11/20 23:13:50 gshapiro Exp $ # Note that this schema is experimental at this point as it has had little # public review. Therefore, it may change in future versions. Feedback @@ -87,6 +87,20 @@ attributetype ( 1.3.6.1.4.1.6152.10.3.1.16 EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) +# attribute sendmailMTAMapSearch cis +attributetype ( 1.3.6.1.4.1.6152.10.3.1.24 + NAME 'sendmailMTAMapSearch' + DESC 'recursive search for values of a map entry' + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) + +# attribute sendmailMTAMapURL cis +attributetype ( 1.3.6.1.4.1.6152.10.3.1.25 + NAME 'sendmailMTAMapURL' + DESC 'recursive search URL for values of a map entry' + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) + #objectClass sendmailMTAMap # requires # objectClass, @@ -108,18 +122,22 @@ objectclass ( 1.3.6.1.4.1.6152.10.3.2.11 # objectClass, # sendmailMTAMapName, # sendmailMTAKey, -# sendmailMTAMapValue, # allows # sendmailMTACluster, # sendmailMTAHost, +# sendmailMTAMapValue, +# sendmailMTAMapSearch, +# sendmailMTAMapURL, # Description objectclass ( 1.3.6.1.4.1.6152.10.3.2.12 NAME 'sendmailMTAMapObject' SUP sendmailMTAMap STRUCTURAL DESC 'Sendmail MTA map object' - MUST ( sendmailMTAMapName $ sendmailMTAKey $ sendmailMTAMapValue ) - MAY ( sendmailMTACluster $ sendmailMTAHost $ Description ) ) + MUST ( sendmailMTAMapName $ sendmailMTAKey ) + MAY ( sendmailMTACluster $ sendmailMTAHost $ + sendmailMTAMapValue $ sendmailMTAMapSearch $ + sendmailMTAMapURL $ Description ) ) ########################################################################### @@ -132,8 +150,8 @@ objectclass ( 1.3.6.1.4.1.6152.10.3.2.12 attributetype ( 1.3.6.1.4.1.6152.10.3.1.18 NAME 'sendmailMTAAliasGrouping' DESC 'name that identifies a particular aliases grouping' - EQUALITY caseIgnoreMatch - SUBSTR caseIgnoreSubstringsMatch + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} ) # attribute sendmailMTAAliasValue cis @@ -143,6 +161,20 @@ attributetype ( 1.3.6.1.4.1.6152.10.3.1.20 EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) +# attribute sendmailMTAAliasSearch cis +attributetype ( 1.3.6.1.4.1.6152.10.3.1.26 + NAME 'sendmailMTAAliasSearch' + DESC 'recursive search for values of an alias' + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) + +# attribute sendmailMTAAliasURL cis +attributetype ( 1.3.6.1.4.1.6152.10.3.1.27 + NAME 'sendmailMTAAliasURL' + DESC 'recursive search URL for values of an alias' + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) + #objectClass sendmailMTAAlias # requires # objectClass, @@ -163,20 +195,23 @@ objectclass ( 1.3.6.1.4.1.6152.10.3.2.13 # requires # objectClass, # sendmailMTAKey, -# sendmailMTAAliasValue, # allows # sendmailMTAAliasGrouping, # sendmailMTACluster, # sendmailMTAHost, +# sendmailMTAAliasValue, +# sendmailMTAAliasSearch, +# sendmailMTAAliasURL, # Description objectclass ( 1.3.6.1.4.1.6152.10.3.2.14 NAME 'sendmailMTAAliasObject' SUP sendmailMTAAlias STRUCTURAL DESC 'Sendmail MTA alias object' - MUST ( sendmailMTAKey $ sendmailMTAAliasValue ) - MAY ( sendmailMTAAliasGrouping $ - sendmailMTACluster $ sendmailMTAHost $ Description ) ) + MUST sendmailMTAKey + MAY ( sendmailMTAAliasGrouping $ sendmailMTACluster $ + sendmailMTAHost $ sendmailMTAAliasValue $ + sendmailMTAAliasSearch $ sendmailMTAAliasURL $ Description ) ) ########################################################################### # @@ -198,19 +233,37 @@ attributetype ( 1.3.6.1.4.1.6152.10.3.1.23 EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) +# attribute sendmailMTAClassSearch cis +attributetype ( 1.3.6.1.4.1.6152.10.3.1.28 + NAME 'sendmailMTAClassSearch' + DESC 'recursive search for members of a class' + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) + +# attribute sendmailMTAClassURL cis +attributetype ( 1.3.6.1.4.1.6152.10.3.1.29 + NAME 'sendmailMTAClassURL' + DESC 'recursive search URL for members of a class' + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) + #objectClass sendmailMTAClass # requires # objectClass, # sendmailMTAClassName, -# sendmailMTAClassValue, # allows # sendmailMTACluster, # sendmailMTAHost, +# sendmailMTAClassValue, +# sendmailMTAClassSearch, +# sendmailMTAClassURL, # Description objectclass ( 1.3.6.1.4.1.6152.10.3.2.15 NAME 'sendmailMTAClass' SUP sendmailMTA STRUCTURAL DESC 'Sendmail MTA class definition' - MUST ( sendmailMTAClassName $ sendmailMTAClassValue ) - MAY ( sendmailMTACluster $ sendmailMTAHost $ Description ) ) + MUST sendmailMTAClassName + MAY ( sendmailMTACluster $ sendmailMTAHost $ + sendmailMTAClassValue $ sendmailMTAClassSearch $ + sendmailMTAClassURL $ Description ) ) diff --git a/debian/examples/logcheck/ignore.d.paranoid/sendmail b/debian/examples/logcheck/ignore.d.paranoid/sendmail index e0781dd..e8cb7f2 100644 --- a/debian/examples/logcheck/ignore.d.paranoid/sendmail +++ b/debian/examples/logcheck/ignore.d.paranoid/sendmail @@ -1,21 +1,21 @@ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: starting daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: restarting -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: accepting connections again for daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* User unknown -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* aliases, longest -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: from= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: split: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* lost input channel -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* message-id= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* return to sender -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* stat= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* timeout waiting -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter add: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter: data, discard -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: discarded -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: AUTH= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: (PLAIN|CRAM-MD5|DIGEST-MD5) set secret -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: STARTTLS=(server|client), .* verify=(OK|NO) +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: starting daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: restarting +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: accepting connections again for daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* User unknown +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* aliases, longest +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: from= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: split: +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* lost input channel +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* message-id= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* return to sender +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* stat= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* timeout waiting +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter add: +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter: data, discard +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: discarded +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: AUTH= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: (PLAIN|CRAM-MD5|DIGEST-MD5) set secret +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: STARTTLS=(server|client), .* verify=(OK|NO) diff --git a/debian/examples/logcheck/ignore.d.server/sendmail b/debian/examples/logcheck/ignore.d.server/sendmail index dfc4984..dbb6e11 100644 --- a/debian/examples/logcheck/ignore.d.server/sendmail +++ b/debian/examples/logcheck/ignore.d.server/sendmail @@ -1,21 +1,27 @@ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: starting daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: restarting -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: accepting connections again for daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* User unknown -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* aliases, longest -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: from= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: split: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* lost input channel -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* message-id= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* return to sender -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* stat= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* timeout waiting -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter add: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter: data, discard -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: discarded -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: AUTH= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: (PLAIN|CRAM-MD5|DIGEST-MD5) set secret -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: STARTTLS=(server|client), .* verify=(OK|NO) +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: starting daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: restarting +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: accepting connections again for daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* User unknown +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* aliases, longest +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: from= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: split: +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* lost input channel +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* message-id= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* return to sender +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* stat= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* timeout waiting +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter: data, discard +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: discarded +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: AUTH= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: (PLAIN|CRAM-MD5|DIGEST-MD5) set secret +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: STARTTLS=(server|client), .* verify=(OK|NO) +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: no secret in database$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: [[:alnum:]]+: [[:alnum:]]+: DSN: Return receipt$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: [[:alnum:]]+: collect: premature EOM: unexpected close$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: [[:alnum:]]+: collect: unexpected close on connection from (\[[0-9.]+\]|[._[:alnum:]-]+), sender=<[^>]+>$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5 (server|client) step [[:alnum:]]+$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: [[:alnum:]]+ Milter (add|change|message): .*$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: [[:alnum:]]+\[[0-9]+\]:.*$ diff --git a/debian/examples/logcheck/ignore.d.workstation/sendmail b/debian/examples/logcheck/ignore.d.workstation/sendmail index 2374b71..d8bd8d0 100644 --- a/debian/examples/logcheck/ignore.d.workstation/sendmail +++ b/debian/examples/logcheck/ignore.d.workstation/sendmail @@ -1,21 +1,21 @@ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: starting daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: restarting -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: accepting connections again for daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* User unknown -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* aliases, longest -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: from= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: split: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* lost input channel -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* message-id= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* return to sender -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* stat= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* timeout waiting -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter add: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter: data, discard -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: discarded -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: AUTH= -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: (PLAIN|CRAM-MD5|DIGEST-MD5) set secret -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: STARTTLS= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: starting daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: restarting +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: accepting connections again for daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* User unknown +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* aliases, longest +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: from= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: split: +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* lost input channel +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* message-id= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* return to sender +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* stat= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* timeout waiting +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter add: +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: Milter: data, discard +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*: discarded +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: AUTH= +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: (PLAIN|CRAM-MD5|DIGEST-MD5) set secret +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: STARTTLS= diff --git a/debian/examples/logcheck/violations.ignore.d/local.sendmail b/debian/examples/logcheck/violations.ignore.d/local.sendmail new file mode 100644 index 0000000..83abd67 --- /dev/null +++ b/debian/examples/logcheck/violations.ignore.d/local.sendmail @@ -0,0 +1 @@ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .* did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA$ diff --git a/debian/examples/logcheck/violations.ignore.d/logcheck-sendmail b/debian/examples/logcheck/violations.ignore.d/logcheck-sendmail deleted file mode 100644 index 9518e7d..0000000 --- a/debian/examples/logcheck/violations.ignore.d/logcheck-sendmail +++ /dev/null @@ -1,12 +0,0 @@ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*stat=(Refused|Deferred) -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: gethostbyaddr\(.*\) failed: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=450 4\.7\.1 <[^>]+>... Relaying temporarily denied. Cannot resolve PTR record for [0-9\.]+$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=451 4\.1\.8 Domain of sender address [^ ]+ does not resolve$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 Access denied$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. Proper authentication required.$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. IP name lookup failed \[[0-9\.]+\]$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. IP name lookup possibly forged \[[0-9\.]+\]$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=553 5\.1\.8 <[^>]+>... Relaying temporarily denied. Cannot resolve PTR record for [0-9\.]+$ diff --git a/debian/examples/logcheck/violations.ignore.d/sendmail b/debian/examples/logcheck/violations.ignore.d/sendmail index 9518e7d..93e0f57 100644 --- a/debian/examples/logcheck/violations.ignore.d/sendmail +++ b/debian/examples/logcheck/violations.ignore.d/sendmail @@ -1,12 +1,13 @@ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*stat=(Refused|Deferred) -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: gethostbyaddr\(.*\) failed: -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=450 4\.7\.1 <[^>]+>... Relaying temporarily denied. Cannot resolve PTR record for [0-9\.]+$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=451 4\.1\.8 Domain of sender address [^ ]+ does not resolve$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 Access denied$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. Proper authentication required.$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. IP name lookup failed \[[0-9\.]+\]$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. IP name lookup possibly forged \[[0-9\.]+\]$ -(sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=553 5\.1\.8 <[^>]+>... Relaying temporarily denied. Cannot resolve PTR record for [0-9\.]+$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: alias database .* rebuilt +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*stat=(Refused|Deferred) +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: gethostbyaddr\(.*\) failed: +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: rejecting connections on daemon +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: DIGEST-MD5: failed .* later in exchange +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=450 4\.7\.1 <[^>]+>... Relaying temporarily denied. Cannot resolve PTR record for [0-9\.]+$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=451 4\.1\.8 Domain of sender address [^ ]+ does not resolve$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 (<[^>]+>... )?Access denied$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. Proper authentication required.$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. IP name lookup failed \[[0-9\.]+\]$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=550 5\.7\.1 <[^>]+>... Relaying denied. IP name (lookup )?possibly forged \[[0-9\.]+\]$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: .*reject=553 5\.1\.8 <[^>]+>... Relaying temporarily denied. Cannot resolve PTR record for [0-9\.]+$ +^\w{3} [ :0-9]{11} [._[:alnum:]-]+ (sendmail|sm-(mta|msp|que))\[[0-9]+\]: [[:alnum:]]+: Milter (add|change|message):.*$ diff --git a/debian/examples/dialup/ip-down.d b/debian/examples/network/if-down.d/sendmail.1.old index 88e719e..88e719e 100644 --- a/debian/examples/dialup/ip-down.d +++ b/debian/examples/network/if-down.d/sendmail.1.old diff --git a/debian/examples/network/if-down.d/sendmail.in b/debian/examples/network/if-down.d/sendmail.in new file mode 100644 index 0000000..0f7d569 --- /dev/null +++ b/debian/examples/network/if-down.d/sendmail.in @@ -0,0 +1,42 @@ +#!/bin/sh +# +# This script is called when a network device goes down. +# +# Here is where we'll stop sendmail if needed +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# + +# These variables are for the use of the scripts run by run-parts +#IFACE=; +#IF_ADDRESS=; +#IF_PROVIDER=; + +if [ ! -z "$IFACE" ]; then + addr=$IF_ADDRESS; + provider=$IF_PROVIDER; + iface=$IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +if [ -z "$provider" ]; then + exit 0; + fi; + +# Bring in some script functions to handle dynamic configuration +. @datadir@/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "STOP"; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail; + +exit 0; diff --git a/debian/examples/network/if-down.d/sendmail.md5sum b/debian/examples/network/if-down.d/sendmail.md5sum new file mode 100644 index 0000000..6afd10a --- /dev/null +++ b/debian/examples/network/if-down.d/sendmail.md5sum @@ -0,0 +1 @@ +fb749db92b73eca0480702c59f6b09ed sendmail diff --git a/debian/examples/dialup/ip-up.d b/debian/examples/network/if-up.d/sendmail.1.old index cae3e1f..cae3e1f 100644 --- a/debian/examples/dialup/ip-up.d +++ b/debian/examples/network/if-up.d/sendmail.1.old diff --git a/debian/examples/network/if-up.d/sendmail.in b/debian/examples/network/if-up.d/sendmail.in new file mode 100644 index 0000000..f0afd8a --- /dev/null +++ b/debian/examples/network/if-up.d/sendmail.in @@ -0,0 +1,61 @@ +#!/bin/sh +# +# This script is called when a network device comes up. +# +# Here is where we'll start sendmail if needed. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# ALSO: make sure to use a 'provider <isp>' tag in /etc/network/interfaces +# it will be used as the name of a file in /etc/mail/peers +# + + +# These variables are for the use of the scripts run by run-parts +#IFACE=; <-- ifupdown +#IF_ADDRESS=; <-- ifupdown +#IF_PROVIDER=; <-- sendmail specific +#IF_DNS_DOMAIN=; <-- resolvconf +#IF_DNS_SEARCH=; <-- resolvconf + +if [ ! -z "$IFACE" ]; then + addr=$IF_ADDRESS; + if [ -n "$IF_PROVIDER" ]; then + provider="$IF_PROVIDER"; + elif [ -n "$IF_DNS_DOMAIN" ]; then + provider="$IF_DNS_DOMAIN"; + elif [ -n "$IF_DNS_SEARCH" ]; then + provider="$IF_DNS_SEARCH"; + fi; + iface=$IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +# Bring in some script functions to handle dynamic configuration +. @datadir@/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "BOUND"; + +# If the domain name has changed, update the provider information +if [ -n "$provider" ]; then + update_provider "$provider"; + fi; + +# If the ip address has changed, update the host information +if [ -n "$addr" ]; then + update_host "$addr"; + fi; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail; + +exit 0; + diff --git a/debian/examples/network/if-up.d/sendmail.md5sum b/debian/examples/network/if-up.d/sendmail.md5sum new file mode 100644 index 0000000..d8e607f --- /dev/null +++ b/debian/examples/network/if-up.d/sendmail.md5sum @@ -0,0 +1 @@ +2b0ad0f52c1c7562311b6a4f49340072 sendmail diff --git a/debian/examples/pam/smtp b/debian/examples/pam.d/smtp index 645535c..50f2ebe 100644 --- a/debian/examples/pam/smtp +++ b/debian/examples/pam.d/smtp @@ -3,12 +3,14 @@ # # /etc/pam.d/smtp # -# Copyright (c) 2000-2001 Richard Nelson. All Rights Reserved. -# Version: 2.0.0 -# Time-stamp: <2001/05/29 12:00:00 cowboy> +# Copyright (c) 2000-2003 Richard Nelson. All Rights Reserved. +# Version: 2.0.1 +# Time-stamp: <2003/05/06 12:00:00 cowboy> # # PAM configuration file used by SASL to authenticate a PLAIN password. # #------------------------------------------------------------------------ #auth sufficient pam_ldap.so auth required pam_unix.so nullok try_first_pass +account required pam_unix.so +password required pam_unix.so diff --git a/debian/examples/pam.d/smtp.md5sum b/debian/examples/pam.d/smtp.md5sum new file mode 100644 index 0000000..4ceae1c --- /dev/null +++ b/debian/examples/pam.d/smtp.md5sum @@ -0,0 +1 @@ +44980f7978afc8051a84b3414e628613 smtp diff --git a/debian/examples/ppp/ip-down.d/sendmail.1.old b/debian/examples/ppp/ip-down.d/sendmail.1.old new file mode 100644 index 0000000..88e719e --- /dev/null +++ b/debian/examples/ppp/ip-down.d/sendmail.1.old @@ -0,0 +1,57 @@ +#!/bin/sh +# +# This script is called when ppp disconnects from the network. +# +# Here is where we'll stop sendmail if needed +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# Exit by default, check for validity before commenting out the next line: +exit 0; + +# Purge any latent host status that might cause us to *NOT* send mail +AM='-Am'; +if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then + AM=''; + fi; +sendmail $AM -bH -O Timeout.hoststatus=1s; + +# New mail will only be queued +file="/etc/mail/dialup.m4"; +if [ -f "$file" ]; then + cat <<-EOT > $file; + LOCAL_CONFIG + #------------------------------------------------------------ + # + # Dynamic updates from $0 + # + # NOTE: the following line *MUST* be in /etc/mail/sendmail.mc + dnl include(\`/etc/mail/dialup.m4')dnl + # + # sendmail is to only queue messages until connected again + define(\`confDELIVERY_MODE', \`deferred')dnl + # + # Allow the queue to age without carping every four hours + define(\`confTO_QUEUEWARN',\`1d')dnl + # + # Don't keep host status while the network is down + define(\`confHOST_STATUS_DIRECTORY')dnl + #------------------------------------------------------------ + EOT + fi; + +# Build a new sendmail.cf from sendmail.mc, including our address. +# NOTE: The following line (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4') +m4 /etc/mail/sendmail.mc \ + > /etc/mail/sendmail.cf.pnew; +chmod 0644 /etc/mail/sendmail.cf.pnew; +chown mail:mail /etc/mail/sendmail.cf.pnew; +mv -f /etc/mail/sendmail.cf.pnew /etc/mail/sendmail.cf; + +# Stop/reload sendmail daemon as needed +/etc/init.d/sendmail reload; diff --git a/debian/examples/ppp/ip-down.d/sendmail.in b/debian/examples/ppp/ip-down.d/sendmail.in new file mode 100644 index 0000000..1baa7ee --- /dev/null +++ b/debian/examples/ppp/ip-down.d/sendmail.in @@ -0,0 +1,45 @@ +#!/bin/sh +# +# This script is called when ppp disconnects from the network. +# +# Here is where we'll stop sendmail if needed +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# + +# These variables are for the use of the scripts run by run-parts +#PPP_IFACE="$1"; +#PPP_TTY="$2"; +#PPP_SPEED="$3"; +#PPP_LOCAL="$4"; +#PPP_REMOTE="$5"; +#PPP_IPPARAM="$6"; + +if [ ! -z "$PPP_LOCAL" ]; then + addr=$PPP_LOCAL; + provider=$PPP_IPPARAM; + iface=$PPP_IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +if [ -z "$provider" ]; then + exit 0; + fi; + +# Bring in some script functions to handle dynamic configuration +. @datadir@/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "STOP"; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail; + +exit 0; diff --git a/debian/examples/ppp/ip-down.d/sendmail.md5sum b/debian/examples/ppp/ip-down.d/sendmail.md5sum new file mode 100644 index 0000000..6afd10a --- /dev/null +++ b/debian/examples/ppp/ip-down.d/sendmail.md5sum @@ -0,0 +1 @@ +fb749db92b73eca0480702c59f6b09ed sendmail diff --git a/debian/examples/ppp/ip-up.d/sendmail.1.old b/debian/examples/ppp/ip-up.d/sendmail.1.old new file mode 100644 index 0000000..cae3e1f --- /dev/null +++ b/debian/examples/ppp/ip-up.d/sendmail.1.old @@ -0,0 +1,130 @@ +#!/bin/sh +# +# This script is called when ppp connects to the network. +# +# Here is where we'll start sendmail if needed, and will +# run the queue in either case. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# ALSO: make sure ipparam is specified somewhere in the ppp options; +# it will be used as the name of a file in /etc/mail/peers +# +# Exit by default, check for validity before commenting out the next line: +exit 0; + +# Define our domain name (from PPP) for sendmail. + +# These variables are for the use of the scripts run by run-parts +#PPP_IFACE="$1"; +#PPP_TTY="$2"; +#PPP_SPEED="$3"; +#PPP_LOCAL="$4"; +#PPP_REMOTE="$5"; +#PPP_IPPARAM="$6"; + +if [ ! -z "$PPP_LOCAL" ]; then + addr=$PPP_LOCAL; + provider=$PPP_IPPARAM; +else + addr=$1; + provider=$2; + fi; + +# Determine our fqdn from our ISP +maxloop=20; +cntr=0; +name=""; +until (test ! -z "$name"); do + cntr=$(($cntr+1)); + rev=$(host $addr); + name=$(echo "$rev" | grep '^Name:' | awk '{print $2}'); + if [ -z "$name" ]; then + name=${rev##*domain name pointer }; + name=${name%.}; + fi; + test=$(echo $name | cut -d ' ' -f 1); + if [ "$name" != "**" ]; then + break; + elif (($cntr > $maxloop)); then + name=''; + break; + fi; + done; +echo "addr=$addr, name=$name"; + +file="/etc/mail/dialup.m4"; +#file="dialup.m4"; +if [ ! -z "$name" ]; then + cat <<-EOT > $file; + LOCAL_CONFIG + #------------------------------------------------------------ + # + # Dynamic updates from $0 + # + # NOTE: the following line *MUST* be in /etc/mail/sendmail.mc + dnl include(\`/etc/mail/dialup.m4')dnl + # + # Chose one of the following options: + # * Add our true hostname as a Virtual Host (we'll accept + # mail for it, but keep our local name for SMTP AUTH, etc) + dnl C{VirtHost}$name + # * Define our true hostname (from our ISP) becomes \$j + dnl define(\`confDOMAIN_NAME', \`$name')dnl + # + # Make sure we accept mail as this name (for bounces, etc) + Cw$name + # Add our hostname to class G for genericstable support + CG$name + #------------------------------------------------------------ + EOT + fi; + +# Add smarthost information (if any)... But not if provider.m4 is a link ! +file="/etc/mail/provider.m4"; +#file="provider.m4"; +if [ -f /etc/mail/peers/$provider -a ! -L $file ]; then + cat <<-EOT > $file; + LOCAL_CONFIG + #------------------------------------------------------------ + # + # Dynamic updates from $0 + # + # NOTE: the following line *MUST* be in /etc/mail/sendmail.mc + dnl include(\`/etc/mail/provider.m4')dnl + # + # Provider information from /etc/mail/peers/$provider + EOT + cat /etc/mail/peers/$provider >> $file; + cat <<-EOT >> $file; + #------------------------------------------------------------ + EOT + fi; +#exit 0 + +# Build a new sendmail.cf from sendmail.mc, including our address. +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +m4 /etc/mail/sendmail.mc \ + > /etc/mail/sendmail.cf.pnew; +chmod 0644 /etc/mail/sendmail.cf.pnew; +chown mail:mail /etc/mail/sendmail.cf.pnew; +mv -f /etc/mail/sendmail.cf.pnew /etc/mail/sendmail.cf; + +# Purge any latent host status that might cause us to *NOT* send mail +AM='-Am'; +if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then + AM=''; + fi; +sendmail $AM -bH -O Timeout.hoststatus=1s; + +# Start/reload sendmail as needed +/etc/init.d/sendmail reload; # may be up, or down + +# Process the sendmail queue (background so as to not defer other ip-up work) +runq & diff --git a/debian/examples/ppp/ip-up.d/sendmail.in b/debian/examples/ppp/ip-up.d/sendmail.in new file mode 100644 index 0000000..5c26de8 --- /dev/null +++ b/debian/examples/ppp/ip-up.d/sendmail.in @@ -0,0 +1,57 @@ +#!/bin/sh +# +# This script is called when ppp connects to the network. +# +# Here is where we'll start sendmail if needed. +# +# Written By Richard Nelson <cowboy@debian.org> +# +# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc: +# include(`/etc/mail/dialup.m4')dnl +# include(`/etc/mail/provider.m4')dnl +# +# ALSO: make sure ipparam is specified somewhere in the ppp options; +# it will be used as the name of a file in /etc/mail/peers +# + +# Define our domain name (from PPP) for sendmail. + +# These variables are for the use of the scripts run by run-parts +#PPP_IFACE="$1"; +#PPP_TTY="$2"; +#PPP_SPEED="$3"; +#PPP_LOCAL="$4"; +#PPP_REMOTE="$5"; +#PPP_IPPARAM="$6"; + +if [ ! -z "$PPP_LOCAL" ]; then + addr=$PPP_LOCAL; + provider=$PPP_IPPARAM; + iface=$PPP_IFACE; +else + addr=$1; + provider=$2; + iface=$3; + fi; + +if [ -z "$provider" ]; then + exit 0; + fi; + +# Bring in some script functions to handle dynamic configuration +. @datadir@/sendmail/dynamic; + +# Note the interface that just changed +update_interface "$iface" "BOUND"; + +# If the domain name has changed, update the provider information +update_provider "$provider"; + +# If the ip address has changed, update the host information +update_host "$addr"; + +# If anything has been changed, update sendmail.cf and reload +update_sendmail; + +exit 0; + diff --git a/debian/examples/ppp/ip-up.d/sendmail.md5sum b/debian/examples/ppp/ip-up.d/sendmail.md5sum new file mode 100644 index 0000000..d8e607f --- /dev/null +++ b/debian/examples/ppp/ip-up.d/sendmail.md5sum @@ -0,0 +1 @@ +2b0ad0f52c1c7562311b6a4f49340072 sendmail diff --git a/debian/examples/resolvconf/update-libc.d/sendmail.in b/debian/examples/resolvconf/update-libc.d/sendmail.in new file mode 100644 index 0000000..4b135a8 --- /dev/null +++ b/debian/examples/resolvconf/update-libc.d/sendmail.in @@ -0,0 +1,15 @@ +#!/bin/sh + +# Make sendmail aware of changes to resolv.conf +# so that we can reset the statistics for unresolvable hostnames + +# Purge any latent host status that might cause us to *NOT* send mail +AM='-Am'; +if [ ! -f @datadir@/sendmail/cf/feature/msp.m4 ]; then + AM=''; + fi; +@sbindir@/sendmail $AM -bH -O Timeout.hoststatus=1s; + +# Start/reload sendmail as needed +#@sysconfdir@/init.d/sendmail reload || true; + diff --git a/debian/examples/sasl/Sendmail.conf b/debian/examples/sasl/Sendmail.conf.1 index b41887b..5456864 100644 --- a/debian/examples/sasl/Sendmail.conf +++ b/debian/examples/sasl/Sendmail.conf.1 @@ -13,6 +13,8 @@ #*** For a more detailed guide on configuring SASL, please look at #doc/sysadmin.html. # +auto_transition: true #pwcheck_method: sasldb +#pwcheck_method: saslauthd +#pwcheck_method: PAM pwcheck_method: PAM -auto_transition: true diff --git a/debian/examples/sasl/Sendmail.conf.2 b/debian/examples/sasl/Sendmail.conf.2 new file mode 100644 index 0000000..e627485 --- /dev/null +++ b/debian/examples/sasl/Sendmail.conf.2 @@ -0,0 +1,23 @@ +#Currently configurable parameters: +#- srvtab (for KERBEROS_V4): [/etc/srvtab] path +# where to find the srvtab +# +#- pwcheck_method: [PAM] one of {PAM, kerberos_v4, passwd, shadow, sasldb} +# how to check plaintext passwords. +# +#- auto_transition: [false] +# if true, automatically add secrets to the secret database when +# PLAIN or check_password is used, so in the future the user can +# use the more secure mechanisms. +# +#*** For a more detailed guide on configuring SASL, please look at +#doc/sysadmin.html. +# +auto_transition: true +pwcheck_method: saslauthd +pwcheck_method: auxprop saslauthd +auxprop_plugin: sasldb +allowanonymouslogin: 0 +allowplaintext: 1 +mech_list: EXTERNAL DIGEST-MD5 CRAM-MD5 NTLM LOGIN PLAIN + diff --git a/debian/examples/sasl/sasl.m4.in b/debian/examples/sasl/sasl.m4.in new file mode 100644 index 0000000..0eb8dcc --- /dev/null +++ b/debian/examples/sasl/sasl.m4.in @@ -0,0 +1,81 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: sasl.m4,v @sm_version@ @sm_date@ @sm_time@ cowboy Exp $ +# +# Copyright (c) 2003-@SM_CPYRT@ Richard Nelson. All Rights Reserved. +# +# @configure_input@ +# +# sasl.m4 m4 file to support user->MTA, MSP->MTA, and MTA->MTA +# encryption and/or authentication. +# +# To use this file, add this line to sendmail.mc and possibly submit.mc: +# `include(`@sysconfdir@/mail/sasl/sasl.m4')dnl' +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +VERSIONID(`$Id: sasl.m4, v @sm_version@@sm_revision@ @sm_date@ @sm_time@ cowboy Exp $') +dnl # +dnl #--------------------------------------------------------------------- +dnl # Bring in Autoconf results +dnl #--------------------------------------------------------------------- +ifdef(`sm_version', `dnl' , +`include(`@datadir@/sendmail/cf/debian/autoconf.m4')')dnl +dnl # +dnl #--------------------------------------------------------------------- +dnl # SMTP AUTH (SASL) support (sendmail 8.10.0 +) +dnl # PLAIN/LOGIN needed to support SASL auth via PAM ;( +dnl # if this bothers you, you allow them only in conjunction w/STARTTLS ! +dnl #--------------------------------------------------------------------- +ifelse(eval(sm_version_math >= 526848), `1', `dnl +ifelse(sm_enable_auth, `yes', `dnl +dnl # +dnl # Set a more reasonable timeout on negotiation +dnl # +define(`confTO_AUTH', `2m')dnl # , def=10m +dnl # +dnl # Do not touch anything above this line... +dnl # +dnl # Available Authentication methods +dnl # +define(`confAUTH_MECHANISMS',dnl +`DIGEST-MD5 CRAM-MD5 NTLM PLAIN LOGIN')dnl +dnl # +dnl # These, we will trust for relaying +dnl # +TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 NTLM PLAIN LOGIN') +dnl # +dnl # for 8.12.0+, add EXTERNAL as an available & trusted mech (w/STARTTLS) +dnl # and allow sharing of /etc/sasldb(2) file, allow group read/write +dnl # +ifelse(eval(sm_version_math >= 527360), `1', `dnl +define(`confAUTH_MECHANISMS',dnl +`EXTERNAL 'defn(`confAUTH_MECHANISMS'))dnl +TRUST_AUTH_MECH(`EXTERNAL') +define(`confDONT_BLAME_SENDMAIL',dnl +defn(`confDONT_BLAME_SENDMAIL')`,GroupReadableSASLDBFile,GroupWritableSASLDBFile')dnl +')dnl +dnl # +dnl # To support SMTP AUTH in `sendmail -bs' : +dnl # Sigh: SASLV1 MSP AUTH does not work in -bs mode (/etc/sasldb !o+r) +dnl # so, we have the MSP not use Auth (or ETRN) +dnl # SASLV2 (w/saslauth) chose to prohibit user authentication - it can +dnl # be made to work by: +dnl # 1) changing /etc/sasldb2 {root,sasl,smmta}:smmsp 0660 +dnl # 2) dpkg-statoverride --remove /var/run/saslauthd +dnl # 3) dpkg-statoverride --add root sasl 711 /var/run/saslauthd +dnl # +ifelse(eval(sm_auth_lib < 2), `1', `dnl +ifdef(`DEBIAN_MSP', `dnl +ifelse(defn(`_DPO_'), `', `dnl +DAEMON_OPTIONS(`Name=NoMTA, Addr=0.0.0.0, M=EA')dnl +')')')dnl +dnl # +dnl # Define the REALM passed to sasl (8.13.0+) +ifelse(eval(sm_version_math >= 527616), `1', `dnl +dnl define(`confAUTH_REALM', `')dnl # Fill this in and uncomment it +')dnl +dnl # +dnl # Do not touch anything below this line... +')')dnl diff --git a/debian/examples/sasl/saslpasswd.conf b/debian/examples/sasl/saslpasswd.conf.1 index dfcc7b7..bc9a86e 100644 --- a/debian/examples/sasl/saslpasswd.conf +++ b/debian/examples/sasl/saslpasswd.conf.1 @@ -13,5 +13,5 @@ #*** For a more detailed guide on configuring SASL, please look at #doc/sysadmin.html. # -pwcheck_method: sasldb auto_transition: true +pwcheck_method: sasldb diff --git a/debian/examples/sasl/saslpasswd.conf.2 b/debian/examples/sasl/saslpasswd.conf.2 new file mode 100644 index 0000000..e2f849b --- /dev/null +++ b/debian/examples/sasl/saslpasswd.conf.2 @@ -0,0 +1,21 @@ +#Currently configurable parameters: +#- srvtab (for KERBEROS_V4): [/etc/srvtab] path +# where to find the srvtab +# +#- pwcheck_method: [PAM] one of {PAM, kerberos_v4, passwd, shadow, sasldb} +# how to check plaintext passwords. +# +#- auto_transition: [false] +# if true, automatically add secrets to the secret database when +# PLAIN or check_password is used, so in the future the user can +# use the more secure mechanisms. +# +#*** For a more detailed guide on configuring SASL, please look at +#doc/sysadmin.html. +# +#auto_transition: true +pwcheck_method: saslauthd +#auxprop_plugin: sasldb +allowanonymouslogin: 0 +allowplaintext: 1 +mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 diff --git a/debian/examples/tls/starttls.m4.in b/debian/examples/tls/starttls.m4.in new file mode 100644 index 0000000..dd45c0a --- /dev/null +++ b/debian/examples/tls/starttls.m4.in @@ -0,0 +1,61 @@ +divert(-1)dnl +#----------------------------------------------------------------------------- +# $Sendmail: starttls.m4,v @sm_version@ @sm_date@ @sm_time@ cowboy Exp $ +# +# Copyright (c) 2002-@SM_CPYRT@ Richard Nelson. All Rights Reserved. +# +# @configure_input@ +# +# starttls.m4 m4 file to support user->MTA, MSP->MTA, and MTA->MTA +# encryption and/or authentication. +# +# To use this file, add this line to sendmail.mc and possibly submit.mc: +# `include(`@sysconfdir@/mail/tls/starttls.m4')dnl' +# +#----------------------------------------------------------------------------- +# +divert(0)dnl +VERSIONID(`$Id: starttls.m4,v @sm_version@@sm_revision@ @sm_date@ @sm_time@ cowboy Exp $') +dnl # +dnl #--------------------------------------------------------------------- +dnl # Bring in Autoconf results +dnl #--------------------------------------------------------------------- +ifdef(`sm_version', `dnl', +`include(`@datadir@/sendmail/cf/debian/autoconf.m4')dnl') +dnl # +dnl # Check to see if inclusion is valid (version >= 8.11.0, tls enabled) +ifelse(eval(sm_version_math >= 527104), `1', `dnl +ifelse(sm_enable_tls, `yes', `dnl +dnl # +dnl # To support shared keyfiles, we need it to be group readable +dnl # +define(`confDONT_BLAME_SENDMAIL',dnl + defn(`confDONT_BLAME_SENDMAIL')`,GroupReadableKeyFile')dnl +dnl # +dnl # Set a more reasonable timeout on negotiation +dnl # +define(`confTO_STARTTLS', `2m')dnl # , def=10m +dnl # +dnl # Do not touch anything above this line... +dnl # +dnl # CA directory - CA certs should be herein +define(`confCACERT_PATH', `@sysconfdir@/ssl/certs')dnl +dnl # +dnl # CA file (may be the same as client/server certificate) +define(`confCACERT', `@sysconfdir@/mail/tls/sendmail-server.crt')dnl +dnl # +dnl # Server certificate/key (can be in the same file, and shared w/client) +dnl # NOTE: The key must *NOT* be encrypted !!! +define(`confSERVER_CERT', `@sysconfdir@/mail/tls/sendmail-server.crt')dnl +define(`confSERVER_KEY', `@sysconfdir@/mail/tls/sendmail-common.key')dnl +dnl # +dnl # Clien certificate/key (can be in the same file, and shared w/server) +dnl # NOTE: The key must *NOT* be encrypted !!! +define(`confCLIENT_CERT', `@sysconfdir@/mail/tls/sendmail-client.crt')dnl +define(`confCLIENT_KEY', `@sysconfdir@/mail/tls/sendmail-common.key')dnl +dnl # +dnl # Optional settings +define(`confTLS_SRV_OPTIONS', `V')dnl # do not request user certs +dnl # +dnl # Do not touch anything below this line... +')')dnl |