summaryrefslogtreecommitdiff
path: root/data/templates/https/nginx.default.j2
blob: a530c14ba9888116565ac928963bf6ac3a54f2a5 (plain)
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
### Autogenerated by service_https.py ###
# Default server configuration

{% for server in server_block_list %}
server {
        # SSL configuration
        #
{%     if server.address == '*' %}
        listen {{ server.port }} ssl;
        listen [::]:{{ server.port }} ssl;
{%     else %}
        listen {{ server.address | bracketize_ipv6 }}:{{ server.port }} ssl;
{%     endif %}

{%     for name in server.name %}
        server_name {{ name }};
{%     endfor %}

        root /srv/localui;

{%     if server.vyos_cert %}
        ssl_certificate {{ server.vyos_cert.crt }};
        ssl_certificate_key {{ server.vyos_cert.key }};
{%     else %}
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        include snippets/snakeoil.conf;
{%     endif %}
        ssl_session_cache shared:le_nginx_SSL:10m;
        ssl_session_timeout 1440m;
        ssl_session_tickets off;

        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';

        # proxy settings for HTTP API, if enabled; 503, if not
        location ~ ^/(retrieve|configure|config-file|image|container-image|generate|show|reboot|reset|poweroff|docs|openapi.json|redoc|graphql) {
{%     if server.api %}
                proxy_pass http://unix:/run/api.sock;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_read_timeout 600;
                proxy_buffering off;
{%     else %}
                return 503;
{%     endif %}
{%     if server.allow_client %}
{%         for client in server.allow_client %}
                allow {{ client }};
{%         endfor %}
                deny all;
{%     endif %}
        }

        error_page 497 =301 https://$host:{{ server.port }}$request_uri;
}

{% endfor %}