diff options
Diffstat (limited to 'idp/shib-entrypoint.sh')
| -rwxr-xr-x | idp/shib-entrypoint.sh | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/idp/shib-entrypoint.sh b/idp/shib-entrypoint.sh index eec7dcd..7803c11 100755 --- a/idp/shib-entrypoint.sh +++ b/idp/shib-entrypoint.sh @@ -6,4 +6,66 @@ if [ -f /metadata/sp-metadata.xml ]; then sed -i -e '/sp.nordu.dev/ s/<!--//' -e '/sp.nordu.dev/ s/-->//' /opt/shibboleth-idp/conf/metadata-providers.xml fi -/docker-entrypoint.sh "$@" +IDP_PROPERTIES=${IDP_PROPERTIES:-/opt/shibboleth-idp/conf/idp.properties} +if [ -n "$IDP_HOSTNAME" ]; then + sed -i -e "s/idp.nordu.dev/$IDP_HOSTNAME/" $IDP_PROPERTIES +fi +if [ -n "$IDP_SCOPE" ]; then + sed -i -e "/idp.scope=/ s/nordu.dev/$IDP_HOSTNAME/" $IDP_PROPERTIES +fi + +# FTICKS +if [ -n "$FTICKS_FEDERATION" ]; then + sed -i -e '/idp.fticks.federation=/ s/^#//' \ + -e "/idp.fticks.federation=/ s/MyFederation/$FTICKS_FEDERATION/" \ + -e '/idp.fticks.algorithm=/ s/^#//' $IDP_PROPERTIES + if [ -n "$FTICKS_SALT" ]; then + sed -i -e '/idp.fticks.salt=/ s/^#//' \ + -e "/idp.fticks.salt=/ s/=.*/=$FTICKS_SALT/" $IDP_PROPERTIES + fi + + if [ -n "$FTICKS_HOST" ]; then + sed -i -e '/idp.fticks.loghost=/ s/^#//' \ + -e "/idp.fticks.loghost=/ s/=.*/=$FTICKS_HOST/" $IDP_PROPERTIES + fi + if [ -n "$FTICKS_PORT" ]; then + sed -i -e '/idp.fticks.logport=/ s/^#//' \ + -e "/idp.fticks.logport=/ s/=.*/=$FTICKS_PORT/" $IDP_PROPERTIES + fi +fi + +# PersistentID + +if [ -n "$IDP_PERSISTENTID_SALT" ]; then + if ! grep '<ref bean="shibboleth.SAML2PersistentGenerator" />' /opt/shibboleth-idp/conf/saml-nameid.xml ; then + sed -i -e '/<util:list id="shibboleth.SAML2NameIDGenerators">/ a <ref bean="shibboleth.SAML2PersistentGenerator" />' /opt/shibboleth-idp/conf/saml-nameid.xml + fi + + source_attr=${IDP_PERSISTENTID_SOURCE:-uid} + sed -i -e '/idp.persistentId.sourceAttribute/ s/^#//' \ + -e "/idp.persistentId.sourceAttribute/ s/changethistosomethingreal/$source_attr/" \ + -e '/idp.persistentId.salt/ s/^#//' \ + -e "/idp.persistentId.salt/ s/changethistosomethingrandom/$IDP_PERSISTENTID_SALT/" /opt/shibboleth-idp/conf/saml-nameid.properties + # add xml conf to attribute-resolver + if ! grep "%{idp.persistentId.sourceAttribute}" /opt/shibboleth-idp/conf/attribute-resolver.xml ; then + sed -i '/<!-- eduPersonTargetdID placeholder -->/r /opt/template-config/edupersontargetdid.xml.add' /opt/shibboleth-idp/conf/attribute-resolver.xml + fi +fi + +if [ -n "$IDP_DEBUG" ]; then + echo "idp.loglevel.messages=DEBUG" >> $IDP_PROPERTIES + echo "idp.loglevel.encryption=DEBUG" >> $IDP_PROPERTIES +fi + +DATADIR=/opt/data +# overwrite signing keys if present +if [ -f ${DATADIR}/credentials/idp-signing.key -a -f ${DATADIR}/credentials/idp-signing.crt ]; then + cp ${DATADIR}/credentials/idp-signing.key /opt/shibboleth-idp/credentials/idp-signing.key + cp ${DATADIR}/credentials/idp-signing.crt /opt/shibboleth-idp/credentials/idp-signing.crt +fi + +if [ $IDP_DEBUG ]; then + sed -i -e '/idp.loglevel.messages/ s/INFO/DEBUG/' -e '/idp.loglevel.encryption/ s/INFO/DEBUG/' /opt/shibboleth-idp/conf/logback.xml +fi + +/docker-entrypoint.sh java -jar /usr/local/jetty/start.jar $JAVA_OPTIONS |
