Gentoo Archives: gentoo-commits

From: Eray Aslan <eras@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-mta/postfix/, mail-mta/postfix/files/
Date: Wed, 27 Jun 2018 06:08:02
Message-Id: 1530079650.07c745adf5d94a8696c7830763e3714c467f95e6.eras@gentoo
1 commit: 07c745adf5d94a8696c7830763e3714c467f95e6
2 Author: Eray Aslan <eras <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 27 06:07:30 2018 +0000
4 Commit: Eray Aslan <eras <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 27 06:07:30 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07c745ad
7
8 mail-mta/postfix: fix eccurve selection for libressl
9
10 Closes: https://bugs.gentoo.org/659224
11 Package-Manager: Portage-2.3.40, Repoman-2.3.9
12
13 .../postfix/files/postfix-libressl-eccurve.patch | 16 ++
14 mail-mta/postfix/postfix-3.3.1-r1.ebuild | 302 +++++++++++++++++++++
15 2 files changed, 318 insertions(+)
16
17 diff --git a/mail-mta/postfix/files/postfix-libressl-eccurve.patch b/mail-mta/postfix/files/postfix-libressl-eccurve.patch
18 new file mode 100644
19 index 00000000000..7ce14fd17ad
20 --- /dev/null
21 +++ b/mail-mta/postfix/files/postfix-libressl-eccurve.patch
22 @@ -0,0 +1,16 @@
23 +Bug: https://bugs.gentoo.org/659224
24 +$OpenBSD: patch-src_tls_tls_dh_c,v 1.2 2017/02/04 22:09:44 sthen Exp $
25 +
26 +Fix building with LibreSSL
27 +
28 +--- src/tls/tls_dh.c.orig Mon Dec 26 18:47:24 2016
29 ++++ src/tls/tls_dh.c Sat Feb 4 01:45:39 2017
30 +@@ -314,7 +314,7 @@ void tls_auto_eecdh_curves(SSL_CTX *ctx)
31 + * This is a NOP in OpenSSL 1.1.0 and later, where curves are always
32 + * auto-negotiated.
33 + */
34 +-#if OPENSSL_VERSION_NUMBER < 0x10100000UL
35 ++#if OPENSSL_VERSION_NUMBER < 0x10100000UL || defined(LIBRESSL_VERSION_NUMBER)
36 + if (SSL_CTX_set_ecdh_auto(ctx, 1) <= 0) {
37 + msg_warn("failed to enable automatic ECDHE curve selection");
38 + tls_print_errors();
39
40 diff --git a/mail-mta/postfix/postfix-3.3.1-r1.ebuild b/mail-mta/postfix/postfix-3.3.1-r1.ebuild
41 new file mode 100644
42 index 00000000000..26a77df46cd
43 --- /dev/null
44 +++ b/mail-mta/postfix/postfix-3.3.1-r1.ebuild
45 @@ -0,0 +1,302 @@
46 +# Copyright 1999-2018 Gentoo Foundation
47 +# Distributed under the terms of the GNU General Public License v2
48 +
49 +EAPI=6
50 +inherit flag-o-matic pam systemd toolchain-funcs user
51 +
52 +MY_PV="${PV/_rc/-RC}"
53 +MY_SRC="${PN}-${MY_PV}"
54 +MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
55 +RC_VER="2.7"
56 +
57 +DESCRIPTION="A fast and secure drop-in replacement for sendmail"
58 +HOMEPAGE="http://www.postfix.org/"
59 +SRC_URI="${MY_URI}/${MY_SRC}.tar.gz"
60 +
61 +LICENSE="|| ( IBM EPL-2.0 )"
62 +SLOT="0"
63 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
64 +IUSE="+berkdb cdb doc dovecot-sasl +eai hardened ldap ldap-bind libressl lmdb memcached mbox mysql nis pam postgres sasl selinux sqlite ssl"
65 +
66 +DEPEND=">=dev-libs/libpcre-3.4
67 + dev-lang/perl
68 + berkdb? ( >=sys-libs/db-3.2:* )
69 + cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r4 ) )
70 + eai? ( dev-libs/icu:= )
71 + ldap? ( net-nds/openldap )
72 + ldap-bind? ( net-nds/openldap[sasl] )
73 + lmdb? ( >=dev-db/lmdb-0.9.11 )
74 + mysql? ( virtual/mysql )
75 + nis? ( net-libs/libnsl )
76 + pam? ( virtual/pam )
77 + postgres? ( dev-db/postgresql:* )
78 + sasl? ( >=dev-libs/cyrus-sasl-2 )
79 + sqlite? ( dev-db/sqlite:3 )
80 + ssl? (
81 + !libressl? ( dev-libs/openssl:0 )
82 + libressl? ( dev-libs/libressl )
83 + )"
84 +
85 +RDEPEND="${DEPEND}
86 + memcached? ( net-misc/memcached )
87 + net-mail/mailbase
88 + !mail-mta/courier
89 + !mail-mta/esmtp
90 + !mail-mta/exim
91 + !mail-mta/mini-qmail
92 + !mail-mta/msmtp[mta]
93 + !mail-mta/netqmail
94 + !mail-mta/nullmailer
95 + !mail-mta/qmail-ldap
96 + !mail-mta/sendmail
97 + !mail-mta/opensmtpd
98 + !<mail-mta/ssmtp-2.64-r2
99 + !>=mail-mta/ssmtp-2.64-r2[mta]
100 + !net-mail/fastforward
101 + selinux? ( sec-policy/selinux-postfix )"
102 +
103 +REQUIRED_USE="ldap-bind? ( ldap sasl )"
104 +
105 +S="${WORKDIR}/${MY_SRC}"
106 +
107 +pkg_setup() {
108 + # Add postfix, postdrop user/group (bug #77565)
109 + enewgroup postfix 207
110 + enewgroup postdrop 208
111 + enewuser postfix 207 -1 /var/spool/postfix postfix,mail
112 +}
113 +
114 +src_prepare() {
115 + default
116 + sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
117 + src/util/sys_defs.h || die "sed failed"
118 + # change default paths to better comply with portage standard paths
119 + sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
120 + eapply -p0 "${FILESDIR}/${PN}-libressl.patch" \
121 + "${FILESDIR}/${PN}-libressl-runtime.patch" \
122 + "${FILESDIR}/${PN}-libressl-eccurve.patch"
123 +}
124 +
125 +src_configure() {
126 + for name in CDB LDAP LMDB MYSQL PCRE PGSQL SDBM SQLITE
127 + do
128 + local AUXLIBS_${name}=""
129 + done
130 +
131 + # Make sure LDFLAGS get passed down to the executables.
132 + local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -ldl"
133 + AUXLIBS_PCRE="$(pcre-config --libs)"
134 +
135 + use pam && mylibs="${mylibs} -lpam"
136 +
137 + if use ldap; then
138 + mycc="${mycc} -DHAS_LDAP"
139 + AUXLIBS_LDAP="-lldap -llber"
140 + fi
141 +
142 + if use mysql; then
143 + mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
144 + AUXLIBS_MYSQL="$(mysql_config --libs)"
145 + fi
146 +
147 + if use postgres; then
148 + mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
149 + AUXLIBS_PGSQL="-L$(pg_config --libdir) -lpq"
150 + fi
151 +
152 + if use sqlite; then
153 + mycc="${mycc} -DHAS_SQLITE"
154 + AUXLIBS_SQLITE="-lsqlite3 -lpthread"
155 + fi
156 +
157 + if use ssl; then
158 + mycc="${mycc} -DUSE_TLS"
159 + mylibs="${mylibs} -lssl -lcrypto"
160 + fi
161 +
162 + if use lmdb; then
163 + mycc="${mycc} -DHAS_LMDB"
164 + AUXLIBS_LMDB="-llmdb -lpthread"
165 + fi
166 +
167 + if ! use eai; then
168 + mycc="${mycc} -DNO_EAI"
169 + fi
170 +
171 + # broken. and "in other words, not supported" by upstream.
172 + # Use inet_protocols setting in main.cf
173 + #if ! use ipv6; then
174 + # mycc="${mycc} -DNO_IPV6"
175 + #fi
176 +
177 + if use sasl; then
178 + if use dovecot-sasl; then
179 + # Set dovecot as default.
180 + mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
181 + fi
182 + if use ldap-bind; then
183 + mycc="${mycc} -DUSE_LDAP_SASL"
184 + fi
185 + mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
186 + mylibs="${mylibs} -lsasl2"
187 + elif use dovecot-sasl; then
188 + mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
189 + fi
190 +
191 + if ! use nis; then
192 + mycc="${mycc} -DNO_NIS"
193 + fi
194 +
195 + if ! use berkdb; then
196 + mycc="${mycc} -DNO_DB"
197 + if use cdb; then
198 + # change default hash format from Berkeley DB to cdb
199 + mycc="${mycc} -DDEF_DB_TYPE=\\\"cdb\\\""
200 + fi
201 + fi
202 +
203 + if use cdb; then
204 + mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
205 + # Tinycdb is preferred.
206 + if has_version dev-db/tinycdb ; then
207 + einfo "Building with dev-db/tinycdb"
208 + AUXLIBS_CDB="-lcdb"
209 + else
210 + einfo "Building with dev-db/cdb"
211 + CDB_PATH="/usr/$(get_libdir)"
212 + for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
213 + AUXLIBS_CDB="${AUXLIBS_CDB} ${CDB_PATH}/${i}"
214 + done
215 + fi
216 + fi
217 +
218 + # Robin H. Johnson <robbat2@g.o> 17/Nov/2006
219 + # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
220 + mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
221 + filter-lfs-flags
222 +
223 + # Workaround for bug #76512
224 + if use hardened; then
225 + [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
226 + fi
227 +
228 + # Remove annoying C++ comment style warnings - bug #378099
229 + append-flags -Wno-comment
230 +
231 + sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
232 + sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
233 +
234 + emake makefiles shared=yes dynamicmaps=no pie=yes \
235 + shlib_directory="/usr/$(get_libdir)/postfix/MAIL_VERSION" \
236 + DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
237 + AUXLIBS_CDB="${AUXLIBS_CDB}" AUXLIBS_LDAP="${AUXLIBS_LDAP}" \
238 + AUXLIBS_LMDB="${AUXLIBS_LMDB}" AUXLIBS_MYSQL="${AUXLIBS_MYSQL}" \
239 + AUXLIBS_PCRE="${AUXLIBS_PCRE}" AUXLIBS_PGSQL="${AUXLIBS_PGSQL}" \
240 + AUXLIBS_SQLITE="${AUXLIBS_SQLITE}"
241 +}
242 +
243 +src_install () {
244 + local myconf
245 + use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
246 + html_directory=\"/usr/share/doc/${PF}/html\""
247 +
248 + LD_LIBRARY_PATH="${S}/lib" \
249 + /bin/sh postfix-install \
250 + -non-interactive \
251 + install_root="${D}" \
252 + config_directory="/etc/postfix" \
253 + manpage_directory="/usr/share/man" \
254 + command_directory="/usr/sbin" \
255 + mailq_path="/usr/bin/mailq" \
256 + newaliases_path="/usr/bin/newaliases" \
257 + sendmail_path="/usr/sbin/sendmail" \
258 + ${myconf} \
259 + || die "postfix-install failed"
260 +
261 + # Fix spool removal on upgrade
262 + rm -Rf "${D}"/var
263 + keepdir /var/spool/postfix
264 +
265 + # Install rmail for UUCP, closes bug #19127
266 + dobin auxiliary/rmail/rmail
267 +
268 + # Provide another link for legacy FSH
269 + dosym ../sbin/sendmail /usr/$(get_libdir)/sendmail
270 +
271 + # Install qshape, posttls-finger and collate
272 + dobin auxiliary/qshape/qshape.pl
273 + doman man/man1/qshape.1
274 + dobin bin/posttls-finger
275 + doman man/man1/posttls-finger.1
276 + dobin auxiliary/collate/collate.pl
277 + newdoc auxiliary/collate/README README.collate
278 +
279 + # Performance tuning tools and their manuals
280 + dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
281 + doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
282 +
283 + keepdir /etc/postfix
284 + if use mbox; then
285 + mypostconf="mail_spool_directory=/var/spool/mail"
286 + else
287 + mypostconf="home_mailbox=.maildir/"
288 + fi
289 + LD_LIBRARY_PATH="${S}/lib" \
290 + "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
291 + -e ${mypostconf} || die "postconf failed"
292 +
293 + insinto /etc/postfix
294 + newins "${FILESDIR}"/smtp.pass saslpass
295 + fperms 600 /etc/postfix/saslpass
296 +
297 + newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
298 + # do not start mysql/postgres unnecessarily - bug #359913
299 + use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
300 + use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
301 +
302 + dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
303 + use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
304 +
305 + pamd_mimic_system smtp auth account
306 +
307 + if use sasl; then
308 + insinto /etc/sasl2
309 + newins "${FILESDIR}"/smtp.sasl smtpd.conf
310 + fi
311 +
312 + # header files
313 + insinto /usr/include/postfix
314 + doins include/*.h
315 +
316 + if has_version mail-mta/postfix; then
317 + # let the sysadmin decide when to change the compatibility_level
318 + sed -i -e /^compatibility_level/"s/^/#/" "${D}"/etc/postfix/main.cf || die
319 + fi
320 +
321 + systemd_dounit "${FILESDIR}/${PN}.service"
322 +}
323 +
324 +pkg_postinst() {
325 + if [[ ! -e /etc/mail/aliases.db ]] ; then
326 + ewarn
327 + ewarn "You must edit /etc/mail/aliases to suit your needs"
328 + ewarn "and then run /usr/bin/newaliases. Postfix will not"
329 + ewarn "work correctly without it."
330 + ewarn
331 + fi
332 +
333 + # check and fix file permissions
334 + "${EROOT}"/usr/sbin/postfix set-permissions 2>/dev/null
335 +
336 + # configure tls
337 + if use ssl ; then
338 + if "${EROOT}"/usr/sbin/postfix tls all-default-client; then
339 + elog "To configure client side TLS settings:"
340 + elog "${EROOT}"usr/sbin/postfix tls enable-client
341 + fi
342 + if "${EROOT}"/usr/sbin/postfix tls all-default-server; then
343 + elog "To configure server side TLS settings:"
344 + elog "${EROOT}"usr/sbin/postfix tls enable-server
345 + fi
346 + fi
347 +}