diff --git a/1.17.2/install-simplesamlphp.sh b/1.17.2/install-simplesamlphp.sh index 2571751..87a2b26 100644 --- a/1.17.2/install-simplesamlphp.sh +++ b/1.17.2/install-simplesamlphp.sh @@ -232,6 +232,36 @@ else rm -rf /simplesamlphp-*/ fi +#Only configure null cient for mail if MTA_NULLCLIENT is true, else remove postfix +if [ "$MTA_NULLCLIENT" == "true" ]; then + echo "[$0] MTA_NULLCLIENT was set to true, configuring postfix..." + sed -i "s|#myhostname = host.domain.tld|myhostname = $POSTFIX_MYHOSTNAME|g" /etc/postfix/main.cf + sed -i "s|#myorigin = \$myhostname|myorigin = $POSTFIX_MYORIGIN|g" /etc/postfix/main.cf + sed -i "s|#relayhost = \$mydomain|relayhost = $POSTFIX_RELAYHOST|g" /etc/postfix/main.cf + sed -i "s|inet_interfaces = localhost|inet_interfaces = $POSTFIX_INETINTERFACES|g" /etc/postfix/main.cf + sed -i "s|inet_protocols = all|inet_protocols = ipv4|g" /etc/postfix/main.cf + sed -i "s|mydestination = \$myhostname, localhost.\$mydomain, localhost|mydestination = $POSTFIX_MYDESTINATION|1" /etc/postfix/main.cf + if [ "$POSTFIX_MYDESTINATION" != "" ] ; then + echo "[$0] [WARN] Only null client is supported in this image. POSTFIX_MYDESTINATION must be set to an empty string but was set to '$POSTFIX_MYDESTINATION'." + echo "[$0] To avoid this warning in the future, set POSTFIX_MYDESTINATION to an empty string." + echo "[$0] Pausing 5 seconds due to above warning." + sleep 5 + fi + echo "[$0] Configured null client." +elif [ "$MTA_NULLCLIENT" == "false" ]; then + echo "[$0] MTA_NULLCLIENT was set to false, removing postfix and mariadb-libs" + yum remove -y postfix mariadb-libs > /dev/null + rm -rf /etc/services.d/postfix/ +else + echo "[$0] [WARN] Unsupported value for MTA_NULLCLIENT. Expecting 'true' or 'false', but was set to '$MTA_NULLCLIENT'. + echo "[$0] To avoid this warning in the future, set MTA_NULLCLIENT to a valid value. Doing nothing. + echo "[$0] Pausing 5 seconds due to above warning." + sleep 5 +fi + +#Apply server certificate check in a TLS session +echo -e "TLS_REQCERT\t$OPENLDAP_TLS_REQCERT" >> /etc/openldap/ldap.conf + ls -A /var/simplesamlphp/config/.dockersetupdone &> /dev/null if ! [ $? -ne 0 ]; then echo "[$0] Breadcrumb located, skipping firstime config." @@ -239,9 +269,6 @@ if ! [ $? -ne 0 ]; then exit 0 fi -#Apply server certificate check in a TLS session -echo -e "TLS_REQCERT\t$OPENLDAP_TLS_REQCERT" >> /etc/openldap/ldap.conf - #Configure SimpleSAMLphp from runtime variables. echo "[$0] Apply Configuration to config.php..." @@ -295,33 +322,6 @@ sed -i "s|'store.type' => 'phpsession',|'store.type' sed -i "s|'core/frontpage_welcome.php'|'$WWW_INDEX'|g" /var/simplesamlphp/www/index.php -#Only configure null cient for mail if MTA_NULLCLIENT is true, else remove postfix -if [ "$MTA_NULLCLIENT" == "true" ]; then - echo "[$0] MTA_NULLCLIENT was set to true, configuring postfix..." - sed -i "s|#myhostname = host.domain.tld|myhostname = $POSTFIX_MYHOSTNAME|g" /etc/postfix/main.cf - sed -i "s|#myorigin = \$myhostname|myorigin = $POSTFIX_MYORIGIN|g" /etc/postfix/main.cf - sed -i "s|#relayhost = \$mydomain|relayhost = $POSTFIX_RELAYHOST|g" /etc/postfix/main.cf - sed -i "s|inet_interfaces = localhost|inet_interfaces = $POSTFIX_INETINTERFACES|g" /etc/postfix/main.cf - sed -i "s|inet_protocols = all|inet_protocols = ipv4|g" /etc/postfix/main.cf - sed -i "s|mydestination = \$myhostname, localhost.\$mydomain, localhost|mydestination = $POSTFIX_MYDESTINATION|1" /etc/postfix/main.cf - if [ "$POSTFIX_MYDESTINATION" != "" ] ; then - echo "[$0] [WARN] Only null client is supported in this image. POSTFIX_MYDESTINATION must be set to an empty string but was set to '$POSTFIX_MYDESTINATION'." - echo "[$0] To avoid this warning in the future, set POSTFIX_MYDESTINATION to an empty string." - echo "[$0] Pausing 5 seconds due to above warning." - sleep 5 - fi - echo "[$0] Configured null client." -elif [ "$MTA_NULLCLIENT" == "false" ]; then - echo "[$0] MTA_NULLCLIENT was set to false, removing postfix and mariadb-libs" - yum remove -y postfix mariadb-libs > /dev/null - rm -rf /etc/services.d/postfix/ -else - echo "[$0] [WARN] Unsupported value for MTA_NULLCLIENT. Expecting 'true' or 'false', but was set to '$MTA_NULLCLIENT'. - echo "[$0] To avoid this warning in the future, set MTA_NULLCLIENT to a valid value. Doing nothing. - echo "[$0] Pausing 5 seconds due to above warning." - sleep 5 -fi - #Check for valid phpsession configuration if [ "$CONFIG_STORETYPE" == "phpsession" ] && [ "$CONFIG_SESSIONPHPSESSIONSAVEPATH" == "null" ]; then echo "[$0] [WARN] CONFIG_STORETYPE was set to 'phpsession', but CONFIG_SESSIONPHPSESSIONSAVEPATH was not set from null. This will not work. Setting CONFIG_SESSIONPHPSESSIONSAVEPATH to '/var/lib/php/session/'."