Skip to content

Commit f3fd653

Browse files
committed
Parameterise binding ip and ports for SMTP setup script
1 parent 0afc2f6 commit f3fd653

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

scripts/ci/exim-setup.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ CERTDIR="${BUILDDIR}/certs"
2121
CERTSRCDIR="${BASEDIR}/raddb/certs"
2222
PASSWORD="whatever"
2323

24+
# Listen options
25+
: "${BINDIP:=127.0.0.1}"
26+
: "${BINDPORT:=2525}"
27+
: "${BINDSSLPORT:=2465}"
28+
2429
# Important files for running dovecot
2530
CONF="${BUILDDIR}/exim.conf"
2631

@@ -58,7 +63,7 @@ echo "
5863
#
5964
#EXIMUSER = username
6065
#EXIMGROUP = groupname
61-
LISTEN=127.0.0.1
66+
LISTEN=${BINDIP}
6267
#
6368
#
6469
# Where all the config files, logs, etc are. See also the
@@ -71,7 +76,7 @@ log_file_path = ${LOGDIR}/%s
7176
spool_directory = ${SPOOLDIR}
7277
exim_user = EXIMUSER
7378
exim_group = EXIMGROUP
74-
daemon_smtp_ports = 2525 : 2465
79+
daemon_smtp_ports = ${BINDPORT} : ${BINDSSLPORT}
7580
local_interfaces = LISTEN
7681
deliver_drop_privilege
7782
keep_environment = ${BASEDIR}
@@ -80,9 +85,9 @@ tls_certificate = ${CERTDIR}/server.pem
8085
tls_privatekey = ${CERTDIR}/server.key
8186
tls_verify_certificates = ${CERTDIR}/ca.pem
8287
#tls_dhparam = ${CERTDIR}/dh
83-
tls_on_connect_ports = 2465
88+
tls_on_connect_ports = ${BINDSSLPORT}
8489
tls_verify_hosts = *
85-
tls_require_ciphers = \${if =={\$received_port}{2525}\
90+
tls_require_ciphers = \${if =={\$received_port}{${BINDPORT}}\
8691
{NORMAL:%COMPAT}\
8792
{SECURE128}}
8893
received_header_text =
@@ -164,4 +169,10 @@ chmod g+r -R "${CERTDIR}"
164169
#
165170
echo "Starting exim"
166171
exim -C ${CONF} -bd -DEXIMUSER=$EXIMUSER -DEXIMGROUP=$EXIMGROUP
167-
echo "Running exim on port 2525, accepting all local connections"
172+
echo "Running exim on port ${BINDPORT}, accepting all local connections"
173+
cat << EOF
174+
export SMTP_TEST_SERVER=${BINDIP}
175+
export SMTP_TEST_SERVER_PORT=${BINDPORT}
176+
export SMTP_TEST_SERVER_SSL_PORT=${BINDSSLPORT}
177+
EOF
178+

0 commit comments

Comments
 (0)