add an rc script for postfix and modify postfix-enable to tell the

user to disable sendmail compeltely to stop abusing that script to starting
up postfix.

the script itself also checks if postfix is actually enabled and if it's not
it is going to fail to avoid conflicts with mailer.conf
This commit is contained in:
robert 2011-07-15 18:10:18 +00:00
parent f714a9033a
commit 3443bcfff4
8 changed files with 66 additions and 10 deletions

View File

@ -1,6 +1,7 @@
# $OpenBSD: Makefile,v 1.217 2011/07/07 16:22:30 sthen Exp $
# $OpenBSD: Makefile,v 1.218 2011/07/15 18:10:18 robert Exp $
VERSION= 2.9-20110706
REVISION= 0
MASTER_SITES= ${MASTER_SITE_POSTFIX:=experimental/}

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $OpenBSD: postfix-enable,v 1.5 2006/07/05 06:21:09 jakob Exp $
# $OpenBSD: postfix-enable,v 1.6 2011/07/15 18:10:18 robert Exp $
if [ -f /etc/mailer.conf.postfix ]; then
if [ -f /etc/mailer.conf ]; then
@ -10,12 +10,15 @@ if [ -f /etc/mailer.conf.postfix ]; then
mv -f /etc/mailer.conf.postfix /etc/mailer.conf
echo "postfix /etc/mailer.conf enabled"
echo ""
echo "NOTE: do not forget to add sendmail_flags=\"-bd\" to"
echo " /etc/rc.conf.local to startup postfix correctly."
echo "NOTE: do not forget to add sendmail_flags=NO to"
echo " /etc/rc.conf.local to disable sendmail."
echo ""
echo "NOTE: do not forget to add \"-a /var/spool/postfix/dev/log\" to"
echo " syslogd_flags in /etc/rc.conf.local and restart syslogd."
echo ""
echo "NOTE: do not forget to add postfix to pkg_scripts in"
echo " /etc/rc.conf.local to start postfix automatically."
echo ""
echo "NOTE: do not forget to remove the \"sendmail clientmqueue runner\""
echo " from root's crontab."
else

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.57 2011/05/03 23:12:00 sthen Exp $
@comment $OpenBSD: PLIST,v 1.58 2011/07/15 18:10:18 robert Exp $
@conflict postfix-*
@newgroup _postfix:507
@newgroup _postdrop:508
@ -322,3 +322,4 @@ share/examples/postfix/transport
share/examples/postfix/virtual
@exec-add PREFIX=%D SYSCONFDIR=${SYSCONFDIR} ${PREFIX}/sbin/postfix-install install
@exec-update PREFIX=%D SYSCONFDIR=${SYSCONFDIR} ${PREFIX}/sbin/postfix-install upgrade
@rcscript ${RCDIR}/postfix

View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# $OpenBSD: postfix.rc,v 1.1 2011/07/15 18:10:18 robert Exp $
daemon="${TRUEPREFIX}/libexec/postfix/master"
. /etc/rc.d/rc.subr
pexp="${daemon}"
rc_pre() {
[ ! -f /etc/mailer.conf.postfix ]
}
rc_start() {
${TRUEPREFIX}/sbin/postfix ${daemon_flags} start
}
rc_stop() {
${TRUEPREFIX}/sbin/postfix stop
}
rc_cmd $1

View File

@ -1,6 +1,7 @@
# $OpenBSD: Makefile,v 1.139 2011/07/07 16:23:07 sthen Exp $
# $OpenBSD: Makefile,v 1.140 2011/07/15 18:10:18 robert Exp $
VERSION= 2.8.4
REVISION= 0
MASTER_SITES= ${MASTER_SITE_POSTFIX:=official/}

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $OpenBSD: postfix-enable,v 1.8 2008/02/01 16:37:53 jakob Exp $
# $OpenBSD: postfix-enable,v 1.9 2011/07/15 18:10:18 robert Exp $
if [ -f /etc/mailer.conf.postfix ]; then
if [ -f /etc/mailer.conf ]; then
@ -10,12 +10,15 @@ if [ -f /etc/mailer.conf.postfix ]; then
mv -f /etc/mailer.conf.postfix /etc/mailer.conf
echo "postfix /etc/mailer.conf enabled"
echo ""
echo "NOTE: do not forget to add sendmail_flags=\"-bd\" to"
echo " /etc/rc.conf.local to startup postfix correctly."
echo "NOTE: do not forget to add sendmail_flags=NO to"
echo " /etc/rc.conf.local to disable sendmail."
echo ""
echo "NOTE: do not forget to add \"-a /var/spool/postfix/dev/log\" to"
echo " syslogd_flags in /etc/rc.conf.local and restart syslogd."
echo ""
echo "NOTE: do not forget to add postfix to pkg_scripts in"
echo " /etc/rc.conf.local to start postfix automatically."
echo ""
echo "NOTE: do not forget to remove the \"sendmail clientmqueue runner\""
echo " from root's crontab."
else

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.26 2011/05/03 23:12:00 sthen Exp $
@comment $OpenBSD: PLIST,v 1.27 2011/07/15 18:10:18 robert Exp $
@conflict postfix-*
@newgroup _postfix:507
@newgroup _postdrop:508
@ -322,3 +322,4 @@ share/examples/postfix/transport
share/examples/postfix/virtual
@exec-add PREFIX=%D SYSCONFDIR=${SYSCONFDIR} ${PREFIX}/sbin/postfix-install install
@exec-update PREFIX=%D SYSCONFDIR=${SYSCONFDIR} ${PREFIX}/sbin/postfix-install upgrade
@rcscript ${RCDIR}/postfix

View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# $OpenBSD: postfix.rc,v 1.1 2011/07/15 18:10:19 robert Exp $
daemon="${TRUEPREFIX}/libexec/postfix/master"
. /etc/rc.d/rc.subr
pexp="${daemon}"
rc_pre() {
[ ! -f /etc/mailer.conf.postfix ]
}
rc_start() {
${TRUEPREFIX}/sbin/postfix ${daemon_flags} start
}
rc_stop() {
${TRUEPREFIX}/sbin/postfix stop
}
rc_cmd $1