1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-09 06:51:44 +00:00

- Update to 201602131907[1]

- Switch to using DISTVERSIONSUFFIX[1]
- Add SSL_PORT option to specify if OpenSSL from ports is to be used[1]
- Enforce SSL_PORT for 9.x[1]
- Cleanup OPTIONS[1]
- Remove unnecessary diffs[1]
- Add diff to handle long usernames (from mail/opensmtpd)
- Mark smtpctl binary as setgid for offline mail queuing to work
  (reported/committed upstream)
- Explicitly create symlink for makemap, as mailwrapper does not seem
  to manage the symlink
- Fix rc.d script as process name has been changed

PR:		206357
Submitted by:	Andrey Fesenko <andrey at bsdnir dot info>[1]
This commit is contained in:
Ashish SHUKLA 2016-02-22 12:21:22 +00:00
parent a4d9b13bef
commit 28282de23b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=409336
9 changed files with 120 additions and 48 deletions

View File

@ -2,13 +2,13 @@
# $FreeBSD$
PORTNAME= opensmtpd
PORTVERSION= 201506112227
PORTVERSION= 201602131907
DISTVERSIONSUFFIX= p1
PORTEPOCH= 1
CATEGORIES= mail
MASTER_SITES= http://www.opensmtpd.org/archives/ \
http://distfiles.pirateparty.in/ashish/
PKGNAMESUFFIX= -devel
DISTNAME= ${PORTNAME}-${PORTVERSION}p1
MAINTAINER= ashish@FreeBSD.org
COMMENT= Security- and simplicity-focused SMTP server from OpenBSD
@ -18,17 +18,24 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libevent.so:${PORTSDIR}/devel/libevent2
OPTIONS_DEFINE= CA_BUNDLE LIBASR MAILERCONF
OPTIONS_DEFINE= CA_BUNDLE LIBASR MAILERCONF PAM SSL_PORT
OPTIONS_DEFAULT= CA_BUNDLE PAM
CA_BUNDLE_DESC= Install CA bundle for OpenSSL
LIBASR_DESC= Use stable version of libasr
CA_BUNDLE_DESC= Install CA bundle for SSL
LIBASR_DESC= Use stable version of libasr
MAILERCONF_DESC= Activate OpenSMTPD in mailer.conf(5)
SSL_PORT_DESC= SSL/TLS support via OpenSSL/LibreSSL from port
USES= cpe libtool
USE_OPENSSL= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-libevent-dir=${LOCALBASE} --sysconfdir=${PREFIX}/etc/mail/ \
--with-mailwrapper --with-ssl-dir=${OPENSSLBASE} --enable-table-db
CONFIGURE_ARGS= --with-table-db \
--sysconfdir=${PREFIX}/etc/mail/ \
--with-libasr=${LOCALBASE} \
--with-libevent=${LOCALBASE} \
--with-libssl=${OPENSSLBASE} \
--with-group-queue=${GROUPS}
USE_RC_SUBR= smtpd
SUB_FILES= pkg-install pkg-deinstall
@ -38,18 +45,29 @@ CONFLICTS_INSTALL= postfix-[0-9]* sendmail-[0-9]* opensmtpd-[0-9]*
USERS= _smtpd _smtpq
GROUPS= _smtpd
PLIST_SUB+= SMTPQ_GROUP=${GROUPS}
OPTIONS_SUB= yes
LIBASR_LIB_DEPENDS_OFF= libasr.so:${PORTSDIR}/dns/libasr-devel
LIBASR_LIB_DEPENDS= libasr.so:${PORTSDIR}/dns/libasr
CA_BUNDLE_CONFIGURE_ON= --with-ca-file=${LOCALBASE}/share/certs/ca-root-nss.crt
CA_BUNDLE_CONFIGURE_WITH= path-CAfile=${LOCALBASE}/share/certs/ca-root-nss.crt
CA_BUNDLE_RUN_DEPENDS= ${LOCALBASE}/share/certs/ca-root-nss.crt:${PORTSDIR}/security/ca_root_nss
USE_OPENSSL= yes
WITH_OPENSSL_PORT= yes
PAM_CONFIGURE_WITH= auth-pam=smtpd
post-deinstall:
@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-DEINSTALL
.include <bsd.port.options.mk>
.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1000000 && ! ${PORT_OPTIONS:MSSL_PORT}
WITH_OPENSSL_PORT= yes
.endif
.if ${PORT_OPTIONS:MSSL_PORT}
WITH_OPENSSL_PORT= yes
.endif
post-install:
@${LN} -sf ${PREFIX}/sbin/smtpctl ${STAGEDIR}${PREFIX}/libexec/opensmtpd/makemap
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
SHA256 (opensmtpd-201506112227p1.tar.gz) = f938796d2655f554e695adff6a3f3bbc4b1326912327b98acc7e29f705b9cf63
SIZE (opensmtpd-201506112227p1.tar.gz) = 706259
SHA256 (opensmtpd-201602131907p1.tar.gz) = 0fd10cff59719523e41fe489ff5c1490c2898a2ce47b98e4bf39f07ba3562252
SIZE (opensmtpd-201602131907p1.tar.gz) = 686726

View File

@ -1,6 +1,6 @@
--- mk/smtpd/Makefile.in.orig 2015-06-20 04:17:57.656811000 +0000
+++ mk/smtpd/Makefile.in 2015-06-20 04:19:53.711103000 +0000
@@ -1366,11 +1366,7 @@ install-exec-hook: $(CONFIGFILES) $(MANP
--- mk/smtpd/Makefile.in.orig 2016-02-07 00:04:24 UTC
+++ mk/smtpd/Makefile.in
@@ -1339,12 +1339,7 @@ install-exec-hook: $(CONFIGFILES) $(MANP
$(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)5
$(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8
@ -9,7 +9,8 @@
- else \
- echo "$(DESTDIR)$(sysconfdir)/smtpd.conf already exists, install will not overwrite"; \
- fi
+ $(INSTALL) -m 644 smtpd.conf.out $(DESTDIR)$(sysconfdir)/smtpd.conf.sample
-
+ $(INSTALL) -m 644 smtpd.conf.out $(DESTDIR)$(sysconfdir)/smtpd.conf.sample
$(INSTALL) -m 644 aliases.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/aliases.5
$(INSTALL) -m 644 forward.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/forward.5
$(INSTALL) -m 644 table.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/table.5

View File

@ -1,17 +0,0 @@
Fix for a build failure, taken from
http://article.gmane.org/gmane.mail.opensmtpd.general/2291
--- openbsd-compat/defines.h.orig
+++ openbsd-compat/defines.h
@@ -79,6 +79,10 @@
# define MAXHOSTNAMELEN 64
#endif
+#ifndef HOST_NAME_MAX
+# define HOST_NAME_MAX 255
+#endif
+
#ifndef LOGIN_NAME_MAX
# define LOGIN_NAME_MAX 9
#endif

View File

@ -0,0 +1,52 @@
diff --git a/smtpd/smtp_session.c b/smtpd/smtp_session.c
index 3a0ca2a..404ee50 100644
--- smtpd/smtp_session.c
+++ smtpd/smtp_session.c
@@ -84,6 +84,7 @@ enum session_flags {
SF_BADINPUT = 0x0080,
SF_FILTERCONN = 0x0100,
SF_FILTERDATA = 0x0200,
+ SF_USERTOOLONG = 0x0400,
};
enum message_flags {
@@ -990,6 +991,15 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg)
s = tree_xpop(&wait_parent_auth, reqid);
strnvis(user, s->username, sizeof user, VIS_WHITE | VIS_SAFE);
+
+ if (s->flags & SF_USERTOOLONG) {
+ log_info("smtp-in: sesson %016"PRIx64
+ ": auth failed because username too long",
+ s->id);
+ s->flags &= (~SF_USERTOOLONG);
+ success = LKA_PERMFAIL;
+ }
+
if (success == LKA_OK) {
log_info("smtp-in: session %016"PRIx64
": authentication successful for user %s ",
@@ -1929,7 +1939,7 @@ smtp_rfc4954_auth_plain(struct smtp_session *s, char *arg)
user++; /* skip NUL */
if (strlcpy(s->username, user, sizeof(s->username))
>= sizeof(s->username))
- goto abort;
+ s->flags |= SF_USERTOOLONG;
pass = memchr(user, '\0', len - (user - buf));
if (pass == NULL || pass >= buf + len - 2)
@@ -1969,9 +1979,12 @@ smtp_rfc4954_auth_login(struct smtp_session *s, char *arg)
case STATE_AUTH_USERNAME:
memset(s->username, 0, sizeof(s->username));
- if (base64_decode(arg, (unsigned char *)s->username,
- sizeof(s->username) - 1) == -1)
+ if (base64_decode(arg, (unsigned char *)buf,
+ sizeof(buf) - 1) == -1)
goto abort;
+ if (strlcpy(s->username, buf, sizeof(s->username))
+ >= sizeof(s->username))
+ s->flags |= SF_USERTOOLONG;
smtp_enter_state(s, STATE_AUTH_PASSWORD);
smtp_reply(s, "334 UGFzc3dvcmQ6");

View File

@ -9,8 +9,8 @@ if [ "$TARGET" = POST-INSTALL -a -z "%%MAILERCONF%%" ]; then
sendmail %%PREFIX%%/sbin/smtpctl
send-mail %%PREFIX%%/sbin/smtpctl
mailq %%PREFIX%%/sbin/smtpctl
makemap %%PREFIX%%/libexec/opensmtpd/makemap
newaliases %%PREFIX%%/libexec/opensmtpd/makemap
makemap %%PREFIX%%/sbin/smtpctl
newaliases %%PREFIX%%/sbin/smtpctl
EOF
fi

View File

@ -0,0 +1,18 @@
If you are upgrading from OpenSMTPD version 201303011853 or earlier, please
follow the procedure below to update the permissions on the OpenSMTPD
spool directories:
1. Stop 'smtpd' service:
# %%PREFIX%%/etc/rc.d/smtpd stop
2. Update permissions:
# chown -R _smtpq:wheel /var/spool/smtpd/corrupt
# chown -R _smtpq:wheel /var/spool/smtpd/purge
# chown -R _smtpq:wheel /var/spool/smtpd/queue
# chown -R _smtpq:wheel /var/spool/smtpd/temporary
3. Start 'smtpd' service:
# %%PREFIX%%/etc/rc.d/smtpd start

View File

@ -20,7 +20,7 @@
check_process()
{
/bin/pgrep -j none -f 'smtpd: \[priv\]'
/bin/pgrep -j none -f "^$smtpd_procname\$"
}
name="smtpd"

View File

@ -1,15 +1,15 @@
etc/mail/smtpd.conf.sample
@sample etc/mail/smtpd.conf.sample
libexec/opensmtpd/encrypt
libexec/opensmtpd/mail.local
libexec/opensmtpd/makemap
libexec/opensmtpd/encrypt
sbin/smtpctl
@(,%%SMTPQ_GROUP%%,2555) sbin/smtpctl
sbin/smtpd
man/man5/aliases.5.gz
man/man5/forward.5.gz
man/man5/smtpd.conf.5.gz
man/man5/table.5.gz
man/man8/makemap.8.gz
man/man8/newaliases.8.gz
man/man8/sendmail.8.gz
man/man8/smtpd.8.gz
man/man8/makemap.8.gz
man/man8/smtpctl.8.gz
man/man5/table.5.gz
man/man5/smtpd.conf.5.gz
man/man5/forward.5.gz
man/man5/aliases.5.gz
man/man8/smtpd.8.gz