diff options
| -rw-r--r-- | data/templates/https/nginx.default.j2 (renamed from data/templates/https/nginx.default.tmpl) | 33 | ||||
| -rw-r--r-- | data/templates/https/override.conf.j2 (renamed from data/templates/https/override.conf.tmpl) | 0 | ||||
| -rw-r--r-- | data/templates/https/vyos-http-api.service.j2 (renamed from data/templates/https/vyos-http-api.service.tmpl) | 0 | ||||
| -rwxr-xr-x | src/conf_mode/http-api.py | 2 | ||||
| -rwxr-xr-x | src/conf_mode/https.py | 4 | 
5 files changed, 18 insertions, 21 deletions
diff --git a/data/templates/https/nginx.default.tmpl b/data/templates/https/nginx.default.j2 index a51505270..70e62ae7a 100644 --- a/data/templates/https/nginx.default.tmpl +++ b/data/templates/https/nginx.default.j2 @@ -1,59 +1,56 @@  ### Autogenerated by https.py ###  # Default server configuration -#  {% for server in server_block_list %}  server { -          # SSL configuration          # -{% if server.address == '*' %} +{%     if server.address == '*' %}          listen {{ server.port }} ssl;          listen [::]:{{ server.port }} ssl; -{% else %} +{%     else %}          listen {{ server.address | bracketize_ipv6 }}:{{ server.port }} ssl; -{% endif %} +{%     endif %} -{% for name in server.name %} +{%     for name in server.name %}          server_name {{ name }}; -{% endfor %} +{%     endfor %} -{% if server.certbot %} +{%     if server.certbot %}          ssl_certificate {{ server.certbot_dir }}/live/{{ server.certbot_domain_dir }}/fullchain.pem;          ssl_certificate_key {{ server.certbot_dir }}/live/{{ server.certbot_domain_dir }}/privkey.pem;          include {{ server.certbot_dir }}/options-ssl-nginx.conf;          ssl_dhparam {{ server.certbot_dir }}/ssl-dhparams.pem; -{% elif server.vyos_cert %} +{%     elif server.vyos_cert %}          ssl_certificate {{ server.vyos_cert.crt }};          ssl_certificate_key {{ server.vyos_cert.key }}; -{% else %} +{%     else %}          #          # Self signed certs generated by the ssl-cert package          # Don't use them in a production server!          #          include snippets/snakeoil.conf; -{% endif %} +{%     endif %}          ssl_protocols TLSv1.2 TLSv1.3;          # proxy settings for HTTP API, if enabled; 503, if not          location ~ /(retrieve|configure|config-file|image|generate|show|docs|openapi.json|redoc|graphql) { -{% if server.api %} -{% if server.api.socket %} +{%     if server.api %} +{%         if server.api.socket %}                  proxy_pass http://unix:/run/api.sock; -{% else %} +{%         else %}                  proxy_pass http://localhost:{{ server.api.port }}; -{% endif %} +{%         endif %}                  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 %} +{%     else %}                  return 503; -{% endif %} +{%     endif %}          }          error_page 497 =301 https://$host:{{ server.port }}$request_uri; -  }  {% endfor %} diff --git a/data/templates/https/override.conf.tmpl b/data/templates/https/override.conf.j2 index c2c191b06..c2c191b06 100644 --- a/data/templates/https/override.conf.tmpl +++ b/data/templates/https/override.conf.j2 diff --git a/data/templates/https/vyos-http-api.service.tmpl b/data/templates/https/vyos-http-api.service.j2 index fb424e06c..fb424e06c 100644 --- a/data/templates/https/vyos-http-api.service.tmpl +++ b/data/templates/https/vyos-http-api.service.j2 diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py index 00f3d4f7f..4a7906c17 100755 --- a/src/conf_mode/http-api.py +++ b/src/conf_mode/http-api.py @@ -117,7 +117,7 @@ def generate(http_api):      with open(api_conf_file, 'w') as f:          json.dump(http_api, f, indent=2) -    render(systemd_service, 'https/vyos-http-api.service.tmpl', http_api) +    render(systemd_service, 'https/vyos-http-api.service.j2', http_api)      return None  def apply(http_api): diff --git a/src/conf_mode/https.py b/src/conf_mode/https.py index 37fa36797..3057357fc 100755 --- a/src/conf_mode/https.py +++ b/src/conf_mode/https.py @@ -214,8 +214,8 @@ def generate(https):          'certbot': certbot      } -    render(config_file, 'https/nginx.default.tmpl', data) -    render(systemd_override, 'https/override.conf.tmpl', https) +    render(config_file, 'https/nginx.default.j2', data) +    render(systemd_override, 'https/override.conf.j2', https)      return None  def apply(https):  | 
