Explorar el Código

Updating init script ... just make it work again

tags/pkg/dev/eole-2.5.2/0.0.1-0
Philippe Caseiro hace 1 año
padre
commit
d3d5e4ea6d
Se han modificado 2 ficheros con 63 adiciones y 38 borrados
  1. 15
    0
      creolefuncs/shibboleth-idp.py
  2. 48
    38
      pretemplate/20-init-shib-IDP

+ 15
- 0
creolefuncs/shibboleth-idp.py Ver fichero

@@ -14,3 +14,18 @@ def getLdapReader(encoder, passwd):
14 14
             return passwd
15 15
     except:
16 16
         return "mot de passe inconnu"
17
+
18
+def getSealer(encoder, file):
19
+    import os
20
+    try:
21
+        if os.path.isfile(file):
22
+            mypwdreader=open(file, "r").readline().rstrip()
23
+            if encoder == "":
24
+                return mypwdreader
25
+            elif encoder == "base64":
26
+                import base64
27
+                return base64.b64encode(mypwdreader)
28
+        else:
29
+            return file
30
+    except:
31
+        return "mot de passe inconnu"

+ 48
- 38
pretemplate/20-init-shib-IDP Ver fichero

@@ -13,43 +13,53 @@ esac
13 13
 
14 14
 if [[ ${RUN} -eq 1 ]]
15 15
 then
16
-	SRCDIR=$(CreoleGet shibbolethIDPSrc)
17
-
18
-	echo "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre" >> /etc/environment
19
-	echo "IDP_SRC=${SRCDIR}" >> /etc/environment
20
-
21
-	source /etc/environment
22
-	export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
23
-	export IDP_SRC=${SRCDIR}
24
-
25
-	srcdir=${IDP_SRC}
26
-	target="/opt/shibboleth-idp"
27
-	hostname=$(CreoleGet nom_domaine_machine)
28
-	mergepropfile=${SRCDIR}/merge.properties
29
-
30
-	entityid="$(CreoleGet entityID)"
31
-	scope="$(CreoleGet samlScope)"
32
-
33
-	sealerPassword=$(date +%s | sha256sum | base64 | head -c 24)
34
-	keystorePassword=$(date +%s | sha256sum | base64 | head -c 24)
35
-
36
-	echo "${sealerPassword}" >> /root/idp.sealer && chmod 600 /root/idp.sealer
37
-	echo "${keystorePassword}" >> /root/idp.keystorer && chmod 600 /root/idp.sealer
38
-
39
-	echo "idp.entityID = ${entityid}" >> ${mergepropfile}
40
-
41
-	CMD="./bin/install.sh"
42
-	OPT="-Didp.src.dir=${SRCDIR}"
43
-	OPT="${OPT} -Didp.merge.properties=${mergepropfile}"
44
-	OPT="${OPT} -Didp.target.dir=${target}"
45
-	OPT="${OPT} -Didp.host.name=${hostname}"
46
-	OPT="${OPT} -Didp.sealer.password=${sealerPassword}"
47
-	OPT="${OPT} -Didp.keystore.password=${keystorePassword}"
48
-	OPT="${OPT} -Didp.scope=${scope}"
49
-
50
-	cd ${srcdir}
51
-	${CMD} ${OPT}
52
-	exit ${?}
16
+    SRCDIR=$(CreoleGet shibbolethIDPSrc)
17
+    echo "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre" >> /etc/environment
18
+    echo "IDP_SRC=${SRCDIR}" >> /etc/environment
19
+    source /etc/environment
20
+    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
21
+    export IDP_SRC=${SRCDIR}
22
+    tomUser="tomcat8"
23
+    tomGroup="adm"
24
+    srcdir=${IDP_SRC}
25
+    target="/opt/shibboleth-idp"
26
+    hostname=$(CreoleGet nom_domaine_machine)
27
+    mergepropfile=${SRCDIR}/merge.properties
28
+    entityid="$(CreoleGet entityID)"
29
+    scope="$(CreoleGet samlScope)"
30
+    serverCert=$(CreoleGet server_cert)
31
+    serverKey=$(CreoleGet server_key)
32
+    sealerPassword=$(date +%s | sha256sum | base64 | head -c 24)
33
+    echo "${sealerPassword}" >> /root/idp.sealer && chmod 600 /root/.idp.sealer
34
+    cat >${mergepropfile} <<__EOF__
35
+idp.entityID = ${entityid}
36
+idp.sealer.storePassword= ${sealerPassword}
37
+idp.sealer.keyPassword= ${sealerPassword}
38
+idp.signing.key= ${serverKey}
39
+idp.signing.cert= ${serverCert}
40
+idp.encryption.key= ${serverKey}
41
+idp.encryption.cert= ${serverCert}
42
+idp.entityID= http://${hostname}/idp/shibboleth
43
+idp.scope= ${scope}
44
+idp.uri.subject.alt.name= ${hostname}
45
+idp.host.name= ${hostname}
46
+idp.ui.fallbackLanguages= fr
47
+idp.session.secondaryServiceIndex = true
48
+__EOF__
49
+    CMD="./bin/install.sh"
50
+    OPT="-Didp.src.dir=${SRCDIR}"
51
+    OPT="${OPT} -Didp.merge.properties=${mergepropfile}"
52
+    OPT="${OPT} -Didp.home=${target}"
53
+    OPT="${OPT} -Didp.target.dir=${target}"
54
+    OPT="${OPT} -Didp.host.name=${hostname}"
55
+    OPT="${OPT} -Didp.sealer.password=${sealerPassword}"
56
+    OPT="${OPT} -Didp.keystore.password=${sealerPassword}"
57
+    OPT="${OPT} -Didp.scope=${scope}"
58
+    cd ${srcdir}
59
+    ${CMD} ${OPT}
60
+    res=${?}
61
+    chown -R ${tomUser}:${tomGroup} ${target}
62
+    exit ${res}
53 63
 else
54
-	exit 0
64
+    exit 0
55 65
 fi

Loading…
Cancelar
Guardar