updated script in primary repo

This commit is contained in:
Asif Bacchus 2019-10-20 22:47:50 -06:00
parent 2beba0b496
commit 6266e34200
2 changed files with 102 additions and 31 deletions

View File

@ -64,4 +64,10 @@ ANONYMOUS_BINDING=yes
# The container will generate Diffie-Hellman parameters automatically the first # The container will generate Diffie-Hellman parameters automatically the first
# time it's launched with TLS certificates defined. # time it's launched with TLS certificates defined.
### Custom LDIFs
# Path to any custom LDIFs you want applied to the container. Leave this line/
# variable commented-out if you don't have any LDIFs to apply.
# MY_LDIF=/path/to/my/LDIFs
#EOF #EOF

View File

@ -174,18 +174,45 @@ elif [ -z "$TLS_CERT" ]; then
if [ $shell = true ]; then if [ $shell = true ]; then
# exec shell # exec shell
printf "${cyan}\nRunning SHELL on %s...${norm}\n" "$container_name" printf "${cyan}\nRunning SHELL on %s...${norm}\n" "$container_name"
if [ -d "$MY_LDIF" ]; then
# bind-mount custom LDIFs if specified
docker run --rm -it --name ${container_name} \
--env-file ab-openldap.params \
-v "$MY_LDIF":/etc/openldap/customLDIF \
-p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest /bin/sh
else
docker run --rm -it --name ${container_name} \ docker run --rm -it --name ${container_name} \
--env-file ab-openldap.params \ --env-file ab-openldap.params \
-p 389:389 -p 636:636 \ -p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest /bin/sh docker.asifbacchus.app/ldap/ab-openldap:latest /bin/sh
fi
else else
# exec normally # exec normally
printf "${cyan}\nRunning OPENLDAP on %s...${norm}\n" "$container_name" printf "${cyan}\nRunning OPENLDAP on %s...${norm}\n" "$container_name"
if [ "$remove" -eq 1 ]; then if [ "$remove" -eq 1 ]; then
if [ -d "$MY_LDIF" ]; then
# bind-mount custom LDIFs if specified
docker run --rm -d --name ${container_name} \
--env-file ab-openldap.params \
-v "$MY_LDIF":/etc/openldap/customLDIF \
-p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest
else
docker run --rm -d --name ${container_name} \ docker run --rm -d --name ${container_name} \
--env-file ab-openldap.params \ --env-file ab-openldap.params \
-p 389:389 -p 636:636 \ -p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest docker.asifbacchus.app/ldap/ab-openldap:latest
fi
else
if [ -d "$MY_LDIF" ]; then
# bind-mount custom LDIFs if specified
docker run -d --name ${container_name} \
--env-file ab-openldap.params \
-v "$MY_LDIF":/etc/openldap/customLDIF \
-p 389:389 -p 636:636 \
--restart unless-stopped \
docker.asifbacchus.app/ldap/ab-openldap:latest
else else
docker run -d --name ${container_name} \ docker run -d --name ${container_name} \
--env-file ab-openldap.params \ --env-file ab-openldap.params \
@ -194,11 +221,23 @@ elif [ -z "$TLS_CERT" ]; then
docker.asifbacchus.app/ldap/ab-openldap:latest docker.asifbacchus.app/ldap/ab-openldap:latest
fi fi
fi fi
fi
# run with TLS # run with TLS
elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then
if [ $shell = true ]; then if [ $shell = true ]; then
# exec shell # exec shell
printf "${cyan}\nRunning SHELL on %s (TLS)...${norm}\n" "$container_name" printf "${cyan}\nRunning SHELL on %s (TLS)...${norm}\n" "$container_name"
if [ -d "$MY_LDIF" ]; then
# bind-mount custom LDIFs if specified
docker run --rm -it --name ${container_name} \
--env-file ab-openldap.params \
-v "$MY_LDIF":/etc/openldap/customLDIF \
-v "$TLS_CERT":/certs/fullchain.pem:ro \
-v "$TLS_KEY":/certs/privkey.pem:ro \
-v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest /bin/sh
else
docker run --rm -it --name ${container_name} \ docker run --rm -it --name ${container_name} \
--env-file ab-openldap.params \ --env-file ab-openldap.params \
-v "$TLS_CERT":/certs/fullchain.pem:ro \ -v "$TLS_CERT":/certs/fullchain.pem:ro \
@ -206,10 +245,22 @@ elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then
-v "$TLS_CHAIN":/certs/chain.pem:ro \ -v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \ -p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest /bin/sh docker.asifbacchus.app/ldap/ab-openldap:latest /bin/sh
fi
else else
# exec normally # exec normally
printf "${cyan}\nRunning OPENLDAP on %s (TLS)...${norm}\n" "$container_name" printf "${cyan}\nRunning OPENLDAP on %s (TLS)...${norm}\n" "$container_name"
if [ "$remove" -eq 1 ]; then if [ "$remove" -eq 1 ]; then
if [ -d "$MY_LDIF" ]; then
# bind-mount custom LDIFs if specified
docker run --rm -d --name ${container_name} \
--env-file ab-openldap.params \
-v "$MY_LDIF":/etc/openldap/customLDIF \
-v "$TLS_CERT":/certs/fullchain.pem:ro \
-v "$TLS_KEY":/certs/privkey.pem:ro \
-v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest
else
docker run --rm -d --name ${container_name} \ docker run --rm -d --name ${container_name} \
--env-file ab-openldap.params \ --env-file ab-openldap.params \
-v "$TLS_CERT":/certs/fullchain.pem:ro \ -v "$TLS_CERT":/certs/fullchain.pem:ro \
@ -217,6 +268,19 @@ elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then
-v "$TLS_CHAIN":/certs/chain.pem:ro \ -v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \ -p 389:389 -p 636:636 \
docker.asifbacchus.app/ldap/ab-openldap:latest docker.asifbacchus.app/ldap/ab-openldap:latest
fi
else
if [ -d "$MY_LDIF" ]; then
# bind-mount custom LDIFs if specified
docker run -d --name ${container_name} \
--env-file ab-openldap.params \
-v "$MY_LDIF":/etc/openldap/customLDIF \
-v "$TLS_CERT":/certs/fullchain.pem:ro \
-v "$TLS_KEY":/certs/privkey.pem:ro \
-v "$TLS_CHAIN":/certs/chain.pem:ro \
-p 389:389 -p 636:636 \
--restart unless-stopped \
docker.asifbacchus.app/ldap/ab-openldap:latest
else else
docker run -d --name ${container_name} \ docker run -d --name ${container_name} \
--env-file ab-openldap.params \ --env-file ab-openldap.params \
@ -228,6 +292,7 @@ elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then
docker.asifbacchus.app/ldap/ab-openldap:latest docker.asifbacchus.app/ldap/ab-openldap:latest
fi fi
fi fi
fi
fi fi