Skip to content

Commit f05f7a0

Browse files
authored
Merge pull request nginx-proxy#574 from teohhanhui/ocsp-stapling-chain
Enable OCSP stapling if certificate trust chain is provided
2 parents 817db85 + 065dd7f commit f05f7a0

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ and `CERT_NAME=shared` will then use this shared cert.
205205
The SSL cipher configuration is based on the [Mozilla nginx intermediate profile](https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx) which
206206
should provide compatibility with clients back to Firefox 1, Chrome 1, IE 7, Opera 5, Safari 1,
207207
Windows XP IE8, Android 2.3, Java 7. Note that the DES-based TLS ciphers were removed for security.
208-
The configuration also enables HSTS, PFS, and SSL session caches. Currently TLS 1.0, 1.1 and 1.2
208+
The configuration also enables HSTS, PFS, OCSP stapling and SSL session caches. Currently TLS 1.0, 1.1 and 1.2
209209
are supported. TLS 1.0 is deprecated but its end of life is not until June 30, 2018. It is being
210210
included because the following browsers will stop working when it is removed: Chrome < 22, Firefox < 27,
211211
IE < 11, Safari < 7, iOS < 5, Android Browser < 5.

docker-entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ fi
1818
# Note: if $DHPARAM_BITS is not defined, generate-dhparam.sh will use 2048 as a default
1919
/app/generate-dhparam.sh $DHPARAM_BITS
2020

21+
# Compute the DNS resolvers for use in the templates
22+
export RESOLVERS=$(awk '$1 == "nameserver" {print $2}' ORS=' ' /etc/resolv.conf | sed 's/ *$//g')
23+
if [ "x$RESOLVERS" = "x" ]; then
24+
echo "Warning: unable to determine DNS resolvers for nginx" >&2
25+
unset RESOLVERS
26+
fi
27+
2128
# If the user has run the default command and the socket doesn't exist, fail
2229
if [ "$socketMissing" = 1 -a "$1" = forego -a "$2" = start -a "$3" = '-r' ]; then
2330
exit 1

nginx.tmpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ log_format vhost '$host $remote_addr - $remote_user [$time_local] '
5858

5959
access_log off;
6060

61+
{{ if $.Env.RESOLVERS }}
62+
resolver {{ $.Env.RESOLVERS }};
63+
{{ end }}
64+
6165
{{ if (exists "/etc/nginx/proxy.conf") }}
6266
include /etc/nginx/proxy.conf;
6367
{{ else }}
@@ -198,6 +202,12 @@ server {
198202
ssl_dhparam {{ printf "/etc/nginx/certs/%s.dhparam.pem" $cert }};
199203
{{ end }}
200204

205+
{{ if (exists (printf "/etc/nginx/certs/%s.chain.crt" $cert)) }}
206+
ssl_stapling on;
207+
ssl_stapling_verify on;
208+
ssl_trusted_certificate {{ printf "/etc/nginx/certs/%s.chain.crt" $cert }};
209+
{{ end }}
210+
201211
{{ if (ne $https_method "noredirect") }}
202212
add_header Strict-Transport-Security "max-age=31536000";
203213
{{ end }}

0 commit comments

Comments
 (0)