Cài đặt client packages
Trên máy client, ta cần cài đặt 1 vài gói để thực hiện chức năng xác thực với máy chủ:
Lệnh cài đặt:
$sudo apt-get update
$sudo apt-get install libpam-ldap nscd
Ta sẽ cấu hình bằng cách trả lời các câu hỏi được đưa ra bởi hệ thống:
LDAP server Uniform Resource Identifier: ldap://LDAP-server-IP-Address
·         Change the initial string from "ldapi:///" to "ldap://" before inputing your server's information
Distinguished name of the search base:
·         This should match the value you put in your LDAP server's /etc/phpldapadmin/config.php file.
·         Search for: " 'server','base',array " within the file.
·         Our example was "dc=test,dc=com"
LDAP version to use: 3
Make local root Database admin: Yes
Does the LDAP database require login? No
LDAP account for root:
·         This should also match the value in your /etc/phpldapadmin/config.php.
·         Search for: " 'login','bind_id' " within the file
·         Our example was "cn=admin,dc=test,dc=com"
LDAP root account password: Your-LDAP-root-password.
Nếu muốn thay đổi các giá trị thì ta thực hiện bằng lệnh:
$sudo dpkg-reconfigure ldap-auth-config
Configure Client Software
 Ta cần điều chỉnh một số thông tin để client xác thực tới server LDAP.
Đầu tiên, sửa đổi trong file /etc/nsswitch.conf  điều này cho phép xác định các thông tin LDAP. 
Lệnh: sudo nano /etc/nsswitch.conf
Sau đó tìm tới dòng chứa các thông tin sau và thay đổi như sau:
passwd:         ldap compat
group:          ldap compat
shadow:         ldap compat
Sau đó cấu hình tại PAM.( Là một hệ thống kết nối các ứng dụng mà có thể cung cấp chứng thực cho các ứng dụng yêu cầu xác thực.).
Chỉnh sửa tại file /etc/pam.d/common-session:
sudo nano /etc/pam.d/common-session
Thêm dòng sau vào cuối file:
session required    pam_mkhomedir.so skel=/etc/skel umask=0022
Điều này sẽ tạo ra một thư mục trên máy khách hàng khi một LDAP user đăng nhập người không có home directory.
Khởi động lại dịch vụ để áp dụng cá thay đổi đó:
sudo /etc/init.d/nscd restart
Tạo quyền
Các user được add vào nhóm “admin” tạo trên sẽ có quyền sudo.
Bằng cách chỉnh sửa thông tin trong file /etc/sudoers. Lệnh sử dụng:
sudo visudo
Khi dòng này được cấu hình:
%admin ALL=(ALL) ALL
Nhóm admin sẽ có quyền như 1 super user.
Ngoài ra ta cũng có thể cấu hình cho từng user cụ thể. Với user sẽ không có % ở đầu.
Đăng nhập bằng  LDAP user
Trong cửa sổ terminnal ta sử dụng lệnh để kết nối:
ssh LDAP_user@LDAP_client_IP_Address
chú ý: Đảm bảo rằng máy chủ LDAP và client đã cài đặt dịch vụ ssh. Nếu chưa ta có thể cài đặt:
sudo apt-get install openssh-server
Kết nối bWAPP với LDAP để test một số lỗi liên quan tới LDAP.
B1: Thực hiện cài đặt bWAPP.
Tải bWAPP tại địa chỉ:  https://sourceforge.net/projects/bwapp/files/?source=navbar
Giải nén và đưa vào mục htdocs của XAMPP.
Thực hiện  cấu hình theo file INSTALL.txt trong bWAPP.
B2: Sau khi cấu hình xong ta thực hiện đăng nhập vào bWAPP với user name và password mặc định:bee/bug.
Lựa chọn các mục để test.
Để test LDAP search ta cần kết nối với máy chủ LDAP:

Đăng nhận xét

 
Top