/
nginx_patch.inc
393 lines (376 loc) · 17.7 KB
/
nginx_patch.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
ngx_hpack_patch() {
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
NGINX_PUSHBASE=$ngver
echo "$DETECT_NGXVER"
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
NGINX_PUSHBASE=$NGINX_VERSION
echo "$DETECT_NGXVER"
fi
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
if [[ "$NGINX_HPACK" = [yY] && "$DETECT_NGXVER" -ge '1013006' ]]; then
pushd "${DIR_TMP}/nginx-${NGINX_PUSHBASE}"
cecho "patching nginx http/2 full HPACK encoding support" $boldyellow
cecho "nginx-1.13.6_http2-hpack.patch" $boldyellow
# rm -rf nginx-1.13.6_http2-hpack.patch
# wget -4 -cnv https://github.com/cloudflare/sslconfig/raw/hpack_1.13.1/patches/nginx-1.13.6_http2-hpack.patch
cecho "patch -p1 < $CUR_DIR/patches/cloudflare/nginx-1.13.6_http2-hpack.patch" $boldyellow
patch -p1 < $CUR_DIR/patches/cloudflare/nginx-1.13.6_http2-hpack.patch
echo
echo "patching nginx http/2 full HPACK encoding for nginx 1.13.6+"
popd
NGX_HPACK_OPT=' --with-http_v2_hpack_enc'
else
NGX_HPACK_OPT=""
fi
}
ngx_httppush_patch() {
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
NGINX_PUSHBASE=$ngver
echo "$DETECT_NGXVER"
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
NGINX_PUSHBASE=$NGINX_VERSION
echo "$DETECT_NGXVER"
fi
if [[ "$NGINX_HTTPPUSH" = [yY] && "$DETECT_NGXVER" -ge '1011012' ]]; then
NGX_HTTPPUSHDIR='http2-push-nginx-module'
if [[ -d "${DIR_TMP}/${NGX_HTTPPUSHDIR}" || ! -d "${DIR_TMP}/${NGX_HTTPPUSHDIR}" ]]; then
rm -rf "${DIR_TMP}/${NGX_HTTPPUSHDIR}"
pushd "${DIR_TMP}"
git clone https://github.com/ghedo/http2-push-nginx-module
popd
pushd "${DIR_TMP}/nginx-${NGINX_PUSHBASE}"
cecho "patching nginx http2 push for community.centminmod.com/threads/11910/" $boldyellow
cecho "patch -p01 < $CUR_DIR/patches/nginx-http2push/nginx_1.11.12_http2_server_push.patch" $boldyellow
patch -p01 < "$CUR_DIR/patches/nginx-http2push/nginx_1.11.12_http2_server_push.patch"
echo
echo "patching nginx http2 push for nginx 1.11.12+"
popd
fi
fi
}
ngx_cachepurge_patch() {
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
echo "$DETECT_NGXVER"
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
echo "$DETECT_NGXVER"
fi
if [[ "$NGINX_CACHEPURGE" = [yY] && "$DETECT_NGXVER" -ge '1011006' && "$NGINX_CACHEPURGEVER" = 2.[3] ]]; then
NGX_CACHEPURGEDIR=$(tar -tzf "$DIR_TMP/${NGX_CACHEPURGEFILE}" | head -1 | cut -f1 -d"/")
if [ -d "${DIR_TMP}/${NGX_CACHEPURGEDIR}" ]; then
rm -rf "${DIR_TMP}/${NGX_CACHEPURGEDIR}"
pushd "${DIR_TMP}"
if [ -f "$DIR_TMP/${NGX_CACHEPURGEFILE}" ]; then
tar xzf "$DIR_TMP/${NGX_CACHEPURGEFILE}"
fi
popd
pushd "${DIR_TMP}/${NGX_CACHEPURGEDIR}"
cecho "patching ngx_cache_purge for community.centminmod.com/threads/11598/" $boldyellow
cecho "patch -p0 < $CUR_DIR/patches/ngx-cache-purge/ngx-cache-purge-1116.patch" $boldyellow
patch -p0 < "$CUR_DIR/patches/ngx-cache-purge/ngx-cache-purge-1116.patch"
echo
echo "patching ngx_cache_purge for nginx 1.11.6+"
popd
fi
fi
}
luanginx_patch() {
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
echo "$DETECT_NGXVER"
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
echo "$DETECT_NGXVER"
fi
if [[ "$ORESTY_LUANGINX" = [yY] && "$DETECT_NGXVER" -ge '1011011' && "$ORESTY_LUANGINXVER" = '0.10.7' ]] || [[ "$ORESTY_LUANGINX" = [yY] && "$DETECT_NGXVER" -ge '1011011' && "$ORESTY_LUANGINXVER" = '0.10.8' ]]; then
NGX_LUANGINXDIR=$(tar -tzf "$DIR_TMP/${NGX_LUANGINXLINKFILE}" | head -1 | cut -f1 -d"/")
if [ -d "${DIR_TMP}/${NGX_LUANGINXDIR}/src" ]; then
pushd "${DIR_TMP}/${NGX_LUANGINXDIR}/src"
rm -rf ngx_http_lua_headers.c
wget -4 -cnv https://gist.githubusercontent.com/centminmod/48a61dcbcb6240fa1b52843be8290573/raw/ngx_http_lua_headers.c
ls -lah
echo
echo "patching lua nginx module for nginx 1.11.11+"
popd
fi
fi
if [[ "$ORESTY_LUANGINX" = [yY] && "$DETECT_NGXVER" -ge '1011011' && "$ORESTY_LUANGINXVER" = '0.10.7' ]]; then
if [ -d "${DIR_TMP}/${NGX_LUANGINXDIR}/src" ]; then
pushd "${DIR_TMP}/${NGX_LUANGINXDIR}/src"
cecho "patching lua nginx 0.10.7 for community.centminmod.com/posts/47450/" $boldyellow
cecho "patch -p0 < $CUR_DIR/patches/luanginx/luanginx-0107.patch" $boldyellow
patch -p0 < "$CUR_DIR/patches/luanginx/luanginx-0107.patch"
popd
fi
fi
if [[ "$ORESTY_LUANGINX" = [yY] && "$DETECT_NGXVER" -ge '1011011' && "$ORESTY_LUANGINXVER" = '0.10.8' ]]; then
if [ -d "${DIR_TMP}/${NGX_LUANGINXDIR}/src" ]; then
pushd "${DIR_TMP}/${NGX_LUANGINXDIR}/src"
cecho "patching lua nginx 0.10.8 for community.centminmod.com/posts/47450/" $boldyellow
cecho "patch -p0 < $CUR_DIR/patches/luanginx/luanginx-0108.patch" $boldyellow
patch -p0 < "$CUR_DIR/patches/luanginx/luanginx-0108.patch"
popd
fi
fi
}
echonginx_patch() {
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
echo "$DETECT_NGXVER"
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
echo "$DETECT_NGXVER"
fi
if [[ "$NGINX_OPENRESTY" = [yY] && "$DETECT_NGXVER" -ge '1011011' && "$ORESTY_ECHOVER" = '0.60' ]]; then
ECHODIR=$(tar -tzf "$DIR_TMP/${NGX_ECHOLINKFILE}" | head -1 | cut -f1 -d"/")
if [ -d "${DIR_TMP}/${ECHODIR}/src" ]; then
pushd "${DIR_TMP}/${ECHODIR}/src"
rm -rf ngx_http_echo_request_info.c
wget -4 -cnv https://gist.githubusercontent.com/centminmod/c2519f3cfdeff90196a13a3188ef0cfa/raw/ngx_http_echo_request_info.c
ls -lah
echo
echo "patching echo nginx module for nginx 1.11.11+"
popd
fi
fi
}
ngxopenresty_patch() {
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
echo "$DETECT_NGXVER"
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
echo "$DETECT_NGXVER"
fi
# apply patches for nginx => 1.11.6
if [[ "$NGINX_OPENRESTY" = [yY] && "$DETECT_NGXVER" -ge '1011006' ]]; then
ORESTY_REDISVERPARSED=$(echo $ORESTY_REDISVER | sed -e 's|\0.||' -e 's|rc1||' -e 's|rc2||' -e 's|rc3||' -e 's|rc4||')
ORESTY_MEMCVERPARSED=$(echo $ORESTY_MEMCVER | sed -e 's|\0.||' -e 's|rc1||' -e 's|rc2||' -e 's|rc3||' -e 's|rc4||')
echo "$CUR_DIR"
echo "$ORESTY_REDISVERPARSED"
echo "$ORESTY_MEMCVERPARSED"
echo "$DIR_TMP/redis2-nginx-module-${ORESTY_REDISVER}/src"
echo "$DIR_TMP/memc-nginx-module-${ORESTY_MEMCVER}/src"
if [[ "$ORESTY_REDISVERPARSED" -le '13' && -f "$CUR_DIR/patches/redis2-nginx/redis2-nginx-1116.patch" && -z $(grep -ro 1011006 "$DIR_TMP/redis2-nginx-module-${ORESTY_REDISVER}/src") ]]; then
if [ -d "$DIR_TMP/redis2-nginx-module-${ORESTY_REDISVER}/src" ]; then
pushd "$DIR_TMP/redis2-nginx-module-${ORESTY_REDISVER}/src"
echo "patch < $CUR_DIR/patches/redis2-nginx/redis2-nginx-1116.patch"
patch < "$CUR_DIR/patches/redis2-nginx/redis2-nginx-1116.patch"
popd
fi
fi
if [[ "$ORESTY_MEMCVERPARSED" -le '17' && -f "$CUR_DIR/patches/memc-nginx/memc-nginx-1116.patch" && -z $(grep -ro 1011006 "$DIR_TMP/memc-nginx-module-${ORESTY_MEMCVER}/src") ]]; then
if [ -d "$DIR_TMP/memc-nginx-module-${ORESTY_MEMCVER}/src" ]; then
pushd "$DIR_TMP/memc-nginx-module-${ORESTY_MEMCVER}/src"
echo "patch < $CUR_DIR/patches/memc-nginx/memc-nginx-1116.patch"
patch < "$CUR_DIR/patches/memc-nginx/memc-nginx-1116.patch"
popd
fi
fi
fi
# exit
}
patchnginx() {
{
sleep "$NGINXPATCH_DELAY"
# unofficial OpenSSL 1.1.0 beta Nginx patches
DETECTOPENSSL_ONEZERO=$(echo $OPENSSL_VERSION | cut -d . -f1-2)
# detect nginx <=1.11.3 or => 1.11.0 as 1.11.4+ has fix for openssl 1.1 so no patching needed
# http://hg.nginx.org/nginx/rev/1891b2892b68
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
fi
if [[ "$DETECTOPENSSL_ONEZERO" = '1.1' ]] && [[ "$DETECT_NGXVER" -le '1011003' && "$DETECT_NGXVER" -ge '1011000' ]]; then
if [[ -f "$CUR_DIR/patches/nginx/openssl-110pre6.patch" && -f "$CUR_DIR/patches/nginx/openssl-110ticket.patch" ]]; then
if [ -f "$(which figlet)" ]; then
figlet -ckf standard "Nginx OpenSSL 1.1.0 Patch"
fi
echo
cecho "patching nginx for OpenSSL 1.1.0 support" $boldyellow
cecho "patch -p1 < $CUR_DIR/patches/nginx/openssl-110pre6.patch" $boldyellow
patch -p1 < "$CUR_DIR/patches/nginx/openssl-110pre6.patch"
echo "patch -p1 < $CUR_DIR/patches/nginx/openssl-110ticket.patch"
patch -p1 < "$CUR_DIR/patches/nginx/openssl-110ticket.patch"
echo
cecho "nginx patched for OpenSSL 1.1.0" $boldyellow
echo
else
if [[ "$DETECT_NGXVER" -le '1011003' && "$DETECT_NGXVER" -ge '1011000' ]]; then
if [ ! -f "$CUR_DIR/patches/nginx/openssl-110pre6.patch" ]; then
cecho "$CUR_DIR/patches/nginx/openssl-110pre6.patch not found" $boldyellow
fi
if [ ! -f "$CUR_DIR/patches/nginx/openssl-110ticket.patch" ]; then
cecho "$CUR_DIR/patches/nginx/openssl-110ticket.patch not found" $boldyellow
fi
elif [[ "$DETECT_NGXVER" -lt '1011000' ]]; then
# OPENSSL_VERSION='1.1.0g'
cecho "skipping patching due to Nginx version less than 1.11.0" $boldyellow
fi
fi
fi
if [[ "$NGINX_HTTP2" = [yY] ]]; then
# assign NGX_VEREVAL nginx version based on if it's an initial
# centmin mod fresh install or a nginx upgrade run
if [[ "$INITIALINSTALL" != [yY] ]]; then
NGX_VEREVAL=${CUR_NGINXUPGRADEVER}
else
NGX_VEREVAL=${SET_NGINXVER}
fi
# only apply Nginx HTTP/2 patch if Nginx version is >= 1.9.3 and <1.9.5
if [[ "$NGX_VEREVAL" -ge '10903' && "$NGX_VEREVAL" -lt '10905' ]]; then
NGINX_SPDY=n
# http/2 patch
echo
cecho "patching nginx for http/2 support" $boldyellow
echo
cecho "wget -4 http://nginx.org/patches/http2/patch.http2.txt" $boldyellow
wget -4 http://nginx.org/patches/http2/patch.http2.txt
cecho "patch -p1 < patch.http2.txt" $boldyellow
patch -p1 < patch.http2.txt
echo
cecho "nginx patched for http/2" $boldyellow
echo
fi
fi
if [[ "$NGINX_SPDYPATCHED" = [yY] ]]; then
if [ -f "$(which figlet)" ]; then
figlet -ckf standard "Cloudflare Nginx HTTP/2 + SPDY Patch"
fi
echo "######################################################################"
echo "Patching Nginx for HTTP/2 + SPDY Support"
echo "######################################################################"
echo "Cloudflare Nginx HTTP/2 + SPDY patch"
echo "https://github.com/felixbuenemann/sslconfig/blob/updated-nginx-1.9.15-spdy-patch/patches/nginx_1_9_15_http2_spdy.patch"
echo "######################################################################"
NGINXSPDYPATCHED_NAME='nginx_1_9_15_http2_spdy.patch'
rm -rf "${NGINXSPDYPATCHED_NAME}"
NGINXTLSPATCHLINK="https://raw.githubusercontent.com/felixbuenemann/sslconfig/updated-nginx-1.9.15-spdy-patch/patches/${NGINXSPDYPATCHED_NAME}"
# fallback mirror if github down, use gitlab mirror
curl -4Is --connect-timeout 5 --max-time 5 "${NGINXTLSPATCHLINK}" | grep 'HTTP\/' | egrep '200' >/dev/null 2>&1
NGINXTLSPATCH_CURLCHECK=$?
if [[ "$NGINXTLSPATCH_CURLCHECK" != '0' ]]; then
NGINXTLSPATCHLINK="https://gitlab.com/centminmod-github-mirror/sslconfig-felix-group/raw/updated-nginx-1.9.15-spdy-patch/patches/${NGINXSPDYPATCHED_NAME}"
fi
wget -4 -cnv --no-check-certificate "$NGINXTLSPATCHLINK"
if [[ -f "${NGINXSPDYPATCHED_NAME}" && ! "$(grep 'ngx_http_spdy_filter' auto/modules)" ]]; then
patch -p1 < "${NGINXSPDYPATCHED_NAME}"
fi
else
if [ -f "${NGINXSPDYPATCHED_NAME}" ]; then
rm -rf "${NGINXSPDYPATCHED_NAME}"
fi
fi
if [[ "$NGINX_DYNAMICTLS" = [yY] ]]; then
if [ -f "$(which figlet)" ]; then
figlet -ckf standard "Cloudflare Nginx Dynamic TLS Patch"
fi
echo "######################################################################"
echo "Patching Nginx for Dynamic TLS Size Support"
echo "######################################################################"
echo "Cloudflare Nginx Dynamic TLS patch"
echo "https://github.com/cloudflare/sslconfig/raw/master/patches/nginx__dynamic_tls_records.patch"
echo "######################################################################"
if [ "$ngver" ]; then
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-$ngver/src/core/nginx.h")
else
DETECT_NGXVER=$(awk '/define nginx_version / {print $3}' "/svr-setup/nginx-${NGINX_VERSION}/src/core/nginx.h")
fi
if [[ "$DETECT_NGXVER" -le '1011004' && "$DETECT_NGXVER" -ge '1011000' ]]; then
NGINXTLSPATCH_NAME='nginx__dynamic_tls_records.patch'
elif [[ "$DETECT_NGXVER" -ge '1011005' ]]; then
NGINXTLSPATCH_NAME='nginx__dynamic_tls_records_1011005.patch'
fi
rm -rf "${NGINXTLSPATCH_NAME}"
if [[ "$DETECT_NGXVER" -le '1011004' && "$DETECT_NGXVER" -ge '1011000' ]]; then
NGINXTLSPATCHLINK="https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/${NGINXTLSPATCH_NAME}"
# fallback mirror if github down, use gitlab mirror
curl -4Is --connect-timeout 5 --max-time 5 "${NGINXTLSPATCHLINK}" | grep 'HTTP\/' | egrep '200' >/dev/null 2>&1
NGINXTLSPATCH_CURLCHECK=$?
if [[ "$NGINXTLSPATCH_CURLCHECK" != '0' ]]; then
NGINXTLSPATCHLINK="https://gitlab.com/centminmod-github-mirror/sslconfig/raw/master/patches/${NGINXTLSPATCH_NAME}"
fi
wget -4 -cnv --no-check-certificate "$NGINXTLSPATCHLINK"
if [[ -f "${NGINXTLSPATCH_NAME}" && ! "$(grep 'dyn_rec.threshold' src/event/ngx_event_openssl.c)" ]]; then
echo "patch -p1 < "${NGINXTLSPATCH_NAME}""
patch -p1 < "${NGINXTLSPATCH_NAME}"
fi
elif [[ "$DETECT_NGXVER" -ge '1011005' ]]; then
if [[ -f "$CUR_DIR/patches/cloudflare/$NGINXTLSPATCH_NAME" && ! "$(grep 'dyn_rec.threshold' src/event/ngx_event_openssl.c)" ]]; then
echo "patch -p1 < "$CUR_DIR/patches/cloudflare/$NGINXTLSPATCH_NAME""
patch -p1 < "$CUR_DIR/patches/cloudflare/$NGINXTLSPATCH_NAME"
fi
fi
else
if [ -f "${NGINXTLSPATCH_NAME}" ]; then
rm -rf "${NGINXTLSPATCH_NAME}"
fi
fi
ngx_hpack_patch
} 2>&1 | tee "${CENTMINLOGDIR}/patch_patchnginx_${DT}.log"
}
luapatch() {
if [ ! -f lua.patch ]; then
{
# echo
echo "patching lua for nginx 1.9.11 workaround"
# patch for nginx 1.9.11 and lua nginx 0.9.20
# from https://github.com/openresty/lua-nginx-module/pull/669
# https://github.com/charlesportwoodii/lua-nginx-module/commit/8a63903c7152b5417e1bf326f6d6ffad0b729945
wget -O "$DIR_TMP/lua-nginx-module-${ORESTY_LUANGINXVER}/lua.patch" https://github.com/charlesportwoodii/lua-nginx-module/commit/8a63903c7152b5417e1bf326f6d6ffad0b729945.patch
if [ -d "$DIR_TMP/lua-nginx-module-${ORESTY_LUANGINXVER}/" ]; then
pushd "$DIR_TMP/lua-nginx-module-${ORESTY_LUANGINXVER}/"
patch -p1 < lua.patch
popd
fi
} 2>&1 | tee "${CENTMINLOGDIR}/patch_luapatch_${DT}.log"
fi
}
luaopensslpatch() {
# for lua-nginx-module 0.10 https://community.centminmod.com/posts/24549/
# echo
{
echo "patching nginx for lua 0.10+ branch support"
if [ "$ngver" ]; then
pushd "$DIR_TMP/nginx-${ngver}"
else
pushd "$DIR_TMP/nginx-${NGINX_VERSION}"
fi
OPENRESTYLUAPATCHLINK='https://github.com/openresty/openresty/raw/master/patches/nginx-1.9.7-ssl_cert_cb_yield.patch'
# fallback mirror if github down, use gitlab mirror
curl -4Is --connect-timeout 5 --max-time 5 $OPENRESTYLUAPATCHLINK | grep 'HTTP\/' | egrep '200|302' >/dev/null 2>&1
OPENRESTYLUAPATCH_CURLCHECK=$?
if [[ "$OPENRESTYLUAPATCH_CURLCHECK" != '0' ]]; then
OPENRESTYLUAPATCHLINK='https://gitlab.com/centminmod-github-mirror/openresty/raw/master/patches/nginx-1.9.7-ssl_cert_cb_yield.patch'
fi
wget "$OPENRESTYLUAPATCHLINK"
patch -p1 < nginx-1.9.7-ssl_cert_cb_yield.patch
popd
} 2>&1 | tee "${CENTMINLOGDIR}/patch_luaopensslpatch_${DT}.log"
}
ngxpagespeed_patched() {
{
echo "patching ngx_pagespeed for nginx 1.13.4 support"
NGXPGSPEED_EVALVER=$(echo $NGXPGSPEED_VER | cut -d . -f1-4 | cut -d - -f1 | sed -e 's|\.||g')
if [[ "$NGXPGSPEED_EVALVER" -le '112342' ]]; then
if [ -d "$DIR_TMP/ngx_pagespeed-release-${NGXPGSPEED_VER}" ]; then
pushd "$DIR_TMP/ngx_pagespeed-release-${NGXPGSPEED_VER}"
if [ -f "$CUR_DIR/patches/nginxpagespeed/nginxpagespeed-1134.patch" ]; then
patch -p1 < $CUR_DIR/patches/nginxpagespeed/nginxpagespeed-1134.patch
fi
elif [ -d "$DIR_TMP/ngx_pagespeed-${NGXPGSPEED_VER}" ]; then
pushd "$DIR_TMP/ngx_pagespeed-${NGXPGSPEED_VER}"
if [ -f "$CUR_DIR/patches/nginxpagespeed/nginxpagespeed-1134.patch" ]; then
patch -p1 < $CUR_DIR/patches/nginxpagespeed/nginxpagespeed-1134.patch
fi
fi
popd
fi
} 2>&1 | tee "${CENTMINLOGDIR}/patch_ngxpagespeed_patched_${DT}.log"
}