Skip to content

Commit

Permalink
Add new image for user_saml_shibboleth-php8.0
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <[email protected]>

fix ipv6 entries in hosts file

Signed-off-by: Arthur Schiwon <[email protected]>

wait for jetty

Signed-off-by: Arthur Schiwon <[email protected]>

wait also for IdP

Signed-off-by: Arthur Schiwon <[email protected]>

exit early when LDAP is not ready

Signed-off-by: Arthur Schiwon <[email protected]>

wait up to 5min for each services, also on 7.3 image

Signed-off-by: Arthur Schiwon <[email protected]>

shut down slapd during build and clean locks

Signed-off-by: Arthur Schiwon <[email protected]>

fix proper startup and shutdown of 389ds on build

Signed-off-by: Arthur Schiwon <[email protected]>

fix deleted lock dir

Turned out not to be a good idea for this structure was expected.
The underlying issue was in an unclean slapd server shutdown,
fixed in a previous commit.

Signed-off-by: Arthur Schiwon <[email protected]>

provide specific log output when ldap fails

Signed-off-by: Arthur Schiwon <[email protected]>

do not use start.sh as CMD

Signed-off-by: Arthur Schiwon <[email protected]>

Update user_saml_shibboleth-php7.3/Dockerfile

Co-authored-by: Louis <[email protected]>
Signed-off-by: Vincent Petry <[email protected]>

Update user_saml_shibboleth-php7.3/start.sh

Co-authored-by: Louis <[email protected]>
Signed-off-by: Vincent Petry <[email protected]>

Use TERM signal to terminate slapd

Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
blizzz committed Apr 7, 2022
1 parent c0a2e0b commit d1c5c64
Show file tree
Hide file tree
Showing 57 changed files with 5,845 additions and 6 deletions.
20 changes: 17 additions & 3 deletions user_saml_shibboleth-php7.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM unicon/shibboleth-idp:3.4.3
ADD shibboleth/ /opt/shibboleth-idp/

# Install the LDAP server
RUN yum install -y https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install -y --enablerepo=centosplus 389-ds
RUN rm -fr /var/lock /usr/lib/systemd/system
ADD ldap/ds-setup.inf /ds-setup.inf
Expand All @@ -15,8 +15,19 @@ RUN sed -i 's/updateSelinuxPolicy($inf);//g' /usr/lib64/dirsrv/perl/*
ADD ldap/DSCreate.pm /usr/lib64/dirsrv/perl/DSCreate.pm
ADD ldap/AdminServer.pm /usr/lib64/dirsrv/perl/AdminServer.pm
RUN setup-ds-admin.pl --silent --file /ds-setup.inf
RUN /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir && sleep 20 && ldapmodify -H ldap:/// -f nextcloud.ldif -x -D "cn=Directory Manager" -w password && ldapadd -H ldap:/// -f users.ldif -x -D "cn=Directory Manager" -w password
RUN /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir \
# ensure to have enough time for startup
&& sleep 40 \
&& ldapmodify -H ldap:/// -f nextcloud.ldif -x -D "cn=Directory Manager" -w password \
&& ldapadd -H ldap:/// -f users.ldif -x -D "cn=Directory Manager" -w password \
&& sleep 10 \
&& kill -TERM "$(ps -C ns-slapd -o pid h)" \
# ensure to have enough time for shut-down
&& sleep 20 \
# debug output
&& ps -aux
RUN rm /*.ldif
RUN echo '' > /var/log/dirsrv/slapd-dir/errors

# Install Apache and PHP 7.3 for Nextcloud
RUN yum -y install centos-release-scl
Expand All @@ -33,4 +44,7 @@ RUN yum -y install nc
ADD start.sh /start.sh
RUN chmod a+x /start.sh

CMD ["/start.sh"]
ADD wait-for-services.sh /wait-for-services.sh
RUN chmod a+x /wait-for-services.sh

CMD ["/bin/bash"]
11 changes: 8 additions & 3 deletions user_saml_shibboleth-php7.3/start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

#set -x

Expand All @@ -19,7 +19,7 @@ apachectl &
/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir &

# wait for LDAP
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
for i in {1..300}
do
nc -zw 5 localhost 389
IS_LDAP=$?
Expand All @@ -28,5 +28,10 @@ do
fi
sleep 1
done
if [ ${IS_LDAP} -ne 0 ]; then
echo "LDAP is not ready"
cat /var/log/dirsrv/slapd-dir/errors
exit 1
fi

run-jetty.sh
run-jetty.sh &
25 changes: 25 additions & 0 deletions user_saml_shibboleth-php7.3/wait-for-services.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# wait for Jetty
for i in {1..300}
do
nc -zw 5 localhost 4443
IS_JETTY=$?
if [ ${IS_JETTY} -eq 0 ]; then
break
fi
sleep 1
done

# wait for IdP becoming ready
for i in {1..300}
do
if curl -f --silent -I -k https://localhost:4443/idp/ > /dev/null ; then
exit 0
break
fi
sleep 1
done

echo "Jetty or IdP not ready"
exit 1
54 changes: 54 additions & 0 deletions user_saml_shibboleth-php8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM unicon/shibboleth-idp:3.4.3

# Add Shibboleth config stuff
ADD shibboleth/ /opt/shibboleth-idp/

# Install the LDAP server
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install -y --enablerepo=centosplus 389-ds

RUN rm -fr /var/lock /usr/lib/systemd/system
ADD ldap/ds-setup.inf /ds-setup.inf
ADD ldap/users.ldif /users.ldif
ADD ldap/nextcloud.ldif /nextcloud.ldif
RUN sed -i 's/checkHostname {/checkHostname {\nreturn();/g' /usr/lib64/dirsrv/perl/DSUtil.pm
RUN sed -i 's/updateSelinuxPolicy($inf);//g' /usr/lib64/dirsrv/perl/*
ADD ldap/DSCreate.pm /usr/lib64/dirsrv/perl/DSCreate.pm
ADD ldap/AdminServer.pm /usr/lib64/dirsrv/perl/AdminServer.pm
RUN setup-ds-admin.pl --silent --file /ds-setup.inf
RUN /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-dir \
# ensure to have enough time for startup
&& sleep 40 \
&& ldapmodify -H ldap:/// -f nextcloud.ldif -x -D "cn=Directory Manager" -w password \
&& ldapadd -H ldap:/// -f users.ldif -x -D "cn=Directory Manager" -w password \
&& sleep 10 \
&& kill -TERM "$(ps -C ns-slapd -o pid h)" \
# ensure to have enough time for shut-down
&& sleep 20 \
# debug output
&& ps -aux
RUN rm /*.ldif
RUN echo '' > /var/log/dirsrv/slapd-dir/errors

# Install Apache and PHP 8.0 for Nextcloud
RUN yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum-config-manager --disable 'remi-php*'
RUN yum-config-manager --enable remi-php80
RUN yum -y install centos-release-scl
RUN yum -y install php php-{fpm,gd,mbstring,pecl-mcrypt,pdo,cli,zip,curl,xml,pear,bcmath,json} httpd git sudo
RUN sed -i "s/128M/512M/" /etc/php.ini
RUN mkdir /run/php-fpm
RUN chmod -R 777 /opt/
RUN rm -f /etc/httpd/conf.d/nss.conf
ADD apache/httpd.conf /etc/httpd/conf/httpd.conf

RUN yum -y install nc

# Add the startup file
ADD start.sh /start.sh
RUN chmod a+x /start.sh

ADD wait-for-services.sh /wait-for-services.sh
RUN chmod a+x /wait-for-services.sh

CMD ["/bin/bash"]
Loading

0 comments on commit d1c5c64

Please sign in to comment.