LDAP server cần các gói sau:
1 2 3 4 5 |
openldap openldap-clients openldap-devel nss_ldap openldap-servers |
LDAP clients cần các gói sau:
1 2 3 4 |
openldap openldap-clients openldap-devel nss_ldap |
Thiets lập firewall : LDAP ngầm định là cổng 389
Check services hoạt động đúng chưa?
1 |
#rpcinfo -p |
Create a database directory
1 thư mục có thể có nhiều database (ldap database)
# mkdir /var/lib/ldap/example.com
# chown ldap:ldap example.com/
Create an LDAP “root” password
[root@centos2 ldap]# slappasswd
{SSHA}rUpmrrqnQCRk6M/JmviPmU/gZENfGssL
chú ý chuỗi passwd này cần ghi lại để lưu vào file ldap.conf
Edit the slapd.conf file
/etc/openldap/slapd.conf
1 2 3 4 5 |
database bdb suffix "dc=example,dc=com" rootdn "cn=Manager,dc=example,dc=com" rootpw {SSHA}rUpmrrqnQCRk6M/JmviPmU/gZENfGssL directory /var/lib/ldap/example.com |
Create LDAP Database
Quá trình này cần để migrating your system’s authentication files to the LDAP database .
Nên sử dung PADL tool để migrate your /etc/passwd file into LDAP : http://www.padl.com/download/MigrationTools.tgz
Create xong thư mục ldap DB thì cần owner cho user ldap
1 |
# chown -R ldap:ldap /var/lib/ldap/example.com |
Và start service :
1 2 |
# service ldap start # chkconfig ldap on |
Test the LDAP database
test local server
1 |
# ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)' |
và test remote client
1 |
# ldapsearch -x -h hostname/ip -b 'dc=example,dc=com' '(objectclass=*)' |
Edit the ldap.conf configuration file
/etc/openldap/ldap.conf
1 2 |
HOST 192.168.100.100 BASE dc=example,dc=com |
Edit the /etc/nsswitch file
1 2 3 |
passwd: files ldap shadow: files ldap group: files ldap |
Việc config trên có thể thực hiện trực tiếp thông qua desktop: System > Administration > Authentication : chọn phương thức là LDAP và input các thông số.
Check if remote user is existing in local machine: the /etc/passwd file
1 |
# grep username /etc/passwd |
Nếu tồn tại thì cần phải detele username hoặc change uid, gid cho username tránh bị conflict với local user.
Create The Home Directory On The LDAP Client
Hoặc tạo trực tiếp thư mục trên local:
1 2 3 4 5 6 |
# mkdir /home/username # chmod 700 /home/username/ tạo cấu trúc xương sống cho 1 thư mục home user # cp /etc/skel/.* /home/username/ thiết lập owner cho username # chown -R username:users /home/username |
Hoặc sử dung thư mục trên server (tập trung dữ liệu cho tất cả user trên 1 máy):
Nếu sử dung Linux GUI desktop and mounting Linux home directories to an NFS server you may have to mount with the option “nolock“. Việc thiết lập NFS server xem hướng dẫn tại đây.
Thêm line sau vào file : /etc/fstab
1 |
nfs-server:/home /home nfs rw,soft,bg,nolock 0 0 |
Cần phải chác chắn là có những essential files and directories from /etc/skel/…để cho môi trường Desktop . Điểu này đc thiết lập trong PAM file :
thêm line sau vào /etc/pam.d/login file
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022
Quản lý LDAP user & Ggroup : có thể sử dụng trong Webmin
Chú ý: các bước thực hiện trên được thực hiện trên Centos (Server) và Fedora (client). Các bước này có thể thực hiện trên các Distro khác với 1 số thay đổi nhỏ.
Giai phap đóng gói sẵn của Fedora
http://directory.fedoraproject.org/