From 0b1adc42a15caea0cffbc962ca6f9e3e7b576834 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Wed, 9 Nov 2022 16:33:03 +0100 Subject: [PATCH] rc.sendmail: remove unused script 20 years ago the use of rc.sendmail script was dropped in favor of /etc/rc.d/sendmail, it is time to retire the script entirely now. MFC after: 1 week --- ObsoleteFiles.inc | 3 + contrib/sendmail/FREEBSD-upgrade | 2 - libexec/rc/Makefile | 3 - libexec/rc/rc.conf | 2 +- libexec/rc/rc.sendmail | 277 --------------------- share/examples/etc/README.examples | 1 - share/man/man8/Makefile | 1 - share/man/man8/rc.sendmail.8 | 298 ----------------------- tools/build/mk/OptionalObsoleteFiles.inc | 1 - 9 files changed, 4 insertions(+), 584 deletions(-) delete mode 100644 libexec/rc/rc.sendmail delete mode 100644 share/man/man8/rc.sendmail.8 diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index c15bdbd26ce..3841fe14b0c 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20221109: remove rc.sendmail(8) +OLD_FILES=etc/rc.sendmail + # 20221015: update the ithread(9) man page OLD_FILES+=usr/share/man/man9/ithread.9.gz OLD_FILES+=usr/share/man/man9/ithread_add_handler.9.gz diff --git a/contrib/sendmail/FREEBSD-upgrade b/contrib/sendmail/FREEBSD-upgrade index c1741592cae..334151cdc71 100644 --- a/contrib/sendmail/FREEBSD-upgrade +++ b/contrib/sendmail/FREEBSD-upgrade @@ -46,7 +46,6 @@ infrastructure in FreeBSD: etc/periodic/daily/440.status-mailq etc/periodic/daily/500.queuerun etc/rc - etc/rc.sendmail etc/sendmail/Makefile etc/sendmail/freebsd.mc etc/sendmail/freebsd.submit.mc @@ -68,7 +67,6 @@ infrastructure in FreeBSD: share/man/man5/rc.conf.5 share/man/man7/hier.7 share/man/man8/Makefile - share/man/man8/rc.sendmail.8 share/mk/bsd.libnames.mk share/sendmail/Makefile tools/build/mk/OptionalObsoleteFiles.inc diff --git a/libexec/rc/Makefile b/libexec/rc/Makefile index 5c35ab67722..a2b16660736 100644 --- a/libexec/rc/Makefile +++ b/libexec/rc/Makefile @@ -10,9 +10,6 @@ CONFETCPACKAGE= rc .if ${MK_IPFW} != "no" CONFETC+= rc.firewall .endif -.if ${MK_SENDMAIL} != "no" -CONFETC+= rc.sendmail -.endif CONFETCMODE= 644 CONFETCEXEC= netstart pccard_ether rc.resume rc.suspend CONFETCEXECDIR= /etc diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 08a6b65980f..50fed07df12 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -595,7 +595,7 @@ allscreens_kbdflags="" # Set this kbdcontrol mode for all virtual screens mta_start_script="/etc/rc.sendmail" # Script to start your chosen MTA, called by /etc/rc. -# Settings for /etc/rc.sendmail and /etc/rc.d/sendmail: +# Settings for /etc/rc.d/sendmail: sendmail_enable="NO" # Run the sendmail inbound daemon (YES/NO/NONE). # If NONE, don't start any sendmail processes. sendmail_pidfile="/var/run/sendmail.pid" # sendmail pid file diff --git a/libexec/rc/rc.sendmail b/libexec/rc/rc.sendmail deleted file mode 100644 index b025bc0bd62..00000000000 --- a/libexec/rc/rc.sendmail +++ /dev/null @@ -1,277 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 2002 Gregory Neil Shapiro. All Rights Reserved. -# Copyright (c) 2000, 2002 The FreeBSD Project -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -# This script is used by /etc/rc at boot time to start sendmail. It -# is meant to be sendmail specific and not a generic script for all -# MTAs. It is only called by /etc/rc if the rc.conf mta_start_script is -# set to /etc/rc.sendmail. This provides the opportunity for other MTAs -# to provide their own startup script. - -# The script is also used by /etc/mail/Makefile to enable the -# start/stop/restart targets. - -# The source for the script can be found in src/etc/sendmail/rc.sendmail. - -if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf - source_rc_confs -elif [ -r /etc/rc.conf ]; then - . /etc/rc.conf -fi - -# The sendmail binary -sendmail_program=${sendmail_program:-/usr/sbin/sendmail} - -# The pid is used to stop and restart the running daemon(s). -sendmail_pidfile=${sendmail_pidfile:-/var/run/sendmail.pid} -sendmail_mspq_pidfile=${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid} - -start_mta() -{ - case ${sendmail_enable} in - [Nn][Oo][Nn][Ee]) - ;; - [Yy][Ee][Ss]) - echo -n ' sendmail' - ${sendmail_program} ${sendmail_flags} - ;; - *) - case ${sendmail_submit_enable} in - [Yy][Ee][Ss]) - echo -n ' sendmail-submit' - ${sendmail_program} ${sendmail_submit_flags} - ;; - *) - case ${sendmail_outbound_enable} in - [Yy][Ee][Ss]) - echo -n ' sendmail-outbound' - ${sendmail_program} ${sendmail_outbound_flags} - ;; - esac - ;; - esac - ;; - esac -} - -stop_mta() -{ - # Check to make sure we are configured to start an MTA - case ${sendmail_enable} in - [Nn][Oo][Nn][Ee]) - return - ;; - [Yy][Ee][Ss]) - ;; - *) - case ${sendmail_submit_enable} in - [Yy][Ee][Ss]) - ;; - *) - case ${sendmail_outbound_enable} in - [Yy][Ee][Ss]) - ;; - *) - return - ;; - esac - ;; - esac - ;; - esac - - if [ -r ${sendmail_pidfile} ]; then - echo -n ' sendmail' - kill -TERM `head -1 ${sendmail_pidfile}` - else - echo "$0: stop-mta: ${sendmail_pidfile} not found" - fi -} - -restart_mta() -{ - # Check to make sure we are configured to start an MTA - case ${sendmail_enable} in - [Nn][Oo][Nn][Ee]) - return - ;; - [Yy][Ee][Ss]) - ;; - *) - case ${sendmail_submit_enable} in - [Yy][Ee][Ss]) - ;; - *) - case ${sendmail_outbound_enable} in - [Yy][Ee][Ss]) - ;; - *) - return - ;; - esac - ;; - esac - ;; - esac - if [ -r ${sendmail_pidfile} ]; then - echo -n ' sendmail' - kill -HUP `head -1 ${sendmail_pidfile}` - else - echo "$0: restart-mta: ${sendmail_pidfile} not found" - fi -} - -start_mspq() -{ - case ${sendmail_enable} in - [Nn][Oo][Nn][Ee]) - ;; - *) - if [ -r /etc/mail/submit.cf ]; then - case ${sendmail_msp_queue_enable} in - [Yy][Ee][Ss]) - echo -n ' sendmail-clientmqueue' - ${sendmail_program} ${sendmail_msp_queue_flags} - ;; - esac - fi - ;; - esac -} - -stop_mspq() -{ - # Check to make sure we are configured to start an MSP queue runner - case ${sendmail_enable} in - [Nn][Oo][Nn][Ee]) - return - ;; - *) - if [ -r /etc/mail/submit.cf ]; then - case ${sendmail_msp_queue_enable} in - [Yy][Ee][Ss]) - ;; - *) - return - ;; - esac - fi - ;; - esac - - if [ -r ${sendmail_mspq_pidfile} ]; then - echo -n ' sendmail-clientmqueue' - kill -TERM `head -1 ${sendmail_mspq_pidfile}` - else - echo "$0: stop-mspq: ${sendmail_mspq_pidfile} not found" - fi -} - -restart_mspq() -{ - # Check to make sure we are configured to start an MSP queue runner - case ${sendmail_enable} in - [Nn][Oo][Nn][Ee]) - return - ;; - *) - if [ -r /etc/mail/submit.cf ]; then - case ${sendmail_msp_queue_enable} in - [Yy][Ee][Ss]) - ;; - *) - return - ;; - esac - fi - ;; - esac - - if [ -r ${sendmail_mspq_pidfile} ]; then - echo -n ' sendmail-clientmqueue' - kill -HUP `head -1 ${sendmail_mspq_pidfile}` - else - echo "$0: restart-mspq: ${sendmail_mspq_pidfile} not found" - fi -} - -# If no argument is given, assume we are being called at boot time. -_action=${1:-start} - -case ${_action} in -start) - start_mta - start_mspq - ;; - -stop) - stop_mta - stop_mspq - ;; - -restart) - restart_mta - restart_mspq - ;; - -start-mta) - start_mta - ;; - -stop-mta) - stop_mta - ;; - -restart-mta) - restart_mta - ;; - -start-mspq) - start_mspq - ;; - -stop-mspq) - stop_mspq - ;; - -restart-mspq) - restart_mspq - ;; - -*) - echo "usage: `basename $0` {start|stop|restart}" >&2 - echo " `basename $0` {start-mta|stop-mta|restart-mta}" >&2 - echo " `basename $0` {start-mspq|stop-mspq|restart-mspq}" >&2 - exit 64 - ;; - -esac -exit 0 diff --git a/share/examples/etc/README.examples b/share/examples/etc/README.examples index 8745f6c9535..3d284f31fde 100644 --- a/share/examples/etc/README.examples +++ b/share/examples/etc/README.examples @@ -53,7 +53,6 @@ rc.bsdextended - startup policy for the mac_bsdextended(4) security module. rc.firewall - ipfw(8) setup script with basic rulesets rc.initdiskless - configuration file to boot a diskless machine rc.resume - sample run command file for APM Resume Event -rc.sendmail - script for sendmail(8) startup rc.shutdown - system shutdown script (see init(8)) rc.subr - script with functions used by various rc scripts rc.suspend - sample run command file for APM Resume Event diff --git a/share/man/man8/Makefile b/share/man/man8/Makefile index 1257f3ab97b..cd3cb34b11d 100644 --- a/share/man/man8/Makefile +++ b/share/man/man8/Makefile @@ -10,7 +10,6 @@ MAN= \ intro.8 \ nanobsd.8 \ rc.8 \ - rc.sendmail.8 \ rc.subr.8 \ rescue.8 \ ${_uefi.8} \ diff --git a/share/man/man8/rc.sendmail.8 b/share/man/man8/rc.sendmail.8 deleted file mode 100644 index d8dff43fdbe..00000000000 --- a/share/man/man8/rc.sendmail.8 +++ /dev/null @@ -1,298 +0,0 @@ -.\" Copyright (c) 1995 -.\" Jordan K. Hubbard -.\" Copyright (c) 2002 The FreeBSD Project -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd October 19, 2013 -.Dt RC.SENDMAIL 8 -.Os -.Sh NAME -.Nm rc.sendmail -.Nd -.Xr sendmail 8 -startup script -.Sh DESCRIPTION -The -.Nm -script is used by -.Pa /etc/rc -at boot time to start -.Xr sendmail 8 . -It is meant to be -.Xr sendmail 8 -specific and not a generic script for all MTAs. -It is only called by -.Pa /etc/rc -if the -.Xr rc.conf 5 -.Va mta_start_script -variable is set to -.Pa /etc/rc.sendmail . -.Pp -The -.Nm -script can take an optional argument specifying the action to -perform. -The available actions are: -.Bl -tag -width ".Cm restart-mspq" -.It Cm start -Starts both the MTA and the MSP queue runner. -.It Cm stop -Stops both the MTA and the MSP queue runner. -.It Cm restart -Restarts both the MTA and the MSP queue runner. -.It Cm start-mta -Starts just the MTA. -.It Cm stop-mta -Stops just the MTA. -.It Cm restart-mta -Restarts just the MTA. -.It Cm start-mspq -Starts just the MSP queue runner. -.It Cm stop-mspq -Stops just the MSP queue runner. -.It Cm restart-mspq -Restarts just the MSP queue runner. -.El -.Pp -If no action is specified, -.Cm start -is assumed. -.Pp -The -.Nm -script is also used by -.Pa /etc/mail/Makefile -to enable the -.Pa Makefile Ns 's -.Cm start , stop , -and -.Cm restart -targets. -.Sh RC.CONF VARIABLES -The following variables affect the behavior of -.Nm . -They are defined in -.Pa /etc/defaults/rc.conf -and can be changed in -.Pa /etc/rc.conf . -.Bl -tag -width indent -.It Va sendmail_enable -.Pq Vt str -If set to -.Dq Li YES , -run the -.Xr sendmail 8 -daemon at system boot time. -If set to -.Dq Li NO , -do not run a -.Xr sendmail 8 -daemon to listen for incoming network mail. -This does not preclude a -.Xr sendmail 8 -daemon listening on the SMTP port of the loopback interface. -The -.Dq Li NONE -option is deprecated and should not be used. -It will be removed in a future release. -.It Va sendmail_cert_create -.Pq Vt str -If -.Va sendmail_enable -is set to -.Dq Li YES , -create a signed certificate -.Pa /etc/mail/certs/host.cert -representing -.Pa /etc/mail/certs/host.key -by the CA certificate in -.Pa /etc/mail/certs/cacert.pem . -This will enable connecting hosts to negotiate STARTTLS allowing incoming -email to be encrypted in transit. -.Xr sendmail 8 -needs to be configured to use these generated files. -The default configuration in -.Pa /etc/mail/freebsd.mc -has the required options in it. -.It Va sendmail_cert_cn -.Pq Vt str -If -.Va sendmail_enable -is set to -.Dq Li YES -and -.Va sendmail_cert_create -is set to -.Dq Li YES , -this is the Common Name (CN) of the certificate that will be created. -If -.Va sendmail_cert_cn -is not set, the system's hostname will be used. -If there is no hostname set, -.Dq Li amnesiac -will be used. -.It Va sendmail_flags -.Pq Vt str -If -.Va sendmail_enable -is set to -.Dq Li YES , -these are the flags to pass to the -.Xr sendmail 8 -daemon. -.It Va sendmail_submit_enable -.Pq Vt bool -If set to -.Dq Li YES -and -.Va sendmail_enable -is set to -.Dq Li NO , -run -.Xr sendmail 8 -using -.Va sendmail_submit_flags -instead of -.Va sendmail_flags . -This is intended to allow local mail submission via -a localhost-only listening SMTP service required for running -.Xr sendmail 8 -as a non-set-user-ID binary. -Note that this does not work inside -.Xr jail 2 -systems, as jails do not allow binding to just the localhost interface. -.It Va sendmail_submit_flags -.Pq Vt str -If -.Va sendmail_enable -is set to -.Dq Li NO -and -.Va sendmail_submit_enable -is set to -.Dq Li YES , -these are the flags to pass to the -.Xr sendmail 8 -daemon. -.It Va sendmail_outbound_enable -.Pq Vt bool -If set to -.Dq Li YES -and both -.Va sendmail_enable -and -.Va sendmail_submit_enable -are set to -.Dq Li NO , -run -.Xr sendmail 8 -using -.Va sendmail_outbound_flags -instead of -.Va sendmail_flags . -This is intended to allow local mail queue management -for systems that do not offer a listening SMTP service. -.It Va sendmail_outbound_flags -.Pq Vt str -If both -.Va sendmail_enable -and -.Va sendmail_submit_enable -are set to -.Dq Li NO -and -.Va sendmail_outbound_enable -is set to -.Dq Li YES , -these are the flags to pass to the -.Xr sendmail 8 -daemon. -.It Va sendmail_msp_queue_enable -.Pq Vt bool -If set to -.Dq Li YES , -start a client (MSP) queue runner -.Xr sendmail 8 -daemon at system boot time. -As of sendmail 8.12, a separate queue is used for command line -submissions. -The client queue runner ensures that nothing is -left behind in the submission queue. -.It Va sendmail_msp_queue_flags -.Pq Vt str -If -.Va sendmail_msp_queue_enable -is set to -.Dq Li YES , -these are the flags to pass to the -.Xr sendmail 8 -daemon. -.El -.Pp -These variables are used to determine how the -.Xr sendmail 8 -daemons are started: -.Bd -literal -offset indent -# MTA -if (${sendmail_enable} == NONE) - # Do nothing -else if (${sendmail_enable} == YES) - start sendmail with ${sendmail_flags} -else if (${sendmail_submit_enable} == YES) - start sendmail with ${sendmail_submit_flags} -else if (${sendmail_outbound_enable} == YES) - start sendmail with ${sendmail_outbound_flags} -endif - -# MSP Queue Runner -if (${sendmail_enable} != NONE && - [ -r /etc/mail/submit.cf] && - ${sendmail_msp_queue_enable} == YES) - start sendmail with ${sendmail_msp_queue_flags} -endif -.Ed -.Pp -To completely prevent any -.Xr sendmail 8 -daemons from starting, you must -set the following variables in -.Pa /etc/rc.conf : -.Bd -literal -offset indent -sendmail_enable="NO" -sendmail_submit_enable="NO" -sendmail_outbound_enable="NO" -sendmail_msp_queue_enable="NO" -.Ed -.Sh SEE ALSO -.Xr rc.conf 5 , -.Xr rc 8 , -.Xr sendmail 8 -.Sh HISTORY -The -.Nm -file appeared in -.Fx 4.6 . diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 9dea5f6fdf1..a1094b2732b 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -1749,7 +1749,6 @@ OLD_FILES+=usr/share/examples/etc/login.access OLD_FILES+=usr/share/examples/etc/make.conf OLD_FILES+=usr/share/examples/etc/rc.bsdextended OLD_FILES+=usr/share/examples/etc/rc.firewall -OLD_FILES+=usr/share/examples/etc/rc.sendmail OLD_FILES+=usr/share/examples/etc/termcap.small OLD_FILES+=usr/share/examples/etc/wpa_supplicant.conf OLD_FILES+=usr/share/examples/find_interface/Makefile -- 2.45.2