From a5ac0d507f1f667b1096baeacd8d89266e13827b Mon Sep 17 00:00:00 2001 From: Marcus Alves Grando Date: Sun, 19 Feb 2006 23:07:01 +0000 Subject: - Turn patch fetchable again - Reorganize Makefile - portlint(1) - Use new style of rc.d script - Bump PORTREVISION PR: 93040 Submitted by: Jean Milanez Melo --- mail/smtpd/Makefile | 67 +++++++++++++---------------------------- mail/smtpd/files/patch-aa | 2 +- mail/smtpd/files/pkg-message.in | 35 +++++++++++++++++++++ mail/smtpd/files/smtpd.in | 25 +++++++++++++++ mail/smtpd/files/smtpd.sh | 11 ------- mail/smtpd/pkg-message | 33 -------------------- mail/smtpd/pkg-plist | 21 +++---------- 7 files changed, 87 insertions(+), 107 deletions(-) create mode 100644 mail/smtpd/files/pkg-message.in create mode 100644 mail/smtpd/files/smtpd.in delete mode 100644 mail/smtpd/files/smtpd.sh delete mode 100644 mail/smtpd/pkg-message (limited to 'mail/smtpd') diff --git a/mail/smtpd/Makefile b/mail/smtpd/Makefile index 82030cff24a2..1e6b32a00d3e 100644 --- a/mail/smtpd/Makefile +++ b/mail/smtpd/Makefile @@ -7,67 +7,42 @@ PORTNAME= smtpd PORTVERSION= 2.0 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= mail security -MASTER_SITES= http://www.netsw.org/net/ip/firewall/proxy/smtpd/ \ - ftp://ftp.obtuse.com/pub/smtpd/ +MASTER_SITES= http://www.netsw.org/net/ip/firewall/proxy/smtpd/ -PATCH_SITES= ${MASTER_SITES} +PATCH_SITES= ftp://ftp.42.org/pub/OLD/p/ \ + ftp://ftp.cdpa.nsysu.edu.tw/BSD/NetBSD/packages/distfiles/ PATCHFILES= patch-smtpd-2.0-RBL.gz MAINTAINER= ports@FreeBSD.org COMMENT= Obtuse smtpd/smtpfwdd, part of the Juniper firewall toolkit -# Directory where smtpd will chroot to, and put the received mail -# If you change it here, change also patches/patch-aa -SPOOLBASE= /var/smtpd - -post-patch: - @${MV} ${WRKSRC}/Makefile ${WRKSRC}/Makefile.tmp - @${SED} s+!!SPOOLBASE!!+${SPOOLBASE}+g < ${WRKSRC}/Makefile.tmp \ - > ${WRKSRC}/Makefile +USE_RC_SUBR= smtpd +SUB_FILES= pkg-message +SPOOLBASE?= /var/smtpd +PLIST_SUB+= SPOOLBASE=${SPOOLBASE} +SUB_LIST+= SPOOLBASE=${SPOOLBASE} post-install: - @${MKDIR} ${PREFIX}/share/doc/smtpd - @${INSTALL_MAN} ${WRKSRC}/README ${PREFIX}/share/doc/smtpd +.if !defined(NOPORTDOCS) + @${MKDIR} ${DOCSDIR} + @${INSTALL_MAN} ${WRKSRC}/README ${DOCSDIR} +.endif @${ECHO_CMD} "Creating spool directories..." - @${MKDIR} ${SPOOLBASE} - @${CHOWN} root:uucp ${SPOOLBASE} - @${CHMOD} 0710 ${SPOOLBASE} - - @${MKDIR} ${SPOOLBASE}/mqueue - @${CHOWN} uucp:uucp ${SPOOLBASE}/mqueue - @${CHMOD} 0700 ${SPOOLBASE}/mqueue - - @${MKDIR} ${SPOOLBASE}/etc - @${CHOWN} root:uucp ${SPOOLBASE}/etc - @${CHMOD} 0710 ${SPOOLBASE}/etc + @${INSTALL} -d -o root -g uucp -m 710 ${SPOOLBASE} + @${INSTALL} -d -o uucp -g uucp -m 700 ${SPOOLBASE}/mqueue + @${INSTALL} -d -o root -g uucp -m 710 ${SPOOLBASE}/etc .if !defined(BATCH) - @${CP} -p /etc/resolv.conf ${SPOOLBASE}/etc - @${CP} -p /etc/localtime ${SPOOLBASE}/etc + @${INSTALL_DATA} /etc/resolv.conf ${SPOOLBASE}/etc + @${INSTALL_DATA} /etc/localtime ${SPOOLBASE}/etc .endif - @${ECHO_CMD} "Copying examples..." - @${INSTALL} ${COPY} -g uucp -o root -m 0640 \ - ${WRKSRC}/antirelay_check_rules_example \ + @${INSTALL_DATA} ${WRKSRC}/antirelay_check_rules_example \ ${SPOOLBASE}/etc/antirelay_check_rules.example - @${INSTALL} ${COPY} -g uucp -o root -m 0640 \ - ${WRKSRC}/antispam_check_rules.example \ - ${SPOOLBASE}/etc - @${INSTALL} ${COPY} -g uucp -o root -m 0640 \ - ${WRKSRC}/smtpd_check_rules.example \ - ${SPOOLBASE}/etc - - @${ECHO_CMD} "Creating startup file..." - @${SED} s+!!PREFIX!!+${PREFIX}+ \ - < ${FILESDIR}/smtpd.sh \ - > ${PREFIX}/etc/rc.d/smtpd.sh - @${CHMOD} 0700 ${PREFIX}/etc/rc.d/smtpd.sh - @${CHOWN} 0:0 ${PREFIX}/etc/rc.d/smtpd.sh - - @${ECHO_CMD} "Done!" - + @${INSTALL_DATA} ${WRKSRC}/antispam_check_rules.example ${SPOOLBASE}/etc + @${INSTALL_DATA} ${WRKSRC}/smtpd_check_rules.example ${SPOOLBASE}/etc @${CAT} ${PKGMESSAGE} .include diff --git a/mail/smtpd/files/patch-aa b/mail/smtpd/files/patch-aa index f12359a1b459..4c94abe05511 100644 --- a/mail/smtpd/files/patch-aa +++ b/mail/smtpd/files/patch-aa @@ -14,7 +14,7 @@ # # The chroot directory -SPOOLDIR = /usr/spool/smtpd -+SPOOLDIR = !!SPOOLBASE!! ++SPOOLDIR = ${SPOOLBASE} # Where to store messages, relative to SPOOLDIR above. -SPOOLSUBDIR = . +SPOOLSUBDIR = mqueue diff --git a/mail/smtpd/files/pkg-message.in b/mail/smtpd/files/pkg-message.in new file mode 100644 index 000000000000..ae3b6147bbda --- /dev/null +++ b/mail/smtpd/files/pkg-message.in @@ -0,0 +1,35 @@ +To enable smtpfwdd via rc.d script please add smtpd_enable="YES" +in your rc.conf. + +You must follow the next steps, as root, in order to finish the installation: + +1) Make sure uucp is a trusted user to sendmail. + To do this, check if your sendmail.cf has a line with "Tuucp" + +2) Disable sendmail from answering smtp requests, but make sure it + handles queue delivering. You have two choices: + + a) Start sendmail without the "-bd" flag, but with the "-q30m" one. + b) Do not start sendmail as a daemon, and add an entry in /etc/crontab + to run sendmail -q when needed. For example, add the following line + to your /etc/crontab: +*/30 * * * * root /usr/sbin/sendmail -q + + In any case, you'll most likely have to edit /etc/rc.conf to change + sendmail configuration. + +3) Add smtpd to your inetd.conf: + smtp stream tcp nowait root %%PREFIX%%/sbin/smtpd smtpd + +4) smtpd runs in a chrooted environment, so you must feed this environment + with any configuration file it needs. Make a copy of /etc/resolv.conf + and /etc/localtime to %%SPOOLBASE%%/etc. If you ever change any of these + files, remember to change the copies also. Do not make a symbolic + link, as it will not work in the chrooted environment. + +5) Create your own %%SPOOLBASE%%/etc/smtpd_check_rules. There are some + examples in that directory. If have any problem, take a look at + http://www.obtuse.com/juniper-docs/man/smtpd_address_check.html. + +6) Reboot ! (Or restart all those daemons manually, if you know how :^) ) + diff --git a/mail/smtpd/files/smtpd.in b/mail/smtpd/files/smtpd.in new file mode 100644 index 000000000000..93b2a5595d99 --- /dev/null +++ b/mail/smtpd/files/smtpd.in @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: smtpd +# REQUIRE: DAEMON +# +# Add the following lines to /etc/rc.conf to run smtpd: +# +# smtpd_enable (bool): Set it to "YES" to enable smtpd. +# Default is "NO". +# + +. %%RC_SUBR%% + +name="smtpd" +rcvar=${name}_enable + +command=%%PREFIX%%/sbin/smtpfwdd + +load_rc_config ${name} + +: ${smtpd_enable="NO"} + +run_rc_command "$1" diff --git a/mail/smtpd/files/smtpd.sh b/mail/smtpd/files/smtpd.sh deleted file mode 100644 index 3aaf433a31d4..000000000000 --- a/mail/smtpd/files/smtpd.sh +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh - -if [ $# -eq 0 -o "$1" = "start" ]; then - if [ -x !!PREFIX!!/sbin/smtpfwdd ] ; then - !!PREFIX!!/sbin/smtpfwdd - echo -n " smtpfwdd" - fi -fi -if [ "$1" = "stop" ]; then - killall smtpfwdd -fi diff --git a/mail/smtpd/pkg-message b/mail/smtpd/pkg-message deleted file mode 100644 index c993abfb7783..000000000000 --- a/mail/smtpd/pkg-message +++ /dev/null @@ -1,33 +0,0 @@ - -You must follow the next steps, as root, in order to finish the installation: - -1) Make sure uucp is a trusted user to sendmail. - To do this, check if your sendmail.cf has a line with "Tuucp" - -2) Disable sendmail from answering smtp requests, but make sure it - handles queue delivering. You have two choices: - - a) Start sendmail without the "-bd" flag, but with the "-q30m" one. - b) Do not start sendmail as a daemon, and add an entry in /etc/crontab - to run sendmail -q when needed. For example, add the following line - to your /etc/crontab: -*/30 * * * * root /usr/sbin/sendmail -q - - In any case, you'll most likely have to edit /etc/rc.conf to change - sendmail configuration. - -3) Add smtpd to your inetd.conf: - smtp stream tcp nowait root /usr/local/sbin/smtpd smtpd - -4) smtpd runs in a chrooted environment, so you must feed this environment - with any configuration file it needs. Make a copy of /etc/resolv.conf - and /etc/localtime to /var/smtpd/etc. If you ever change any of these - files, remember to change the copies also. Do not make a symbolic - link, as it will not work in the chrooted environment. - -5) Create your own /var/smtpd/etc/smtpd_check_rules. There are some - examples in that directory. If have any problem, take a look at - http://www.obtuse.com/juniper-docs/man/smtpd_address_check.html. - -6) Reboot ! (Or restart all those daemons manually, if you know how :^) ) - diff --git a/mail/smtpd/pkg-plist b/mail/smtpd/pkg-plist index c35052e54952..6fedc0834937 100644 --- a/mail/smtpd/pkg-plist +++ b/mail/smtpd/pkg-plist @@ -1,21 +1,10 @@ sbin/smtpd sbin/smtpfwdd -etc/rc.d/smtpd.sh -share/doc/smtpd/README -@dirrm share/doc/smtpd -@exec mkdir /var/smtpd -@exec chown root:uucp /var/smtpd -@exec chmod 0710 /var/smtpd -@cwd /var/smtpd -@exec mkdir mqueue -@exec chown uucp:uucp mqueue -@exec chmod 0700 mqueue -@exec mkdir etc -@exec chown root:uucp etc -@exec chmod 0710 etc -@exec cp -p /etc/resolv.conf etc -@exec cp -p /etc/localtime etc +%%DOCSDIR%%/README +@dirrm %%DOCSDIR%% +@cwd %%SPOOLBASE%% etc/antirelay_check_rules.example etc/antispam_check_rules.example etc/smtpd_check_rules.example -@unexec echo "You may want to remove /var/smtpd manually" +@dirrmtry mqueue +@unexec echo "You may want to remove %%SPOOLBASE%% manually" -- cgit v1.2.3