2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 {%- set passenger_pkg = 'nginx-mod-http-passenger'
7 if grains.osfinger in ('CentOS Linux-7') else
8 'libnginx-mod-http-passenger' %}
9 {%- set passenger_mod = '/usr/lib64/nginx/modules/ngx_http_passenger_module.so'
10 if grains.osfinger in ('CentOS Linux-7',) else
11 '/usr/lib/nginx/modules/ngx_http_passenger_module.so' %}
12 {%- set passenger_ruby = '/usr/local/rvm/wrappers/default/ruby'
13 if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') else
15 {%- set max_reqs = "__CONTROLLER_MAX_CONCURRENT_REQUESTS__" %}
19 __NGINX_INSTALL_SOURCE__: true
21 passenger_package: {{ passenger_pkg }}
24 passenger_ruby: {{ passenger_ruby }}
25 passenger_max_pool_size: {{ "__CONTROLLER_NGINX_WORKERS__" or grains['num_cpus'] }}
26 {%- if max_reqs != "" %}
27 # Default is 100 -- Configuring this a bit higher than API.MaxConcurrentRequests
28 # to be able to handle /metrics requests even on heavy load situations.
29 passenger_max_request_queue_size: {{ (max_reqs|int * 1.1)|round|int }}
35 # Needed for RVM, harmless otherwise. Cf. https://dev.arvados.org/issues/19015
37 # As we now differentiate where passenger is required or not, we need to
38 # load this module conditionally, so we add this conditional just to use
39 # the same pillar file
40 {% if "install_from_phusionpassenger" == "__NGINX_INSTALL_SOURCE__" %}
41 # This is required to get the passenger module loaded
42 # In Debian it can be done with this
43 # include: 'modules-enabled/*.conf'
44 load_module: {{ passenger_mod }}
46 worker_processes: {{ "__CONTROLLER_NGINX_WORKERS__" or grains['num_cpus'] }}
47 {%- if max_reqs != "" %}
48 worker_rlimit_nofile: {{ (max_reqs|int * 3)|round|int }}
50 worker_connections: {{ (max_reqs|int * 3)|round|int }}
52 worker_rlimit_nofile: 4096
54 worker_connections: 1024
59 # Based on https://ssl-config.mozilla.org/#server=nginx&version=1.14.2&config=intermediate&openssl=1.1.1d&guideline=5.4
60 ssl_hardening_default.conf:
61 - ssl_session_timeout: 1d
62 - ssl_session_cache: 'shared:arvadosSSL:10m'
63 - ssl_session_tickets: 'off'
65 # intermediate configuration
66 - ssl_protocols: TLSv1.2 TLSv1.3
67 - ssl_ciphers: ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
68 - ssl_prefer_server_ciphers: 'off'
70 # HSTS (ngx_http_headers_module is required) (63072000 seconds)
71 - add_header: 'Strict-Transport-Security "max-age=63072000" always'
75 - ssl_stapling_verify: 'on'
77 # verify chain of trust of OCSP response using Root CA and Intermediate certs
78 # - ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates
80 # curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam
81 # - ssl_dhparam: /path/to/dhparam
83 # replace with the IP address of your resolver
84 # - resolver: 127.0.0.1
89 # Remove default webserver