Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow special character inside redis password #176

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/files/entrypoint_fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ term_proc() {
trap term_proc SIGTERM

change_php_vars() {
ESCAPED=$(printf '%s\n' "$REDIS_PASSWORD" | sed -e 's/[\/&]/\\&/g')
for FILE in /etc/php/*/fpm/php.ini
do
[[ -e $FILE ]] || break
Expand All @@ -23,8 +24,8 @@ change_php_vars() {
echo "Configure PHP | Setting 'max_input_time = ${PHP_MAX_INPUT_TIME}'"
sed -i "s/max_input_time = .*/max_input_time = ${PHP_MAX_INPUT_TIME}/" "$FILE"
sed -i "s/session.save_handler = .*/session.save_handler = redis/" "$FILE"
echo "Configure PHP | Setting 'session.save_path = '$(echo $REDIS_HOST | grep -E '^\w+://' || echo tcp://$REDIS_HOST):6379?auth=${REDIS_PASSWORD}'"
sed -i "s|.*session.save_path = .*|session.save_path = '$(echo $REDIS_HOST | grep -E '^\w+://' || echo tcp://$REDIS_HOST):6379?auth=${REDIS_PASSWORD}'|" "$FILE"
echo "Configure PHP | Setting 'session.save_path = '$(echo $REDIS_HOST | grep -E '^\w+://' || echo tcp://$REDIS_HOST):$REDIS_PORT?auth=${ESCAPED}'"
sed -i "s|.*session.save_path = .*|session.save_path = '$(echo $REDIS_HOST | grep -E '^\w+://' || echo tcp://$REDIS_HOST):$REDIS_PORT?auth=${ESCAPED}'|" "$FILE"
sed -i "s/session.sid_length = .*/session.sid_length = 64/" "$FILE"
sed -i "s/session.use_strict_mode = .*/session.use_strict_mode = 1/" "$FILE"
done
Expand Down
17 changes: 14 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ services:

redis:
image: valkey/valkey:7.2
command: "--requirepass ${REDIS_PASSWORD:-redispassword}"
command: "--requirepass '${REDIS_PASSWORD:-redispassword}'"
healthcheck:
test: "valkey-cli -a ${REDIS_PASSWORD:-redispassword} ping || exit 1"
test: "valkey-cli -a '${REDIS_PASSWORD:-redispassword}' -p ${REDIS_PORT:-6379} ping | grep -q PONG || exit 1"
interval: 2s
timeout: 1s
retries: 3
start_period: 30s
start_period: 5s
start_interval: 5s

db:
# We use MariaDB because it supports ARM and has the expected collations
Expand Down Expand Up @@ -49,6 +50,7 @@ services:
timeout: 1s
retries: 3
start_period: 30s
start_interval: 5s

misp-core:
image: ghcr.io/misp/misp-docker/misp-core:${CORE_RUNNING_TAG:-latest}
Expand All @@ -75,6 +77,8 @@ services:
condition: service_healthy
db:
condition: service_healthy
misp-modules:
condition: service_healthy
healthcheck:
test: curl -ks ${BASE_URL:-https://localhost}/users/heartbeat > /dev/null || exit 1
interval: 2s
Expand Down Expand Up @@ -223,6 +227,13 @@ services:
depends_on:
redis:
condition: service_healthy
healthcheck:
test: "/bin/bash -c '</dev/tcp/localhost/6666'"
interval: 2s
timeout: 1s
retries: 3
start_period: 5s
start_interval: 5s

volumes:
mysql_data:
3 changes: 2 additions & 1 deletion template.env
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ SYNCSERVERS_1_PULL_RULES=
# MYSQL_ROOT_PASSWORD=
# MYSQL_DATABASE=

# optional and used to set redis password
# optional and used to set redis
# REDIS_HOST=
# REDIS_PORT=
# remember to escape special character '$', e.g., 'test1%<$1323>' becomes 'test1%<$$1323>'
# REDIS_PASSWORD=

# These variables allows overriding some MISP email values.
Expand Down