+ All Categories
Home > Documents > CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration

Date post: 03-Jan-2016
Category:
Upload: jack-stephenson
View: 26 times
Download: 1 times
Share this document with a friend
Description:
CIT 470: Advanced Network and System Administration. Directories. Topics. Directories LDAP Structure LDIF Distinguished Names Replication OpenLDAP Configuration. What is a Directory?. Directory : A collection of information that is primarily searched and read, rarely modified. - PowerPoint PPT Presentation
28
CIT 470: Advanced Network and System Administration Slide #1 CIT 470: Advanced Network and System Administration Directories
Transcript
Page 1: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #1

CIT 470: Advanced Network and System Administration

Directories

Page 2: CIT 470: Advanced Network and System Administration

Topics

1. Directories

2. LDAP Structure

3. LDIF

4. Distinguished Names

5. Replication

6. OpenLDAP Configuration

CIT 470: Advanced Network and System Administration Slide #2

Page 3: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #3

What is a Directory?

Directory: A collection of information that is primarily searched and read, rarely modified.

Directory Service: Provides access to directory information.

Directory Server: Application that provides a directory service.

Page 4: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #4

Directories vs. Databases

Directories are optimized for reading.– Databases balanced for read and write.

Directories are tree-structured.– Databases typically have relational structure.

Directories are usually replicated.– Databases can be replicated too.

Both are extensible data storage systems.

Both have advanced search capabilities.

Page 5: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #5

System Administration Directories

Types of directory data– Accounts– Mail aliases and lists (address book)– Cryptographic keys– IP addresses– Hostnames– Printers

Common directory services– DNS, LDAP, NIS

Page 6: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #6

Advantages of Directories

Make administration easier.– Change data only once: people, accounts, hosts.

Unify access to network resources.– Single sign on.– Single place for users to search (address book)

Improve data management– Improve consistency (one location vs many)– Secure data through only one server.

Page 7: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #7

NIS: Network Information Service

Originally called Sun Yellow Pages– Clients run ypbind.– Servers run ypserv.– Data stored under /var/yp on server.

Server shares NIS maps with clients– Each UNIX file may provide multiple NIS maps.– NIS maps map keys like UID, username to data.– passwd: passwd.byname, passwd.byuid

Slave servers replicate master server content.Easy to use, but insecure, difficult to extend.

Page 8: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #8

LDAP

Lightweight Directory Access Protocol– Lightweight compared to X.500 directories.– Directory, not a database, service.– Access Protocol, not a directory itself.

Page 9: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #9

LDAP Clients and ServersLDAP Clients

– Standalone directory browsers.– Embedded clients (mail clients, logins, etc.)– Cfg /etc/nsswitch.conf on UNIX to use LDAP.

Common LDAP servers

Page 10: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #10

LDAP Structure

An LDAP directory is made of entries.– Entries may be employee records, hosts, etc.

Each entries consists of attributes.– Attributes can be names, phone numbers, etc.– objectClass attribute identifies entry type.

Each attribute is a type / value pair.– Type is a label for the information stored (name)– Value is value for the attribute in this entry.– Attributes can be multi-valued.

Page 11: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #11

Tree-structure of LDAP Directories

Page 12: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #12

LDAP SchemasSchemas specify allowed objectClasses and attributes.

Page 13: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #13

LDIF

LDAP Interchange Format.– Standard text format for storing LDAP configuration

data and directory contents.

LDIF Files– Collection of entries separated by blank lines.– Mapping of attribute names to values.

Uses– Import new data into directory.– Export directory to LDIF files for backups.

Page 14: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #14

LDIF Output Example

Page 15: CIT 470: Advanced Network and System Administration

LDIF Backups and Restores

Backing up an LDAP directoryslapcat > backup.ldif

OR to do a daily backup use date in name

slapcat > backup-`date +%F`.ldif

Restoring an LDAP directoryservice ldap stop

rm -rf /var/lib/ldap/*

slapadd < backup.ldif

service ldap start

CIT 470: Advanced Network and System Administration Slide #15

Page 16: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #16

Distinguished Names

Distinguished Names (DNs)– Uniquely identify an LDAP entry.– Provides path from LDAP root to the named entry.– Similar to an absolute pathname.– dn:cn=Jeff Foo,ou=Sales,dc=plainjoe,dc=org

Relative DNs (RDNs)– Any unique attribute pair in directory’s container.– ex: cn=Jeff Foo OR username=fooj– Similar to a relative pathname.– Except may have multiple components.– cn=Jane Smith+ou=Sales– cn=Jane Smith+ou=Engineering

Page 17: CIT 470: Advanced Network and System Administration

(R)DN Example #1

CIT 470: Advanced Network and System Administration Slide #17

Page 18: CIT 470: Advanced Network and System Administration

(R)DN Example #2

CIT 470: Advanced Network and System Administration Slide #18

Page 19: CIT 470: Advanced Network and System Administration

ldapsearch

Options-LLL removes comments and LDAP version info.

-b base supplies base DN (uses ldap.conf if no -b.)

-x uses simple authentication instead of SASL.

-H ldap://your.server.edu accesses that server.

If -H not specified, uses ldap.conf to find server.

Search for all elementsldapsearch -LLL -x -b "dc=gkar,dc=nku,dc=edu"

"(objectclass=*)"

CIT 470: Advanced Network and System Administration Slide #19

Page 20: CIT 470: Advanced Network and System Administration

ldapsearch -LLL -x "(DN)"> ldapsearch -LLL -x "(uid=fooj)"

dn: uid=fooj,ou=People,dc=gkar,dc=nku,dc=edu

objectClass: top

objectClass: account

objectClass: posixAccount

objectClass: shadowAccount

uid: fooj

uidNumber: 10101

cn: fooj

homeDirectory: /home/c/fooj

loginShell: /bin/bash

gidNumber: 10101

CIT 470: Advanced Network and System Administration Slide #20

Page 21: CIT 470: Advanced Network and System Administration

ldapsearch -LLL -x "(DN)"> ldapsearch -LLL -x "(uidNumber=10101)"

dn: uid=fooj,ou=People,dc=gkar,dc=nku,dc=edu

objectClass: top

objectClass: account

objectClass: posixAccount

objectClass: shadowAccount

uid: fooj

uidNumber: 10101

cn: fooj

homeDirectory: /home/c/fooj

loginShell: /bin/bash

gidNumber: 10101

CIT 470: Advanced Network and System Administration Slide #21

Page 22: CIT 470: Advanced Network and System Administration

Multiple Record Matches> ldapsearch -LLL -x "(loginShell=/bin/bash)"

dn: uid=fooj,ou=People,dc=gkar,dc=nku,dc=edu

objectClass: top

objectClass: account

objectClass: posixAccount

objectClass: shadowAccount

uid: fooj

uidNumber: 10101

cn: fooj

homeDirectory: /home/b/fooj

loginShell: /bin/bash

...

Size limit exceeded (4)

CIT 470: Advanced Network and System Administration Slide #22

Page 23: CIT 470: Advanced Network and System Administration

Wildcard Matches> ldapsearch -LLL -x "(uid=smith*)"

dn: uid=smitha,ou=People,dc=gkar,dc=nku,dc=edu

uid: smitha

uidNumber: 10221

cn: smitha

homeDirectory: /home/f/smitha

loginShell: /bin/bash

...

dn:

uid: smithj

uidNumber: 12302

cn: smithj

homeDirectory: /home/g/smithj

CIT 470: Advanced Network and System Administration Slide #23

Page 24: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #24

Open source LDAPv3 server.– LDAP server: slapd– Client commands: ldapadd, ldapsearch– Backend storage: BerkeleyDB– Backend commands: slapadd, slapcat– Schemas: /etc/openldap/schema– Data: /var/lib/ldap

Configuration files– Client: /etc/openldap/ldap.conf– Server: /etc/openldap/slapd.conf

Page 25: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #25

Building an OpenLDAP Server

1. Install OpenLDAP.2. Configure LDAP for your domain.

Edit slapd.conf OR use Run Time Configuration (RTC)

3. Start serverImmediate: service ldap startPermanent: chkconfig --level 35 ldap on

4. Add data with ldapadd.5. Verify functionality with ldapsearch.

Page 26: CIT 470: Advanced Network and System Administration

slapd.conf (Server)

File Locations (usually accept defaults)Schema files

Configuration files

Database directory

Databasesuffix = DN of topmost node in directory

rootdn = DN of LDAP administrative user

rootpw = Password of LDAP administrator

Access ControlCIT 470: Advanced Network and System Administration Slide #26

Page 27: CIT 470: Advanced Network and System Administration

ldap.conf (Client)## LDAP Defaults#

# See ldap.conf(5) for details# This file should be world readable but not world

writable.

#BASE dc=example,dc=com (match suffix in slapd.conf)#URI ldap://ldap.example.com ldap://ldap-

master.example.com:666

#SIZELIMIT 12#TIMELIMIT 15#DEREF never

CIT 470: Advanced Network and System Administration Slide #27

Page 28: CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Slide #28

References1. Brian Arkills, LDAP Directories Explained: An Introduction and

Analysis, Addison-Wesley, 2003.2. Gerald Carter, LDAP System Administration, O’Reilly, 2003.3. LDAP Howtos, Links, and Whitepapers, http://www.bind9.net/ldap/,

2005.4. http://www.ldapman.org/, 2005.5. LDAP for Rocket Scientists, http://www.zytrax.com/books/ldap/,

2009.6. Thomas Limoncelli, Christine Hogan, Strata Chalup, The Practice of

System and Network Administration, 2nd ed, Limoncelli and Hogan, Addison-Wesley, 2007.

7. Luiz Malere, “Linux LDAP HOWTO,” http://www.tldp.org/HOWTO/LDAP-HOWTO/, 2004.

8. Evi Nemeth et al, UNIX System Administration Handbook, 3rd edition, Prentice Hall, 2001.

9. OpenLDAP, OpenLDAP Administrator’s Guide, http://www.openldap.org/devel/admin/, 2005.


Recommended