diff --git a/.gitignore b/.gitignore index 9a5e13a4b..2fb516639 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 11fa4ac20..558f76462 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 @@ -62,19 +62,20 @@ RUN export DEBIAN_FRONTEND=noninteractive \ libldap-common \ libpq5 \ libxmlsec1-openssl \ + openssh-client \ openssl \ 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/VERSION b/VERSION index 6a6a3d8e3..24ba9a38d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.1 +2.7.0 diff --git a/build.sh b/build.sh index 5bbaf4d95..fd340299f 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/configuration/configuration.py b/configuration/configuration.py index 518573583..d3bffb4fe 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -141,8 +141,11 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn: 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 +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 # allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or @@ -272,9 +275,9 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn: # 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', '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 = {} diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 680c16c5f..0035f3268 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 049268c93..38cd6582e 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 @@ -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: diff --git a/docker/launch-netbox.sh b/docker/launch-netbox.sh index 510c5c854..6cc63ba01 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 diff --git a/env/netbox.env b/env/netbox.env index 9e490d019..ca2254917 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 diff --git a/requirements-container.txt b/requirements-container.txt index e00569fd6..8ea63525a 100644 --- a/requirements-container.txt +++ b/requirements-container.txt @@ -1,4 +1,5 @@ -django-auth-ldap==4.3.0 +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 ab15e2a87..884defd42 100644 --- a/test-configuration/logging.py +++ b/test-configuration/test_config.py @@ -2,3 +2,5 @@ 'version': 1, 'disable_existing_loggers': True } + +DEFAULT_PERMISSIONS = {}