Make SMTP host setting configurable (#77)

* Allows to configure a STMP server different from the one in docker-compose

* Addresses @ostefano regarding envvars with defaults

* Ensures default is present in template.env
pull/80/head
David Manzano 2024-06-20 02:57:30 -05:00 committed by GitHub
parent b6aaed52c7
commit c140a40f0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -18,6 +18,7 @@ trap term_proc SIGTERM
[ -z "$BASE_URL" ] && export BASE_URL="https://localhost" [ -z "$BASE_URL" ] && export BASE_URL="https://localhost"
[ -z "$DISABLE_IPV6" ] && export DISABLE_IPV6=false [ -z "$DISABLE_IPV6" ] && export DISABLE_IPV6=false
[ -z "$DISABLE_SSL_REDIRECT" ] && export DISABLE_SSL_REDIRECT=false [ -z "$DISABLE_SSL_REDIRECT" ] && export DISABLE_SSL_REDIRECT=false
[ -z "$SMTP_FQDN" ] && export SMTP_FQDN=mail
init_mysql(){ init_mysql(){
# Test when MySQL is ready.... # Test when MySQL is ready....
@ -93,7 +94,7 @@ class EmailConfig {
public \$default = array( public \$default = array(
'transport' => 'Smtp', 'transport' => 'Smtp',
'from' => array('misp-dev@admin.test' => 'Misp DEV'), 'from' => array('misp-dev@admin.test' => 'Misp DEV'),
'host' => 'mail', 'host' => '$SMTP_FQDN',
'port' => 25, 'port' => 25,
'timeout' => 30, 'timeout' => 30,
'client' => null, 'client' => null,
@ -102,7 +103,7 @@ class EmailConfig {
public \$smtp = array( public \$smtp = array(
'transport' => 'Smtp', 'transport' => 'Smtp',
'from' => array('misp-dev@admin.test' => 'Misp DEV'), 'from' => array('misp-dev@admin.test' => 'Misp DEV'),
'host' => 'mail', 'host' => '$SMTP_FQDN',
'port' => 25, 'port' => 25,
'timeout' => 30, 'timeout' => 30,
'client' => null, 'client' => null,
@ -128,7 +129,7 @@ class EmailConfig {
'attachments' => null, 'attachments' => null,
'emailFormat' => null, 'emailFormat' => null,
'transport' => 'Smtp', 'transport' => 'Smtp',
'host' => 'mail', 'host' => '$SMTP_FQDN',
'port' => 25, 'port' => 25,
'timeout' => 30, 'timeout' => 30,
'client' => null, 'client' => null,

View File

@ -158,6 +158,8 @@ services:
- "MYSQL_DATABASE=${MYSQL_DATABASE:-misp}" - "MYSQL_DATABASE=${MYSQL_DATABASE:-misp}"
# Debug setting # Debug setting
- "DEBUG=${DEBUG}" - "DEBUG=${DEBUG}"
# SMTP setting
- "SMTP_FQDN=${SMTP_FQDN}"
misp-modules: misp-modules:
image: ghcr.io/misp/misp-docker/misp-modules:latest image: ghcr.io/misp/misp-docker/misp-modules:latest

View File

@ -44,6 +44,9 @@ BASE_URL=
# store settings in db except those that must stay in config.php. true/false, defaults to false # store settings in db except those that must stay in config.php. true/false, defaults to false
ENABLE_DB_SETTINGS= ENABLE_DB_SETTINGS=
# Defines what mail system to use defaults to 'mail' which is provided in docker-compose.yml
SMTP_FQDN=mail
# optional and used by the mail sub-system # optional and used by the mail sub-system
SMARTHOST_ADDRESS= SMARTHOST_ADDRESS=
SMARTHOST_PORT= SMARTHOST_PORT=