From 87e015fd63d8f907cd28d5bf2dcf3f074172eda3 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 20 Jan 2021 15:57:08 +0100 Subject: [PATCH 1/3] Temporary fix on directory init for seth module --- postservice/91-cadolesldap | 69 +++++++++++++++++++++++++++++++++++++ posttemplate/91-cadolesldap | 5 +++ 2 files changed, 74 insertions(+) create mode 100755 postservice/91-cadolesldap diff --git a/postservice/91-cadolesldap b/postservice/91-cadolesldap new file mode 100755 index 0000000..6210346 --- /dev/null +++ b/postservice/91-cadolesldap @@ -0,0 +1,69 @@ +#!/bin/bash + +# +# Initialisation of LDAP Directory +# + + +# +# Run command as particular user +# +function runAs() { + USER=${1} + shift + CMD="su ${USER} -s /bin/bash -c ${@}" + + eval ${CMD} + return ${?} +} + +function addLDAPschema() +{ + LDIF="/etc/cadolesldap/init/cadolesldap.ldif" + USER="openldap" + CMD="\"slapadd -l ${LDIF} -f \"/etc/ldap/slapd.conf\"\"" + + service slapd stop + runAs ${USER} ${CMD} + result=$((result+${?})) + service slapd start + return ${result} +} + +function addADSchema() +{ + /usr/share/eole/sbin/cadoles_add_schema.sh + return ${?} +} + +function main() +{ + MODE=${1} + result=0 + + + if [[ ${MODE} == "instance" ]] + then + if [[ $(CreoleGet eole_module) == "seth" ]] + then + addADSchema + return ${?} + else + addLDAPschema + return ${?} + fi + fi +} + +if [[ $(CreoleGet eole_module eolebase) != "seth" ]] +then + exit 0 +fi + +if [[ $(CreoleGet activer_cadolesldap non) == "oui" ]] +then + main $@ + exit ${?} +else + exit 0 +fi diff --git a/posttemplate/91-cadolesldap b/posttemplate/91-cadolesldap index 3a7d47c..813e417 100755 --- a/posttemplate/91-cadolesldap +++ b/posttemplate/91-cadolesldap @@ -55,6 +55,11 @@ function main() fi } +if [[ $(CreoleGet eole_module eolebase) == "seth" ]] +then + exit 0 +fi + if [[ $(CreoleGet activer_cadolesldap non) == "oui" ]] then main $@ From ff8eb3a042095b7d22290845798e6ae039c06864 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 20 Jan 2021 16:29:34 +0100 Subject: [PATCH 2/3] Fix ldap schema import for Set module --- ldap/schema/eole/cadoles.schema.ldif | 97 ---------------------------- scripts/cadoles_add_schema.sh | 18 +++--- 2 files changed, 9 insertions(+), 106 deletions(-) diff --git a/ldap/schema/eole/cadoles.schema.ldif b/ldap/schema/eole/cadoles.schema.ldif index c3ff35a..07a8a0b 100644 --- a/ldap/schema/eole/cadoles.schema.ldif +++ b/ldap/schema/eole/cadoles.schema.ldif @@ -297,100 +297,3 @@ description: Label Etablissement attributeSyntax: 2.5.5.12 oMSyntax: 64 isSingleValued: TRUE - -DN: -changeType: modify -add: schemaUpdateNow -schemaUpdateNow: 1 -- - -dn: CN=cadolesPerson,CN=Schema,CN=Configuration,{DNCONFIG} -changeType: add -objectClass: top -objectClass: classSchema -governsID: 2.16.840.1.113732.3.1.1 -schemaIdGuid:: BS9z8eJKvYZ+lS8OJgeC1g== -cn: cadolesPerson -name: cadolesPerson -lDAPDisplayName: cadolesPerson -description: Description Personne Cadoles -subClassOf: top -objectClassCategory: 3 -mayContain: givensName -mayContain: usualname -mayContain: birthdate -mayContain: birthcountry -mayContain: birthplace -mayContain: gender -mayContain: job -mayContain: position -mayContain: belongingpopulation -mayContain: authlevel -defaultObjectCategory: CN=cadolesPerson,CN=Schema,CN=Configuration,{DNCONFIG} - -DN: -changeType: modify -add: schemaUpdateNow -schemaUpdateNow: 1 -- - -dn: CN=cadolesSiren,CN=Schema,CN=Configuration,{DNCONFIG} -changeType: add -objectClass: top -objectClass: classSchema -governsID: 2.16.840.1.113732.3.1.2 -schemaIdGuid:: 7pJbNueSjwpq7TsL2aiW1w== -cn: cadolesSiren -name: cadolesSiren -lDAPDisplayName: cadolesSiren -description: Siren -subClassOf: top -objectClassCategory: 3 -mayContain: siren -mayContain: niveau01 -defaultObjectCategory: CN=cadolesSiren,CN=Schema,CN=Configuration,{DNCONFIG} - -DN: -changeType: modify -add: schemaUpdateNow -schemaUpdateNow: 1 -- - -dn: CN=cadolesSiret,CN=Schema,CN=Configuration,{DNCONFIG} -changeType: add -objectClass: top -objectClass: classSchema -governsID: 2.16.840.1.113732.3.1.3 -schemaIdGuid:: BOOf/nwBuCFehtpsyYrLjA== -cn: cadolesSiret -name: cadolesSiret -lDAPDisplayName: cadolesSiret -description: Siret -subClassOf: top -objectClassCategory: 3 -mayContain: siret -mayContain: postalAddress -mayContain: niveau02 -defaultObjectCategory: CN=cadolesSiret,CN=Schema,CN=Configuration,{DNCONFIG} - -DN: -changeType: modify -add: schemaUpdateNow -schemaUpdateNow: 1 -- - -dn: CN=cadolesGroup,CN=Schema,CN=Configuration,{DNCONFIG} -changeType: add -objectClass: top -objectClass: classSchema -governsID: 2.16.840.1.113732.3.1.4 -schemaIdGuid:: IPc/rPzhpAjekHrvXgdI8w== -cn: cadolesGroup -name: cadolesGroup -lDAPDisplayName: cadolesGroup -description: Descirption Groupe Cadoles -subClassOf: top -objectClassCategory: 3 -mayContain: cadolesMember -defaultObjectCategory: CN=cadolesGroup,CN=Schema,CN=Configuration,{DNCONFIG} - diff --git a/scripts/cadoles_add_schema.sh b/scripts/cadoles_add_schema.sh index ca987f4..9b103ca 100755 --- a/scripts/cadoles_add_schema.sh +++ b/scripts/cadoles_add_schema.sh @@ -33,23 +33,23 @@ RETURNED=$(ldbsearch --option="dsdb:schema update allowed"=true -H /var/lib/samb if [ "$RETURNED" = "# returned 0 records" ]; then # Import schema - SCHEMAS="cadoles.schema" + SCHEMAS="cadoles.schema cadoles.schema-2" PRIVATE_DIR=/etc/eole/private for schema in $SCHEMAS do - updateSchemaDN "{DNCONFIG}" "${DN}" /etc/ldap/schema/eole/${schema}.ldif - if [[ $? -ne 0 ]] - then + updateSchemaDN "{DNCONFIG}" "${DN}" /etc/ldap/schema/eole/${schema}.ldif + if [[ $? -ne 0 ]] + then echo "Error updating DN for ${schema}" break fi ldbmodify -H /var/lib/samba/private/sam.ldb /etc/ldap/schema/eole/${schema}.ldif --option="dsdb:schema update allowed"=true - if [[ $? -ne 0 ]] - then - echo "Error updating Schema ${schema} !!" - break - fi + if [[ $? -ne 0 ]] + then + echo "Error updating Schema ${schema} !!" + break + fi done fi From 613b33236c8b02090f2bdf3fa364787df58de9c9 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Wed, 20 Jan 2021 16:37:00 +0100 Subject: [PATCH 3/3] Adding missing schema for AD --- ldap/schema/eole/cadoles.schema-2.ldif | 96 ++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 ldap/schema/eole/cadoles.schema-2.ldif diff --git a/ldap/schema/eole/cadoles.schema-2.ldif b/ldap/schema/eole/cadoles.schema-2.ldif new file mode 100644 index 0000000..1e8fefe --- /dev/null +++ b/ldap/schema/eole/cadoles.schema-2.ldif @@ -0,0 +1,96 @@ +DN: +changeType: modify +add: schemaUpdateNow +schemaUpdateNow: 1 +- + +dn: CN=cadolesPerson,CN=Schema,CN=Configuration,{DNCONFIG} +changeType: add +objectClass: top +objectClass: classSchema +governsID: 2.16.840.1.113732.3.1.1 +schemaIdGuid:: BS9z8eJKvYZ+lS8OJgeC1g== +cn: cadolesPerson +name: cadolesPerson +lDAPDisplayName: cadolesPerson +description: Description Personne Cadoles +subClassOf: top +objectClassCategory: 3 +mayContain: givensName +mayContain: usualname +mayContain: birthdate +mayContain: birthcountry +mayContain: birthplace +mayContain: gender +mayContain: job +mayContain: position +mayContain: belongingpopulation +mayContain: authlevel +defaultObjectCategory: CN=cadolesPerson,CN=Schema,CN=Configuration,{DNCONFIG} + +DN: +changeType: modify +add: schemaUpdateNow +schemaUpdateNow: 1 +- + +dn: CN=cadolesSiren,CN=Schema,CN=Configuration,{DNCONFIG} +changeType: add +objectClass: top +objectClass: classSchema +governsID: 2.16.840.1.113732.3.1.2 +schemaIdGuid:: 7pJbNueSjwpq7TsL2aiW1w== +cn: cadolesSiren +name: cadolesSiren +lDAPDisplayName: cadolesSiren +description: Siren +subClassOf: top +objectClassCategory: 3 +mayContain: siren +mayContain: niveau01 +defaultObjectCategory: CN=cadolesSiren,CN=Schema,CN=Configuration,{DNCONFIG} + +DN: +changeType: modify +add: schemaUpdateNow +schemaUpdateNow: 1 +- + +dn: CN=cadolesSiret,CN=Schema,CN=Configuration,{DNCONFIG} +changeType: add +objectClass: top +objectClass: classSchema +governsID: 2.16.840.1.113732.3.1.3 +schemaIdGuid:: BOOf/nwBuCFehtpsyYrLjA== +cn: cadolesSiret +name: cadolesSiret +lDAPDisplayName: cadolesSiret +description: Siret +subClassOf: top +objectClassCategory: 3 +mayContain: siret +mayContain: postalAddress +mayContain: niveau02 +defaultObjectCategory: CN=cadolesSiret,CN=Schema,CN=Configuration,{DNCONFIG} + +DN: +changeType: modify +add: schemaUpdateNow +schemaUpdateNow: 1 +- + +dn: CN=cadolesGroup,CN=Schema,CN=Configuration,{DNCONFIG} +changeType: add +objectClass: top +objectClass: classSchema +governsID: 2.16.840.1.113732.3.1.4 +schemaIdGuid:: IPc/rPzhpAjekHrvXgdI8w== +cn: cadolesGroup +name: cadolesGroup +lDAPDisplayName: cadolesGroup +description: Descirption Groupe Cadoles +subClassOf: top +objectClassCategory: 3 +mayContain: cadolesMember +defaultObjectCategory: CN=cadolesGroup,CN=Schema,CN=Configuration,{DNCONFIG} +