Ubuntu Server Guide
Note A simple bind without some sort of transport security mechanism is clear text
Download 1.23 Mb. Pdf ko'rish
|
ubuntu-server-guide (1)
- Bu sahifa navigatsiya:
- Modifying/Populating your Database
Note
A simple bind without some sort of transport security mechanism is clear text, meaning the credentials are transmitted in the clear. You should add TLS support to your OpenLDAP server as soon as possible. Here are the SASL EXTERNAL examples: $ ldapwhoami −Y EXTERNAL −H l d a p i : / / / −Q dn : gidNumber=1000+uidNumber =1000 , cn=p e e r c r e d , cn=e x t e r n a l , cn=auth $ sudo ldapwhoami −Y EXTERNAL −H l d a p i : / / / −Q dn : gidNumber=0+uidNumber=0, cn=p e e r c r e d , cn=e x t e r n a l , cn=auth When using SASL EXTERNAL via the ldapi:/// transport, the binddn becomes a combination of the uid and gid of the connecting user, followed by the suffix cn=peercred,cn=external,cn=auth. The server ACLs know about this, and grant the local root user complete write access to cn=config via the SASL mechanism. Modifying/Populating your Database Let’s introduce some content to our database. We will add the following: 191 • a node called People (to store users) • a node called Groups (to store groups) • a group called miners • a user called john Create the following LDIF file and call it add_content.ldif: dn : ou=People , dc=example , dc=com o b j e c t C l a s s : o r g a n i z a t i o n a l U n i t ou : People dn : ou=Groups , dc=example , dc=com o b j e c t C l a s s : o r g a n i z a t i o n a l U n i t ou : Groups dn : cn=miners , ou=Groups , dc=example , dc=com o b j e c t C l a s s : posixGroup cn : mi ner s gidNumber : 5000 dn : u i d=john , ou=People , dc=example , dc=com o b j e c t C l a s s : i n e t O r g P e r s o n o b j e c t C l a s s : p o s i xA c c o un t o b j e c t C l a s s : shadowAccount u i d : john sn : Doe givenName : John cn : John Doe displayName : John Doe uidNumber : 10000 gidNumber : 5000 userPassword : {CRYPT}x g e c o s : John Doe l o g i n S h e l l : / b i n / bash homeDirectory : /home/ john Note It’s important that uid and gid values in your directory do not collide with local values. You can use high number ranges, such as starting at 5000 or even higher. Add the content: $ ldapadd −x −D cn=admin , dc=example , dc=com −W −f add_content . l d i f Enter LDAP Password : ******** adding new e n t r y ” ou=People , dc=example , dc=com” adding new e n t r y ” ou=Groups , dc=example , dc=com” adding new e n t r y ” cn=miners , ou=Groups , dc=example , dc=com” adding new e n t r y ” u i d=john , ou=People , dc=example , dc=com” We can check that the information has been correctly added with the ldapsearch utility. For example, let’s search for the john entry, and request the cn and gidnumber attributes: 192 $ l d a p s e a r c h −x −LLL −b dc=example , dc=com ’ ( u i d=john ) ’ cn gidNumber dn : u i d=john , ou=People , dc=example , dc=com cn : John Doe gidNumber : 5000 Here we used an LDAP “filter”: (uid=john). LDAP filters are very flexible and can become complex. For example, to list the group names of which john is a member, we could use the filter: (&( o b j e c t C l a s s=posixGroup ) ( memberUid=john ) ) That is a logical AND between two attributes. Filters are very important in LDAP and mastering their syntax will help a long way. They are used for simple queries like this, but can also select what content is to be replicated to a secondary server, or even in complex ACLs. The full specification is defined in RFC 4515. Notice we set the userPassword field for the john entry to the cryptic value {CRYPT}x. This essentially is an invalid password, because no hashing will produce just x. It’s a common pattern when adding a user entry without a default password. To change the password to something valid, you can now use ldappasswd: $ ldappasswd −x −D cn=admin , dc=example , dc=com −W −S u i d=john , ou=p e o p l e , dc= example , dc=com New password : Re−e n t e r new password : Enter LDAP Password : Note Remember that simple binds are insecure and you should add TLS support to your server! Modifying the slapd Configuration Database The slapd-config DIT can also be queried and modified. Here are some common operations. Download 1.23 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling