Full Lab vBullentin Authenticate with LDAP Server

thanhdc

Junior – IT Sơ cấp
Aug 10, 2014
124
3
18
I. Tổng quan:

1.1 Sơ đồ:

eZ63rT7b1rgLFuNayCtIJXuU_82TW9I6yROKlcj5bVa71Qe8_TXOQz72WTqc3nH9mCCM-iXLY13xR6ihxh6qC0BtL8mDPxqDtvPv5SDwmLAHebNEpZfMSsKnBJSgAr-Y601iO_ncAuY


1.2 Yêu cầu:

vBullentin sử dụng user của LDAP server để login và post bài viết,...


II. Cài đặt, cấu hình:


2.1 Config LDAP:

Trước tiên bạn phải đảm bảo là đã cài thành công một con DC (Domian Controller) trên Windows Server 2008 R2, quá trình cài sẽ cài luôn DNS trên server này …


AdsiEdit.msc








Tạo user để test…






2.2 Install WEB SERVER:






















Tự động Download va Install các gói cần thiết…
Tự động cài PHP, MySQL, PHPMyAdmin,...




















 
Last edited:
2.3 Config Web Server

nano phpinfo.php




Vào http://172.16.1.40/svuit/php.info xem thông tin PHP
Mặc định gói php5-ldap chưa được cài…

1MM7meg-xSwNsvo4T70r1aHRivOw2D49fbDi0zfnfCVlQLft0vyUVNe11P0lfyG6mUA9SyhO3k0JXr1D6JDJzqyU_kMmINcnMwBdAC9jedni1cVyoZTBSlylnLMjR5rR_eUNP4agoFE




Cài gói php5-ldap


root@lamp www/svuit# apt-get install php5-ldap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libapache2-mod-php5 lsof php5-cli php5-common php5-mcrypt php5-mysql
The following NEW packages will be installed:
lsof php5-ldap
The following packages will be upgraded:
libapache2-mod-php5 php5-cli php5-common php5-mcrypt php5-mysql
5 upgraded, 2 newly installed, 0 to remove and 12 not upgraded.
Need to get 6261 kB of archives.
After this operation, 552 kB of additional disk space will be used.
Do you want to continue [Y/n]?


root@lamp www/svuit# service apache2 restart
[....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
. ok




root@lamp www/svuit# dpkg --get-selections | grep ldap
libaprutil1-ldap install
libldap-2.4-2:amd64 install
php5-ldap install


Cài gói php-codesnifferCài gói này để giúp tương thích giữa các phiên bản php…

root@lamp www/svuit# apt-get install php-codesniffer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
pear-phpunit-channel php-timer php5
The following NEW packages will be installed:
pear-phpunit-channel php-codesniffer php-timer php5
0 upgraded, 4 newly installed, 0 to remove and 12 not upgraded.
Need to get 467 kB of archives.
After this operation, 3507 kB of additional disk space will be used.
Do you want to continue [Y/n]?



Liệt kê các mod đã enable

root@lamp www/svuit# ls /etc/apache2/mods-enabled
alias.conf authz_default.load autoindex.conf deflate.load mime.conf perl.load reqtimeout.conf ssl.conf
alias.load authz_groupfile.load autoindex.load dir.conf mime.load php5.conf reqtimeout.load ssl.load
auth_basic.load authz_host.load cgi.load dir.load negotiation.conf php5.load setenvif.conf status.conf
authn_file.load authz_user.load deflate.conf env.load negotiation.load python.load setenvif.load status.load
Nếu như mode authnz_ldap đã được enable
root@wordpress ~# ls /etc/apache2/mods-enabled | grep ldap
authnz_ldap.load
ldap.conf
ldap.load
root@wordpress ~#


ENABLE mod ldap và authnz_ldap

a2enmod authnz_ldap
a2enmod ldap
/etc/init.d/apache2 restart
root@lamp www/svuit# a2enmod authnz_ldap
Considering dependency ldap for authnz_ldap:
Enabling module ldap.
Enabling module authnz_ldap.
To activate the new configuration, you need to run:
service apache2 restart
root@lamp www/svuit# a2enmod ldap
Module ldap already enabled
root@lamp www/svuit# /etc/init.d/apache2 restart
[....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
. ok
Lưu ý: bạn cũng có thể chạy lệnh a2enmod ldap authnz_ldap để enable cùng lúc 2 mode

Kiểm tra lại, bảo đảm 2 mode đã được enable
root@lamp www/svuit# ls /etc/apache2/mods-enabled | grep ldap
authnz_ldap.load
ldap.conf
ldap.load
root@lamp www/svuit#



Edit file /etc/hostsLưu ý: webserver phải phân giải được domain svuit.com thì mới có thể xác thực được ldap



Kiểm tra bảm đảm phân giải được domain svuit.com
root@lamp www/svuit# ping svuit.com
PING svuit.com (172.16.1.200) 56(84) bytes of data.
64 bytes from svuit.com (172.16.1.200): icmp_req=1 ttl=128 time=1.23 ms
64 bytes from svuit.com (172.16.1.200): icmp_req=2 ttl=128 time=0.316 ms
64 bytes from svuit.com (172.16.1.200): icmp_req=3 ttl=128 time=1.03 ms
64 bytes from svuit.com (172.16.1.200): icmp_req=4 ttl=128 time=0.326 ms
 
Last edited:
2.4 INSTALL vBullentin 4.2.2


http://www.vnseo.edu.vn/threads/download-vbb-4-2-2-vbulletin-suite-4-2-2.13749.html
vBulletin Suite 4.2.2 chính thức ra mắt và cập nhật , cái này được Nulled By VietVBB-Team.


Link download:
https://app.box.com/s/6lup78vgdbw7n7ng8czi

Upload source vBullentin


Sử dùng WinSCP để upload, copy, edit,…



Upload source vào /var/www/



Dùng PuTTy để chạy lệnh Linux:






Đổi tên thư mục upload thành svuit
Đổi tên file config.php.new thành config.php
Edit file cấu hình config.php

root@lamp ~# cd /var/www/
root@lamp /var/www# mv upload svuit
root@lamp /var/www#
root@lamp /var/www# cd svuit/includes/
root@lamp svuit/includes# mv config.php.new config.php
root@lamp svuit/includes# nano config.php



Sửa nội dung trong file cau hinh config.php:

$config['Database']['dbtype'] = 'mysql';
$config['Database']['dbname'] = 'svuit';
$config['Database']['tableprefix'] = '';
$config['MasterServer']['servername'] = 'localhost';
$config['MasterServer']['port'] = 3306;
$config['MasterServer']['username'] = 'root';
$config['MasterServer']['password'] = '123456';


Thêm @ini_set('display_errors', false); vào file cấu hình config.php

<?php
@ini_set('display_errors', false);

?>



Truy cập vào đường dẫn http://172.16.1.40/svuit/install/install.php để bắt đầu quá trình cài…


====Edit svuit.com --> VIETVBB.VN



Bỏ qua lỗi…





Chọn Begin Install để bắt đầu cài…




Chỉnh sửa một số thông tin Forum







Tạo Administrator Account (User Name tùy thích)




Bỏ qua ko cài CMS default data…
Bạn nào thích thì chọn Yes để cài nội dung mẫu cho Forum.




Install Complete…

Yêu cầu phải xóa, hoặc đổi tên thư mục install




root@lamp www/svuit# rm -rf install
OR:
root@lamp www/svuit# mv install install_svuit



Login vào Admin CP:



Admin CP

 
Last edited:
2.5 Install plugin LDAP Authentication

Lưu ý: bạn có thể download plugin tại đây: http://vbwarez.net/threads/1397-vBulletin-Ldap-Authentication-Plugin-1-0-1
đây là bản gôc chưa chỉnh sửa hổ trợ cho các phiên bản vBullentin 4.0 trở về trước (Mình thử cài plugin này cho bản vbb 4.0 nhưng kết quả cũng ko dc ..)

Dựa trên bản này mình đã lập trình lại để nó có thể chạy được trên vBullentin 4.2,
Hiện tại thì code mình sửa có thể xác thực tốt với LDAP của Domain Controller Windows Server 2008 R2.
Link download: http://svuit.com/vBulletin-Ldap-Authentication-Plugin-2-0-1.zip
Or http://svuit.com/ldapAuth_2.0.1.zip
Or https://drive.google.com/folderview?id=0Byd5pXHPhHDOclNzYzhxczJ4LWs&usp
Để có một môi trường hoàn chỉnh để test bạn cũng phải khá vất vả,
bạn phải dựng Server Web chạy Linux, cài apache, php, mysql, phpmyadmin,… cài các plugin ldap, enable các plugin, …
Các webserver dùng Xampp, Appser, Vertrigo, … chạy trên Windows khi enable extension php_ldap.dll thì bị lỗi, … nên ko dùng được…
vBullentin v4.0, 4.2 cài trên PHP 5.4 trở lên thì báo lỗi ….Vấn đề tương thích giữa các phiên bản PHP…Xác thực ko được do cấu hình DC ko đúng,…..


Copy code xác thực Ldap vào
/var/www/svuit/



Edit file ldapconfig.inc.php



Copy file hocks_ldap.xml vào svuit/includes/xml/



Copy



Paste



Edit file svuit/includes/clash_bootstrap.php



Vào Import Plugin

 
Last edited:
III. KẾT QUẢ :


Trước khi test, bạn phải đảm bảo là trên DC đã có user svuit01,
và bạn đã thiết lập địa chỉ email cho tài khoản này, nếu ko có địa chỉ email sẽ ko thể login được…



Login



Redirecting…



Login thành công:



Login Vào phpMyAdmin





Vào database svuit



Vào user
Bạn sẽ thấy user svuit01 vừa được tạo với các thông tin giống với thông tin trên LDAP (như username, email)
Lưu ý: password là một chuỗi md5 ngẫu nhiên bất kỳ…
nên ko login dc bằng pass này mà vẫn phải dùng pass của LDAP để xác thực…



Tạo một chủ đề mới:



Chủ đề đã được tạo thành công…





Bổ xung:


Trong quá trình Test có thể bạn cấu hình chưa đúng nên ko thể xác thực được .
vBullentin giới hạn login sai 5 lần sẽ bị khóa login trong 15 phút …



Để cho vBullentin cho phép bạn tiếp tục đăng nhập
Bạn vào database svuit ==> vào mục SQL ==> chạy script “TRUNCATE strikes;”



Hoặc đơn giản hơn, bạn vào Admin CP ==> Setting ==> Options ==> General Settings: tắt tính năng User Login “Strikes” System




Download:

Full VMWare WebServer + Ldap Authentication Plugin
Ldap Authentication Plugin 2.0.1
https://drive.google.com/folderview?id=0Byd5pXHPhHDOclNzYzhxczJ4LWs&usp
 
Last edited:
Dear Bạn
Bài viết của bạn rất hay . mình đã đăng kí thành viên để cảm ơn bài viết này .
Mình bổ sung 1 chút : hoàn toàn thực hiện được với apache+ php+mysql cài đặt trên window.
apache : 2.4.10 ( 64bit)
Php : 5.6.1
Mysql : 5.6.22
Thanks bạn vì bài viết hay
 
Last edited:

About us

  • Securityzone.vn là một trang web chuyên về an ninh mạng và công nghệ thông tin. Trang web này cung cấp các bài viết, tin tức, video, diễn đàn và các dịch vụ liên quan đến lĩnh vực này. Securityzone.vn là một trong những cộng đồng IT lớn và uy tín tại Việt Nam, thu hút nhiều người quan tâm và tham gia. Securityzone.vn cũng là nơi để các chuyên gia, nhà nghiên cứu, sinh viên và người yêu thích an ninh mạng có thể trao đổi, học hỏi và chia sẻ kiến thức, kinh nghiệm và giải pháp về các vấn đề bảo mật trong thời đại số.

Quick Navigation

User Menu