From 619b2e8dbd47c5dc1a46318a46a644fec5760a41 Mon Sep 17 00:00:00 2001 From: Jonathan Voss Date: Wed, 26 Apr 2023 15:12:05 -0500 Subject: [PATCH] version bump and configuration updates for netbox v3.4.9 --- .github/workflows/netbox.yml | 2 +- README.md | 2 +- defaults/main.yml | 15 +++++++++++++++ templates/configuration.py.j2 | 12 ++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/netbox.yml b/.github/workflows/netbox.yml index f0597b8..e6def46 100644 --- a/.github/workflows/netbox.yml +++ b/.github/workflows/netbox.yml @@ -26,7 +26,7 @@ jobs: - ubuntu2004 - ubuntu2204 netbox: - - v3.4.8 + - v3.4.9 - v3.3.10 - v3.2.9 - v3.1.11 diff --git a/README.md b/README.md index 6bc4e00..2f67904 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Ansible Role: Netbox [![Netbox]( -https://img.shields.io/badge/Netbox-v3.4.8-blue)](https://github.com/netbox-community/netbox) +https://img.shields.io/badge/Netbox-v3.4.9-blue)](https://github.com/netbox-community/netbox) [![CI](https://github.com/jvoss/ansible-role-netbox/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jvoss/ansible-role-netbox/actions/workflows/ci.yml) [![Netbox](https://github.com/jvoss/ansible-role-netbox/actions/workflows/netbox.yml/badge.svg)](https://github.com/jvoss/ansible-role-netbox/actions/workflows/netbox.yml) [![Ansible Galaxy](https://img.shields.io/badge/galaxy-jvoss.netbox-blue.svg)](https://galaxy.ansible.com/jvoss/netbox) diff --git a/defaults/main.yml b/defaults/main.yml index d15e35f..a5df230 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -181,6 +181,11 @@ netbox_cors_origin_regex_whitelist: [ # "r'^https?://)?(\w+\.)?example\.com$'" ] +# Netbox >= 3.4.9 +# https://github.com/netbox-community/netbox/issues/11386 +# set django config element CSRF_COOKIE_SECURE +# netbox_csrf_cookie_secure: True + # Netbox >3.2 # https://github.com/netbox-community/netbox/issues/8509 netbox_csrf_trusted_origins: [] @@ -382,12 +387,22 @@ netbox_rq_default_timeout: 300 # The name to use for the session cookie. netbox_session_cookie_name: 'sessionid' +# Netbox >= 3.4.9 +# https://github.com/netbox-community/netbox/issues/11386 +# set django config element SESSION_COOKIE_SECURE +# netbox_session_cookie_secure: True + # By default, NetBox will store session data in the database. Alternatively, a file # path can be specified here to use local file storage instead. (This can be useful for # enabling authentication on a standby instance with read-only database access.) Note # that the user as which NetBox runs must have read and write permissions to this path. netbox_session_file_path: None +# Netbox >= 3.4.9 +# https://github.com/netbox-community/netbox/issues/11386 +# set django config element SECURE_SSL_REDIRECT +# netbox_secure_ssl_redirect: True + # Time zone (default: UTC) netbox_time_zone: UTC diff --git a/templates/configuration.py.j2 b/templates/configuration.py.j2 index 58b2451..510f1b2 100644 --- a/templates/configuration.py.j2 +++ b/templates/configuration.py.j2 @@ -109,6 +109,10 @@ CORS_ORIGIN_REGEX_WHITELIST = {{ netbox_cors_origin_regex_whitelist|to_json }} CORS_ORIGIN_REGEX_WHITELIST = [] {% endif %} +{% if netbox_csrf_cookie_secure is defined %} +CSRF_COOKIE_SECURE = {{ netbox_csrf_cookie_secure | to_json }} +{% endif %} + {% if netbox_csrf_trusted_origins | length > 0 %} CSRF_TRUSTED_ORIGINS = {{ netbox_csrf_trusted_origins }} {% endif %} @@ -314,8 +318,16 @@ FILE_UPLOAD_MAX_MEMORY_SIZE = {{ netbox_file_upload_max_memory_size }} CSRF_COOKIE_NAME = '{{ netbox_csrf_cookie_name }}' {% endif %} +{% if netbox_secure_ssl_redirect is defined %} +SECURE_SSL_REDIRECT = {{ netbox_secure_ssl_redirect | to_json }} +{% endif %} + SESSION_COOKIE_NAME = '{{ netbox_session_cookie_name }}' +{% if netbox_session_cookie_secure is defined %} +SESSION_COOKIE_SECURE = {{ netbox_session_cookie_secure | to_json }} +{% endif %} + {% if netbox_session_file_path == 'None' %} SESSION_FILE_PATH = None {% else %}