Repository navigation
Conversation
…SION_PREFIX Append prefix=<value> to session.save_path when PHP_REDIS_SESSION_PREFIX is set, so PHP session keys can be namespaced (default stays PHPREDIS_SESSION:). Useful when the Redis instance is shared across applications.
…IS_NAMESPACE Two optional env vars to namespace Redis keys when Redis is shared between apps: - PHP_REDIS_SESSION_PREFIX (default empty -> phpredis default PHPREDIS_SESSION:) - BACKGROUND_JOBS_REDIS_NAMESPACE (default 'background_jobs' -> backward compatible) Both are backward compatible: defaults preserve current behaviour.
…igurable via env
Map SimpleBackgroundJobs.redis_namespace to ${BACKGROUND_JOBS_REDIS_NAMESPACE} so the
background job Redis keys can be namespaced (e.g. misp:background_jobs) when Redis is
shared. Enforced through the existing envars.json mechanism; default keeps 'background_jobs'.
Expose MISP.redis_database, SimpleBackgroundJobs.redis_database and Plugin.ZeroMQ_redis_database through env vars (MISP_REDIS_DATABASE / BACKGROUND_JOBS_REDIS_DATABASE / ZEROMQ_REDIS_DATABASE). Needed for single-DB backends like Azure Managed Redis (only DB 0). Enforced via envars.json.
…BASE / ZEROMQ_REDIS_DATABASE Defaults preserve MISP's historical values (13/1/1) for backward compatibility. Set all to 0 for single-DB backends (e.g. Azure Managed Redis).
Collaborator
|
Should these settings be included in the docker-compose or template file? |
… docker-compose Pass MISP_REDIS_DATABASE, BACKGROUND_JOBS_REDIS_DATABASE, ZEROMQ_REDIS_DATABASE, BACKGROUND_JOBS_REDIS_NAMESPACE and PHP_REDIS_SESSION_PREFIX to the misp-core service so they are configurable from the user's .env. Defaults preserve current behaviour (13/1/1, background_jobs, empty prefix).
…in template.env Add commented MISP_REDIS_DATABASE, BACKGROUND_JOBS_REDIS_DATABASE, ZEROMQ_REDIS_DATABASE, BACKGROUND_JOBS_REDIS_NAMESPACE (Redis section) and PHP_REDIS_SESSION_PREFIX (Additional PHP settings) with their defaults and single-DB / shared-Redis guidance.
Contributor
Author
|
Good question — I'd say both, because in this repo the two files play complementary roles:
I've just pushed both to this branch:
Let me know if you'd prefer the compose entries without inline defaults (relying solely on |
ostefano
reviewed
Nov 19, 2026
| # backend such as Azure Managed Redis (only DB 0 exists); key isolation is by prefix. | ||
| export MISP_REDIS_DATABASE=${MISP_REDIS_DATABASE:-13} | ||
| export BACKGROUND_JOBS_REDIS_DATABASE=${BACKGROUND_JOBS_REDIS_DATABASE:-1} | ||
| export ZEROMQ_REDIS_DATABASE=${ZEROMQ_REDIS_DATABASE:-1} |
Collaborator
There was a problem hiding this comment.
I understand they might match historical values, but what about existing installations?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does it do?
Makes the Redis logical database index and key prefixes/namespaces configurable via environment variables, so MISP can run against a Redis backend that only exposes a single logical database and/or is shared with other applications. The motivating case is Azure Managed Redis, which only exposes DB
0and where several apps share the same instance.All changes are backward compatible: the defaults reproduce today's behaviour exactly.
New environment variables
PHP_REDIS_SESSION_PREFIXprefix=<value>to php-fpm'ssession.save_pathso PHP session keys are namespaced (default phpredis prefix isPHPREDIS_SESSION:).BACKGROUND_JOBS_REDIS_NAMESPACEbackground_jobsSimpleBackgroundJobs.redis_namespace.MISP_REDIS_DATABASE13MISP.redis_database.BACKGROUND_JOBS_REDIS_DATABASE1SimpleBackgroundJobs.redis_database.ZEROMQ_REDIS_DATABASE1Plugin.ZeroMQ_redis_database.Changes
core/files/entrypoint.sh: declare the five env vars above with their current defaults (backward compatible).core/files/etc/misp-docker/minimum_config.envars.json: exposeMISP.redis_database,SimpleBackgroundJobs.redis_database,Plugin.ZeroMQ_redis_databaseandSimpleBackgroundJobs.redis_namespacethrough those env vars (enforced via the existingenvsubst+enforce_env_settingsmechanism).core/files/entrypoint_fpm.sh: optionally appendprefix=${PHP_REDIS_SESSION_PREFIX}to the generatedsession.save_path(inserted into the query string with?/&as appropriate).Why
On a single-DB backend (e.g. Azure Managed Redis) all MISP Redis subsystems must target DB
0, and when the instance is shared each subsystem needs its own key prefix to avoid collisions. Today the DB indices (13/1/1) and the session prefix are hard-coded / not reachable via env.How was it tested?
Built and run against MISP 2.5.51 on AKS with Azure Managed Redis (single DB 0, shared with other apps). With
PHP_REDIS_SESSION_PREFIX=misp:session:,BACKGROUND_JOBS_REDIS_NAMESPACE=misp:background_jobsand the three*_REDIS_DATABASE=0:misp:session:*misp:background_jobs:*Defaults (no env vars set) reproduce the previous behaviour.