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