From 5408cf5af0a7be8c05596e64655cab6374f81dfd Mon Sep 17 00:00:00 2001 From: Marc Leuser Date: Sun, 7 May 2023 21:23:10 +0200 Subject: [PATCH 01/11] rename JOBRESULT_RETENTION to JOB_RETENTION --- configuration/configuration.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configuration/configuration.py b/configuration/configuration.py index 5185735..3e50aaf 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -141,8 +141,11 @@ if 'CHANGELOG_RETENTION' in environ: CHANGELOG_RETENTION = _environ_get_and_map('CHANGELOG_RETENTION', None, _AS_INT) # Maximum number of days to retain job results (scripts and reports). Set to 0 to retain job results in the database indefinitely. (Default: 90) -if 'JOBRESULT_RETENTION' in environ: - JOBRESULT_RETENTION = _environ_get_and_map('JOBRESULT_RETENTION', None, _AS_INT) +if 'JOB_RETENTION' in environ: + JOB_RETENTION = _environ_get_and_map('JOB_RETENTION', None, _AS_INT) +# JOBRESULT_RETENTION was renamed to JOB_RETENTION in the v3.5.0 release of NetBox. For backwards compatibility, map JOBRESULT_RETENTION to JOB_RETENTION +else if 'JOBRESULT_RETENTION' in environ: + JOB_RETENTION = _environ_get_and_map('JOBRESULT_RETENTION', None, _AS_INT) # API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be # allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or From 055538cc21b782d767af144f2919dff0b9f4aab0 Mon Sep 17 00:00:00 2001 From: Tobias Genannt Date: Mon, 8 May 2023 17:44:09 +0200 Subject: [PATCH 02/11] Fixed type in else --- configuration/configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/configuration.py b/configuration/configuration.py index 3e50aaf..18c55dd 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -144,7 +144,7 @@ if 'CHANGELOG_RETENTION' in environ: if 'JOB_RETENTION' in environ: JOB_RETENTION = _environ_get_and_map('JOB_RETENTION', None, _AS_INT) # JOBRESULT_RETENTION was renamed to JOB_RETENTION in the v3.5.0 release of NetBox. For backwards compatibility, map JOBRESULT_RETENTION to JOB_RETENTION -else if 'JOBRESULT_RETENTION' in environ: +elif 'JOBRESULT_RETENTION' in environ: JOB_RETENTION = _environ_get_and_map('JOBRESULT_RETENTION', None, _AS_INT) # API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be From 23d5865e3d512606cf11db74110818464de3d060 Mon Sep 17 00:00:00 2001 From: Tobias Genannt Date: Thu, 11 May 2023 08:09:56 +0200 Subject: [PATCH 03/11] Update Ubuntu und Nginx Unit --- .gitignore | 3 +-- Dockerfile | 10 +++++----- build.sh | 4 ++-- docker/launch-netbox.sh | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 9a5e13a..2fb5166 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ *.sql.gz .netbox -.initializers +.python-version docker-compose.override.yml *.pem configuration/* @@ -11,5 +11,4 @@ configuration/ldap/* !configuration/ldap/ldap_config.py !configuration/logging.py !configuration/plugins.py -prometheus.yml super-linter.log diff --git a/Dockerfile b/Dockerfile index 11fa4ac..bd00e90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,15 +66,15 @@ RUN export DEBIAN_FRONTEND=noninteractive \ python3 \ python3-distutils \ tini \ - && curl -sL https://nginx.org/keys/nginx_signing.key \ - > /etc/apt/trusted.gpg.d/nginx.asc && \ - echo "deb https://packages.nginx.org/unit/ubuntu/ jammy unit" \ + && curl --silent --output /usr/share/keyrings/nginx-keyring.gpg \ + https://unit.nginx.org/keys/nginx-keyring.gpg \ + && echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ lunar unit" \ > /etc/apt/sources.list.d/unit.list \ && apt-get update -qq \ && apt-get install \ --yes -qq --no-install-recommends \ - unit=1.29.1-1~jammy \ - unit-python3.10=1.29.1-1~jammy \ + unit=1.30.0-1~lunar \ + unit-python3.11=1.30.0-1~lunar \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /opt/netbox/venv /opt/netbox/venv diff --git a/build.sh b/build.sh index 5bbaf4d..fd34029 100755 --- a/build.sh +++ b/build.sh @@ -61,7 +61,7 @@ DOCKERFILE The name of Dockerfile to use. ${_GREEN}Default:${_CLEAR} Dockerfile DOCKER_FROM The base image to use. - ${_GREEN}Default:${_CLEAR} 'ubuntu:22.04' + ${_GREEN}Default:${_CLEAR} 'ubuntu:23.04' BUILDX_PLATFORMS Specifies the platform(s) to build the image for. @@ -219,7 +219,7 @@ fi # Determining the value for DOCKER_FROM ### if [ -z "$DOCKER_FROM" ]; then - DOCKER_FROM="docker.io/ubuntu:22.04" + DOCKER_FROM="docker.io/ubuntu:23.04" fi ### diff --git a/docker/launch-netbox.sh b/docker/launch-netbox.sh index 510c5c8..6cc63ba 100755 --- a/docker/launch-netbox.sh +++ b/docker/launch-netbox.sh @@ -51,7 +51,7 @@ exec unitd \ --control unix:$UNIT_SOCKET \ --pid /opt/unit/unit.pid \ --log /dev/stdout \ - --state /opt/unit/state/ \ - --tmp /opt/unit/tmp/ \ + --statedir /opt/unit/state/ \ + --tmpdir /opt/unit/tmp/ \ --user unit \ --group root From 8208dedb190fd7ef216a672d2ab790765840361c Mon Sep 17 00:00:00 2001 From: Florian Schroen Date: Thu, 15 Jun 2023 12:11:46 +0200 Subject: [PATCH 04/11] docker-compose.yml: fix volume mount options `z` is valid only for bindmounts When using with volumes a warning for each volume appears: netbox$ docker compose up [+] Building 0.0s (0/0) WARN[0000] mount of type `volume` should not define `bind` option WARN[0000] mount of type `volume` should not define `bind` option WARN[0000] mount of type `volume` should not define `bind` option This may appear only when using a docker-compose.override.yml --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 049268c..a0076b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,9 +15,9 @@ services: test: "curl -f http://localhost:8080/api/ || exit 1" volumes: - ./configuration:/etc/netbox/config:z,ro - - netbox-media-files:/opt/netbox/netbox/media:z,rw - - netbox-reports-files:/opt/netbox/netbox/reports:z,rw - - netbox-scripts-files:/opt/netbox/netbox/scripts:z,rw + - netbox-media-files:/opt/netbox/netbox/media:rw + - netbox-reports-files:/opt/netbox/netbox/reports:rw + - netbox-scripts-files:/opt/netbox/netbox/scripts:rw netbox-worker: <<: *netbox depends_on: From d69dacef09881959b666bd26e01967949dd56b05 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 22 Jul 2023 19:52:18 +0000 Subject: [PATCH 05/11] Update dependency django-auth-ldap to v4.4.0 --- requirements-container.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-container.txt b/requirements-container.txt index e00569f..b7d3858 100644 --- a/requirements-container.txt +++ b/requirements-container.txt @@ -1,4 +1,4 @@ -django-auth-ldap==4.3.0 +django-auth-ldap==4.4.0 django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.13.2 psycopg2==2.9.6 python3-saml==1.15.0 From c99172661ce384174685ad7fd2b7e45661b24a97 Mon Sep 17 00:00:00 2001 From: toriningen Date: Thu, 3 Aug 2023 05:19:59 +0000 Subject: [PATCH 06/11] netbox.env: fixed unwanted string interpolation --- env/netbox.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/netbox.env b/env/netbox.env index 9e490d0..ca22549 100644 --- a/env/netbox.env +++ b/env/netbox.env @@ -29,6 +29,6 @@ REDIS_INSECURE_SKIP_TLS_VERIFY=false REDIS_PASSWORD=H733Kdjndks81 REDIS_SSL=false RELEASE_CHECK_URL=https://api.github.com/repos/netbox-community/netbox/releases -SECRET_KEY=r(m)9nLGnz$(_q3N4z1k(EFsMCjjjzx08x9VhNVcfd%6RF#r!6DE@+V5Zk2X +SECRET_KEY='r(m)9nLGnz$(_q3N4z1k(EFsMCjjjzx08x9VhNVcfd%6RF#r!6DE@+V5Zk2X' SKIP_SUPERUSER=true WEBHOOKS_ENABLED=true From ec603633ea9171edaea6bd24c23e8c1b0d9e4d43 Mon Sep 17 00:00:00 2001 From: NeodymiumFerBore <32781483+NeodymiumFerBore@users.noreply.github.com> Date: Fri, 4 Aug 2023 23:49:44 +0200 Subject: [PATCH 07/11] Set REMOTE_AUTH_AUTO_CREATE_USER default to False --- configuration/configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/configuration.py b/configuration/configuration.py index 18c55dd..72fabd5 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -277,7 +277,7 @@ if 'RACK_ELEVATION_DEFAULT_UNIT_WIDTH' in environ: REMOTE_AUTH_ENABLED = _environ_get_and_map('REMOTE_AUTH_ENABLED', 'False', _AS_BOOL) REMOTE_AUTH_BACKEND = environ.get('REMOTE_AUTH_BACKEND', 'netbox.authentication.RemoteUserBackend') REMOTE_AUTH_HEADER = environ.get('REMOTE_AUTH_HEADER', 'HTTP_REMOTE_USER') -REMOTE_AUTH_AUTO_CREATE_USER = _environ_get_and_map('REMOTE_AUTH_AUTO_CREATE_USER', 'True', _AS_BOOL) +REMOTE_AUTH_AUTO_CREATE_USER = _environ_get_and_map('REMOTE_AUTH_AUTO_CREATE_USER', 'False', _AS_BOOL) REMOTE_AUTH_DEFAULT_GROUPS = _environ_get_and_map('REMOTE_AUTH_DEFAULT_GROUPS', '', _AS_LIST) # REMOTE_AUTH_DEFAULT_PERMISSIONS = {} From 75690ac7dd8242f879b9b9754898775d38634099 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:58:31 +0000 Subject: [PATCH 08/11] Update dependency django-auth-ldap to v4.5.0 --- requirements-container.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-container.txt b/requirements-container.txt index b7d3858..20faff0 100644 --- a/requirements-container.txt +++ b/requirements-container.txt @@ -1,4 +1,4 @@ -django-auth-ldap==4.4.0 +django-auth-ldap==4.5.0 django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.13.2 psycopg2==2.9.6 python3-saml==1.15.0 From 12af4233bd72c13748ff39b5aa152674e3b9f8bc Mon Sep 17 00:00:00 2001 From: NeodymiumFerBore <32781483+NeodymiumFerBore@users.noreply.github.com> Date: Fri, 25 Aug 2023 11:26:36 +0200 Subject: [PATCH 09/11] Map REMOTE_AUTH_BACKEND env var to list --- configuration/configuration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/configuration.py b/configuration/configuration.py index 72fabd5..d3bffb4 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -275,7 +275,7 @@ if 'RACK_ELEVATION_DEFAULT_UNIT_WIDTH' in environ: # Remote authentication support REMOTE_AUTH_ENABLED = _environ_get_and_map('REMOTE_AUTH_ENABLED', 'False', _AS_BOOL) -REMOTE_AUTH_BACKEND = environ.get('REMOTE_AUTH_BACKEND', 'netbox.authentication.RemoteUserBackend') +REMOTE_AUTH_BACKEND = _environ_get_and_map('REMOTE_AUTH_BACKEND', 'netbox.authentication.RemoteUserBackend', _AS_LIST) REMOTE_AUTH_HEADER = environ.get('REMOTE_AUTH_HEADER', 'HTTP_REMOTE_USER') REMOTE_AUTH_AUTO_CREATE_USER = _environ_get_and_map('REMOTE_AUTH_AUTO_CREATE_USER', 'False', _AS_BOOL) REMOTE_AUTH_DEFAULT_GROUPS = _environ_get_and_map('REMOTE_AUTH_DEFAULT_GROUPS', '', _AS_LIST) From 44d0f47fb5d6d612e074199f8e7e77eaa745f1ba Mon Sep 17 00:00:00 2001 From: Tobias Genannt Date: Fri, 7 Jul 2023 08:12:33 +0200 Subject: [PATCH 10/11] Prepare for Netbox 3.6 --- Dockerfile | 4 ++-- VERSION | 2 +- docker-compose.test.yml | 2 +- docker-compose.yml | 2 +- requirements-container.txt | 3 ++- test-configuration/{logging.py => test_config.py} | 2 ++ 6 files changed, 9 insertions(+), 6 deletions(-) rename test-configuration/{logging.py => test_config.py} (72%) diff --git a/Dockerfile b/Dockerfile index bd00e90..a090c08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,8 +31,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \ ARG NETBOX_PATH COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt / RUN \ - # We compile 'psycopg2' in the build process - sed -i -e '/psycopg2-binary/d' /requirements.txt && \ + # We compile 'psycopg' in the build process + sed -i -e '/psycopg/d' /requirements.txt && \ # Gunicorn is not needed because we use Nginx Unit sed -i -e '/gunicorn/d' /requirements.txt && \ # We need 'social-auth-core[all]' in the Docker image. But if we put it in our own requirements-container.txt diff --git a/VERSION b/VERSION index 6a6a3d8..24ba9a3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.1 +2.7.0 diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 680c16c..0035f32 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -12,7 +12,7 @@ services: env_file: env/netbox.env user: 'unit:root' volumes: - - ./test-configuration/logging.py:/etc/netbox/config/logging.py:z,ro + - ./test-configuration/test_config.py:/etc/netbox/config/test_config.py:z,ro healthcheck: start_period: ${NETBOX_START_PERIOD-120s} timeout: 3s diff --git a/docker-compose.yml b/docker-compose.yml index a0076b7..38cd658 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.4' services: netbox: &netbox - image: docker.io/netboxcommunity/netbox:${VERSION-v3.5-2.6.1} + image: docker.io/netboxcommunity/netbox:${VERSION-v3.6-2.7.0} depends_on: - postgres - redis diff --git a/requirements-container.txt b/requirements-container.txt index 20faff0..8ea6352 100644 --- a/requirements-container.txt +++ b/requirements-container.txt @@ -1,4 +1,5 @@ django-auth-ldap==4.5.0 django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.13.2 -psycopg2==2.9.6 +dulwich==0.21.5 +psycopg[c,pool]==3.1.10 python3-saml==1.15.0 diff --git a/test-configuration/logging.py b/test-configuration/test_config.py similarity index 72% rename from test-configuration/logging.py rename to test-configuration/test_config.py index ab15e2a..884defd 100644 --- a/test-configuration/logging.py +++ b/test-configuration/test_config.py @@ -2,3 +2,5 @@ LOGGING = { 'version': 1, 'disable_existing_loggers': True } + +DEFAULT_PERMISSIONS = {} From 69c5580a3ed5a763609e14b1be50c7135ad65b46 Mon Sep 17 00:00:00 2001 From: Tobias Genannt Date: Tue, 29 Aug 2023 13:13:57 +0200 Subject: [PATCH 11/11] Fix #1061: Install openssh-client --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index a090c08..558f764 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,6 +62,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ libldap-common \ libpq5 \ libxmlsec1-openssl \ + openssh-client \ openssl \ python3 \ python3-distutils \