Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/nginx/
Date: Tue, 31 Jan 2017 17:51:11
Message-Id: 1485884951.f37bc910a241a557cf1386c59907dc75a2d30e6e.whissi@gentoo
1 commit: f37bc910a241a557cf1386c59907dc75a2d30e6e
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 31 17:49:11 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 31 17:49:11 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f37bc910
7
8 www-servers/nginx: Bump nginx (stable) to v1.10.3
9
10 Package-Manager: Portage-2.3.3, Repoman-2.3.1
11
12 www-servers/nginx/Manifest | 1 +
13 www-servers/nginx/nginx-1.10.3.ebuild | 989 ++++++++++++++++++++++++++++++++++
14 2 files changed, 990 insertions(+)
15
16 diff --git a/www-servers/nginx/Manifest b/www-servers/nginx/Manifest
17 index e97451e..6f1c342 100644
18 --- a/www-servers/nginx/Manifest
19 +++ b/www-servers/nginx/Manifest
20 @@ -1,5 +1,6 @@
21 DIST modsecurity-2.9.1.tar.gz 4261212 SHA256 958cc5a7a7430f93fac0fd6f8b9aa92fc1801efce0cda797d6029d44080a9b24 SHA512 374733cbfc26e53d95b78c8f268a4e465d838163e9893fc24e33a9d272b114f1b287147bab6d0289575074cbbd94f48983e23fa59832cbcb32950046cea59269 WHIRLPOOL 5f41bebf032f8a269412d104b7632a06af4d4c495658c9cd1ebf69b82c10ce1bbcb34b9dd159a7b00e57348714a5e93ad3db19701dda51479accd3a9dc79a9cb
22 DIST nginx-1.10.2.tar.gz 910812 SHA256 1045ac4987a396e2fa5d0011daf8987b612dd2f05181b67507da68cbe7d765c2 SHA512 f2d5a4fbabaf9333bae46461bcbe3dbcc5ff7e8f8c7a5dead3063e3d59c9ec15dc85262a23ca7d693db45a50ec98a70fb216b3da9872ee23d57b6bfaf064876e WHIRLPOOL 7e819f43a68de49d3cceb3e5ec81eef6872859df0abca2be00fb73c8779c2716b6997ea5f8cadb93af195d9f4d07a4404f51e0752dd881628de93a0c0289aea7
23 +DIST nginx-1.10.3.tar.gz 911509 SHA256 75020f1364cac459cb733c4e1caed2d00376e40ea05588fb8793076a4c69dd90 SHA512 25cddbe5c419700aeca41bff3be5b7c3accfb38ad846ec8d91d81ab7c15f10db719f02d9263edf1fa12f59805ff7001b62864dc2885370b24afeea1d7d2afbbf WHIRLPOOL 1ebf540d49d28a853a9221a558b53d28e2e7dfddf345e433baa4c2b819f6e1fe34528b4680387147c73271d3837529a4452e53b863dff5d29772c2b0a75e0ba6
24 DIST nginx-1.11.6.tar.gz 960331 SHA256 3153abbb518e2d9c032e1b127da3dc0028ad36cd4679e5f3be0b8afa33bc85bd SHA512 1969f527d4554a976d14e82c2297c519a0d0d82a9fbd3cc703ab42a23067c7fcf101ddf16f1abff374c71f37969fd7c58d2a344c57566538b821acc32cd3d979 WHIRLPOOL 67ed24c25b20f6d94f3a0602946f750b4efafd79d3a093a35fdf370a20377abcc2a54c00fcd5e7bc54305515da9234fb2f192c744a7fb59c4bbdee2ba0c0f626
25 DIST nginx-1.11.8.tar.gz 964918 SHA256 53aef3715d79015314c2dcb18f2b185a0c64368cc01b30bdf0737a215f666b34 SHA512 4bbecf17579022cc925af8808554983c57e4f438edc8f987751413f0a023267a4766edc8321cbbe8a8b675f7e86d8a2cba76bd52236c8d9509b2b301ab349ffa WHIRLPOOL a30ad4cdc0b74e0f860938942caeee961759ceabae8735725a989db29702b366fb285079a992cbc681ec3fd157ef6f8907f6a3eac13a8af302daad94ca867738
26 DIST nginx-1.11.9.tar.gz 965463 SHA256 dc22b71f16b551705930544dc042f1ad1af2f9715f565187ec22c7a4b2625748 SHA512 95247d5db3e23a0ea22686cc3fe4295f8854948a6f168a783082fdbb2acbecdad61cd9c8cadd84c1f74c1e87becdca8d6664622ff9cebc72687f20b29cc09fd0 WHIRLPOOL 39a56073e359aac716e0a9ff672ee89b97205c281b53be97920c098aea9b25635e59a5ea0e3a7cb4ba79d43afc8ed3942cd34840773dd1e472101c9ab6ac72a4
27
28 diff --git a/www-servers/nginx/nginx-1.10.3.ebuild b/www-servers/nginx/nginx-1.10.3.ebuild
29 new file mode 100644
30 index 00000000..6d538c8
31 --- /dev/null
32 +++ b/www-servers/nginx/nginx-1.10.3.ebuild
33 @@ -0,0 +1,989 @@
34 +# Copyright 1999-2017 Gentoo Foundation
35 +# Distributed under the terms of the GNU General Public License v2
36 +# $Id$
37 +
38 +EAPI=6
39 +
40 +# Maintainer notes:
41 +# - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
42 +# - any http-module activates the main http-functionality and overrides USE=-http
43 +# - keep the following requirements in mind before adding external modules:
44 +# * alive upstream
45 +# * sane packaging
46 +# * builds cleanly
47 +# * does not need a patch for nginx core
48 +# - TODO: test the google-perftools module (included in vanilla tarball)
49 +
50 +# prevent perl-module from adding automagic perl DEPENDs
51 +GENTOO_DEPEND_ON_PERL="no"
52 +
53 +# devel_kit (https://github.com/simpl/ngx_devel_kit, BSD license)
54 +DEVEL_KIT_MODULE_PV="0.3.0"
55 +DEVEL_KIT_MODULE_P="ngx_devel_kit-${DEVEL_KIT_MODULE_PV}-r1"
56 +DEVEL_KIT_MODULE_URI="https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_MODULE_PV}.tar.gz"
57 +DEVEL_KIT_MODULE_WD="${WORKDIR}/ngx_devel_kit-${DEVEL_KIT_MODULE_PV}"
58 +
59 +# http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
60 +HTTP_UPLOAD_PROGRESS_MODULE_PV="0.9.2"
61 +HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_http_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}-r1"
62 +HTTP_UPLOAD_PROGRESS_MODULE_URI="https://github.com/masterzen/nginx-upload-progress-module/archive/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}.tar.gz"
63 +HTTP_UPLOAD_PROGRESS_MODULE_WD="${WORKDIR}/nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
64 +
65 +# http_headers_more (https://github.com/agentzh/headers-more-nginx-module, BSD license)
66 +HTTP_HEADERS_MORE_MODULE_PV="0.32"
67 +HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}"
68 +HTTP_HEADERS_MORE_MODULE_URI="https://github.com/agentzh/headers-more-nginx-module/archive/v${HTTP_HEADERS_MORE_MODULE_PV}.tar.gz"
69 +HTTP_HEADERS_MORE_MODULE_WD="${WORKDIR}/headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_PV}"
70 +
71 +# http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, https://github.com/FRiCKLE/ngx_cache_purge, BSD-2 license)
72 +HTTP_CACHE_PURGE_MODULE_PV="2.3"
73 +HTTP_CACHE_PURGE_MODULE_P="ngx_http_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
74 +HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}.tar.gz"
75 +HTTP_CACHE_PURGE_MODULE_WD="${WORKDIR}/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
76 +
77 +# http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
78 +HTTP_SLOWFS_CACHE_MODULE_PV="1.10"
79 +HTTP_SLOWFS_CACHE_MODULE_P="ngx_http_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
80 +HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}.tar.gz"
81 +HTTP_SLOWFS_CACHE_MODULE_WD="${WORKDIR}/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
82 +
83 +# http_fancyindex (https://github.com/aperezdc/ngx-fancyindex, BSD license)
84 +HTTP_FANCYINDEX_MODULE_PV="0.4.1"
85 +HTTP_FANCYINDEX_MODULE_P="ngx_http_fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
86 +HTTP_FANCYINDEX_MODULE_URI="https://github.com/aperezdc/ngx-fancyindex/archive/v${HTTP_FANCYINDEX_MODULE_PV}.tar.gz"
87 +HTTP_FANCYINDEX_MODULE_WD="${WORKDIR}/ngx-fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
88 +
89 +# http_lua (https://github.com/openresty/lua-nginx-module, BSD license)
90 +HTTP_LUA_MODULE_PV="0.10.7"
91 +HTTP_LUA_MODULE_P="ngx_http_lua-${HTTP_LUA_MODULE_PV}"
92 +HTTP_LUA_MODULE_URI="https://github.com/openresty/lua-nginx-module/archive/v${HTTP_LUA_MODULE_PV}.tar.gz"
93 +HTTP_LUA_MODULE_WD="${WORKDIR}/lua-nginx-module-${HTTP_LUA_MODULE_PV}"
94 +
95 +# http_auth_pam (https://github.com/stogh/ngx_http_auth_pam_module/, http://web.iti.upv.es/~sto/nginx/, BSD-2 license)
96 +HTTP_AUTH_PAM_MODULE_PV="1.5.1"
97 +HTTP_AUTH_PAM_MODULE_P="ngx_http_auth_pam-${HTTP_AUTH_PAM_MODULE_PV}"
98 +HTTP_AUTH_PAM_MODULE_URI="https://github.com/stogh/ngx_http_auth_pam_module/archive/v${HTTP_AUTH_PAM_MODULE_PV}.tar.gz"
99 +HTTP_AUTH_PAM_MODULE_WD="${WORKDIR}/ngx_http_auth_pam_module-${HTTP_AUTH_PAM_MODULE_PV}"
100 +
101 +# http_upstream_check (https://github.com/yaoweibin/nginx_upstream_check_module, BSD license)
102 +HTTP_UPSTREAM_CHECK_MODULE_PV="0.3.0-10-gf3bdb7b"
103 +HTTP_UPSTREAM_CHECK_MODULE_P="ngx_http_upstream_check-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
104 +HTTP_UPSTREAM_CHECK_MODULE_URI="https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${HTTP_UPSTREAM_CHECK_MODULE_PV}.tar.gz"
105 +HTTP_UPSTREAM_CHECK_MODULE_WD="${WORKDIR}/nginx_upstream_check_module-f3bdb7b85a194e2ad58e3c306c1d021ee76da2f5"
106 +
107 +# http_metrics (https://github.com/zenops/ngx_metrics, BSD license)
108 +HTTP_METRICS_MODULE_PV="0.1.1"
109 +HTTP_METRICS_MODULE_P="ngx_metrics-${HTTP_METRICS_MODULE_PV}"
110 +HTTP_METRICS_MODULE_URI="https://github.com/madvertise/ngx_metrics/archive/v${HTTP_METRICS_MODULE_PV}.tar.gz"
111 +HTTP_METRICS_MODULE_WD="${WORKDIR}/ngx_metrics-${HTTP_METRICS_MODULE_PV}"
112 +
113 +# naxsi-core (https://github.com/nbs-system/naxsi, GPLv2+)
114 +HTTP_NAXSI_MODULE_PV="0.55.1"
115 +HTTP_NAXSI_MODULE_P="ngx_http_naxsi-${HTTP_NAXSI_MODULE_PV}"
116 +HTTP_NAXSI_MODULE_URI="https://github.com/nbs-system/naxsi/archive/${HTTP_NAXSI_MODULE_PV}.tar.gz"
117 +HTTP_NAXSI_MODULE_WD="${WORKDIR}/naxsi-${HTTP_NAXSI_MODULE_PV}/naxsi_src"
118 +
119 +# nginx-rtmp-module (https://github.com/arut/nginx-rtmp-module, BSD license)
120 +RTMP_MODULE_PV="1.1.10"
121 +RTMP_MODULE_P="ngx_rtmp-${RTMP_MODULE_PV}"
122 +RTMP_MODULE_URI="https://github.com/arut/nginx-rtmp-module/archive/v${RTMP_MODULE_PV}.tar.gz"
123 +RTMP_MODULE_WD="${WORKDIR}/nginx-rtmp-module-${RTMP_MODULE_PV}"
124 +
125 +# nginx-dav-ext-module (https://github.com/arut/nginx-dav-ext-module, BSD license)
126 +HTTP_DAV_EXT_MODULE_PV="0.0.3"
127 +HTTP_DAV_EXT_MODULE_P="ngx_http_dav_ext-${HTTP_DAV_EXT_MODULE_PV}"
128 +HTTP_DAV_EXT_MODULE_URI="https://github.com/arut/nginx-dav-ext-module/archive/v${HTTP_DAV_EXT_MODULE_PV}.tar.gz"
129 +HTTP_DAV_EXT_MODULE_WD="${WORKDIR}/nginx-dav-ext-module-${HTTP_DAV_EXT_MODULE_PV}"
130 +
131 +# echo-nginx-module (https://github.com/openresty/echo-nginx-module, BSD license)
132 +HTTP_ECHO_MODULE_PV="0.60"
133 +HTTP_ECHO_MODULE_P="ngx_http_echo-${HTTP_ECHO_MODULE_PV}"
134 +HTTP_ECHO_MODULE_URI="https://github.com/openresty/echo-nginx-module/archive/v${HTTP_ECHO_MODULE_PV}.tar.gz"
135 +HTTP_ECHO_MODULE_WD="${WORKDIR}/echo-nginx-module-${HTTP_ECHO_MODULE_PV}"
136 +
137 +# mod_security for nginx (https://modsecurity.org/, Apache-2.0)
138 +# keep the MODULE_P here consistent with upstream to avoid tarball duplication
139 +HTTP_SECURITY_MODULE_PV="2.9.1"
140 +HTTP_SECURITY_MODULE_P="modsecurity-${HTTP_SECURITY_MODULE_PV}"
141 +HTTP_SECURITY_MODULE_URI="https://www.modsecurity.org/tarball/${HTTP_SECURITY_MODULE_PV}/${HTTP_SECURITY_MODULE_P}.tar.gz"
142 +HTTP_SECURITY_MODULE_WD="${WORKDIR}/${HTTP_SECURITY_MODULE_P}"
143 +
144 +# push-stream-module (http://www.nginxpushstream.com, https://github.com/wandenberg/nginx-push-stream-module, GPL-3)
145 +HTTP_PUSH_STREAM_MODULE_PV="0.5.2"
146 +HTTP_PUSH_STREAM_MODULE_P="ngx_http_push_stream-${HTTP_PUSH_STREAM_MODULE_PV}"
147 +HTTP_PUSH_STREAM_MODULE_URI="https://github.com/wandenberg/nginx-push-stream-module/archive/${HTTP_PUSH_STREAM_MODULE_PV}.tar.gz"
148 +HTTP_PUSH_STREAM_MODULE_WD="${WORKDIR}/nginx-push-stream-module-${HTTP_PUSH_STREAM_MODULE_PV}"
149 +
150 +# sticky-module (https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng, BSD-2)
151 +HTTP_STICKY_MODULE_PV="1.2.6-10-g08a395c66e42"
152 +HTTP_STICKY_MODULE_P="nginx_http_sticky_module_ng-${HTTP_STICKY_MODULE_PV}"
153 +HTTP_STICKY_MODULE_URI="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/${HTTP_STICKY_MODULE_PV}.tar.bz2"
154 +HTTP_STICKY_MODULE_WD="${WORKDIR}/nginx-goodies-nginx-sticky-module-ng-08a395c66e42"
155 +
156 +# mogilefs-module (https://github.com/vkholodkov/nginx-mogilefs-module, BSD-2)
157 +HTTP_MOGILEFS_MODULE_PV="1.0.4"
158 +HTTP_MOGILEFS_MODULE_P="ngx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
159 +HTTP_MOGILEFS_MODULE_URI="https://github.com/vkholodkov/nginx-mogilefs-module/archive/${HTTP_MOGILEFS_MODULE_PV}.tar.gz"
160 +HTTP_MOGILEFS_MODULE_WD="${WORKDIR}/nginx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
161 +
162 +# memc-module (https://github.com/openresty/memc-nginx-module, BSD-2)
163 +HTTP_MEMC_MODULE_PV="0.17"
164 +HTTP_MEMC_MODULE_P="ngx_memc_module-${HTTP_MEMC_MODULE_PV}"
165 +HTTP_MEMC_MODULE_URI="https://github.com/openresty/memc-nginx-module/archive/v${HTTP_MEMC_MODULE_PV}.tar.gz"
166 +HTTP_MEMC_MODULE_WD="${WORKDIR}/memc-nginx-module-${HTTP_MEMC_MODULE_PV}"
167 +
168 +# nginx-ldap-auth-module (https://github.com/kvspb/nginx-auth-ldap, BSD-2)
169 +HTTP_LDAP_MODULE_PV="49a8b4d28fc4a518563c82e0b52821e5f37db1fc"
170 +HTTP_LDAP_MODULE_P="nginx-auth-ldap-${HTTP_LDAP_MODULE_PV}"
171 +HTTP_LDAP_MODULE_URI="https://github.com/kvspb/nginx-auth-ldap/archive/${HTTP_LDAP_MODULE_PV}.tar.gz"
172 +HTTP_LDAP_MODULE_WD="${WORKDIR}/nginx-auth-ldap-${HTTP_LDAP_MODULE_PV}"
173 +
174 +# We handle deps below ourselves
175 +SSL_DEPS_SKIP=1
176 +AUTOTOOLS_AUTO_DEPEND="no"
177 +
178 +inherit autotools ssl-cert toolchain-funcs perl-module flag-o-matic user systemd versionator multilib
179 +
180 +DESCRIPTION="Robust, small and high performance http and reverse proxy server"
181 +HOMEPAGE="http://nginx.org"
182 +SRC_URI="http://nginx.org/download/${P}.tar.gz
183 + ${DEVEL_KIT_MODULE_URI} -> ${DEVEL_KIT_MODULE_P}.tar.gz
184 + nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
185 + nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
186 + nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} -> ${HTTP_CACHE_PURGE_MODULE_P}.tar.gz )
187 + nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} -> ${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz )
188 + nginx_modules_http_fancyindex? ( ${HTTP_FANCYINDEX_MODULE_URI} -> ${HTTP_FANCYINDEX_MODULE_P}.tar.gz )
189 + nginx_modules_http_lua? ( ${HTTP_LUA_MODULE_URI} -> ${HTTP_LUA_MODULE_P}.tar.gz )
190 + nginx_modules_http_auth_pam? ( ${HTTP_AUTH_PAM_MODULE_URI} -> ${HTTP_AUTH_PAM_MODULE_P}.tar.gz )
191 + nginx_modules_http_upstream_check? ( ${HTTP_UPSTREAM_CHECK_MODULE_URI} -> ${HTTP_UPSTREAM_CHECK_MODULE_P}.tar.gz )
192 + nginx_modules_http_metrics? ( ${HTTP_METRICS_MODULE_URI} -> ${HTTP_METRICS_MODULE_P}.tar.gz )
193 + nginx_modules_http_naxsi? ( ${HTTP_NAXSI_MODULE_URI} -> ${HTTP_NAXSI_MODULE_P}.tar.gz )
194 + rtmp? ( ${RTMP_MODULE_URI} -> ${RTMP_MODULE_P}.tar.gz )
195 + nginx_modules_http_dav_ext? ( ${HTTP_DAV_EXT_MODULE_URI} -> ${HTTP_DAV_EXT_MODULE_P}.tar.gz )
196 + nginx_modules_http_echo? ( ${HTTP_ECHO_MODULE_URI} -> ${HTTP_ECHO_MODULE_P}.tar.gz )
197 + nginx_modules_http_security? ( ${HTTP_SECURITY_MODULE_URI} -> ${HTTP_SECURITY_MODULE_P}.tar.gz )
198 + nginx_modules_http_push_stream? ( ${HTTP_PUSH_STREAM_MODULE_URI} -> ${HTTP_PUSH_STREAM_MODULE_P}.tar.gz )
199 + nginx_modules_http_sticky? ( ${HTTP_STICKY_MODULE_URI} -> ${HTTP_STICKY_MODULE_P}.tar.bz2 )
200 + nginx_modules_http_mogilefs? ( ${HTTP_MOGILEFS_MODULE_URI} -> ${HTTP_MOGILEFS_MODULE_P}.tar.gz )
201 + nginx_modules_http_memc? ( ${HTTP_MEMC_MODULE_URI} -> ${HTTP_MEMC_MODULE_P}.tar.gz )
202 + nginx_modules_http_auth_ldap? ( ${HTTP_LDAP_MODULE_URI} -> ${HTTP_LDAP_MODULE_P}.tar.gz )"
203 +
204 +LICENSE="BSD-2 BSD SSLeay MIT GPL-2 GPL-2+
205 + nginx_modules_http_security? ( Apache-2.0 )
206 + nginx_modules_http_push_stream? ( GPL-3 )"
207 +
208 +SLOT="0"
209 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
210 +
211 +# Package doesn't provide a real test suite
212 +RESTRICT="test"
213 +
214 +NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif
215 + fastcgi geo gzip limit_req limit_conn map memcached proxy referer
216 + rewrite scgi ssi split_clients upstream_ip_hash userid uwsgi"
217 +NGINX_MODULES_OPT="addition auth_request dav degradation flv geoip gunzip
218 + gzip_static image_filter mp4 perl random_index realip secure_link
219 + slice stub_status sub xslt"
220 +NGINX_MODULES_STREAM="access limit_conn upstream"
221 +NGINX_MODULES_MAIL="imap pop3 smtp"
222 +NGINX_MODULES_3RD="
223 + http_upload_progress
224 + http_headers_more
225 + http_cache_purge
226 + http_slowfs_cache
227 + http_fancyindex
228 + http_lua
229 + http_auth_pam
230 + http_upstream_check
231 + http_metrics
232 + http_naxsi
233 + http_dav_ext
234 + http_echo
235 + http_security
236 + http_push_stream
237 + http_sticky
238 + http_mogilefs
239 + http_memc
240 + http_auth_ldap"
241 +
242 +IUSE="aio debug +http +http2 +http-cache ipv6 libatomic libressl luajit +pcre
243 + pcre-jit rtmp selinux ssl threads userland_GNU vim-syntax"
244 +
245 +for mod in $NGINX_MODULES_STD; do
246 + IUSE="${IUSE} +nginx_modules_http_${mod}"
247 +done
248 +
249 +for mod in $NGINX_MODULES_OPT; do
250 + IUSE="${IUSE} nginx_modules_http_${mod}"
251 +done
252 +
253 +for mod in $NGINX_MODULES_STREAM; do
254 + IUSE="${IUSE} nginx_modules_stream_${mod}"
255 +done
256 +
257 +for mod in $NGINX_MODULES_MAIL; do
258 + IUSE="${IUSE} nginx_modules_mail_${mod}"
259 +done
260 +
261 +for mod in $NGINX_MODULES_3RD; do
262 + IUSE="${IUSE} nginx_modules_${mod}"
263 +done
264 +
265 +# Add so we can warn users updating about config changes
266 +# @TODO: jbergstroem: remove on next release series
267 +IUSE="${IUSE} nginx_modules_http_spdy"
268 +
269 +CDEPEND="
270 + pcre? ( dev-libs/libpcre:= )
271 + pcre-jit? ( dev-libs/libpcre:=[jit] )
272 + ssl? (
273 + !libressl? ( dev-libs/openssl:0= )
274 + libressl? ( dev-libs/libressl:= )
275 + )
276 + http2? (
277 + !libressl? ( >=dev-libs/openssl-1.0.1c:0= )
278 + libressl? ( dev-libs/libressl:= )
279 + )
280 + http-cache? (
281 + userland_GNU? (
282 + !libressl? ( dev-libs/openssl:0= )
283 + libressl? ( dev-libs/libressl:= )
284 + )
285 + )
286 + nginx_modules_http_geoip? ( dev-libs/geoip )
287 + nginx_modules_http_gunzip? ( sys-libs/zlib )
288 + nginx_modules_http_gzip? ( sys-libs/zlib )
289 + nginx_modules_http_gzip_static? ( sys-libs/zlib )
290 + nginx_modules_http_image_filter? ( media-libs/gd:=[jpeg,png] )
291 + nginx_modules_http_perl? ( >=dev-lang/perl-5.8:= )
292 + nginx_modules_http_rewrite? ( dev-libs/libpcre:= )
293 + nginx_modules_http_secure_link? (
294 + userland_GNU? (
295 + !libressl? ( dev-libs/openssl:0= )
296 + libressl? ( dev-libs/libressl:= )
297 + )
298 + )
299 + nginx_modules_http_xslt? ( dev-libs/libxml2:= dev-libs/libxslt )
300 + nginx_modules_http_lua? ( !luajit? ( dev-lang/lua:0= ) luajit? ( dev-lang/luajit:2= ) )
301 + nginx_modules_http_auth_pam? ( virtual/pam )
302 + nginx_modules_http_metrics? ( dev-libs/yajl:= )
303 + nginx_modules_http_dav_ext? ( dev-libs/expat )
304 + nginx_modules_http_security? (
305 + dev-libs/apr:=
306 + dev-libs/apr-util:=
307 + dev-libs/libxml2:=
308 + net-misc/curl
309 + www-servers/apache
310 + )
311 + nginx_modules_http_auth_ldap? ( net-nds/openldap[ssl?] )"
312 +RDEPEND="${CDEPEND}
313 + selinux? ( sec-policy/selinux-nginx )
314 + !www-servers/nginx:mainline"
315 +DEPEND="${CDEPEND}
316 + nginx_modules_http_security? ( ${AUTOTOOLS_DEPEND} )
317 + arm? ( dev-libs/libatomic_ops )
318 + libatomic? ( dev-libs/libatomic_ops )"
319 +PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
320 +
321 +REQUIRED_USE="pcre-jit? ( pcre )
322 + nginx_modules_http_lua? ( nginx_modules_http_rewrite )
323 + nginx_modules_http_naxsi? ( pcre )
324 + nginx_modules_http_dav_ext? ( nginx_modules_http_dav )
325 + nginx_modules_http_metrics? ( nginx_modules_http_stub_status )
326 + nginx_modules_http_security? ( pcre )
327 + nginx_modules_http_push_stream? ( ssl )"
328 +
329 +pkg_setup() {
330 + NGINX_HOME="/var/lib/nginx"
331 + NGINX_HOME_TMP="${NGINX_HOME}/tmp"
332 +
333 + ebegin "Creating nginx user and group"
334 + enewgroup ${PN}
335 + enewuser ${PN} -1 -1 "${NGINX_HOME}" ${PN}
336 + eend $?
337 +
338 + if use libatomic; then
339 + ewarn "GCC 4.1+ features built-in atomic operations."
340 + ewarn "Using libatomic_ops is only needed if using"
341 + ewarn "a different compiler or a GCC prior to 4.1"
342 + fi
343 +
344 + if [[ -n $NGINX_ADD_MODULES ]]; then
345 + ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
346 + ewarn "This nginx installation is not supported!"
347 + ewarn "Make sure you can reproduce the bug without those modules"
348 + ewarn "_before_ reporting bugs."
349 + fi
350 +
351 + if use !http; then
352 + ewarn "To actually disable all http-functionality you also have to disable"
353 + ewarn "all nginx http modules."
354 + fi
355 +
356 + if use nginx_modules_http_mogilefs && use threads; then
357 + eerror "mogilefs won't compile with threads support."
358 + eerror "Please disable either flag and try again."
359 + die "Can't compile mogilefs with threads support"
360 + fi
361 +}
362 +
363 +src_prepare() {
364 + eapply "${FILESDIR}/${PN}-1.4.1-fix-perl-install-path.patch"
365 + eapply "${FILESDIR}/${PN}-httpoxy-mitigation-r1.patch"
366 +
367 + if use nginx_modules_http_upstream_check; then
368 + eapply -p0 "${HTTP_UPSTREAM_CHECK_MODULE_WD}/check_1.9.2+".patch
369 + fi
370 +
371 + if use nginx_modules_http_lua; then
372 + sed -i -e 's/-llua5.1/-llua/' "${HTTP_LUA_MODULE_WD}/config" || die
373 + fi
374 +
375 + if use nginx_modules_http_security; then
376 + cd "${HTTP_SECURITY_MODULE_WD}" || die
377 +
378 + eapply "${FILESDIR}"/http_security-pr_1158.patch
379 +
380 + eautoreconf
381 +
382 + if use luajit ; then
383 + sed -i \
384 + -e 's|^\(LUA_PKGNAMES\)=.*|\1="luajit"|' \
385 + configure || die
386 + fi
387 +
388 + cd "${S}" || die
389 + fi
390 +
391 + if use nginx_modules_http_upload_progress; then
392 + cd "${HTTP_UPLOAD_PROGRESS_MODULE_WD}" || die
393 + eapply "${FILESDIR}"/http_uploadprogress-issue_50-r1.patch
394 + cd "${S}" || die
395 + fi
396 +
397 + if use nginx_modules_http_memc; then
398 + cd "${HTTP_MEMC_MODULE_WD}" || die
399 + eapply "${FILESDIR}"/http_memc-0.17-issue_26.patch
400 + cd "${S}" || die
401 + fi
402 +
403 + find auto/ -type f -print0 | xargs -0 sed -i 's:\&\& make:\&\& \\$(MAKE):' || die
404 + # We have config protection, don't rename etc files
405 + sed -i 's:.default::' auto/install || die
406 + # remove useless files
407 + sed -i -e '/koi-/d' -e '/win-/d' auto/install || die
408 +
409 + # don't install to /etc/nginx/ if not in use
410 + local module
411 + for module in fastcgi scgi uwsgi ; do
412 + if ! use nginx_modules_http_${module}; then
413 + sed -i -e "/${module}/d" auto/install || die
414 + fi
415 + done
416 +
417 + eapply_user
418 +}
419 +
420 +src_configure() {
421 + # mod_security needs to generate nginx/modsecurity/config before including it
422 + if use nginx_modules_http_security; then
423 + cd "${HTTP_SECURITY_MODULE_WD}" || die
424 +
425 + ./configure \
426 + --enable-standalone-module \
427 + --disable-mlogc \
428 + --with-ssdeep=no \
429 + $(use_enable pcre-jit) \
430 + $(use_with nginx_modules_http_lua lua) || die "configure failed for mod_security"
431 +
432 + cd "${S}" || die
433 + fi
434 +
435 + local myconf=() http_enabled= mail_enabled= stream_enabled=
436 +
437 + use aio && myconf+=( --with-file-aio )
438 + use debug && myconf+=( --with-debug )
439 + use http2 && myconf+=( --with-http_v2_module )
440 + use ipv6 && myconf+=( --with-ipv6 )
441 + use libatomic && myconf+=( --with-libatomic )
442 + use pcre && myconf+=( --with-pcre )
443 + use pcre-jit && myconf+=( --with-pcre-jit )
444 + use threads && myconf+=( --with-threads )
445 +
446 + # HTTP modules
447 + for mod in $NGINX_MODULES_STD; do
448 + if use nginx_modules_http_${mod}; then
449 + http_enabled=1
450 + else
451 + myconf+=( --without-http_${mod}_module )
452 + fi
453 + done
454 +
455 + for mod in $NGINX_MODULES_OPT; do
456 + if use nginx_modules_http_${mod}; then
457 + http_enabled=1
458 + myconf+=( --with-http_${mod}_module )
459 + fi
460 + done
461 +
462 + if use nginx_modules_http_fastcgi; then
463 + myconf+=( --with-http_realip_module )
464 + fi
465 +
466 + # third-party modules
467 + if use nginx_modules_http_upload_progress; then
468 + http_enabled=1
469 + myconf+=( --add-module=${HTTP_UPLOAD_PROGRESS_MODULE_WD} )
470 + fi
471 +
472 + if use nginx_modules_http_headers_more; then
473 + http_enabled=1
474 + myconf+=( --add-module=${HTTP_HEADERS_MORE_MODULE_WD} )
475 + fi
476 +
477 + if use nginx_modules_http_cache_purge; then
478 + http_enabled=1
479 + myconf+=( --add-module=${HTTP_CACHE_PURGE_MODULE_WD} )
480 + fi
481 +
482 + if use nginx_modules_http_slowfs_cache; then
483 + http_enabled=1
484 + myconf+=( --add-module=${HTTP_SLOWFS_CACHE_MODULE_WD} )
485 + fi
486 +
487 + if use nginx_modules_http_fancyindex; then
488 + http_enabled=1
489 + myconf+=( --add-module=${HTTP_FANCYINDEX_MODULE_WD} )
490 + fi
491 +
492 + if use nginx_modules_http_lua; then
493 + http_enabled=1
494 + if use luajit; then
495 + export LUAJIT_LIB=$(pkg-config --variable libdir luajit)
496 + export LUAJIT_INC=$(pkg-config --variable includedir luajit)
497 + else
498 + export LUA_LIB=$(pkg-config --variable libdir lua)
499 + export LUA_INC=$(pkg-config --variable includedir lua)
500 + fi
501 + myconf+=( --add-module=${DEVEL_KIT_MODULE_WD} )
502 + myconf+=( --add-module=${HTTP_LUA_MODULE_WD} )
503 + fi
504 +
505 + if use nginx_modules_http_auth_pam; then
506 + http_enabled=1
507 + myconf+=( --add-module=${HTTP_AUTH_PAM_MODULE_WD} )
508 + fi
509 +
510 + if use nginx_modules_http_upstream_check; then
511 + http_enabled=1
512 + myconf+=( --add-module=${HTTP_UPSTREAM_CHECK_MODULE_WD} )
513 + fi
514 +
515 + if use nginx_modules_http_metrics; then
516 + http_enabled=1
517 + myconf+=( --add-module=${HTTP_METRICS_MODULE_WD} )
518 + fi
519 +
520 + if use nginx_modules_http_naxsi ; then
521 + http_enabled=1
522 + myconf+=( --add-module=${HTTP_NAXSI_MODULE_WD} )
523 + fi
524 +
525 + if use rtmp ; then
526 + http_enabled=1
527 + myconf+=( --add-module=${RTMP_MODULE_WD} )
528 + fi
529 +
530 + if use nginx_modules_http_dav_ext ; then
531 + http_enabled=1
532 + myconf+=( --add-module=${HTTP_DAV_EXT_MODULE_WD} )
533 + fi
534 +
535 + if use nginx_modules_http_echo ; then
536 + http_enabled=1
537 + myconf+=( --add-module=${HTTP_ECHO_MODULE_WD} )
538 + fi
539 +
540 + if use nginx_modules_http_security ; then
541 + http_enabled=1
542 + myconf+=( --add-module=${HTTP_SECURITY_MODULE_WD}/nginx/modsecurity )
543 + fi
544 +
545 + if use nginx_modules_http_push_stream ; then
546 + http_enabled=1
547 + myconf+=( --add-module=${HTTP_PUSH_STREAM_MODULE_WD} )
548 + fi
549 +
550 + if use nginx_modules_http_sticky ; then
551 + http_enabled=1
552 + myconf+=( --add-module=${HTTP_STICKY_MODULE_WD} )
553 + fi
554 +
555 + if use nginx_modules_http_mogilefs ; then
556 + http_enabled=1
557 + myconf+=( --add-module=${HTTP_MOGILEFS_MODULE_WD} )
558 + fi
559 +
560 + if use nginx_modules_http_memc ; then
561 + http_enabled=1
562 + myconf+=( --add-module=${HTTP_MEMC_MODULE_WD} )
563 + fi
564 +
565 + if use nginx_modules_http_auth_ldap; then
566 + http_enabled=1
567 + myconf+=( --add-module=${HTTP_LDAP_MODULE_WD} )
568 + fi
569 +
570 + if use http || use http-cache || use http2; then
571 + http_enabled=1
572 + fi
573 +
574 + if [ $http_enabled ]; then
575 + use http-cache || myconf+=( --without-http-cache )
576 + use ssl && myconf+=( --with-http_ssl_module )
577 + else
578 + myconf+=( --without-http --without-http-cache )
579 + fi
580 +
581 + # Stream modules
582 + for mod in $NGINX_MODULES_STREAM; do
583 + if use nginx_modules_stream_${mod}; then
584 + stream_enabled=1
585 + else
586 + # Treat stream upstream slightly differently
587 + if ! use nginx_modules_stream_upstream; then
588 + myconf+=( --without-stream_upstream_hash_module )
589 + myconf+=( --without-stream_upstream_least_conn_module )
590 + myconf+=( --without-stream_upstream_zone_module )
591 + else
592 + myconf+=( --without-stream_${mod}_module )
593 + fi
594 + fi
595 + done
596 +
597 + if [ $stream_enabled ]; then
598 + myconf+=( --with-stream )
599 + use ssl && myconf+=( --with-stream_ssl_module )
600 + fi
601 +
602 + # MAIL modules
603 + for mod in $NGINX_MODULES_MAIL; do
604 + if use nginx_modules_mail_${mod}; then
605 + mail_enabled=1
606 + else
607 + myconf+=( --without-mail_${mod}_module )
608 + fi
609 + done
610 +
611 + if [ $mail_enabled ]; then
612 + myconf+=( --with-mail )
613 + use ssl && myconf+=( --with-mail_ssl_module )
614 + fi
615 +
616 + # custom modules
617 + for mod in $NGINX_ADD_MODULES; do
618 + myconf+=( --add-module=${mod} )
619 + done
620 +
621 + # https://bugs.gentoo.org/286772
622 + export LANG=C LC_ALL=C
623 + tc-export CC
624 +
625 + if ! use prefix; then
626 + myconf+=( --user=${PN} )
627 + myconf+=( --group=${PN} )
628 + fi
629 +
630 + ./configure \
631 + --prefix="${EPREFIX}"/usr \
632 + --conf-path="${EPREFIX}"/etc/${PN}/${PN}.conf \
633 + --error-log-path="${EPREFIX}"/var/log/${PN}/error_log \
634 + --pid-path="${EPREFIX}"/run/${PN}.pid \
635 + --lock-path="${EPREFIX}"/run/lock/${PN}.lock \
636 + --with-cc-opt="-I${EROOT}usr/include" \
637 + --with-ld-opt="-L${EROOT}usr/$(get_libdir)" \
638 + --http-log-path="${EPREFIX}"/var/log/${PN}/access_log \
639 + --http-client-body-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/client \
640 + --http-proxy-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/proxy \
641 + --http-fastcgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/fastcgi \
642 + --http-scgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/scgi \
643 + --http-uwsgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/uwsgi \
644 + "${myconf[@]}" || die "configure failed"
645 +
646 + # A purely cosmetic change that makes nginx -V more readable. This can be
647 + # good if people outside the gentoo community would troubleshoot and
648 + # question the users setup.
649 + sed -i -e "s|${WORKDIR}|external_module|g" objs/ngx_auto_config.h || die
650 +}
651 +
652 +src_compile() {
653 + use nginx_modules_http_security && emake -C "${HTTP_SECURITY_MODULE_WD}"
654 +
655 + # https://bugs.gentoo.org/286772
656 + export LANG=C LC_ALL=C
657 + emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}"
658 +}
659 +
660 +src_install() {
661 + emake DESTDIR="${D%/}" install
662 +
663 + cp "${FILESDIR}"/nginx.conf-r2 "${ED}"etc/nginx/nginx.conf || die
664 +
665 + newinitd "${FILESDIR}"/nginx.initd-r4 nginx
666 + newconfd "${FILESDIR}"/nginx.confd nginx
667 +
668 + systemd_newunit "${FILESDIR}"/nginx.service-r1 nginx.service
669 +
670 + doman man/nginx.8
671 + dodoc CHANGES* README
672 +
673 + # just keepdir. do not copy the default htdocs files (bug #449136)
674 + keepdir /var/www/localhost
675 + rm -rf "${D}"usr/html || die
676 +
677 + # set up a list of directories to keep
678 + local keepdir_list="${NGINX_HOME_TMP}"/client
679 + local module
680 + for module in proxy fastcgi scgi uwsgi; do
681 + use nginx_modules_http_${module} && keepdir_list+=" ${NGINX_HOME_TMP}/${module}"
682 + done
683 +
684 + keepdir /var/log/nginx ${keepdir_list}
685 +
686 + # this solves a problem with SELinux where nginx doesn't see the directories
687 + # as root and tries to create them as nginx
688 + fperms 0750 "${NGINX_HOME_TMP}"
689 + fowners ${PN}:0 "${NGINX_HOME_TMP}"
690 +
691 + fperms 0700 ${keepdir_list}
692 + fowners ${PN}:${PN} ${keepdir_list}
693 +
694 + fperms 0710 /var/log/nginx
695 + fowners 0:${PN} /var/log/nginx
696 +
697 + # logrotate
698 + insinto /etc/logrotate.d
699 + newins "${FILESDIR}"/nginx.logrotate-r1 nginx
700 +
701 + if use nginx_modules_http_perl; then
702 + cd "${S}"/objs/src/http/modules/perl/ || die
703 + emake DESTDIR="${D}" INSTALLDIRS=vendor
704 + perl_delete_localpod
705 + cd "${S}" || die
706 + fi
707 +
708 + if use nginx_modules_http_cache_purge; then
709 + docinto ${HTTP_CACHE_PURGE_MODULE_P}
710 + dodoc "${HTTP_CACHE_PURGE_MODULE_WD}"/{CHANGES,README.md,TODO.md}
711 + fi
712 +
713 + if use nginx_modules_http_slowfs_cache; then
714 + docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
715 + dodoc "${HTTP_SLOWFS_CACHE_MODULE_WD}"/{CHANGES,README.md}
716 + fi
717 +
718 + if use nginx_modules_http_fancyindex; then
719 + docinto ${HTTP_FANCYINDEX_MODULE_P}
720 + dodoc "${HTTP_FANCYINDEX_MODULE_WD}"/README.rst
721 + fi
722 +
723 + if use nginx_modules_http_lua; then
724 + docinto ${HTTP_LUA_MODULE_P}
725 + dodoc "${HTTP_LUA_MODULE_WD}"/README.markdown
726 + fi
727 +
728 + if use nginx_modules_http_auth_pam; then
729 + docinto ${HTTP_AUTH_PAM_MODULE_P}
730 + dodoc "${HTTP_AUTH_PAM_MODULE_WD}"/{README.md,ChangeLog}
731 + fi
732 +
733 + if use nginx_modules_http_upstream_check; then
734 + docinto ${HTTP_UPSTREAM_CHECK_MODULE_P}
735 + dodoc "${HTTP_UPSTREAM_CHECK_MODULE_WD}"/{README,CHANGES}
736 + fi
737 +
738 + if use nginx_modules_http_naxsi; then
739 + insinto /etc/nginx
740 + doins "${HTTP_NAXSI_MODULE_WD}"/../naxsi_config/naxsi_core.rules
741 + fi
742 +
743 + if use rtmp; then
744 + docinto ${RTMP_MODULE_P}
745 + dodoc "${RTMP_MODULE_WD}"/{AUTHORS,README.md,stat.xsl}
746 + fi
747 +
748 + if use nginx_modules_http_dav_ext; then
749 + docinto ${HTTP_DAV_EXT_MODULE_P}
750 + dodoc "${HTTP_DAV_EXT_MODULE_WD}"/README
751 + fi
752 +
753 + if use nginx_modules_http_echo; then
754 + docinto ${HTTP_ECHO_MODULE_P}
755 + dodoc "${HTTP_ECHO_MODULE_WD}"/README.markdown
756 + fi
757 +
758 + if use nginx_modules_http_security; then
759 + docinto ${HTTP_SECURITY_MODULE_P}
760 + dodoc "${HTTP_SECURITY_MODULE_WD}"/{CHANGES,README.TXT,authors.txt}
761 + fi
762 +
763 + if use nginx_modules_http_push_stream; then
764 + docinto ${HTTP_PUSH_STREAM_MODULE_P}
765 + dodoc "${HTTP_PUSH_STREAM_MODULE_WD}"/{AUTHORS,CHANGELOG.textile,README.textile}
766 + fi
767 +
768 + if use nginx_modules_http_sticky; then
769 + docinto ${HTTP_STICKY_MODULE_P}
770 + dodoc "${HTTP_STICKY_MODULE_WD}"/{README.md,Changelog.txt,docs/sticky.pdf}
771 + fi
772 +
773 + if use nginx_modules_http_memc; then
774 + docinto ${HTTP_MEMC_MODULE_P}
775 + dodoc "${HTTP_MEMC_MODULE_WD}"/README.markdown
776 + fi
777 +
778 + if use nginx_modules_http_auth_ldap; then
779 + docinto ${HTTP_LDAP_MODULE_P}
780 + dodoc "${HTTP_LDAP_MODULE_WD}"/example.conf
781 + fi
782 +}
783 +
784 +pkg_postinst() {
785 + if use ssl; then
786 + if [[ ! -f "${EROOT}"etc/ssl/${PN}/${PN}.key ]]; then
787 + install_cert /etc/ssl/${PN}/${PN}
788 + use prefix || chown ${PN}:${PN} "${EROOT}"etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
789 + fi
790 + fi
791 +
792 + if use nginx_modules_http_spdy; then
793 + ewarn "In nginx 1.9.5 the spdy module was superseded by http2."
794 + ewarn "Update your configs and package.use accordingly."
795 + fi
796 +
797 + if use nginx_modules_http_lua && use http2; then
798 + ewarn "Lua 3rd party module author warns against using ${P} with"
799 + ewarn "NGINX_MODULES_HTTP=\"lua http2\". For more info, see http://git.io/OldLsg"
800 + fi
801 +
802 + local _n_permission_layout_checks=0
803 + local _has_to_adjust_permissions=0
804 + local _has_to_show_permission_warning=0
805 +
806 + # Defaults to 1 to inform people doing a fresh installation
807 + # that we ship modified {scgi,uwsgi,fastcgi}_params files
808 + local _has_to_show_httpoxy_mitigation_notice=1
809 +
810 + local _replacing_version=
811 + for _replacing_version in ${REPLACING_VERSIONS}; do
812 + _n_permission_layout_checks=$((${_n_permission_layout_checks}+1))
813 +
814 + if [[ ${_n_permission_layout_checks} -gt 1 ]]; then
815 + # Should never happen:
816 + # Package is abusing slots but doesn't allow multiple parallel installations.
817 + # If we run into this situation it is unsafe to automatically adjust any
818 + # permission...
819 + _has_to_show_permission_warning=1
820 +
821 + ewarn "Replacing multiple ${PN}' versions is unsupported! " \
822 + "You will have to adjust permissions on your own."
823 +
824 + break
825 + fi
826 +
827 + local _replacing_version_branch=$(get_version_component_range 1-2 "${_replacing_version}")
828 + debug-print "Updating an existing installation (v${_replacing_version}; branch '${_replacing_version_branch}') ..."
829 +
830 + # Do we need to adjust permissions to fix CVE-2013-0337 (bug #458726, #469094)?
831 + # This was before we introduced multiple nginx versions so we
832 + # do not need to distinguish between stable and mainline
833 + local _need_to_fix_CVE2013_0337=1
834 +
835 + if version_is_at_least "1.4.1-r2" "${_replacing_version}"; then
836 + # We are updating an installation which should already be fixed
837 + _need_to_fix_CVE2013_0337=0
838 + debug-print "Skipping CVE-2013-0337 ... existing installation should not be affected!"
839 + else
840 + _has_to_adjust_permissions=1
841 + debug-print "Need to adjust permissions to fix CVE-2013-0337!"
842 + fi
843 +
844 + # Do we need to inform about HTTPoxy mitigation?
845 + # In repository since commit 8be44f76d4ac02cebcd1e0e6e6284bb72d054b0f
846 + if ! version_is_at_least "1.10" "${_replacing_version_branch}"; then
847 + # Updating from <1.10
848 + _has_to_show_httpoxy_mitigation_notice=1
849 + debug-print "Need to inform about HTTPoxy mitigation!"
850 + else
851 + # Updating from >=1.10
852 + local _fixed_in_pvr=
853 + case "${_replacing_version_branch}" in
854 + "1.10")
855 + _fixed_in_pvr="1.10.1-r2"
856 + ;;
857 + "1.11")
858 + _fixed_in_pvr="1.11.3-r1"
859 + ;;
860 + *)
861 + # This should be any future branch.
862 + # If we run this code it is safe to assume that the user has
863 + # already seen the HTTPoxy mitigation notice because he/she is doing
864 + # an update from previous version where we have already shown
865 + # the warning. Otherwise, we wouldn't hit this code path ...
866 + _fixed_in_pvr=
867 + esac
868 +
869 + if [[ -z "${_fixed_in_pvr}" ]] || version_is_at_least "${_fixed_in_pvr}" "${_replacing_version}"; then
870 + # We are updating an installation where we already informed
871 + # that we are mitigating HTTPoxy per default
872 + _has_to_show_httpoxy_mitigation_notice=0
873 + debug-print "No need to inform about HTTPoxy mitigation ... information was already shown for existing installation!"
874 + else
875 + _has_to_show_httpoxy_mitigation_notice=1
876 + debug-print "Need to inform about HTTPoxy mitigation!"
877 + fi
878 + fi
879 +
880 + # Do we need to adjust permissions to fix CVE-2016-1247 (bug #605008)?
881 + # All branches up to 1.11 are affected
882 + local _need_to_fix_CVE2016_1247=1
883 +
884 + if ! version_is_at_least "1.10" "${_replacing_version_branch}"; then
885 + # Updating from <1.10
886 + _has_to_adjust_permissions=1
887 + debug-print "Need to adjust permissions to fix CVE-2016-1247!"
888 + else
889 + # Updating from >=1.10
890 + local _fixed_in_pvr=
891 + case "${_replacing_version_branch}" in
892 + "1.10")
893 + _fixed_in_pvr="1.10.2-r3"
894 + ;;
895 + "1.11")
896 + _fixed_in_pvr="1.11.6-r1"
897 + ;;
898 + *)
899 + # This should be any future branch.
900 + # If we run this code it is safe to assume that we have already
901 + # adjusted permissions or were never affected because user is
902 + # doing an update from previous version which was safe or did
903 + # the adjustments. Otherwise, we wouldn't hit this code path ...
904 + _fixed_in_pvr=
905 + esac
906 +
907 + if [[ -z "${_fixed_in_pvr}" ]] || version_is_at_least "${_fixed_in_pvr}" "${_replacing_version}"; then
908 + # We are updating an installation which should already be adjusted
909 + # or which was never affected
910 + _need_to_fix_CVE2016_1247=0
911 + debug-print "Skipping CVE-2016-1247 ... existing installation should not be affected!"
912 + else
913 + _has_to_adjust_permissions=1
914 + debug-print "Need to adjust permissions to fix CVE-2016-1247!"
915 + fi
916 + fi
917 + done
918 +
919 + if [[ ${_has_to_adjust_permissions} -eq 1 ]]; then
920 + # We do not DIE when chmod/chown commands are failing because
921 + # package is already merged on user's system at this stage
922 + # and we cannot retry without losing the information that
923 + # the existing installation needs to adjust permissions.
924 + # Instead we are going to a show a big warning ...
925 +
926 + if [[ ${_has_to_show_permission_warning} -eq 0 ]] && [[ ${_need_to_fix_CVE2013_0337} -eq 1 ]]; then
927 + ewarn ""
928 + ewarn "The world-readable bit (if set) has been removed from the"
929 + ewarn "following directories to mitigate a security bug"
930 + ewarn "(CVE-2013-0337, bug #458726):"
931 + ewarn ""
932 + ewarn " ${EPREFIX%/}/var/log/nginx"
933 + ewarn " ${EPREFIX%/}${NGINX_HOME_TMP}/{,client,proxy,fastcgi,scgi,uwsgi}"
934 + ewarn ""
935 + ewarn "Check if this is correct for your setup before restarting nginx!"
936 + ewarn "This is a one-time change and will not happen on subsequent updates."
937 + ewarn "Furthermore nginx' temp directories got moved to '${EPREFIX%/}${NGINX_HOME_TMP}'"
938 + chmod o-rwx \
939 + "${EPREFIX%/}"/var/log/nginx \
940 + "${EPREFIX%/}"${NGINX_HOME_TMP}/{,client,proxy,fastcgi,scgi,uwsgi} || \
941 + _has_to_show_permission_warning=1
942 + fi
943 +
944 + if [[ ${_has_to_show_permission_warning} -eq 0 ]] && [[ ${_need_to_fix_CVE2016_1247} -eq 1 ]]; then
945 + ewarn ""
946 + ewarn "The permissions on the following directory have been reset in"
947 + ewarn "order to mitigate a security bug (CVE-2016-1247, bug #605008):"
948 + ewarn ""
949 + ewarn " ${EPREFIX%/}/var/log/nginx"
950 + ewarn ""
951 + ewarn "Check if this is correct for your setup before restarting nginx!"
952 + ewarn "Also ensure that no other log directory used by any of your"
953 + ewarn "vhost(s) is not writeable for nginx user. Any of your log files"
954 + ewarn "used by nginx can be abused to escalate privileges!"
955 + ewarn "This is a one-time change and will not happen on subsequent updates."
956 + chown 0:nginx "${EPREFIX%/}"/var/log/nginx || _has_to_show_permission_warning=1
957 + chmod 710 "${EPREFIX%/}"/var/log/nginx || _has_to_show_permission_warning=1
958 + fi
959 +
960 + if [[ ${_has_to_show_permission_warning} -eq 1 ]]; then
961 + # Should never happen ...
962 + ewarn ""
963 + ewarn "*************************************************************"
964 + ewarn "*************** W A R N I N G ***************"
965 + ewarn "*************************************************************"
966 + ewarn "The one-time only attempt to adjust permissions of the"
967 + ewarn "existing nginx installation failed. Be aware that we will not"
968 + ewarn "try to adjust the same permissions again because now you are"
969 + ewarn "using a nginx version where we expect that the permissions"
970 + ewarn "are already adjusted or that you know what you are doing and"
971 + ewarn "want to keep custom permissions."
972 + ewarn ""
973 + fi
974 + fi
975 +
976 + # Sanity check for CVE-2016-1247
977 + # Required to warn users who received the warning above and thought
978 + # they could fix it by unmerging and re-merging the package or have
979 + # unmerged a affected installation on purpose in the past leaving
980 + # /var/log/nginx on their system due to keepdir/non-empty folder
981 + # and are now installing the package again.
982 + local _sanity_check_testfile=$(mktemp --dry-run "${EPREFIX%/}"/var/log/nginx/.CVE-2016-1247.XXXXXXXXX)
983 + su -s /bin/sh -c "touch ${_sanity_check_testfile}" nginx >&/dev/null
984 + if [ $? -eq 0 ] ; then
985 + # Cleanup -- no reason to die here!
986 + rm -f "${_sanity_check_testfile}"
987 +
988 + ewarn ""
989 + ewarn "*************************************************************"
990 + ewarn "*************** W A R N I N G ***************"
991 + ewarn "*************************************************************"
992 + ewarn "Looks like your installation is vulnerable to CVE-2016-1247"
993 + ewarn "(bug #605008) because nginx user is able to create files in"
994 + ewarn ""
995 + ewarn " ${EPREFIX%/}/var/log/nginx"
996 + ewarn ""
997 + ewarn "Also ensure that no other log directory used by any of your"
998 + ewarn "vhost(s) is not writeable for nginx user. Any of your log files"
999 + ewarn "used by nginx can be abused to escalate privileges!"
1000 + fi
1001 +
1002 + if [[ ${_has_to_show_httpoxy_mitigation_notice} -eq 1 ]]; then
1003 + # HTTPoxy mitigation
1004 + ewarn ""
1005 + ewarn "This nginx installation comes with a mitigation for the HTTPoxy"
1006 + ewarn "vulnerability for FastCGI, SCGI and uWSGI applications by setting"
1007 + ewarn "the HTTP_PROXY parameter to an empty string per default when you"
1008 + ewarn "are sourcing one of the default"
1009 + ewarn ""
1010 + ewarn " - 'fastcgi_params' or 'fastcgi.conf'"
1011 + ewarn " - 'scgi_params'"
1012 + ewarn " - 'uwsgi_params'"
1013 + ewarn ""
1014 + ewarn "files in your server block(s)."
1015 + ewarn ""
1016 + ewarn "If this is causing any problems for you make sure that you are sourcing the"
1017 + ewarn "default parameters _before_ you set your own values."
1018 + ewarn "If you are relying on user-supplied proxy values you have to remove the"
1019 + ewarn "correlating lines from the file(s) mentioned above."
1020 + ewarn ""
1021 + fi
1022 +}