Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added web security headers for nginx configuration #5183

Merged
merged 12 commits into from
Mar 12, 2021
Merged
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ Changed

Contributed by @Kami.

* Default nginx config (``conf/nginx/st2.conf``) which is used by the installer and Docker
images has been updated to only support TLS v1.2 (support for TLS v1.0 and v1.1 has been
removed).

If someone still needs to support those versions, they can modify the nginx config
accordingly. #5183

Contributed by @Kami and @ashwini.
Kami marked this conversation as resolved.
Show resolved Hide resolved

3.4.0 - March 02, 2021
----------------------

Expand Down
13 changes: 8 additions & 5 deletions conf/nginx/st2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ server {

server {
listen *:443 ssl;

server_tokens off;
ssl_certificate /etc/ssl/st2/st2.crt;
ssl_certificate_key /etc/ssl/st2/st2.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_protocols TLSv1.2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;

Expand All @@ -40,6 +40,9 @@ server {

add_header Front-End-Https on;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY always;
add_header Strict-Transport-Security "max-age=3153600;includeSubDomains";
add_header X-XSS-Protection "1; mode=block";

location @apiError {
add_header Content-Type application/json always;
Expand All @@ -50,7 +53,7 @@ server {
error_page 502 = @apiError;

rewrite ^/api/(.*) /$1 break;

proxy_pass http://127.0.0.1:9101/;
proxy_read_timeout 90;
proxy_connect_timeout 90;
Expand Down Expand Up @@ -91,7 +94,7 @@ server {
sendfile on;
tcp_nopush on;
tcp_nodelay on;

# Disable buffering and chunked encoding.
# In the stream case we want to receive the whole payload at once, we don't
# want multiple chunks.
Expand All @@ -110,7 +113,7 @@ server {
error_page 502 = @authError;

rewrite ^/auth/(.*) /$1 break;

proxy_pass http://127.0.0.1:9100/;
proxy_read_timeout 90;
proxy_connect_timeout 90;
Expand Down