Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/nginx/, www-servers/nginx/files/
Date: Tue, 26 Jul 2016 09:51:42
Message-Id: 1469526682.c4b897dc39a939d0f409e1bcd9f6bd9c75679cf9.polynomial-c@gentoo
1 commit: c4b897dc39a939d0f409e1bcd9f6bd9c75679cf9
2 Author: Thomas Deutschmann <whissi <AT> whissi <DOT> de>
3 AuthorDate: Tue Jul 19 23:16:33 2016 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 26 09:51:22 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4b897dc
7
8 www-servers/nginx: HTTPoxy mitigation added
9
10 Package-Manager: portage-2.3.0
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 .../nginx/files/nginx-httpoxy-mitigation.patch | 33 ++++++++++++++++++++++
14 ...{nginx-1.11.2.ebuild => nginx-1.10.1-r1.ebuild} | 23 +++++++++------
15 www-servers/nginx/nginx-1.11.2.ebuild | 13 +++++++++
16 3 files changed, 61 insertions(+), 8 deletions(-)
17
18 diff --git a/www-servers/nginx/files/nginx-httpoxy-mitigation.patch b/www-servers/nginx/files/nginx-httpoxy-mitigation.patch
19 new file mode 100644
20 index 0000000..7e9618b
21 --- /dev/null
22 +++ b/www-servers/nginx/files/nginx-httpoxy-mitigation.patch
23 @@ -0,0 +1,33 @@
24 +httpoxy mitigation
25 +
26 +See https://httpoxy.org/ and https://www.nginx.com/blog/?p=41962 for details.
27 +---
28 + conf/fastcgi.conf | 3 +++
29 + conf/fastcgi_params | 3 +++
30 + 2 files changed, 6 insertions(+)
31 +
32 +diff --git a/conf/fastcgi.conf b/conf/fastcgi.conf
33 +index 091738c..9f7e192 100644
34 +--- a/conf/fastcgi.conf
35 ++++ b/conf/fastcgi.conf
36 +@@ -24,3 +24,6 @@ fastcgi_param SERVER_NAME $server_name;
37 +
38 + # PHP only, required if PHP was built with --enable-force-cgi-redirect
39 + fastcgi_param REDIRECT_STATUS 200;
40 ++
41 ++# httpoxy mitigation (https://httpoxy.org/ https://www.nginx.com/blog/?p=41962)
42 ++fastcgi_param HTTP_PROXY "";
43 +diff --git a/conf/fastcgi_params b/conf/fastcgi_params
44 +index 28decb9..3be3a95 100644
45 +--- a/conf/fastcgi_params
46 ++++ b/conf/fastcgi_params
47 +@@ -23,3 +23,6 @@ fastcgi_param SERVER_NAME $server_name;
48 +
49 + # PHP only, required if PHP was built with --enable-force-cgi-redirect
50 + fastcgi_param REDIRECT_STATUS 200;
51 ++
52 ++# httpoxy mitigation (https://httpoxy.org/ https://www.nginx.com/blog/?p=41962)
53 ++fastcgi_param HTTP_PROXY "";
54 +--
55 +2.9.2
56 +
57
58 diff --git a/www-servers/nginx/nginx-1.11.2.ebuild b/www-servers/nginx/nginx-1.10.1-r1.ebuild
59 similarity index 97%
60 copy from www-servers/nginx/nginx-1.11.2.ebuild
61 copy to www-servers/nginx/nginx-1.10.1-r1.ebuild
62 index 9bfdddd..5912230 100644
63 --- a/www-servers/nginx/nginx-1.11.2.ebuild
64 +++ b/www-servers/nginx/nginx-1.10.1-r1.ebuild
65 @@ -171,7 +171,7 @@ LICENSE="BSD-2 BSD SSLeay MIT GPL-2 GPL-2+
66 nginx_modules_http_security? ( Apache-2.0 )
67 nginx_modules_http_push_stream? ( GPL-3 )"
68
69 -SLOT="mainline"
70 +SLOT="0"
71 KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
72
73 NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif
74 @@ -269,7 +269,7 @@ CDEPEND="
75 nginx_modules_http_auth_ldap? ( net-nds/openldap[ssl?] )"
76 RDEPEND="${CDEPEND}
77 selinux? ( sec-policy/selinux-nginx )
78 - !www-servers/nginx:0"
79 + !www-servers/nginx:mainline"
80 DEPEND="${CDEPEND}
81 arm? ( dev-libs/libatomic_ops )
82 libatomic? ( dev-libs/libatomic_ops )"
83 @@ -319,12 +319,7 @@ pkg_setup() {
84
85 src_prepare() {
86 eapply "${FILESDIR}/${PN}-1.4.1-fix-perl-install-path.patch"
87 -
88 - if use nginx_modules_http_sticky; then
89 - cd "${HTTP_STICKY_MODULE_WD}" || die
90 - eapply "${FILESDIR}"/http-sticky-nginx-1.11.2.patch
91 - cd "${S}" || die
92 - fi
93 + eapply "${FILESDIR}/${PN}-httpoxy-mitigation.patch"
94
95 if use nginx_modules_http_upstream_check; then
96 eapply -p0 "${HTTP_UPSTREAM_CHECK_MODULE_WD}/check_1.9.2+".patch
97 @@ -758,4 +753,16 @@ pkg_postinst() {
98 ewarn "'rx' permissions on /var/log/nginx (default on a fresh install)"
99 ewarn "Otherwise you end up with empty log files after a logrotate."
100 fi
101 +
102 + # HTTPoxy mitigation
103 + ewarn ""
104 + ewarn "This nginx installation comes with a mitigation for the HTTPoxy"
105 + ewarn "vulnerability for FastCGI applications by setting the HTTP_PROXY FastCGI"
106 + ewarn "parameter to an empty string per default when you are sourcing the default"
107 + ewarn "'fastcgi_params' or 'fastcgi.conf' in your server block(s)."
108 + ewarn ""
109 + ewarn "If this is causing any problems for you make sure that you are sourcing the"
110 + ewarn "default parameters _before_ you set your own values."
111 + ewarn "If you are relying on user-supplied proxy values you have to remove the"
112 + ewarn "correlating lines from 'fastcgi_params' and or 'fastcgi.conf'."
113 }
114
115 diff --git a/www-servers/nginx/nginx-1.11.2.ebuild b/www-servers/nginx/nginx-1.11.2.ebuild
116 index 9bfdddd..0a7e068 100644
117 --- a/www-servers/nginx/nginx-1.11.2.ebuild
118 +++ b/www-servers/nginx/nginx-1.11.2.ebuild
119 @@ -319,6 +319,7 @@ pkg_setup() {
120
121 src_prepare() {
122 eapply "${FILESDIR}/${PN}-1.4.1-fix-perl-install-path.patch"
123 + eapply "${FILESDIR}/${PN}-httpoxy-mitigation.patch"
124
125 if use nginx_modules_http_sticky; then
126 cd "${HTTP_STICKY_MODULE_WD}" || die
127 @@ -758,4 +759,16 @@ pkg_postinst() {
128 ewarn "'rx' permissions on /var/log/nginx (default on a fresh install)"
129 ewarn "Otherwise you end up with empty log files after a logrotate."
130 fi
131 +
132 + # HTTPoxy mitigation
133 + ewarn ""
134 + ewarn "This nginx installation comes with a mitigation for the HTTPoxy"
135 + ewarn "vulnerability for FastCGI applications by setting the HTTP_PROXY FastCGI"
136 + ewarn "parameter to an empty string per default when you are sourcing the default"
137 + ewarn "'fastcgi_params' or 'fastcgi.conf' in your server block(s)."
138 + ewarn ""
139 + ewarn "If this is causing any problems for you make sure that you are sourcing the"
140 + ewarn "default parameters _before_ you set your own values."
141 + ewarn "If you are relying on user-supplied proxy values you have to remove the"
142 + ewarn "correlating lines from 'fastcgi_params' and or 'fastcgi.conf'."
143 }