Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2653 connectés 

  FORUM HardWare.fr
  Linux et OS Alternatifs
  réseaux et sécurité

  OpenLDAP et SAMBA | Insufficient access at /usr/sbin/smbldap-passwd li

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

OpenLDAP et SAMBA | Insufficient access at /usr/sbin/smbldap-passwd li

n°966268
bmachina
Posté le 19-10-2007 à 00:51:49  profilanswer
 

Bonjour à tous,
 
j'essaie de configurer un serveur SAMBA dont les utilisateurs sont géré par un annuaire LDAP (en l'occurrence OpenLDAP).
j'utilise:

  • openSuse 10.3
  • OpenLDAP 2.3.37
  • smbldap-tools 0.9.4-3
  • nss_ldap 257.2-2
  • pam_ldap 184-49


j'ai fait une première configuration dans laquelle j'accédais à l'annuaire avec le compte Root DN. Avec cette config, tout fonctionnait à merveille. Pour des raisons évidentes de sécurité je souhaite faire une autre config dans laquelle j'utilise un compte cn=samba,ou=DSA,dc=effata,dc=ch pour les accès SAMBA à l'annuaire, et un autre compte cn=smbldap-tools,ou=DSA,dc=effata,dc=ch pour l'accès des scripts smbldap-tools à l'annuaire.
 
Je rencontre un problème lorsque j'exécute le script smbldap-populate dont le résultat est ci-dessous:

Code :
  1. smbldap-populate
  2. Populating LDAP directory for domain EFFATA.CH (S-1-5-21-918170500-1583366388-3599232829)
  3. (using builtin directory structure)
  4. entry dc=effata,dc=ch already exist.
  5. entry ou=Users,dc=effata,dc=ch already exist.
  6. entry ou=Groups,dc=effata,dc=ch already exist.
  7. entry ou=Computers,dc=effata,dc=ch already exist.
  8. entry ou=Idmap,dc=effata,dc=ch already exist.
  9. entry uid=root,ou=Users,dc=effata,dc=ch already exist.
  10. entry uid=nobody,ou=Users,dc=effata,dc=ch already exist.
  11. entry cn=Domain Admins,ou=Groups,dc=effata,dc=ch already exist.
  12. entry cn=Domain Users,ou=Groups,dc=effata,dc=ch already exist.
  13. entry cn=Domain Guests,ou=Groups,dc=effata,dc=ch already exist.
  14. entry cn=Domain Computers,ou=Groups,dc=effata,dc=ch already exist.
  15. entry cn=Administrators,ou=Groups,dc=effata,dc=ch already exist.
  16. entry cn=Account Operators,ou=Groups,dc=effata,dc=ch already exist.
  17. entry cn=Print Operators,ou=Groups,dc=effata,dc=ch already exist.
  18. entry cn=Backup Operators,ou=Groups,dc=effata,dc=ch already exist.
  19. entry cn=Replicators,ou=Groups,dc=effata,dc=ch already exist.
  20. entry sambaDomainName=EFFATA.CH,dc=effata,dc=ch already exist. Updating it...
  21. Please provide a password for the domain root:
  22. Changing UNIX and samba passwords for root
  23. New password:
  24. Retype new password:
  25. Failed to modify UNIX password: Insufficient access at /usr/sbin/smbldap-passwd line 285, <STDIN> l


 
Il semblerait donc que l'utilisateur cn=smbldap-tools,ou=DSA,dc=effata,dc=ch ne puisse modifier les mots de passes UNIX.
J'ai suivis scrupuleusement le tutoriel "The Linux Samba-OpenLDAP Howto (Revision : 20060710)". J'ai donc le fichier de configuration slapd.conf ci-dessous:
 

Code :
  1. #
  2. # See slapd.conf(5) for details on configuration options.
  3. # This file should NOT be world readable.
  4. #
  5. include  /etc/openldap/schema/core.schema
  6. include  /etc/openldap/schema/cosine.schema
  7. include  /etc/openldap/schema/inetorgperson.schema
  8. include  /etc/openldap/schema/yast.schema
  9. include  /etc/openldap/schema/nis.schema
  10. include  /etc/openldap/schema/samba3.schema
  11. # Define global ACLs to disable default read access.
  12. # Do not enable referrals until AFTER you have a working directory
  13. # service AND an understanding of referrals.
  14. #referral ldap://root.openldap.org
  15. pidfile  /var/run/slapd/slapd.pid
  16. argsfile /var/run/slapd/slapd.args
  17. # Load dynamic backend modules:
  18. modulepath /usr/lib/openldap/modules
  19. # moduleload back_ldap.la
  20. # moduleload back_meta.la
  21. # moduleload back_monitor.la
  22. # moduleload back_perl.la
  23. # Sample security restrictions
  24. # Require integrity protection (prevent hijacking)
  25. # Require 112-bit (3DES or better) encryption for updates
  26. # Require 63-bit encryption for simple bind
  27. # security ssf=1 update_ssf=112 simple_bind=64
  28. # Sample access control policy:
  29. #       Root DSE: allow anyone to read it
  30. #       Subschema (sub)entry DSE: allow anyone to read it
  31. #       Other DSEs:
  32. #               Allow self write access to user password
  33. #               Allow anonymous users to authenticate
  34. #               Allow read access to everything else
  35. #       Directives needed to implement policy:
  36. # any users can authenticate and change his password
  37. access to attrs=userPassword,sambaLMPassword,sambaNTPassword,sambaPwdLastSet,sambaPwdMustChange
  38. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  39. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  40. by dn="cn=nssldap,ou=DSA,dc=effata,dc=ch" write
  41.         by self write
  42.         by anonymous auth
  43. by * none
  44. # some attributes need to be readable anonymously so that  "id user" can answer correctly
  45. access to attrs=objectClass,entry,homeDirectory,uid,uidNumber,gidNumber,memberUid
  46. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  47. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  48. by * read
  49. # somme attributes can be writable by users them selves
  50. access to attrs=description,telephoneNumber,roomNumber,homePhone,loginShell,gecos,cn,sn,givenname
  51. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  52. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  53. by self write
  54. by * read
  55. # some attributes need to be writable for samba
  56. access to attrs=cn,sambaLMPassword,sambaNTPassword,sambaPwdLastSet,sambaLogonTime,sambaLogoffTime,sambaKickoffTime,sambaPwdCanChange,sambaPwdMustChange,sambaAcctFlags,displayName,sambaHomePath,sambaHomeDrive,sambaLogonScript,sambaProfilePath,description,sambaUserWorkstations,sambaPrimaryGroupSID,sambaDomainName,sambaMungedDial,sambaBadPasswordCount,sambaBadPasswordTime,sambaPasswordHistory,sambaLogonHours,sambaSID,sambaSIDList,sambaTrustFlags,sambaGroupType,sambaNextRid,sambaNextGroupRid,sambaNextUserRid,sambaAlgorithmicRidBase,sambaShareName,sambaOptionName,sambaBoolOption,sambaIntegerOption,sambaStringOption,sambaStringListoption
  57. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  58. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  59. by self read
  60. by * none
  61. # samba need to be able to create the samba domain account
  62. access to dn.base="dc=effata,dc=ch"
  63. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  64. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  65.         by * none
  66. # samba need to be able to create new users accounts
  67. access to dn="ou=Users,dc=effata,dc=ch"
  68. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  69. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  70.         by * none
  71. # samba need to be able to create new groups accounts
  72. access to dn="ou=Groups,dc=effata,dc=ch"
  73. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  74. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  75.         by * none
  76. # samba need to be able to create new computers accounts
  77. access to dn="ou=Computers,dc=effata,dc=ch"
  78. by dn="cn=samba,ou=DSA,dc=effata,dc=ch" write
  79. by dn="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch" write
  80.         by * none
  81. # this can be omitted but we let it stay because there could be other
  82. # branches in the directory
  83. access to *
  84. by self read
  85.         by * none
  86. # if no access controls are present, the default policy
  87. # allows anyone and everyone to read anything but restricts
  88. # updates to rootdn.  (e.g., "access to * by * read" )
  89. #
  90. # rootdn can always read and write EVERYTHING!
  91. #######################################################################
  92. # BDB database definitions
  93. #######################################################################
  94. loglevel 4095
  95. database bdb
  96. suffix "dc=effata,dc=ch"
  97. rootdn "cn=Manager,dc=effata,dc=ch"
  98. rootpw "{ssha}********"
  99. directory /var/lib/ldap/
  100. checkpoint 1024 5
  101. cachesize 10000
  102. index objectClass,uidNumber,gidNumber eq
  103. index member,mail eq,pres
  104. index cn,displayname,uid,sn,givenname sub,eq,pres
  105. index sambaSID,sambaPrimaryGroupSID,sambaDomainName eq


 
Comme vous pouvez le constater, j'ai activé les logs du serveur LDAP afin d'en savoir un peu plus sur l'erreur. Voici un extrait qui me parraissait intéressant:

Code :
  1. conn=7 op=4 MOD dn="uid=root,ou=Users,dc=effata,dc=ch"
  2. Oct 19 02:34:16 server slapd[18723]: conn=7 op=4 MOD attr=userPassword shadowLastChange shadowMax
  3. Oct 19 02:34:16 server slapd[18723]: bdb_dn2entry("uid=root,ou=users,dc=effata,dc=ch" )
  4. Oct 19 02:34:16 server slapd[18723]: bdb_modify: uid=root,ou=Users,dc=effata,dc=ch
  5. Oct 19 02:34:16 server slapd[18723]: bdb_dn2entry("uid=root,ou=users,dc=effata,dc=ch" )
  6. Oct 19 02:34:16 server slapd[18723]: bdb_modify_internal: 0x00000006: uid=root,ou=Users,dc=effata,dc=ch
  7. Oct 19 02:34:16 server slapd[18723]: => access_allowed: delete access to "uid=root,ou=Users,dc=effata,dc=ch" "userPassword" requested
  8. Oct 19 02:34:16 server slapd[18723]: => acl_get: [1] attr userPassword
  9. Oct 19 02:34:16 server slapd[18723]: access_allowed: no res from state (userPassword)
  10. Oct 19 02:34:16 server slapd[18723]: => acl_mask: access to entry "uid=root,ou=Users,dc=effata,dc=ch", attr "userPassword" requested
  11. Oct 19 02:34:16 server slapd[18723]: => acl_mask: to all values by "cn=smbldap-tools,ou=dsa,dc=effata,dc=ch", (=0)
  12. Oct 19 02:34:16 server slapd[18723]: <= check a_dn_pat: cn=samba,ou=dsa,dc=effata,dc=ch
  13. Oct 19 02:34:16 server slapd[18723]: <= check a_dn_pat: cn=smbldap-tools,ou=dsa,dc=effata,dc=ch
  14. Oct 19 02:34:16 server slapd[18723]: <= acl_mask: [2] applying write(=wrscxd) (stop)
  15. Oct 19 02:34:16 server slapd[18723]: <= acl_mask: [2] mask: write(=wrscxd)
  16. Oct 19 02:34:16 server slapd[18723]: => access_allowed: delete access granted by write(=wrscxd)
  17. Oct 19 02:34:16 server slapd[18723]: => access_allowed: delete access to "uid=root,ou=Users,dc=effata,dc=ch" "shadowLastChange" requested
  18. Oct 19 02:34:16 server slapd[18723]: => dn: [5] dc=effata,dc=ch
  19. Oct 19 02:34:16 server slapd[18723]: => dn: [6] ou=users,dc=effata,dc=ch
  20. Oct 19 02:34:16 server slapd[18723]: => dn: [7] ou=groups,dc=effata,dc=ch
  21. Oct 19 02:34:16 server slapd[18723]: => dn: [8] ou=computers,dc=effata,dc=ch
  22. Oct 19 02:34:16 server slapd[18723]: => acl_get: [9] attr shadowLastChange
  23. Oct 19 02:34:16 server slapd[18723]: access_allowed: no res from state (shadowLastChange)
  24. Oct 19 02:34:16 server slapd[18723]: => acl_mask: access to entry "uid=root,ou=Users,dc=effata,dc=ch", attr "shadowLastChange" requested
  25. Oct 19 02:34:16 server slapd[18723]: => acl_mask: to all values by "cn=smbldap-tools,ou=dsa,dc=effata,dc=ch", (=0)
  26. Oct 19 02:34:16 server slapd[18723]: <= check a_dn_pat: self
  27. Oct 19 02:34:16 server slapd[18723]: <= check a_dn_pat: *
  28. Oct 19 02:34:16 server slapd[18723]: <= acl_mask: [2] applying none(=0) (stop)
  29. Oct 19 02:34:16 server slapd[18723]: <= acl_mask: [2] mask: none(=0)
  30. Oct 19 02:34:16 server slapd[18723]: => access_allowed: delete access denied by none(=0)
  31. Oct 19 02:34:16 server slapd[18723]: bdb_modify: modify failed (50)
  32. Oct 19 02:34:16 server slapd[18723]: send_ldap_result: conn=7 op=4 p=3
  33. Oct 19 02:34:16 server slapd[18723]: send_ldap_result: err=50 matched="" text=""
  34. Oct 19 02:34:16 server slapd[18723]: send_ldap_response: msgid=5 tag=103 err=50
  35. Oct 19 02:34:16 server slapd[18723]: conn=7 op=4 RESULT tag=103 err=50 text=
  36. Oct 19 02:34:16 server slapd[18723]: daemon: activity on 1 descriptor
  37. Oct 19 02:34:16 server slapd[18723]: daemon: activity on:
  38. Oct 19 02:34:16 server slapd[18723]:  22r


 
"access_allowed: delete access denied by none(=0)" ceci singifie que le script ne s'est pas authentifié en tant que cn=smbldap-tools,ou=DSA,dc=effata,dc=ch ?
J'ai un peu de peine à interpréter ce fichier log.... si quelqu'un peut m'aider...
 
Merci d'avance !

mood
Publicité
Posté le 19-10-2007 à 00:51:49  profilanswer
 

n°966338
black_lord
Modérateur
Truth speaks from peacefulness
Posté le 19-10-2007 à 09:31:50  profilanswer
 

tu as bien créé le "ticket" d'accès au LDAP pour ton samba ? avec le DN correspondant ?


---------------
uptime is for lousy system administrators what Viagra is for impotent people - mes unixeries - github me
n°966363
bmachina
Posté le 19-10-2007 à 10:25:03  profilanswer
 

black_lord a écrit :

tu as bien créé le "ticket" d'accès au LDAP pour ton samba ? avec le DN correspondant ?


 
merci pour ta réponse.
 
je ne sais pas exactement ce qu'on entends par ticket...
mais les "comptes" samba et smbldap-tools existe bien dans l'annuaire puisqu'un slapcat me renvoie, entre autre, les lignes suivantes:
 

Code :
  1. dn: cn=smbldap-tools,ou=DSA,dc=effata,dc=ch
  2. objectClass: organizationalRole
  3. objectClass: top
  4. objectClass: simpleSecurityObject
  5. cn: smbldap-tools
  6. structuralObjectClass: organizationalRole
  7. entryUUID: 9fb1c4e8-11ff-102c-9abc-8da43b1ca053
  8. creatorsName: cn=Manager,dc=effata,dc=ch
  9. createTimestamp: 20071018195404Z
  10. userPassword:: e1NTSEF9dDFGRHdmbUNQa3J3VUE1ckRuaXByREdQR2lBOUt1eks=
  11. entryCSN: 20071018195429Z#000000#00#000000
  12. modifiersName: cn=Manager,dc=effata,dc=ch
  13. modifyTimestamp: 20071018195429Z
  14. dn: cn=samba,ou=DSA,dc=effata,dc=ch
  15. objectClass: organizationalRole
  16. objectClass: top
  17. objectClass: simpleSecurityObject
  18. cn: samba
  19. structuralObjectClass: organizationalRole
  20. entryUUID: 68bad392-11f7-102c-9aaf-8da43b1ca053
  21. creatorsName: cn=Manager,dc=effata,dc=ch
  22. createTimestamp: 20071018185516Z
  23. userPassword:: e1NTSEF9b2tTR3QyZEp3Vk9CVExPYlNMa0VvM0orZFdmMkNQSHk=
  24. entryCSN: 20071018185953Z#000000#00#000000
  25. modifiersName: cn=Manager,dc=effata,dc=ch
  26. modifyTimestamp: 20071018185953Z


 
mais je ne sais pas si c'était vraiment la question...

n°966365
black_lord
Modérateur
Truth speaks from peacefulness
Posté le 19-10-2007 à 10:27:53  profilanswer
 

non en effet.
pour que ton samba s'identifie auprès de ton ldap il faut qu'il fournisse les infos dn+pass associé. Si tu as modifié le DN d'accès alors il faut recréer ce ticket d'accès avec le bon DN. c'est pour ça que tu as un access denied.


---------------
uptime is for lousy system administrators what Viagra is for impotent people - mes unixeries - github me
n°966371
bmachina
Posté le 19-10-2007 à 10:47:26  profilanswer
 

black_lord a écrit :

non en effet.
pour que ton samba s'identifie auprès de ton ldap il faut qu'il fournisse les infos dn+pass associé. Si tu as modifié le DN d'accès alors il faut recréer ce ticket d'accès avec le bon DN. c'est pour ça que tu as un access denied.


 
dans /etc/samba/smb.conf j'ai évidemment mis la ligne: ldap admin dn = cn=samba,ou=DSA,dc=effata,dc=ch dans la section global.
J'y ai associé un mot de passe avec smbpasswd -w sambasecretpwd
 
En ce qui concerne les scripts smbldap-tools j'ai bien mis dans /etc/smbldap-tools/smbldap_bind.conf les lignes:
 
slaveDN="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch"
slavePw="***"
masterDN="cn=smbldap-tools,ou=DSA,dc=effata,dc=ch"
masterPw="***"
 
 
j'espère cette fois-ci avoir répondu à ta question...

n°968340
bmachina
Posté le 23-10-2007 à 16:58:24  profilanswer
 

bon finalement j'ai trouvé.....a coups de loglevel 4095...
 
il manquait les droits en écriture sur les champs "shadowLastChange" et "shadowMax" au compte "cn=smbldap-tools,dc=effata,dc=ch".afin qu'il puisse modifier le mot de passe UNIX;
 
il suffit donc d'ajouter les deux champs ci-dessus à la ligne
 
# # any users can authenticate and change his password
# access to attrs=userPassword,sambaLMPassword,sambaNTPassword,sambaPwdLastSet,sambaPwdMustChange
 
dans le fichier slapd.conf
 
..en espérant que cela puisse être utile...


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Linux et OS Alternatifs
  réseaux et sécurité

  OpenLDAP et SAMBA | Insufficient access at /usr/sbin/smbldap-passwd li

 

Sujets relatifs
samba et aclConversion de access.log
[Samba] Sécurité des partage et exclusion de répertoireModifier l'utilisateur sous lequel s'utilise samba
Probleme d'impression depuis passage de workgroup en domaine (samba)Samba et W2003
Access : requête date anniversaireImpossible d'avoir plus de 2 noms Netbios avec Samba
[Résolu] Heartbeat2 et Samba3Problème avec Postfix - 554 5.7.1 Relay access denied
Plus de sujets relatifs à : OpenLDAP et SAMBA | Insufficient access at /usr/sbin/smbldap-passwd li


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR