@@ -12,25 +12,25 @@ ulimit -n $LDAP_NOFILE
12
12
13
13
14
14
# usage: file_env VAR
15
- # ie: file_env 'XYZ_DB_PASSWORD'
15
+ # ie: file_env 'XYZ_DB_PASSWORD'
16
16
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
17
17
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
18
18
file_env () {
19
- local var=" $1 "
20
- local fileVar=" ${var} _FILE"
19
+ local var=" $1 "
20
+ local fileVar=" ${var} _FILE"
21
21
22
22
# The variables are already defined from the docker-light-baseimage
23
23
# So if the _FILE variable is available we ovewrite them
24
- if [ " ${! fileVar:- } " ]; then
24
+ if [ " ${! fileVar:- } " ]; then
25
25
log-helper trace " ${fileVar} was defined"
26
26
27
- val=" $( < " ${! fileVar} " ) "
27
+ val=" $( < " ${! fileVar} " ) "
28
28
log-helper debug " ${var} was repalced with the contents of ${fileVar} (the value was: ${val} )"
29
29
30
30
export " $var " =" $val "
31
- fi
32
-
33
- unset " $fileVar "
31
+ fi
32
+
33
+ unset " $fileVar "
34
34
}
35
35
36
36
@@ -267,11 +267,11 @@ EOF
267
267
268
268
# start OpenLDAP
269
269
log-helper info " Start OpenLDAP..."
270
-
270
+ # At this stage, we can just listen to ldap:// and ldap:// without naming any names
271
271
if log-helper level ge debug; then
272
- slapd -h " ldap://$HOSTNAME $PREVIOUS_HOSTNAME_PARAM ldap://localhost ldapi:///" -u openldap -g openldap -d $LDAP_LOG_LEVEL 2>&1 &
272
+ slapd -h " ldap:/// ldapi:///" -u openldap -g openldap -d " $LDAP_LOG_LEVEL " 2>&1 &
273
273
else
274
- slapd -h " ldap://$HOSTNAME $PREVIOUS_HOSTNAME_PARAM ldap://localhost ldapi:///" -u openldap -g openldap
274
+ slapd -h " ldap:/// ldapi:///" -u openldap -g openldap
275
275
fi
276
276
277
277
365
365
366
366
# create DHParamFile if not found
367
367
[ -f ${LDAP_TLS_DH_PARAM_PATH} ] || openssl dhparam -out ${LDAP_TLS_DH_PARAM_PATH} 2048
368
-
368
+
369
369
# fix file permissions
370
370
if [ " ${DISABLE_CHOWN,,} " == " false" ]; then
371
371
chmod 600 ${LDAP_TLS_DH_PARAM_PATH}
@@ -520,8 +520,17 @@ ln -sf ${CONTAINER_SERVICE_DIR}/slapd/assets/.ldaprc $HOME/.ldaprc
520
520
ln -sf ${CONTAINER_SERVICE_DIR} /slapd/assets/ldap.conf /etc/ldap/ldap.conf
521
521
522
522
# force OpenLDAP to listen on all interfaces
523
+ # We need to make sure that /etc/hosts continues to include the
524
+ # fully-qualified domain name and not just the specified hostname.
525
+ # Without the FQDN, /bin/hostname --fqdn stops working.
526
+ FQDN=" $( /bin/hostname --fqdn) "
527
+ if [ " $FQDN " != " $HOSTNAME " ]; then
528
+ FQDN_PARAM=" $FQDN "
529
+ else
530
+ FQDN_PARAM=" "
531
+ fi
523
532
ETC_HOSTS=$( cat /etc/hosts | sed " /$HOSTNAME /d" )
524
- echo " 0.0.0.0 $HOSTNAME " > /etc/hosts
533
+ echo " 0.0.0.0 $FQDN_PARAM $ HOSTNAME" > /etc/hosts
525
534
echo " $ETC_HOSTS " >> /etc/hosts
526
535
527
536
exit 0
0 commit comments