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