diff options
Diffstat (limited to 'debian/examples/ppp/ip-up.d')
-rw-r--r-- | debian/examples/ppp/ip-up.d/sendmail.1.old | 130 | ||||
-rw-r--r-- | debian/examples/ppp/ip-up.d/sendmail.in | 57 | ||||
-rw-r--r-- | debian/examples/ppp/ip-up.d/sendmail.md5sum | 1 |
3 files changed, 188 insertions, 0 deletions
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 |