Comment restaurer ses utilisateurs ldap?

Bonjour tout le monde,

J’ai mon serveur Yunohost qui a rendu l’âme physiquement (alim HS)

De fait, j’ai réinstallé un serveur Yunohost from scratch sur une raspberry avec la même conf réseau. J’ai crée l’utilisateur admin avec le même mot de passe que sur mon ancien Yunohost.

Je souhaiterais réimporter les utilsateurs LDAP sauvegardés de mon ancien serveur Yunohost.
Je possède une sauvegarde du ldap avec ses 3 fichiers;

  • dc=yunohost-dc=org.ldif
  • cn=config.master.ldif
  • ldap.conf

J’ai installé phpldapadmin et tenté l’import du fichier “dc=yunohost-dc=org.ldif”. Mais c’est un échec avec messages d’erreurs:


Could not add the object to the LDAP server.
**LDAP said**: Constraint violation
--- ---
**Error number**: 0x13 (LDAP_CONSTRAINT_VIOLATION)
**Description**: Some constraint would be violated by performing the action. This can happen when you try to add a second value to a single-valued attribute, for example.
![warn](https://online/phpldapadmin/htdocs/images/default/warn-big.png) LDIF text import
Could not add object **dc=yunohost,dc=org**

**LDAP said**: Constraint violation
--- ---
**Error number**: 0x13 (LDAP_CONSTRAINT_VIOLATION)
**Description**: Some constraint would be violated by performing the action. This can happen when you try to add a second value to a single-valued attribute, for example.
![error](https://online/phpldapadmin/htdocs/images/default/error-big.png) Could not add the object to the LDAP server.
**LDAP said**: Constraint violation
--- ---
**Error number**: 0x13 (LDAP_CONSTRAINT_VIOLATION)
**Description**: Some constraint would be violated by performing the action. This can happen when you try to add a second value to a single-valued attribute, for example.
![warn](https://online/phpldapadmin/htdocs/images/default/warn-big.png) LDIF text import
Could not add object **cn=admin,dc=yunohost,dc=org**

**LDAP said**: Constraint violation
--- ---
**Error number**: 0x13 (LDAP_CONSTRAINT_VIOLATION)
**Description**: Some constraint would be violated by performing the action. This can happen when you try to add a second value to a single-valued attribute, for example.
![error](https://online/phpldapadmin/htdocs/images/default/error-big.png) Could not add the object to the LDAP server.
**LDAP said**: Constraint violation
--- ---
**Error number**: 0x13 (LDAP_CONSTRAINT_VIOLATION)
**Description**: Some constraint would be violated by performing the action. This can happen when you try to add a second value to a single-valued attribute, for example.
![warn](https://online/phpldapadmin/htdocs/images/default/warn-big.png) LDIF text i...
<small>Adding [dc=yunohost,dc=org](https://online/phpldapadmin/htdocs/cmd.php?cmd=template_engine&server_id=1&dn=dc%3Dyunohost%2Cdc%3Dorg) Failed</small>

<small>Adding [cn=admin,dc=yunohost,dc=org](https://online/phpldapadmin/htdocs/cmd.php?cmd=template_engine&server_id=1&dn=cn%3Dadmin%2Cdc%3Dyunohost%2Cdc%3Dorg) Failed</small>

<small>Adding [ou=users,dc=yunohost,dc=org](https://online/phpldapadmin/htdocs/cmd.php?cmd=template_engine&server_id=1&dn=ou%3Dusers%2Cdc%3Dyunohost%2Cdc%3Dorg) Failed</small>

<small>Adding [ou=domains,dc=yunohost,dc=org](https://online/phpldapadmin/htdocs/cmd.php?cmd=template_engine&server_id=1&dn=ou%3Ddomains%2Cdc%3Dyunohost%2Cdc%3Dorg) Failed</small>

<small>Adding [ou=groups,dc=yunohost,dc=org](https://online/phpldapadmin/htdocs/cmd.php?cmd=template_engine&server_id=1&dn=ou%3Dgroups%2Cdc%3Dyunohost%2Cdc%3Dorg) Failed</small>

<small>Adding [ou=sudo,dc=yunohost,dc=org](https://online/phpldapadmin/htdocs/cmd.php?cmd=template_engine&server_id=1&dn=ou%3Dsudo%2Cdc%3Dyunohost%2Cdc%3Dorg) Failed</small>

Je sollicite donc votre aide ^^
Merci

Mon serveur YunoHost

  • raspberry 3
  • Yunohost 11.0.11
  • accès ssh , webadmin et en physique clavier écran
    J’ai accès à mon serveur : En SSH | Par la webadmin | En direct avec un clavier/écran | …

Réponse légèrement à côté: n’as-tu pas plutôt une sauvegarde système de YunoHost ? :thinking:

Merci pour ta réponse

J’ai un backup de /etc, /var et /home mais je ne sais pas où trouver les fichiers pour restaurer les utilisateurs…

Je suggérais de faire une restauration système, si tu en as une, qui devrait intégrer les utilisateurs, domaines, paramètres de YunoHost. Les sauvegardes générées par YunoHost sont dans /home/yunohost.backup/archives

dans /home/yunohost.backup/archives jai bien des fichiers .tar

Quand j’extrais l’archive"20230101-000101.tar", elle contient 3 dossiers:

  • conf
  • data
  • hooks

Je ne trouve pas de fichiers faisant référence aux comptes utilisateurs…

Je t’enjoins à lire la documentation : Sauvegarder son serveur | Yunohost Documentation

Salut,

Je ne sais pas si tu as réussi à faire ce que tu voulais mais je fais face à un problème similaire avec une base ldap corrompue.

Dans conf, il y a la partie ldap (normalement), mais pour restaurer l’archive tar il faut juste suivre la procédure de restauration décrite dans la doc que @tituspijean a donné.

Sinon tu peux t’inspirer du script de restoration qui est utilisé dans le système automatique:

ENfin, si tu n’a sfinalement pas de sauvegarde, tu peux probablement mettre le disque de l’ancien serveur dans un autre ordinateur pour pouvoir faire le backup.

1 Like

@tituspijean merci j’ai réussi à restaurer les comptes utilisateurs à partir de l’archive de sauvegarde. Donc le résultat au final cest ce que je voulais mais j’aurais préféré savoir le faire à la mano sans passer par les scripts auto …juste pour ma connaissance …

@thms quand tu dis base corrompue , tessayes de l’importer en ligne de commande avec openldap? cest quoi ton mess d’erreur?

@ljf merci , du coup je n’ai pas essayé , j’essayerai la prochaine fois que j’en aurai besoin mais le plus tard possible jespère ^^

Le bout de code mentionné par ljf devrait correspondre à ton envie de faire à la mano. :wink:

@DjeDje12 J’avais ouvert un autre topic avant de tomber sur le tien : Base ldap corrompue

Mais j’ai finalement réussi à m’en sorti après moults essais/erreurs et surtout grâce aux indications de @ljf.

Pour ne pas tout mélanger, je vais détailler la manière dont j’ai résolu mon problème dans mon topic.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.