Chinaunix首页 | 论坛 | 博客
  • 博客访问: 74399
  • 博文数量: 17
  • 博客积分: 679
  • 博客等级: 上士
  • 技术积分: 265
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-04 23:55
文章分类
文章存档

2011年(15)

2010年(2)

分类: LINUX

2011-01-28 00:36:26

Ubuntu 8.04 下配置LDAP客戶端簡直是個噩夢, 這在CentOS 5.1下本是一件非常輕松的事情. 要是網上沒有找到這篇文章, 估計我這輩子就別想配置成功了. 不過看原文中說的, 7.10似乎還要噩夢.
有些地方當然要修改成與自己服務器對應的設置, 另外, 我這裡有個小小的區別是: 注釋掉了/etc/ldap.conf中的ssl start_tls一行. 不是很明白什麼意思, 大概我的服務器沒有開啟SSL支持吧(事實上確實沒開啟^ ^)


Ubuntu 8.04 Hardy LDAP Client



Ubuntu 7.10 was a nightmare when it came to setting up ldap, but 8.04 improves this process quite a bit.

We are going to set up a Hardy client on a desktop machine, which involves using NFS (for /home) and allowing all desktop users to do desktop tasks.
Java代码
  1. apt-get install libpam-ldap libnss-ldap nss-updatedb libnss-db nfs-common nscd  
apt-get install libpam-ldap libnss-ldap nss-updatedb libnss-db nfs-common nscd
Answer the questions; unlike Debian they should actually be put in the configuration file.

Make sure to transfer over your certifiate if you use SSL. I like to use /etc/ldap/ssl

Edit /etc/ldap.conf (which both libnss and libpam use).
Java代码
  1. host 192.168.1.1  
  2. base dc=example,dc=com  
  3.   
  4. #This is important! Don’t use ldap:///192.168.1.1  
  5. uri ldap://example.com/  
  6. ldap_version 3  
  7. rootbinddn cn=admin,dc=example,dc=com  
  8. port 389  
  9. bind_policy soft  
  10. pam_password crypt  
  11. ssl start_tls  
  12. tls_checkpeer no  
  13. tls_cacertfile /etc/ldap/ssl/cert.pem  
  14. nss_initgroups_ignoreusers avahi,avahi-autoipd,backup,bin,daemon,dhcp,games,gdm,gnats,haldaemon,hplip,irc,klog,libuuid,list,lp,mail,man,messagebus,news,polkituser,proxy,pulse,root,sync,sys,syslog,uucp,www-data  
host 192.168.1.1 base dc=example,dc=com #This is important! Don’t use ldap:///192.168.1.1 uri ldap://example.com/ ldap_version 3 rootbinddn cn=admin,dc=example,dc=com port 389 bind_policy soft pam_password crypt ssl start_tls tls_checkpeer no tls_cacertfile /etc/ldap/ssl/cert.pem nss_initgroups_ignoreusers avahi,avahi-autoipd,backup,bin,daemon,dhcp,games,gdm,gnats,haldaemon,hplip,irc,klog,libuuid,list,lp,mail,man,messagebus,news,polkituser,proxy,pulse,root,sync,sys,syslog,uucp,www-data
Now edit /etc/ldap/ldap.conf
Java代码
  1. BASE    dc=example,dc=com  
  2. URI    ldap://example.com  
  3. TLS_CACERT /etc/ldap/ssl/cert.pem  
  4. TLS_REQCERT never  
BASE dc=example,dc=com URI ldap://example.com TLS_CACERT /etc/ldap/ssl/cert.pem TLS_REQCERT never

/etc/pam.d/common-account
Java代码
  1. account    sufficient   pam_ldap.so  
  2. account    required     pam_unix.so  
account sufficient pam_ldap.so account required pam_unix.so
/etc/pam.d/common-auth
Java代码
  1. auth       sufficient   pam_ldap.so  
  2. auth       required     pam_unix.so nullok_secure use_first_pass  
auth sufficient pam_ldap.so auth required pam_unix.so nullok_secure use_first_pass
/etc/pam.d/common-password
Java代码
  1. password   sufficient   pam_ldap.so  
  2. password   required     pam_unix.so nullok obscure min=4 max=8 md5  
password sufficient pam_ldap.so password required pam_unix.so nullok obscure min=4 max=8 md5
/etc/pam.d/common-session
Java代码
  1. session    required     pam_unix.so  
  2. session    required     pam_mkhomedir.so skel=/etc/skel/  
  3. session    optional     pam_ldap.so  
session required pam_unix.so session required pam_mkhomedir.so skel=/etc/skel/ session optional pam_ldap.so
/etc/nsswitch.conf
Java代码
  1. passwd: files ldap  
  2.   
  3. group: files ldap  
  4.   
  5. shadow: files ldap  
  6.   
  7. hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4  
  8. networks:       files  
  9.   
  10. protocols:      db files  
  11. services:       db files  
  12. ethers:         db files  
  13. rpc:            db files  
passwd: files ldap group: files ldap shadow: files ldap hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 networks: files protocols: db files services: db files ethers: db files rpc: db files
Now we want to make sure users are assigned to the correct groups when they log in, so add the following to /etc/security/groups.conf
Java代码
  1. gdm;*;*;Al0000-9000;floppy,audio,cdrom,video,plugdev,scanner  
gdm;*;*;Al0000-9000;floppy,audio,cdrom,video,plugdev,scanner
Hal does not recognize this, however, so delete the following entries from /etc/dbus-1/system.d/hal.conf
Java代码
  1.   
  2.   

We need to edit /etc/pam.d/gdm for the groups.conf file to take effect, so add the following
Java代码
  1. auth optional pam_group.so  
auth optional pam_group.so
As root, run
Java代码
  1. nss_updatedb ldap  
nss_updatedb ldap
To mount /home over NFS, add the following to /etc/fstab
Java代码
  1. 192.168.1.1:/home       /home   nfs defaults 0 0 
阅读(1270) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~