<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SpaLinux.com &#187; Directory Server</title>
	<atom:link href="http://spalinux.com/category/directory-server/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>Resources for Relaxing Linux System Administrators</description>
	<lastBuildDate>Sat, 21 Jan 2012 16:07:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>ติดตั้ง OpenLDAP Server บน Fedora 13</title>
		<link>http://spalinux.com/2010/07/install_openldap_server_on_fedora_13</link>
		<comments>http://spalinux.com/2010/07/install_openldap_server_on_fedora_13#comments</comments>
		<pubDate>Fri, 16 Jul 2010 08:19:45 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[fedora 13]]></category>
		<category><![CDATA[openldap]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1126</guid>
		<description><![CDATA[การเปลี่ยนแปลงอย่างหนึ่งใน Fedora เวอร์ชั่นหลังๆ คือการเปลี่ยนวิธีการคอนฟิก OpenLDAP ซึ่งจะเป็นรูปแบบใหม่ที่มีมาตั้งแต่ OpenLDAP เวอร์ชั่น 2.3 เป็นต้นมา แต่ทาง Fedora เพิ่งเริ่มนำมาใช้ แบบเก่าไฟล์คอนฟิกหลักจะอยู่ในไฟล์ /etc/openldap/slapd.conf แต่แบบใหม่คอนฟิกจะถูกเก็บแยกเป็นไฟล์ LDIF เป็นโครงสร้างอยู่ในไดเร็คทอรี /etc/openldap/slapd.d/ และเมื่อรันเซอร์วิส ไฟล์เหล่านี้จะถูกอ่านเข้าไปใน LDAP เลย ซึ่งทำให้เราสามารถแก้ไขคอนฟิกเซิร์ฟเวอร์ ได้ เหมือนกับการแก้ไขข้อมูลอื่นๆ ใน LDAP รายละเอียดเพิ่มเติมหาอ่านได้จาก ข้อมูลอ้างอิง Configuring slapd เพื่อความสะดวก ทางทีมพัฒนา OpenLDAP ได้สร้างคำสั่ง slaptest เพื่อใช้ในการเปลี่ยนคอนฟิกแบบเก่าไฟล์เดียว ให้เป็นรูปแบบใหม่ได้ ในบทความนี้จะแสดงขั้นตอนการติดตั้งและคอนฟิก OpenLDAP บนเครื่อง Fedora 13 (x86_64) ติดตั้ง openldap ใช้คำสั่ง rpm เพื่อตรวจสอบการติดตั้ง openldap ว่ามีอยู่แล้วหรือไม่ [root@fc13-64a ~]# rpm [...]]]></description>
			<content:encoded><![CDATA[<p>การเปลี่ยนแปลงอย่างหนึ่งใน Fedora เวอร์ชั่นหลังๆ คือการเปลี่ยนวิธีการคอนฟิก OpenLDAP ซึ่งจะเป็นรูปแบบใหม่ที่มีมาตั้งแต่ OpenLDAP เวอร์ชั่น 2.3 เป็นต้นมา แต่ทาง Fedora เพิ่งเริ่มนำมาใช้</p>
<p>แบบเก่าไฟล์คอนฟิกหลักจะอยู่ในไฟล์ /etc/openldap/slapd.conf แต่แบบใหม่คอนฟิกจะถูกเก็บแยกเป็นไฟล์ LDIF เป็นโครงสร้างอยู่ในไดเร็คทอรี /etc/openldap/slapd.d/ และเมื่อรันเซอร์วิส ไฟล์เหล่านี้จะถูกอ่านเข้าไปใน LDAP เลย ซึ่งทำให้เราสามารถแก้ไขคอนฟิกเซิร์ฟเวอร์ ได้ เหมือนกับการแก้ไขข้อมูลอื่นๆ ใน LDAP</p>
<p>รายละเอียดเพิ่มเติมหาอ่านได้จาก ข้อมูลอ้างอิง Configuring slapd</p>
<p>เพื่อความสะดวก ทางทีมพัฒนา OpenLDAP ได้สร้างคำสั่ง slaptest เพื่อใช้ในการเปลี่ยนคอนฟิกแบบเก่าไฟล์เดียว ให้เป็นรูปแบบใหม่ได้</p>
<p>ในบทความนี้จะแสดงขั้นตอนการติดตั้งและคอนฟิก OpenLDAP บนเครื่อง Fedora 13 (x86_64)</p>
<p><span id="more-1126"></span></p>
<h4>ติดตั้ง openldap</h4>
<p>ใช้คำสั่ง rpm เพื่อตรวจสอบการติดตั้ง openldap ว่ามีอยู่แล้วหรือไม่</p>
<pre>[root@fc13-64a ~]# <strong>rpm -qa | grep openldap
</strong>openldap-2.4.21-4.fc13.x86_64</pre>
<p>เพื่อจะคอนฟิกเป็นเซิร์ฟเวอร์ได้ ต้องติดตั้งไฟล์ rpm เพิ่มเติม บางไฟล์หาได้จากแผ่นดีวีดีติดตั้ง</p>
<pre>[root@fc13-64a ~]# <strong>mount /dev/scd0 /media
</strong>mount: block device /dev/sr0 is write-protected, mounting read-only
[root@fc13-64a ~]# <strong>cd /media/Packages/</strong></pre>
<pre>[root@fc13-64a Packages]# <strong>rpm -i libtool-ltdl-2.2.6-20.fc13.x86_64.rpm
</strong>[root@fc13-64a Packages]# <strong>rpm -i openldap-clients-2.4.21-4.fc13.x86_64.rpm</strong></pre>
<p>ดาวน์โหลดไฟล์เพิ่มเติมจาก fc13 Everything แล้วติดตั้ง</p>
<pre>[root@fc13-64a Everything]# <strong>rpm -i openldap-servers-2.4.21-4.fc13.x86_64.rpm</strong></pre>
<p>ไฟล์คอนฟิกดีฟอลต์ของ OpenLDAP จะถูกติดตั้งอยู่ใน /etc/openldap/</p>
<pre>[root@fc13-64a ~]# <strong>cd /etc/openldap/</strong></pre>
<pre>[root@fc13-64a openldap]# <strong>ls -l
</strong>total 24
drwxr-xr-x. 2 root root 4096 Feb 24 16:19 cacerts
-rw-r--r--. 1 root root  245 Feb 24 16:19 ldap.conf
drwxr-xr-x  3 root root 4096 Jul 16 20:37 schema
-rw-r-----  1 root ldap 4153 Feb 24 16:19 slapd.conf.bak
drwx------  3 ldap ldap 4096 Jul 16 20:37 slapd.d</pre>
<h4>รันเซอร์วิส</h4>
<p>ใช้คำสั่ง service เพิ่มรัน slapd (OpenLDAP server)</p>
<pre>[root@fc13-64a ~]# <strong>service slapd start
</strong>/var/lib/ldap/__db.004<span style="color: #ff0000;"> is not owned by "ldap" </span>             [WARNING]
/var/lib/ldap/__db.001 is not owned by "ldap"              [WARNING]
/var/lib/ldap/__db.002 is not owned by "ldap"              [WARNING]
/var/lib/ldap/__db.006 is not owned by "ldap"              [WARNING]
/var/lib/ldap/__db.005 is not owned by "ldap"              [WARNING]
/var/lib/ldap/alock is not owned by "ldap"                 [WARNING]
/var/lib/ldap/__db.003 is not owned by "ldap"              [WARNING]
ln: accessing `/var/run/openldap/slapd.pid': No such file or directory</pre>
<p>มีข้อผิดพลาดฟ้องเรื่อง permission ไม่ถูกต้อง</p>
<pre>[root@fc13-64a ~]# <strong>ls -l /var/lib/ldap/
</strong>total 884
-rw------- 1 <span style="color: #ff0000;">root root</span>   2048 Jul 16 20:37 alock
-rw------- 1 root root  24576 Jul 16 20:37 __db.001
-rw------- 1 root root 212992 Jul 16 20:37 __db.002
-rw------- 1 root root 270336 Jul 16 20:37 __db.003
-rw------- 1 root root 163840 Jul 16 20:37 __db.004
-rw------- 1 root root 802816 Jul 16 20:37 __db.005
-rw------- 1 root root  32768 Jul 16 20:37 __db.006</pre>
<p>ใช้คำสัง chown เพื่อเปลี่ยนเจ้าของไฟล์ (owner)</p>
<pre>[root@fc13-64a ldap]# <strong>chown ldap.ldap *
</strong>[root@fc13-64a ldap]# <strong>ls -l
</strong>total 884
-rw------- 1 <span style="color: #0000ff;">ldap ldap   </span>2048 Jul 16 20:37 alock
-rw------- 1 ldap ldap  24576 Jul 16 20:37 __db.001
-rw------- 1 ldap ldap 212992 Jul 16 20:37 __db.002
-rw------- 1 ldap ldap 270336 Jul 16 20:37 __db.003
-rw------- 1 ldap ldap 163840 Jul 16 20:37 __db.004
-rw------- 1 ldap ldap 802816 Jul 16 20:37 __db.005
-rw------- 1 ldap ldap  32768 Jul 16 20:37 __db.006</pre>
<p>ใช้คำสั่ง service เพื่อรันเซอร์วิสอีกครั้ง</p>
<pre>[root@fc13-64a ldap]# <strong>service slapd start
</strong>Starting slapd:                                            [  OK  ]</pre>
<p>ใช้คำสั่ง ps เพื่อตรวจสอบ process</p>
<pre>[root@fc13-64a ldap]# <strong>ps -ef | grep ldap
</strong>ldap     22636     1  0 21:18 ?        00:00:00 /usr/sbin/slapd -h  ldap:/// -u ldap</pre>
<p>ใช้คำสั่ง service เพื่อปิดเซอร์วิส</p>
<pre>[root@fc13-64a ldap]# <strong>service slapd stop
</strong>Stopping slapd:                                            [  OK  ]</pre>
<p>แล้วทดลองรันเซอร์วิสอีกครั้ง จะมีข้อความฟ้องเรื่อง performance</p>
<pre>[root@fc13-64a ldap]# <strong>service slapd start
</strong>Checking configuration files for slapd:                    [WARNING]
<span style="color: #ff0000;">bdb_db_open: warning - no DB_CONFIG file found in directory /var/lib/ldap: (2).
Expect poor performance for suffix "dc=my-domain,dc=com".
</span>config file testing succeeded
Starting slapd:                                            [  OK  ]</pre>
<p>ปิดเซอร์วิสอีกครั้ง</p>
<pre>[root@fc13-64a ldap]# <strong>service slapd stop
</strong>Stopping slapd:                                            [  OK  ]</pre>
<p>เพื่อปรับปรุงเรื่อง performance ต้องสร้างไฟล์ DB_CONFIG  จากตัวอย่างไฟล์ใน /usr/share/doc/openldap-servers-2.4.21/</p>
<pre>[root@fc13-64a ldap]# <strong>cp /usr/share/doc/openldap-servers-2.4.21/DB_CONFIG.example DB_CONFIG
</strong>[root@fc13-64a ldap]# <strong>chown ldap.ldap DB_CONFIG
</strong>[root@fc13-64a ldap]# <strong>chmod 600 DB_CONFIG</strong></pre>
<p>ทดสอบการเปิด/ปิด เซอร์วิส ครั้งแรกจะมีฟ้องว่า มีการปรับเปลี่ยนคอนฟิก แล้วหลังจากนั้นก็สามารถรันได้ตามปกติ</p>
<pre>[root@fc13-64a ldap]# <strong>service slapd start
</strong>Checking configuration files for slapd:                    [WARNING]
<span style="color: #0000ff;">bdb_db_open: DB_CONFIG for suffix "dc=my-domain,dc=com" has changed.
Performing database recovery to activate new settings.
</span>bdb_db_open: database "dc=my-domain,dc=com": recovery skipped in read-only mode. Run manual recovery if errors are encountered.
config file testing succeeded
Starting slapd:                                            [  OK  ]</pre>
<pre>[root@fc13-64a ldap]# <strong>service slapd stop</strong>
Stopping slapd:                                            [  OK  ]</pre>
<pre>[root@fc13-64a ldap]# <strong>service slapd start</strong>
Starting slapd:                                            [  OK  ]</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/05/install_openldap_server_on_fedora_10">ติดตั้ง OpenLDAP Server บน Fedora 10</a></li>
<li><a href="http://www.openldap.org/doc/admin24/slapdconf2.html" target="_blank">OpenLDAP Software 2.4 Administrator&#8217;s Guide: Configuring slapd</a></li>
<li><a href="http://www.mirror.in.th/osarchive/fedora/releases/13/Everything/x86_64/os/Packages/" target="_blank">Fedora 13 x86_64 Everything</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2010/07/install_openldap_server_on_fedora_13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>คอนฟิกเซอร์วิส nscd</title>
		<link>http://spalinux.com/2008/11/configure_nscd</link>
		<comments>http://spalinux.com/2008/11/configure_nscd#comments</comments>
		<pubDate>Fri, 28 Nov 2008 09:13:12 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[cache]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=348</guid>
		<description><![CDATA[ในกรณีที่คอนฟิกให้ลีนุกซ์ตรวจสอบ user, group (authenticate) จาก LDAP Server ทุกครั้งที่มีการอ้างอิง เช่นการสร้างไฟล์ หรือแสดงรายชื่อไฟล์ด้วยคำสั่ง ls ของ user หรืออื่นๆ ที่เกี่ยวข้องกับ user, group เครื่องจะต้องมีการสอบถามจาก LDAP ทุกครั้ง ทำให้บางครั้งอาจเพิ่มโหลดมากเกินไปบนตัว LDAP Server เพื่อเพิ่มประสิทธิภาพในการตรวจสอบ user, group จาก LDAP แนะนำให้รันเซอร์วิส nscd (name service cache daemon) บนเครื่อง โดยโปรแกรมนี้จะทำหน้าที่เก็บข้อมูล cache ไว้บนเครื่องตัวเอง ถ้าถามซ้ำกับข้อมูลเดิมที่มีอยู่ใน cache แล้ว ภายในระยะเวลาที่กำหนดไว้ (time to live) จะไม่มีการส่งไปถาม LDAP Server อีก ข้อเสียของการรันเซอร์วิส nscd อย่างหนึ่งคือ เรื่องการตั้งค่าเวลา (time to [...]]]></description>
			<content:encoded><![CDATA[<p>ในกรณีที่คอนฟิกให้ลีนุกซ์ตรวจสอบ user, group (authenticate) จาก LDAP Server ทุกครั้งที่มีการอ้างอิง เช่นการสร้างไฟล์ หรือแสดงรายชื่อไฟล์ด้วยคำสั่ง ls ของ user หรืออื่นๆ ที่เกี่ยวข้องกับ user, group เครื่องจะต้องมีการสอบถามจาก LDAP ทุกครั้ง ทำให้บางครั้งอาจเพิ่มโหลดมากเกินไปบนตัว LDAP Server</p>
<p>เพื่อเพิ่มประสิทธิภาพในการตรวจสอบ user, group จาก LDAP แนะนำให้รันเซอร์วิส nscd (name service cache daemon) บนเครื่อง โดยโปรแกรมนี้จะทำหน้าที่เก็บข้อมูล cache ไว้บนเครื่องตัวเอง ถ้าถามซ้ำกับข้อมูลเดิมที่มีอยู่ใน cache แล้ว ภายในระยะเวลาที่กำหนดไว้ (time to live) จะไม่มีการส่งไปถาม LDAP Server อีก</p>
<p>ข้อเสียของการรันเซอร์วิส nscd อย่างหนึ่งคือ เรื่องการตั้งค่าเวลา (time to live) ทำให้บางครั้งอาจไม่ได้ข้อมูลที่ล่าสุด เช่นดีฟอลต์เวลาที่ cache ไว้สำหรับการเก็บข้อมูลของ user คือ 600 วินาที สำหรับการค้นหาข้อมูลที่สำเร็จ (positive-time-to-live) ถ้ามีการเปลี่ยนแปลงข้อมูลของ user บน LDAP Server จะต้องรอจนเวลานี้ผ่านไป  ข้อมูล cache ใน nscd ถึงจะปรับปรุงเป็นข้อมูลใหม่</p>
<p><span id="more-348"></span></p>
<h4>ปรับปรุงเวอร์ชั่น nscd</h4>
<p>ใช้คำสั่ง rpm เพื่อตรวจสอบเวอร์ชั่นของ nscd ที่ติดตั้งอยู่</p>
<pre>[root@ldap-client ~]# <strong>rpm -q nscd</strong>
nscd-2.8-3.i386</pre>
<p>คำแนะนำ ก่อนที่จะรันเซอร์วิส nscd แนะนำให้ปรับปรุงเป็นเวอร์ชั่นล่าสุด เช่น Fedora 9 เวอร์ชั่นล่าสุดที่เขียนบทความนี้คือ nscd-2.8-8</p>
<pre>[root@ldap-client ~]# <strong>rpm -Uvh nscd-2.8-8.i386.rpm
</strong>Preparing...                ########################################### [100%]
   1:nscd                   ########################################### [100%]</pre>
<h4>คอนฟิกไฟล์ /etc/nscd.conf</h4>
<p>ไฟล์คอนฟิกจากการติดตั้ง nscd จะเก็บ cache ของ passwd, group, hosts, services ในที่นี้เราจะเปลี่ยนคอนฟิกเพื่อให้เก็บ cache เฉพาะ passwd, group จาก LDAP</p>
<pre>[root@ldap-client ~]# <strong>cat /etc/nscd.conf
</strong>#
# /etc/nscd.conf
#
server-user             nscd
debug-level             0
paranoia                no</pre>
<pre>enable-cache            passwd          yes
positive-time-to-live   passwd          600
negative-time-to-live   passwd          20
suggested-size          passwd          211
check-files             passwd          yes
persistent              passwd          yes
shared                  passwd          yes
max-db-size             passwd          33554432
auto-propagate          passwd          yes</pre>
<pre>enable-cache            group           yes
positive-time-to-live   group           3600
negative-time-to-live   group           60
suggested-size          group           211
check-files             group           yes
persistent              group           yes
shared                  group           yes
max-db-size             group           33554432
auto-propagate          group           yes</pre>
<pre>enable-cache            hosts           <strong>no</strong>
enable-cache            services        <strong>no</strong></pre>
<p><strong>คำแนะนำการคอนฟิกไฟล์ nscd.conf</strong></p>
<ul>
<li>ดีฟอลต์คอนฟิกจากการติดตั้ง จะเป็บ cache ของ user (passwd) เป็นเวลา 600 วินาที สำหรับข้อมูลที่ค้นหาได้สำเร็จ (positive-time-to-live) แต่จะเก็บ cache ของ user ที่ค้นหาไม่สำเร็จ (ไม่มีข้อมูลใน LDAP) เป็นเวลา 20 วินาที</li>
<li>ดีฟอลต์คอนฟิกจากการติดตั้ง จะเป็บ cache ของ group เป็นเวลา 3600 วินาที สำหรับข้อมูลที่ค้นหาได้สำเร็จ (positive-time-to-live) แต่จะเก็บ cache ของ group ที่ค้นหาไม่สำเร็จ (ไม่มีข้อมูลใน LDAP) เป็นเวลา 60 วินาที</li>
<li>ต้องรอเวลา time-to-live เหล่านี้หมดไป จนกว่า nscd จะทำการตรวจสอบข้อมูลจาก LDAP ใหม่อีกครั้ง ก่อนการใช้งานจริงแนะนำให้ทดลองปรับค่าแล้วดูผลลัพธ์ที่ได้</li>
</ul>
<h4>รันเซอร์วิส nscd</h4>
<p>ใช้คำสั่ง service เพื่อรันเซอร์วิส nscd</p>
<pre>[root@fc9-k2 ~]# <strong>service nscd start</strong>
Starting nscd:                                             [  OK  ]</pre>
<p>ข้อมูล cache ของ nscd จะถูกเก็บไว้ใน /var/db/nscd/</p>
<pre>[root@fc9-k2 ~]# <strong>ls -l /var/db/nscd/
</strong>total 432
-rw------- 1 root root 217016 2008-11-28 15:39 group
-rw------- 1 root root 217016 2008-11-28 15:39 passwd</pre>
<h4>ทดสอบ nscd cache</h4>
<p>ใช้คำสั่ง time เพื่อเปรียบเทียบความเร็ว ระหว่างการดึงข้อมูล user จาก LDAP ในครั้งแรก และครั้งที่สอง ดึงข้อมูลจาก cache ของ nscd</p>
<pre>[root@fc9-k2 ~]# <strong>time id user01</strong>
uid=1011(user01) gid=513(Domain Users) groups=513(Domain Users)</pre>
<pre>real    0m0.046s
user    0m0.000s
sys     0m0.007s</pre>
<pre>[root@fc9-k2 ~]# <strong>time id user01</strong>
uid=1011(user01) gid=513(Domain Users) groups=513(Domain Users)</pre>
<pre>real    0m0.007s
user    0m0.000s
sys     0m0.005s</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/add_user_into_openldap">เพิ่มบัญชีผู้ใช้งานเข้าไปใน OpenLDAP</a> </li>
<li><a href="http://spalinux.com/2008/07/authenticate_user_on_fedora_directory_server">คอนฟิกให้ authenticate จาก Fedora Directory Server</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/11/configure_nscd/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ไฟล์คอนฟิก openldap สำหรับ smbldap-tools</title>
		<link>http://spalinux.com/2008/11/openldap_configuration_for_smbldap-tools</link>
		<comments>http://spalinux.com/2008/11/openldap_configuration_for_smbldap-tools#comments</comments>
		<pubDate>Thu, 27 Nov 2008 16:25:07 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[Samba]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=334</guid>
		<description><![CDATA[ไฟล์คอนฟิก /etc/openldap/slapd.conf สำหรับ คอนฟิก Samba เป็น Domain Controller โดยปรับปรุงเพิ่มเติมคุณสมบัติดังนี้ กำหนดคีย์ (index) ที่ใช้ในการค้นหาข้อมูล อนุญาตให้ผู้ใช้สามารถเปลี่ยน password โดยใช้คำสั่ง smbldap-passwd ด้วยตัวเองได้ ไม่ต้องใช้ rootdn ซ่อนรหัสผ่าน (password) ไม่ให้สามารถอ่านได้โดยตรง แต่ใช้ในการตรวจสอบสิทธิ (authenticate) ได้ # ------------------------ # /etc/openldap/slapd.conf # ------------------------ include     /etc/openldap/schema/corba.schema include     /etc/openldap/schema/core.schema include     /etc/openldap/schema/cosine.schema include     /etc/openldap/schema/duaconf.schema include     /etc/openldap/schema/dyngroup.schema include     /etc/openldap/schema/inetorgperson.schema include     /etc/openldap/schema/java.schema include     /etc/openldap/schema/misc.schema include     /etc/openldap/schema/nis.schema include     /etc/openldap/schema/openldap.schema include     /etc/openldap/schema/ppolicy.schema include     /etc/openldap/schema/collective.schema # [...]]]></description>
			<content:encoded><![CDATA[<p>ไฟล์คอนฟิก /etc/openldap/slapd.conf สำหรับ <a href="http://spalinux.com/2008/10/configure_samba_domain_controller">คอนฟิก Samba เป็น Domain Controller</a> โดยปรับปรุงเพิ่มเติมคุณสมบัติดังนี้</p>
<ul>
<li>กำหนดคีย์ (index) ที่ใช้ในการค้นหาข้อมูล</li>
<li>อนุญาตให้ผู้ใช้สามารถเปลี่ยน password โดยใช้คำสั่ง smbldap-passwd ด้วยตัวเองได้ ไม่ต้องใช้ rootdn</li>
<li>
<pre>ซ่อนรหัสผ่าน (password) ไม่ให้สามารถอ่านได้โดยตรง แต่ใช้ในการตรวจสอบสิทธิ (authenticate) ได้</pre>
</li>
</ul>
<p><span id="more-334"></span></p>
<pre># ------------------------
# /etc/openldap/slapd.conf
# ------------------------
include     /etc/openldap/schema/corba.schema
include     /etc/openldap/schema/core.schema
include     /etc/openldap/schema/cosine.schema
include     /etc/openldap/schema/duaconf.schema
include     /etc/openldap/schema/dyngroup.schema
include     /etc/openldap/schema/inetorgperson.schema
include     /etc/openldap/schema/java.schema
include     /etc/openldap/schema/misc.schema
include     /etc/openldap/schema/nis.schema
include     /etc/openldap/schema/openldap.schema
include     /etc/openldap/schema/ppolicy.schema
include     /etc/openldap/schema/collective.schema</pre>
<pre># Samba Schema
include     /etc/openldap/schema/samba.schema</pre>
<pre># Allow LDAPv2 client connections.  This is NOT the default.
allow bind_v2</pre>
<pre>pidfile     /var/run/openldap/slapd.pid
argsfile    /var/run/openldap/slapd.args</pre>
<pre># Enable Monitoring
database monitor</pre>
<pre># ldbm and/or bdb database definitions
database    bdb
suffix      "dc=test-ldap,dc=com"
rootdn      "uid=root,ou=People,dc=test-ldap,dc=com"
rootpw      {SSHA}xxx
directory   /var/lib/ldap</pre>
<pre># Indices to maintain for this database
index objectClass                       eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
index nisMapName,nisMapEntry            eq,pres,sub
index uniqueMember                      eq</pre>
<pre># required to support pdb_getsambapwrid()
index displayName                       pres,sub,eq
index sambaSID                          eq
index sambaPrimaryGroupSID              eq
index sambaDomainName                   eq
index sambaSIDList                      eq
index sambaGroupType                    eq
index default                           sub</pre>
<pre># users can authenticate and change their password
# hide password fields
access to attrs=userPassword,sambaNTPassword,sambaLMPassword,sambaPwdMustChange,sambaPwdLastSet
      by self write
      by anonymous auth
      by * none</pre>
<pre>access to attrs=shadowLastChange,shadowMax
      by self write
      by * read</pre>
<pre># all others attributes are readable to everybody
access to *
      by * read</pre>
<pre># loglevel stats stats2</pre>
<pre># EOF.</pre>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/11/openldap_configuration_for_smbldap-tools/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>การใช้งานคำสั่งของ smbldap-tools</title>
		<link>http://spalinux.com/2008/10/using_smbldap-tools</link>
		<comments>http://spalinux.com/2008/10/using_smbldap-tools#comments</comments>
		<pubDate>Sat, 18 Oct 2008 10:11:53 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[File Sharing]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[smbldap-tools]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=271</guid>
		<description><![CDATA[ในบทความนี้จะกล่าวถึงการใช้งานโปรแกรม smbldap-tools (เวอร์ชั่น 0.9.5) สำหรับเพิ่ม แก้ไข ลบข้อมูลของ user หรือ group ที่อยู่ใน LDAP เพื่อใช้งานร่วมกับ Samba หมายเหตุ ทุกคำสั่งของ smbldap-tools สามารถที่จะดูวิธีการใช้งานโดยย่อได้ จากการรันคำสั่งที่ต้องการแล้วต่อท้ายด้วยออปชั่น &#8216;-h&#8217; หรือ &#8216;-?&#8217; หรือไม่ก็อ่านรายละเอียดการใช้งานได้จาก man page ของแต่ละคำสั่ง smbldap-useradd เพิ่ม user คำสั่ง smbldap-useradd ใช้เพิ่ม user เข้าไปใน LDAP ตัวอย่างการเพิ่ม user01 เข้าไปใน LDAP [root@fc9-min ~]# smbldap-useradd -a -m -P user01 Changing UNIX and samba passwords for user01 New password: [...]]]></description>
			<content:encoded><![CDATA[<p>ในบทความนี้จะกล่าวถึงการใช้งานโปรแกรม smbldap-tools (เวอร์ชั่น 0.9.5) สำหรับเพิ่ม แก้ไข ลบข้อมูลของ user หรือ group ที่อยู่ใน LDAP เพื่อใช้งานร่วมกับ Samba</p>
<p>หมายเหตุ ทุกคำสั่งของ smbldap-tools สามารถที่จะดูวิธีการใช้งานโดยย่อได้ จากการรันคำสั่งที่ต้องการแล้วต่อท้ายด้วยออปชั่น &#8216;-h&#8217; หรือ &#8216;-?&#8217; หรือไม่ก็อ่านรายละเอียดการใช้งานได้จาก man page ของแต่ละคำสั่ง</p>
<p><span id="more-271"></span></p>
<hr />
<h4>smbldap-useradd เพิ่ม user</h4>
<p>คำสั่ง smbldap-useradd ใช้เพิ่ม user เข้าไปใน LDAP</p>
<p>ตัวอย่างการเพิ่ม user01 เข้าไปใน LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-useradd -a -m -P user01
</strong>Changing UNIX and samba passwords for user01
New password:
Retype new password:</pre>
<p>ออปชั่นของคำสั่ง smbldap-useradd ที่ใช้ เพื่อให้ใช้งานร่วมกับ Samba ได้มีดังนี้</p>
<ul>
<li>-a    เพิ่มข้อมูล Samba ของ user</li>
<li>-m   สร้างไดเร็คทอรี่ Home ของ user ด้วย</li>
<li>-P    ให้เรียกคำสั่ง smbldap-passwd หลังจบคำสั่ง เพื่อตั้งรหัสให้ user</li>
</ul>
<p>หลังจากที่เพิ่ม user เข้าในระบบแล้ว สามารถใช้คำสั่ง id หรือ getent เพื่อตรวจสอบข้อมูลของ user ได้</p>
<pre>[root@fc9-min ~]# <strong>id user01</strong>
uid=1001(user01) gid=513(Domain Users) groups=513(Domain Users)</pre>
<pre>[root@fc9-min ~]# <strong>getent passwd user01</strong>
user01:x:1001:513:System User:/home/user01:/bin/bash</pre>
<hr />
<h4>smbldap-passwd เปลี่ยนรหัสผ่านของ user</h4>
<p>คำสั้ง smbldap-passwd ใช้เพื่อเปลี่ยนรหัสผ่านของ user ที่อยู่ใน LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-passwd user01</strong>
Changing UNIX and samba passwords for user01
New password:
Retype new password:</pre>
<hr />
<h4>smbldap-userlist แสดงรายชื่อ user</h4>
<p>คำสั่ง smbldap-userlist ใช้เพื่อแสดงรายชื่อ user ทั้งหมดที่อยู่ใน LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-userlist
</strong>uid  |username</pre>
<pre>   0 |root                 |
 999 |nobody               |
1001 |user01               |</pre>
<hr />
<h4>smbldap-usershow แสดงรายละเอียด user</h4>
<p>คำสั่ง smbldap-usershow ใช้เพื่อตรวจสอบข้อมูลทั้งหมดของ user ที่อยู่ใน LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-usershow user01</strong>
dn: uid=user01,ou=People,dc=test-ldap,dc=com
objectClass: top,person,organizationalPerson,inetOrgPerson,posixAccount,shadowAccount,sambaSamAccount
uid: user01
uidNumber: 1001
gidNumber: 513
homeDirectory: /home/user01
sambaLogonTime: 0
sambaLogoffTime: 2147483647
sambaKickoffTime: 2147483647
sambaPwdCanChange: 0
displayName: user01
sambaSID: S-1-5-21-3697236364-1357617849-1956783867-3002
sambaPrimaryGroupSID: S-1-5-21-3697236364-1357617849-1956783867-513
sambaProfilePath: \\fc9-min\profiles\user01
sambaHomePath: \\fc9-min\user01
sambaHomeDrive: H:
sambaLMPassword: C53C042BF139A7D9AAD3B435B51404EE
sambaAcctFlags: [U]
sambaNTPassword: 152E0323FE05645650DD50FD31C2FCDF
sambaPwdLastSet: 1224343354
sambaPwdMustChange: 1228231354
userPassword: {SSHA}d+ZTyu7BhUarCaM2Ifu9bk/RS0lkSi80
shadowLastChange: 14170
shadowMax: 45
gecos: System User,,,,
cn: System User
sn: User
givenName: System
loginShell: /bin/bash</pre>
<hr />
<h4>smbldap-userinfo แก้ไขข้อมูลเบื้องต้นของ user</h4>
<p>คำสั่ง smbldap-userinfo ใช้เพื่อแก้ไขข้อมูลเบื้องต้นของ user เช่น User Shell, Full Name ถ้าต้องการแก้ไขข้อมูลอื่นๆ ต้องใช้คำสั่ง smbldap-usermod</p>
<pre>[root@fc9-min ~]# <strong>smbldap-userinfo user01
</strong>Changing the user information for user01
Enter the new value, or press ENTER for the default
 User Shell [/bin/bash]:
 Full Name [System User]: <strong>User01 Full Name</strong>
 Room Number []:
 Work Phone []:
 Home Phone []:
 Other []:
LDAP updated</pre>
<p>ตรวจสอบ Full Name หลังการแก้ไขด้วยคำสั่ง getent</p>
<pre>[root@fc9-min ~]# <strong>getent passwd user01</strong>
user01:x:1001:513:User01 Full Name,,,,:/home/user01:/bin/bash</pre>
<hr />
<h4>smbldap-usermod แก้ไขข้อมูลของ user</h4>
<p>คำสั่ง smbldap-usermod ใช้เพื่อแก้ข้อมูลของ user ที่อยู่ใน LDAP โดยต้องระบุออปชั่นที่ต้องการแก้ไข</p>
<p>ตัวอย่างการใช้คำสั่ง smbldap-usermod เพื่อแก้ไข Home ของ user01</p>
<pre>[root@fc9-min ~]# <strong>smbldap-usermod -d /new-home/user01 user01</strong></pre>
<p>ตรวจสอบหลังการแก้ไข</p>
<pre>[root@fc9-min ~]# <strong>getent passwd user01
</strong>user01:x:1001:513:User01 Full Name,,,,:/new-home/user01:/bin/bash</pre>
<p>เปลี่ยนข้อมูลกลับ</p>
<pre>[root@fc9-min ~]# <strong>smbldap-usermod -d /home/user01 user01
</strong>[root@fc9-min ~]# <strong>getent passwd user01
</strong>user01:x:1001:513:User01 Full Name,,,,:/home/user01:/bin/bash</pre>
<hr />
<h4>smbldap-userdel ลบ user</h4>
<p>คำสั่ง smbldap-userdel ใช้เพื่อลบ user ออกจาก LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-userdel -r user02</strong></pre>
<hr />
<h4>smbldap-groupadd เพิ่ม group</h4>
<p>คำสั่ง smbldap-groupadd ใช้เพื่อเพิ่ม group ใหม่เข้าไปใน LDAP</p>
<p>ตัวอย่างการเพิ่ม newgroup เข้าไปใน LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-groupadd newgroup</strong></pre>
<hr />
<h4>smbldap-groupshow ดูข้อมูลของ group</h4>
<p>คำสั่ง smbldap-groupshow ใช้เพื่อดูข้อมูลรายละเอียดของ group ที่อยู่ใน LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-groupshow newgroup</strong>
dn: cn=newgroup,ou=Group,dc=test-ldap,dc=com
objectClass: top,posixGroup
cn: newgroup
gidNumber: 1000</pre>
<hr />
<h4>smbldap-groupmod แก้ไขข้อมูลของ group</h4>
<p>คำสั่ง smbldap-groupmod ใช้เพื่อแก้ไขข้อมูลของ group เช่น การเพิ่ม user เข้าไปอยู่ใน group</p>
<p>ตัวอย่างการเพิ่ม user01 เข้าไปอยู่ใน newgroup</p>
<pre>[root@fc9-min ~]# <strong>smbldap-groupmod -m user01 newgroup</strong>
adding user user01 to group newgroup</pre>
<pre>[root@fc9-min ~]# <strong>id user01
</strong>uid=1001(user01) gid=513(Domain Users) groups=513(Domain Users),1000(newgroup)</pre>
<p>ตัวอย่างการเพิ่มหลายๆ user เข้าไปใน newgroup</p>
<pre>[root@fc9-min ~]# <strong>smbldap-groupmod -m user02,user03,user04,user05 newgroup
</strong>adding user user02 to group newgroup
adding user user03 to group newgroup
adding user user04 to group newgroup
adding user user05 to group newgroup</pre>
<p>ตรวจสอบข้อมูลของ newgroup</p>
<pre>[root@fc9-min ~]# <strong>smbldap-groupshow newgroup
</strong>dn: cn=newgroup,ou=Group,dc=test-ldap,dc=com
objectClass: top,posixGroup
cn: newgroup
gidNumber: 1000
memberUid: user01,user02,user03,user04,user05</pre>
<p>ตัวอย่างการลบ user ออกจาก group</p>
<pre>[root@fc9-min ~]# <strong>smbldap-groupmod -x user01 newgroup</strong>
deleting user user01 from group newgroup</pre>
<pre>[root@fc9-min ~]# <strong>id user01
</strong>uid=1001(user01) gid=513(Domain Users) groups=513(Domain Users)</pre>
<hr />
<h4>smbldap-groupdel ลบ group</h4>
<p>คำสั่ง smbldap-groupdel ใช้เพื่อลบ group ออกจาก LDAP</p>
<p>ตัวอย่างการลบ newgroup ออกจาก LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbldap-groupdel newgroup</strong></pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li> <a href="http://spalinux.com/2008/10/install_smbldap-tools_on_fedora_9">ติดตั้ง smbldap-tools บน Fedora 9</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/10/using_smbldap-tools/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ติดตั้ง smbldap-tools บน Fedora 9</title>
		<link>http://spalinux.com/2008/10/install_smbldap-tools_on_fedora_9</link>
		<comments>http://spalinux.com/2008/10/install_smbldap-tools_on_fedora_9#comments</comments>
		<pubDate>Sat, 18 Oct 2008 09:09:07 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[File Sharing]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[smbldap-tools]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=266</guid>
		<description><![CDATA[บทความนี้จะอธิบายการติดตั้งโปรแกรม smbldap-tools เพื่อช่วยในการคอนฟิกให้ Samba สามารถที่จะตรวจสอบ (authenticate) user จาก OpenLDAP ได้ โดยจะอ้างอิงจากการ ติดตั้ง OpenLDAP Server บน Fedora 9 ปรับปรุง samba เป็นเวอร์ชั่นล่าสุดใน Fedora 9 ในบทความนี้จะถือว่าเป็นการติดตั้ง OpenLDAP ใหม่เลย โดยไม่มีข้อมูลใดๆ อยู่ใน LDAP ติดตั้ง Perl Module ที่จำเป็น โปรแกรม smbldap-tools เขียนด้วยภาษา Perl จะเรียกใช้ Perl Module ต่างๆ ดังนั้นก่อนที่จะใช้งานได้ ต้องติดตั้ง Perl Module เหล่านี้ก่อน สำหรับ Fedora 9 สามารถดาวน์โหลดไฟล์ต่างๆ ได้จาก Fedora 9 Everything ตัวอย่างการติดตั้ง Perl [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้จะอธิบายการติดตั้งโปรแกรม smbldap-tools เพื่อช่วยในการคอนฟิกให้ Samba สามารถที่จะตรวจสอบ (authenticate) user จาก OpenLDAP ได้ โดยจะอ้างอิงจากการ</p>
<ul>
<li><a href="http://spalinux.com/2008/10/install_openldap_server_on_fedora_9">ติดตั้ง OpenLDAP Server บน Fedora 9</a></li>
<li><a href="http://spalinux.com/2008/07/update_samba_in_fedora_9">ปรับปรุง samba เป็นเวอร์ชั่นล่าสุดใน Fedora 9</a></li>
</ul>
<p>ในบทความนี้จะถือว่าเป็นการติดตั้ง OpenLDAP ใหม่เลย โดยไม่มีข้อมูลใดๆ อยู่ใน LDAP</p>
<p><span id="more-266"></span></p>
<h4>ติดตั้ง Perl Module ที่จำเป็น</h4>
<p>โปรแกรม smbldap-tools เขียนด้วยภาษา Perl จะเรียกใช้ Perl Module ต่างๆ ดังนั้นก่อนที่จะใช้งานได้ ต้องติดตั้ง Perl Module เหล่านี้ก่อน สำหรับ Fedora 9 สามารถดาวน์โหลดไฟล์ต่างๆ ได้จาก <a href="http://mirrors.kernel.org/fedora/releases/9/Everything/" target="_blank">Fedora 9 Everything</a></p>
<p>ตัวอย่างการติดตั้ง Perl Module ที่จำเป็นตามลำดับ บน Fedora 9</p>
<pre>[root@fc9-min ~]# <strong>rpm -ivh perl-Digest-MD4-1.5-6.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Crypt-SmbHash-0.12-8.fc9.noarch.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Digest-SHA1-2.11-7.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Net-SSLeay-1.32-5.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-IO-Socket-SSL-1.12-4.fc9.noarch.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Compress-Raw-Zlib-2.008-20.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-IO-Compress-Base-2.008-20.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-IO-Compress-Zlib-2.008-20.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Compress-Zlib-2.008-20.fc9.i386.rpm</strong>
[root@fc9-min ~]# <strong>rpm -ivh perl-HTML-Tagset-3.10-8.fc9.noarch.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-HTML-Parser-3.56-5.fc9.i386.r</strong>pm
[root@fc9-min ~]# <strong>rpm -ivh perl-URI-1.35-8.fc9.noarch.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-libwww-perl-5.808-7.fc9.noarch.rpm</strong>
[root@fc9-min ~]# <strong>rpm -ivh perl-XML-LibXML-Common-0.13-13.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-XML-NamespaceSupport-1.09-4.fc9.noarch.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh --nodeps perl-XML-SAX-0.16-5.fc9.noarch.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-XML-LibXML-1.65-5.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-LDAP-0.34-4.fc9.noarch.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Jcode-2.06-6.fc9.noarch.rpm</strong>
[root@fc9-min ~]# <strong>rpm -ivh perl-Unicode-Map-0.112-14.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Unicode-String-2.09-8.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Unicode-Map8-0.12-17.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -ivh perl-Unicode-MapUTF8-1.11-6.fc8.noarch.rpm</strong></pre>
<p>หลังจากติดตั้ง Perl Module ที่ต้องใช้เรียบร้อยแล้ว ก็ติดตั้งโปรแกรม smbldap-tools โดยสามารถดาวน์โหลดได้จากที่เดียวกัน</p>
<pre>[root@fc9-min ~]# <strong>rpm -ivh smbldap-tools-0.9.5-2.fc9.noarch.rpm</strong></pre>
<h4>รันเซอร์วิส Samba เบื้องต้น</h4>
<p>ก่อนที่จะเริ่มคอนฟิก smbldap-tools ได้นั้น จำเป็นต้องรันเซอร์วิส Samba ก่อน โดยคอนฟิกที่ต้องเปลี่ยนในไฟล์ /etc/samba/smb.conf ในเบื้องต้นนี้คือส่วน workgroup เพราะค่านี้จะถูกอ่านตอนรันคอนฟิก smbldap-tools ส่วนคอนฟิก อื่นๆ ไว้แก้ไขที่หลังได้</p>
<p>ตัวอย่างไฟล์ smb.conf ที่แก้ไข ก่อนคอนฟิก smbldap-tools</p>
<pre> workgroup = SMBLDAP</pre>
<p>ใช้คำสั่ง service เพื่อรันเซอร์วิส Samba</p>
<pre>[root@fc9-min ~]# <strong>/etc/init.d/smb start
</strong>Starting SMB services:                                     [  OK  ]</pre>
<h4>แก้ไขคอนฟิก OpenLDAP</h4>
<p>จากการติดตั้ง OpenLDAP Server ต้องเพิ่มไฟล์ schema ของ Samba เข้าไปในไฟล์ slapd.conf ด้วย</p>
<p>ตัวอย่างไฟล์ /etc/openldap/slapd.conf หลังการแก้ไข</p>
<pre>include     /etc/openldap/schema/samba.schema</pre>
<pre>suffix      "dc=test-ldap,dc=com"
rootdn      "uid=root,ou=People,dc=test-ldap,dc=com"
rootpw      {SSHA}zA4XZB4pD1TUh/mRO31MC0kbUF+V0v2Y</pre>
<p>หมายเหตุ คอนฟิกส่วน rootpw ได้มาจากการรันคำสั่ง slappasswd</p>
<p>รันเซอร์วิส OpenLDAP หลังจากแก้ไขคอนฟิกไฟล์ slapd.conf</p>
<pre>[root@fc9-min ~]# <strong>/etc/init.d/ldap start
</strong>Starting slapd:                                            [  OK  ]</pre>
<h4>รันไฟล์ configure.pl เพื่อคอนฟิก smbldap-tools</h4>
<p>ไฟล์คอนฟิกหลักของ smbldap-tools จะอยู่ในไดเร็คทอรี /etc/smbldap-tools/ ซึ่งจะประกอบด้วยคอนฟิกหลายๆ ส่วน เพื่อความสะดวกในการแก้ไขไฟล์ จากการติดตั้ง smbldap-tools จะมีไฟล์ /usr/share/doc/smbldap-tools-0.9.5/configure.pl เพื่อช่วยในการคอนฟิกไฟล์</p>
<p>ตัวอย่างรันไฟล์ configure.pl เพื่อสร้างคอนฟิกไฟล์ของ smbldap-tools</p>
<pre>[root@fc9-min ~]# <strong>/usr/share/doc/smbldap-tools-0.9.5/configure.pl
</strong>$# is no longer supported at /usr/share/doc/smbldap-tools-0.9.5/configure.pl line 314.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
       smbldap-tools script configuration
       -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Before starting, check
 . if your samba controller is up and running.
 . if the domain SID is defined (you can get it with the 'net getlocalsid')</pre>
<pre> . you can leave the configuration using the Crtl-c key combination
 . empty value can be set with the "." character
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Looking for configuration files...</pre>
<pre>Samba Configuration File Path [/etc/samba/smb.conf] &gt;</pre>
<pre>The default directory in which the smbldap configuration files are stored is shown.
If you need to change this, enter the full directory path, then press enter to continue.
Smbldap-tools Configuration Directory Path [/etc/smbldap-tools/] &gt;
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Let's start configuring the smbldap-tools scripts ...</pre>
<pre>. workgroup name: name of the domain Samba act as a PDC
  workgroup name [SMBLDAP] &gt;
. netbios name: netbios name of the samba controler
  netbios name [] &gt; <strong>fc9-min
</strong>. logon drive: local path to which the home directory will be connected (for NT Workstations). Ex: 'H:'
  logon drive [] &gt; <strong>H:
</strong>. logon home: home directory location (for Win95/98 or NT Workstation).
  (use %U as username) Ex:'\\fc9-min\%U'
  logon home (press the "." character if you don't want homeDirectory) [\\fc9-min\%U] &gt;
. logon path: directory where roaming profiles are stored. Ex:'\\fc9-min\profiles\%U'
  logon path (press the "." character if you don't want roaming profile) [\\fc9-min\profiles\%U] &gt;
. home directory prefix (use %U as username) [/home/%U] &gt;
. default users' homeDirectory mode [700] &gt;
. default user netlogon script (use %U as username) [] &gt; <strong>\\fc9-min\netlogon\%U
</strong>  default password validation time (time in days) [45] &gt;
. ldap suffix [] &gt; <strong>dc=test-ldap,dc=com
</strong>. ldap group suffix [] &gt; <strong>ou=Group
</strong>. ldap user suffix [] &gt; <strong>ou=People</strong>
. ldap machine suffix [] &gt; <strong>ou=Computers</strong>
. Idmap suffix [ou=Idmap] &gt;
. sambaUnixIdPooldn: object where you want to store the next uidNumber
  and gidNumber available for new users and groups
  sambaUnixIdPooldn object (relative to ${suffix}) [sambaDomainName=PDCTEST] &gt;
Use of uninitialized value $server in substitution (s///) at /usr/share/doc/smbldap-tools-0.9.5/configure.pl line 244, &lt;STDIN&gt; line 17.
. ldap master server: IP adress or DNS name of the master (writable) ldap server
Use of uninitialized value $example_value in concatenation (.) or string at /usr/share/doc/smbldap-tools-0.9.5/configure.pl line 161, &lt;STDIN&gt; line 17.
Use of uninitialized value $example_value in string at /usr/share/doc/smbldap-tools-0.9.5/configure.pl line 162, &lt;STDIN&gt; line 17.
  ldap master server [] &gt; <strong>127.0.0.1
</strong>. ldap master port [389] &gt;
. ldap master bind dn [] &gt; <strong>uid=root,ou=People,dc=test-ldap,dc=com</strong>
. ldap master bind password [] &gt;
. ldap slave server: IP adress or DNS name of the slave ldap server: can also be the master one
Use of uninitialized value $server in string at /usr/share/doc/smbldap-tools-0.9.5/configure.pl line 262, &lt;STDIN&gt; line 21.
  ldap slave server [] &gt; <strong>127.0.0.1</strong>
. ldap slave port [389] &gt;
. ldap slave bind dn [] &gt; <strong>uid=root,ou=People,dc=test-ldap,dc=com</strong>
. ldap slave bind password [] &gt;
. ldap tls support (1/0) [0] &gt;
. SID for domain PDCTEST: SID of the domain (can be obtained with 'net getlocalsid fc9-min')
  SID for domain PDCTEST [S-1-5-21-3697236364-1357617849-1956783867] &gt;
. unix password encryption: encryption used for unix passwords
  unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA) [SSHA] &gt;
. default user gidNumber [513] &gt;
. default computer gidNumber [515] &gt;
. default login shell [/bin/bash] &gt;
. default skeleton directory [/etc/skel] &gt;
. default domain name to append to mail adress [] &gt;
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Use of uninitialized value $# in concatenation (.) or string at /usr/share/doc/smbldap-tools-0.9.5/configure.pl line 314, &lt;STDIN&gt; line 33.
backup old configuration files:
  /etc/smbldap-tools/smbldap.conf-&gt;/etc/smbldap-tools/smbldap.conf.old
  /etc/smbldap-tools/smbldap_bind.conf-&gt;/etc/smbldap-tools/smbldap_bind.conf.old
writing new configuration file:
  /etc/smbldap-tools/smbldap.conf done.
  /etc/smbldap-tools/smbldap_bind.conf done.</pre>
<h4>รันคำสั่ง smbldap-populate</h4>
<p>โปรแกรม smbldap-tools จะมีคำสั่ง smbldap-populate เพื่อช่วยเพิ่มข้อมูลเข้าไปใน OpenLDAP โดยจะอ้างอิงจากคอนฟิกที่รันด้วย configure.pl</p>
<p>หมายเหตุ ในที่นี้จะถือว่า ไม่มีข้อมูลใดๆ อยู่ใน OpenLDAP เลย</p>
<p>ตัวอย่างการรันคำสั่ง smbldap-populate</p>
<pre>[root@fc9-min openldap]# <strong>smbldap-populate
</strong>Populating LDAP directory for domain PDCTEST (S-1-5-21-3697236364-1357617849-1956783867)
(using builtin directory structure)</pre>
<pre>adding new entry: dc=test-ldap,dc=com
adding new entry: ou=People,dc=test-ldap,dc=com
adding new entry: ou=Group,dc=test-ldap,dc=com
adding new entry: ou=Computers,dc=test-ldap,dc=com
adding new entry: ou=Idmap,dc=test-ldap,dc=com
adding new entry: uid=root,ou=People,dc=test-ldap,dc=com
adding new entry: uid=nobody,ou=People,dc=test-ldap,dc=com
adding new entry: cn=Domain Admins,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Domain Users,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Domain Guests,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Domain Computers,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Administrators,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Account Operators,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Print Operators,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Backup Operators,ou=Group,dc=test-ldap,dc=com
adding new entry: cn=Replicators,ou=Group,dc=test-ldap,dc=com
adding new entry: sambaDomainName=PDCTEST,dc=test-ldap,dc=com</pre>
<pre>Please provide a password for the domain root:
Changing UNIX and samba passwords for root
New password: <strong>ldap1234</strong>
Retype new password: <strong>ldap1234</strong></pre>
<p>หมายเหตุ Password ที่ใส่ในส่วนท้ายของคำสั่ง smbldap-populate เป็น rootpw ที่ระบุในไฟล์ /etc/openldap/slapd.conf</p>
<h4>รันคำสั่ง smbpasswd</h4>
<p>รันคำสั่ง smbpasswd เพื่อใส่ ldap admin password ที่ Samba ใช้ในการเชื่อมต่อกับ LDAP</p>
<pre>[root@fc9-min ~]# <strong>smbpasswd -w ldap1234</strong>
Setting stored password for "uid=root,ou=People,dc=test-ldap,dc=com" in secrets.tdb</pre>
<p>หมายเหตุ &#8216;ldap1234&#8242; คือ rootpw ที่ระบุในไฟล์ /etc/openldap/slapd.conf</p>
<h4>คอนฟิกให้ลีนุกซ์ ตรวจสอบผู้ใช้งานจาก LDAP</h4>
<p>ใช้คำสั่ง authconfig-tui เพื่อคอนฟิกให้ ลีนุกซ์ตรวจสอบผู้ใช้งานหรือ authenticate จาก LDAP</p>
<h4>คอนฟิก Samba ให้ authenticate จาก LDAP</h4>
<p>แก้ไขคอนฟิกไฟล์ของ Samba เพื่อให้ authenticate จาก ldap</p>
<p>ตัวอย่างไฟล์ /etc/samba/smb.conf ที่แก้ไขเพิ่มเติม</p>
<pre> workgroup = SMBLDAP
 security = user
 passdb backend = ldapsam:ldap://127.0.0.1/</pre>
<pre> ldap suffix = dc=test-ldap,dc=com
 ldap admin dn = uid=root,ou=People,dc=test-ldap,dc=com
 ldap group suffix = ou=Group
 ldap user suffix = ou=People</pre>
<h4>เพิ่ม user ใน LDAP</h4>
<pre>[root@fc9-min ~]# <strong>smbldap-useradd -a -m -s /bin/bash -d /home/user01 -P user01</strong>
Changing UNIX and samba passwords for user01
New password:
Retype new password:</pre>
<h4>ทดสอบด้วยคำสั่ง smbclient</h4>
<p>ใช้คำสั่ง smbclient เพื่อทดสอบการใช้ Samba เพื่อ authenticate ผู้ใช้จาก LDAP</p>
<p>ตัวอย่างการทดสอบด้วยคำสั่ง smbclient</p>
<pre>[root@fc9-min samba]# <strong>smbclient '\\localhost\user01' -U user01</strong>
Enter user01's password:
Domain=[fc9-min] OS=[Unix] Server=[Samba 3.2.3-0.20.fc9]
smb: \&gt; <strong>dir
</strong>  .                                   D        0  Sat Oct 18 12:21:59 2008
  ..                                  D        0  Sat Oct 18 11:38:30 2008
  .bashrc                             H      124  Sat Oct 18 11:38:30 2008
  .bash_logout                        H       18  Sat Oct 18 11:38:30 2008
  .bash_profile                       H      176  Sat Oct 18 11:38:30 2008</pre>
<pre>                60160 blocks of size 65536. 55959 blocks available
smb: \&gt; <strong>exit</strong></pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/install_openldap_server_on_fedora_9">ติดตั้ง OpenLDAP Server บน Fedora 9</a></li>
<li><a href="http://spalinux.com/2008/07/update_samba_in_fedora_9" target="_self">ปรับปรุง samba เป็นเวอร์ชั่นล่าสุดใน Fedora 9</a></li>
<li><a href="http://spalinux.com/2008/10/using_smbldap-tools">การใช้งานคำสั่งของ smbldap-tools</a></li>
<li><a href="http://spalinux.com/2008/10/configure_samba_domain_controller">คอนฟิก Samba เป็น Domain Controller</a></li>
<li><a href="http://www.iallanis.info/smbldap-tools/docs/smbldap-tools/" target="_blank">Smbldap-tools User Manual</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/10/install_smbldap-tools_on_fedora_9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>เพิ่ม แก้ไข ลบ ผู้ใช้งานใน OpenLDAP</title>
		<link>http://spalinux.com/2008/10/add_modify_delete_user_in_openldap</link>
		<comments>http://spalinux.com/2008/10/add_modify_delete_user_in_openldap#comments</comments>
		<pubDate>Sat, 11 Oct 2008 18:38:23 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[openldap]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=255</guid>
		<description><![CDATA[จากบทความ ติดตั้ง OpenLDAP Server บน Fedora 9 และ เพิ่มบัญชีผู้ใช้งานเข้าไปใน OpenLDAP  ในบทความนี้จะแสดงวิธีการเพิ่ม แก้ไข ลบ รวมทั้งการเปลี่ยนรหัสผ่าน (Password) ของผู้ใช้งานที่ถูกเก็บข้อมูลไว้ใน OpenLDAP  โดยจะสร้างเป็นไฟล์ ldif แล้วใช้คำสั่งของ ldap ในการแก้ไข เพิ่มผู้ใช้งานเข้าไปใน OpenLDAP ตัวอย่างไฟล์ ldif และการใช้คำสั่ง ldapadd เพิ่ม user01 เข้าไปใน OpenLDAP [root@fc9-min ldif]# cat add-user01.ldif dn: uid=user01,ou=People,dc=test-ldap,dc=com uid: user01 cn: user01 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}!! shadowLastChange: 14030 shadowMax: [...]]]></description>
			<content:encoded><![CDATA[<p>จากบทความ <a href="http://spalinux.com/2008/10/install_openldap_server_on_fedora_9">ติดตั้ง OpenLDAP Server บน Fedora 9</a> และ <a href="http://spalinux.com/2008/10/add_user_into_openldap">เพิ่มบัญชีผู้ใช้งานเข้าไปใน OpenLDAP</a><br />
 ในบทความนี้จะแสดงวิธีการเพิ่ม แก้ไข ลบ รวมทั้งการเปลี่ยนรหัสผ่าน (Password) ของผู้ใช้งานที่ถูกเก็บข้อมูลไว้ใน OpenLDAP  โดยจะสร้างเป็นไฟล์ ldif แล้วใช้คำสั่งของ ldap ในการแก้ไข</p>
<p><span id="more-255"></span></p>
<hr />
<h4>เพิ่มผู้ใช้งานเข้าไปใน OpenLDAP</h4>
<p>ตัวอย่างไฟล์ ldif และการใช้คำสั่ง ldapadd เพิ่ม user01 เข้าไปใน OpenLDAP</p>
<pre>[root@fc9-min ldif]# <strong>cat add-user01.ldif
</strong>dn: uid=user01,ou=People,dc=test-ldap,dc=com
uid: user01
cn: user01
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}!!
shadowLastChange: 14030
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1001
gidNumber: 100
homeDirectory: /home/user01</pre>
<pre>[root@fc9-min ldif]# <strong>ldapadd -x -D uid=root,ou=People,dc=test-ldap,dc=com \
                       -W -f add-user01.ldif
</strong>Enter LDAP Password:
adding new entry "uid=user01,ou=People,dc=test-ldap,dc=com"</pre>
<p>รหัสผ่าน (Enter LDAP Password) ที่ต้องใส่คือรหัส rootpw ที่ถูกเข้ารหัสแล้วเก็บไว้ในไฟล์ slapd.conf</p>
<p>หลังจากที่เพิ่มผู้ใช้งาน ต้องสร้างไดเร็คทอรีเพื่อเป็น HOME ของ user ด้วย ดังนี้</p>
<pre>[root@fc9-min ~]# <strong>cd /home
</strong>[root@fc9-min home]# <strong>mkdir user01
</strong>[root@fc9-min home]# <strong>cp -av /etc/skel/. user01/
</strong>`/etc/skel/./.bash_profile' -&gt; `user01/./.bash_profile'
`/etc/skel/./.bash_logout' -&gt; `user01/./.bash_logout'
`/etc/skel/./.bashrc' -&gt; `user01/./.bashrc'
[root@fc9-min home]# <strong>chown user01:users user01/
</strong>[root@fc9-min home]# <strong>chmod 700 user01</strong></pre>
<hr />
<h4>ตรวจสอบผู้ใช้งานจาก OpenLDAP</h4>
<p>นอกจากการทดสอบด้วยการล็อกอินแล้ว สามารถใช้คำสั่ง id หรือ getent ในการตรวจสอบผู้ใช้งานจาก OpenLDAP ได้ดังนี้</p>
<pre>[root@fc9-min ~]# <strong>id user01
</strong>uid=1001(user01) gid=100(users) groups=100(users) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023</pre>
<pre>[root@fc9-min ldif]# <strong>getent passwd user01
</strong>user01:x:1001:100:user01:/home/user01:/bin/bash</pre>
<hr />
<h4>เปลี่ยนรหัสผ่าน</h4>
<p>ใช้คำสั่ง ldappasswd ในการเปลี่ยนรหัสผู้ใช้งานที่อยู่ใน OpenLDAP โดยต้องระบุ CN ของผู้ใช้นั้นๆ เช่น ต้องการเปลี่ยนรหัสผ่านของ user01 ซึ่งมี CN: uid=user01,ou=People,dc=test-ldap,dc=com สามารถทำได้ดังนี้</p>
<pre>[root@fc9-min ldif]# <strong>ldappasswd -x -S -W -D uid=root,ou=People,dc=test-ldap,dc=com \
                       uid=user01,ou=People,dc=test-ldap,dc=com</strong></pre>
<pre>New password: <strong>&lt;new-user-password&gt;</strong>
Re-enter new password: <strong>&lt;new-user-password&gt;
</strong>Enter LDAP Password: <strong>&lt;rootpw-password&gt;</strong></pre>
<p>รหัสสองอันแรกที่ต้องใส่ (New password และ Re-enter new password) เป็นรหัสใหม่ที่ต้องการตั้งให้กับผู้ใช้ ส่วน Enter LDAP Password ต้องใส่รหัสผ่านของ rootpw ที่ระบุในไฟล์ slapd.conf</p>
<hr />
<h4>แก้ไขข้อมูล</h4>
<p>ใช้คำสั่ง ldapmodify เพื่อแก้ไขข้อมูลที่อยู่ใน OpenLDAP โดยข้อมูลที่ถูกแก้ไข จะถูกระบุอยู่ในไฟล์ ldif เช่น ตัวอย่างนี้จะเป็นการแก้ไขข้อมูล homeDirectory ของ user01 ให้เป็นค่าใหม่คือ /new-home/user01 และเพิ่ม gecos โดยมีค่าเป็น “User01 GECOS Name”</p>
<pre>[root@fc9-min ldif]# <strong>cat modify-user01.ldif
</strong>dn: uid=user01,ou=People,dc=test-ldap,dc=com
changetype: modify
replace: homeDirectory
homeDirectory: /new-home/user01
-
add: gecos
gecos: User01 GECOS Name
-</pre>
<p>ใช้คำสั่ง getent เพื่อเปรียบเทียบข้อมูลก่อนและหลังรันคำสั่ง ldapmodify</p>
<pre>[root@fc9-min ldif]# <strong>getent passwd user01
</strong>user01:x:1001:100:user01:/home/user01:/bin/bash</pre>
<pre>[root@fc9-min ldif]# <strong>ldapmodify -x -D "uid=root,ou=People,dc=test-ldap,dc=com" \
                       -W -f modify-user01.ldif
</strong>Enter LDAP Password:
modifying entry "uid=user01,ou=People,dc=test-ldap,dc=com"</pre>
<pre>[root@fc9-min ldif]# <strong>getent passwd user01
</strong>user01:x:1001:100:User01 GECOS Name:/new-home/user01:/bin/bash</pre>
<hr />
<h4>ลบ user</h4>
<p>ใช้คำสั่ง ldapdelete เพื่อลบผู้ใช้งานออกจาก OpenLDAP โดยต้องระบุชื่อผู้ใช้เป็นค่า CN ของผู้ใช้นั้นๆ เช่นต้องการลบ user01 ที่มี CN: uid=user01,ou=People,dc=test-ldap,dc=com</p>
<pre>[root@fc9-min bin]# <strong>ldapdelete -x -D uid=root,ou=People,dc=test-ldap,dc=com –W \
                      uid=user01,ou=People,dc=test-ldap,dc=com
</strong>Enter LDAP Password:</pre>
<pre>[root@fc9-min bin]# <strong>getent passwd user01
</strong>[root@fc9-min bin]#</pre>
<hr />
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/install_openldap_server_on_fedora_9">ติดตั้ง OpenLDAP Server บน Fedora 9</a></li>
<li><a href="http://spalinux.com/2008/10/add_user_into_openldap">เพิ่มบัญชีผู้ใช้งานเข้าไปใน OpenLDAP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/10/add_modify_delete_user_in_openldap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>เพิ่มบัญชีผู้ใช้งานเข้าไปใน OpenLDAP</title>
		<link>http://spalinux.com/2008/10/add_user_into_openldap</link>
		<comments>http://spalinux.com/2008/10/add_user_into_openldap#comments</comments>
		<pubDate>Sat, 11 Oct 2008 18:05:32 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[ldap authentication]]></category>
		<category><![CDATA[openldap]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=250</guid>
		<description><![CDATA[หลังจากที่ ติดตั้ง OpenLDAP Server ไปแล้ว บทความนี้จะเป็นการเริ่มต้นใส่ข้อมูลเข้าไปใน LDAP ซึ่งในที่นี้จะใส่ข้อมูลให้สามารถเก็บบัญชีผู้ใช้งาน (User Account) และรหัสผ่าน (Password) เพื่อให้สามารถ authenticate user บนลีนุกซ์ได้ การเพิ่มข้อมูลเข้าไปใน LDAP ได้นั้น วิธีการหนี่งที่ทำได้คือสร้างไฟล์เป็นรูปแบบ ldif ก่อน แล้วใช้คำสั่ง ldapadd เพื่อเพิ่มข้อมูลเข้าไปใน LDAP เพิ่มข้อมูลพื้นฐานของ LDAP ตัวอย่างไฟล์ ldif สำหรับใส่ข้อมูลพื้นฐานของ LDAP  และการใช้คำสั่ง ldapadd เพิ่มข้อมูลเข้าไปใน LDAP [root@fc9-min ldif]# cat ldap-base.ldif dn: dc=test-ldap,dc=com dc: test-ldap objectClass: top objectClass: domain dn: ou=People,dc=test-ldap,dc=com ou: People objectClass: top objectClass: [...]]]></description>
			<content:encoded><![CDATA[<p>หลังจากที่ <a href="http://spalinux.com/2008/10/install_openldap_server_on_fedora_9">ติดตั้ง OpenLDAP Server</a> ไปแล้ว บทความนี้จะเป็นการเริ่มต้นใส่ข้อมูลเข้าไปใน LDAP ซึ่งในที่นี้จะใส่ข้อมูลให้สามารถเก็บบัญชีผู้ใช้งาน (User Account) และรหัสผ่าน (Password) เพื่อให้สามารถ authenticate user บนลีนุกซ์ได้</p>
<p><span id="more-250"></span></p>
<p>การเพิ่มข้อมูลเข้าไปใน LDAP ได้นั้น วิธีการหนี่งที่ทำได้คือสร้างไฟล์เป็นรูปแบบ ldif ก่อน แล้วใช้คำสั่ง ldapadd เพื่อเพิ่มข้อมูลเข้าไปใน LDAP</p>
<h4>เพิ่มข้อมูลพื้นฐานของ LDAP</h4>
<p>ตัวอย่างไฟล์ ldif สำหรับใส่ข้อมูลพื้นฐานของ LDAP  และการใช้คำสั่ง ldapadd เพิ่มข้อมูลเข้าไปใน LDAP</p>
<pre>[root@fc9-min ldif]# <strong>cat ldap-base.ldif</strong>
dn: dc=test-ldap,dc=com
dc: test-ldap
objectClass: top
objectClass: domain</pre>
<pre>dn: ou=People,dc=test-ldap,dc=com
ou: People
objectClass: top
objectClass: organizationalUnit</pre>
<pre>dn: ou=Group,dc=test-ldap,dc=com
ou: Group
objectClass: top
objectClass: organizationalUnit</pre>
<pre>[root@fc9-min ldif]# <strong>ldapadd -x -D uid=root,ou=People,dc=test-ldap,dc=com -W -f ldap-base.ldif
</strong>Enter LDAP Password:
adding new entry "dc=test-ldap,dc=com"</pre>
<pre>adding new entry "ou=People,dc=test-ldap,dc=com"</pre>
<pre>adding new entry "ou=Group,dc=test-ldap,dc=com"</pre>
<p><strong>หมายเหตุ</strong> LDAP Password ที่ต้องใส่ในคำสั่ง ldapadd คือรหัสที่ถูกเข้ารหัสด้วยคำสั่ง slappasswd แล้วนำมาใส่ไว้เป็นคอนฟิก rootpw ในไฟล์ /etc/openldap/slapd.conf</p>
<h4>เพิ่ม user01 เข้าไปใน LDAP</h4>
<p>ตัวอย่างไฟล์ ldif เพื่อเพิ่ม user01 เข้าไปใน LDAP</p>
<pre>[root@fc9-min ldif]# <strong>cat add-user01.ldif
</strong>dn: uid=user01,ou=People,dc=test-ldap,dc=com
uid: user01
cn: user01
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}!!
shadowLastChange: 14030
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1001
gidNumber: 100
homeDirectory: /home/user01</pre>
<p>ใช้คำสั่ง ldapadd เพิ่ม user01 เข้าไปใน LDAP</p>
<pre>[root@fc9-min ldif]# <strong>ldapadd -x -D uid=root,ou=People,dc=test-ldap,dc=com -W -f add-user01.ldif</strong>
Enter LDAP Password:
adding new entry "uid=user01,ou=People,dc=test-ldap,dc=com"</pre>
<h4>แก้ใขให้ลีนุกซ์ตรวจสอบผู้ใช้งานจาก LDAP</h4>
<p>ใช้คำสั่ง authconfig-tui เพื่อคอนฟิกให้อ่านค่าผู้ใช้งาน (User Account) จาก LDAP Server โดยในที่นี้จะให้ LDAP Server รันอยู่บนเครื่องเดียวกัน เราสามารถระบุ Server เป็น 127.0.0.1 หรือ localhost ได้</p>
<p>ในหน้าแรกของคำสั่ง authconfig-tui ส่วนของ User Information  ให้คลิกเลือก [*] Use LDAP และส่วนของ Authentication ให้คลิกเลือก [*] Use LDAP Authentication เสร็จเรียบร้อยให้กด Next</p>
<pre>                              ┌────────────────┤ Authentication Configuration ├─────────────────┐
                              │                                                                 │
                              │  User Information        Authentication                         │
                              │  [ ] Cache Information   [ ] Use MD5 Passwords                  │
                              │  [ ] Use Hesiod          [*] Use Shadow Passwords               │
                              │  <strong>[*] Use LDAP</strong>            <strong>[*] Use LDAP Authentication</strong>            │
                              │  [ ] Use NIS             [ ] Use Kerberos                       │
                              │  [ ] Use Winbind         [ ] Use SMB Authentication             │
                              │                          [ ] Use Winbind Authentication         │
                              │                          [*] Local authorization is sufficient  │
                              │                                                                 │
                              │            ┌────────┐                      ┌──────┐             │
                              │            │ Cancel │                      │ Next │             │
                              │            └────────┘                      └──────┘             │
                              │                                                                 │
                              │                                                                 │
                              └─────────────────────────────────────────────────────────────────┘</pre>
<p>ในหน้าที่สองจะเป็นการระบุ Server เพื่อชี้ไปยัง LDAP Server โดยจะใส่ ldap:// นำหน้า IP Address หรือชื่อ Hostname  อีกส่วนที่ต้องแก้ไขคือ Base DN ซึ่งเป็นค่าเดียวกับที่ตั้งไว้ในไฟล์ slapd.conf เสร็จเรียบร้อยให้กด Ok ออกมา</p>
<pre>                                     ┌─────────────────┤ LDAP Settings ├─────────────────┐
                                     │                                                   │
                                     │          [ ] Use TLS                              │
                                     │  Server: <strong>ldap://127.0.0.1/</strong>_______________________ │
                                     │ Base DN: <strong>dc=test-ldap,dc=com</strong>_____________________ │
                                     │                                                   │
                                     │         ┌──────┐                  ┌────┐          │
                                     │         │ Back │                  │ Ok │          │
                                     │         └──────┘                  └────┘          │
                                     │                                                   │
                                     │                                                   │
                                     └───────────────────────────────────────────────────┘</pre>
<h4>ทดสอบตรวจสอบบัญชีผู้ใช้งานจาก LDAP</h4>
<p>สามารถใช้คำสั่ง id เพื่อตรวจสอบผู้ใช้งานจาก LDAP ได้ ดังนี้</p>
<pre>[root@fc9-min ~]# <strong>id user01
</strong>uid=1001(user01) gid=100(users) groups=100(users) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023</pre>
<p>หรือใช้คำสั่ง getent เพื่อดูรายละเอียดเพิ่มเติมของผู้ใช้นั้นๆ</p>
<pre>[root@fc9-min ~]# <strong>getent passwd user01
</strong>user01:x:1001:100:user01:/home/user01:/bin/bash</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/install_openldap_server_on_fedora_9">ติดตั้ง OpenLDAP Server บน Fedora 9</a></li>
<li><a href="http://spalinux.com/2008/10/add_modify_delete_user_in_openldap">เพิ่ม แก้ไข ลบ ผู้ใช้งานใน OpenLDAP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/10/add_user_into_openldap/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ติดตั้ง OpenLDAP Server บน Fedora 9</title>
		<link>http://spalinux.com/2008/10/install_openldap_server_on_fedora_9</link>
		<comments>http://spalinux.com/2008/10/install_openldap_server_on_fedora_9#comments</comments>
		<pubDate>Sat, 11 Oct 2008 17:22:08 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[openldap]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=242</guid>
		<description><![CDATA[จากครั้งก่อนได้กล่าวถึง การติดตั้งและคอนฟิก Fedora Directory Server เบื้องต้น  ซึ่งเป็น LDAP Server ที่พัฒนาจากทีมงานของ Fedora ในบทความนี้จะกล่าวถึงอีกทางเลือกหนึ่งในการเลือกใช้งาน LDAP Server โดยจะเป็นการติดตั้งและเริ่มต้นคอนฟิก OpenLDAP Server  หมายเหตุ ตัวอย่างในบทความนี้จะติดตั้งบนเครื่องที่ ติดตั้ง Fedora 9 แบบประหยัดพื้นที่สุด ดาวน์โหลดไฟล์ rpm สำหรับติดตั้ง OpenLDAP สามารถดาวน์โหลดไฟล์ rpm เวอร์ชั่นล่าสุด (update) ของ Fedora 9 สำหรับการติดตั้งได้ที่ http://mirrors.kernel.org/fedora/updates/9/ โดยรายชื่อไฟล์ที่ต้องดาวน์โหลด (ตุลาคม 2551) มีดังนี้ openldap-2.4.10-1.fc9.i386.rpm openldap-clients-2.4.10-1.fc9.i386.rpm openldap-servers-2.4.10-1.fc9.i386.rpm ติดตั้งโปรแกรมไฟล์ rpm ของ openldap หลังจากได้ไฟล์ที่ดาวน์โหลดมา ใช้คำสั่ง rpm ในการติดตั้ง ตัวอย่างการติดตั้งไฟล์ rpm โปรแกรม OpenLDAP [root@fc9-min ~]# [...]]]></description>
			<content:encoded><![CDATA[<p>จากครั้งก่อนได้กล่าวถึง <a href="http://spalinux.com/2008/06/basic_install_configure_fedora_directory_server">การติดตั้งและคอนฟิก Fedora Directory Server เบื้องต้น</a>  ซึ่งเป็น LDAP Server ที่พัฒนาจากทีมงานของ Fedora ในบทความนี้จะกล่าวถึงอีกทางเลือกหนึ่งในการเลือกใช้งาน LDAP Server โดยจะเป็นการติดตั้งและเริ่มต้นคอนฟิก OpenLDAP Server </p>
<p><span id="more-242"></span></p>
<p>หมายเหตุ ตัวอย่างในบทความนี้จะติดตั้งบนเครื่องที่ <a href="http://spalinux.com/2008/06/install_minimal_fedora_9 ">ติดตั้ง Fedora 9 แบบประหยัดพื้นที่สุด</a></p>
<h4>ดาวน์โหลดไฟล์ rpm สำหรับติดตั้ง OpenLDAP</h4>
<p>สามารถดาวน์โหลดไฟล์ rpm เวอร์ชั่นล่าสุด (update) ของ Fedora 9 สำหรับการติดตั้งได้ที่ <a href="http://mirrors.kernel.org/fedora/updates/9/">http://mirrors.kernel.org/fedora/updates/9/</a> โดยรายชื่อไฟล์ที่ต้องดาวน์โหลด (ตุลาคม 2551) มีดังนี้</p>
<ul>
<li>openldap-2.4.10-1.fc9.i386.rpm</li>
<li>openldap-clients-2.4.10-1.fc9.i386.rpm</li>
<li>openldap-servers-2.4.10-1.fc9.i386.rpm</li>
</ul>
<h4>ติดตั้งโปรแกรมไฟล์ rpm ของ openldap</h4>
<p>หลังจากได้ไฟล์ที่ดาวน์โหลดมา ใช้คำสั่ง rpm ในการติดตั้ง</p>
<p>ตัวอย่างการติดตั้งไฟล์ rpm โปรแกรม OpenLDAP</p>
<pre>[root@fc9-min ~]# <strong>rpm -U openldap-2.4.10-1.fc9.i386.rpm</strong>
[root@fc9-min ~]# <strong>rpm -i openldap-clients-2.4.10-1.fc9.i386.rpm
</strong>[root@fc9-min ~]# <strong>rpm -i openldap-servers-2.4.10-1.fc9.i386.rpm
</strong>/etc/pki/tls/certs /
umask 77 ; \
        PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
        PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
        /usr/bin/openssl req -utf8 -newkey rsa:1024 -keyout $PEM1 -nodes -x509 -days 365 -out $PEM2 -set_serial 0 ; \
        cat $PEM1 &gt;  slapd.pem ; \
        echo ""    &gt;&gt; slapd.pem ; \
        cat $PEM2 &gt;&gt; slapd.pem ; \
        rm -f $PEM1 $PEM2
Generating a 1024 bit RSA private key
...++++++
....++++++
writing new private key to '/tmp/openssl.etZSRT'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:State or Province Name (full name) [Berkshire]:Locality Name (eg, city) [Newbury]:Organization Name (eg, company) [My Company Ltd]:Organizational Unit Name (eg, section) []:Common Name (eg, your name or your server's hostname) []:Email Address []:/</pre>
<p>หมายเหตุ</p>
<ul>
<li>ตัวอย่างนี้ใช้คำสั่ง rpm ด้วยออปชั่น -U (Upgrade) เพราะว่าจากการติดตั้ง Fedora 9 จะมีไฟล์ rpm ของ openldap ติดมาด้วย และมีโปรแกรมอื่นๆ ที่บังคับไม่ให้เราสามารถถอดไฟล์ rpm นี้ออกไปก่อนจะลงใหม่ได้ ออปชั่น -U จะเป็นการสั่งให้ปรับปรุงและแทนที่ด้วยเวอร์ชั่นใหม่ทับของเก่าไป</li>
<li>การติดตั้ง openldap-servers จะมีข้อความขึ้นมา ซึ่งเป็นการสร้างคีย์ไฟล์เพื่อความปลอดภัยในการรับส่งข้อมูลระหว่างเซิร์ฟเวอร์กับไคลเอนต์  ณ ตอนนี้ไม่ต้องสนใจ</li>
</ul>
<p>หลังจากติดตั้งแล้ว สามารถตรวจสอบเวอร์ชั่นของไฟล์ rpm ที่ติดตั้งได้ ดังนี้</p>
<pre>[root@fc9-min ~]# <strong>rpm -qa | grep openldap</strong>
openldap-servers-2.4.10-1.fc9.i386
openldap-clients-2.4.10-1.fc9.i386
openldap-2.4.10-1.fc9.i386</pre>
<h4>แก้ไขคอนฟิกไฟล์ /etc/openldap/slapd.conf</h4>
<p>ไฟล์คอนฟิกหลักของ OpenLDAP Server คือไฟล์ /etc/openldap/slapd.conf ในเบื้องต้นจะต้องมีการแก้ไขบางส่วนก่อนที่จะเริ่มใช้งานได้ ในที่นี้จะสมมติข้อมูลเบื้องต้นสำหรับการคอนฟิก OpenLDAP Server เป็นดังนี้</p>
<pre>Suffix:  dc=test-ldap,dc=com
Root DN: uid=root,ou=People,dc=test-ldap,dc=com
Root PW: ldap1234</pre>
<p>ก่อนที่จะเริ่มแก้ไขไฟล์คอนฟิก ต้องใช้คำสั่ง spappasswd เพื่อเข้ารหัส Root PW แล้วนำผลลัพธ์ที่ได้ไปใส่ไว้ส่วนของคอนฟิก rootpw ในไฟล์ slapd.conf โดยรหัสนี้จะใช้เมื่อต้องการแก้ไขข้อมูลที่อยู่ใน LDAP เช่นเพิ่ม แก้ไข ลบ ข้อมูล</p>
<p>ตัวอย่างการรันคำสั่ง spappasswd</p>
<pre>[root@fc9-min openldap]# <strong>slappasswd
</strong>New password: ldap1234
Re-enter new password: ldap1234
{SSHA}zA4XZB4pD1TUh/mRO31MC0kbUF+V0v2Y</pre>
<p>นำผลลัพธ์การเข้ารหัสที่ได้ ไปใส่ไว้ในไฟล์ slapd.conf</p>
<p>ตัวอย่างการแก้ไขไฟล์ slapd.conf</p>
<pre>database    bdb
suffix      <strong>"dc=test-ldap,dc=com"
</strong>rootdn      <strong>"uid=root,ou=People,dc=test-ldap,dc=com"
</strong>rootpw      <strong>{SSHA}zA4XZB4pD1TUh/mRO31MC0kbUF+V0v2Y</strong></pre>
<pre>directory   /var/lib/ldap</pre>
<h4>รันเซอร์วิส ldap</h4>
<p>ก่อนที่จะรันเซอร์วิส ต้อง copy ไฟล์ DB_CONFIG มาใส่ไว้ในไดเร็คทอรี /var/lib/ldap/ ก่อน แล้วใช้คำสั่ง service เพื่อรันเซอร์วิส ldap ดังนี้</p>
<pre>
[root@fc9-min ~]# <strong>cp /usr/share/doc/openldap-servers-2.4.10/DB_CONFIG.example /var/lib/ldap/DB_CONFIG</strong>
[root@fc9-min ~]# <strong>chown ldap:ldap /var/lib/ldap/DB_CONFIG</strong>
[root@fc9-min ~]# <strong>chmod 600 /var/lib/ldap/DB_CONFIG</strong>

[root@fc9-min ~]# <strong>service ldap start
</strong>Starting slapd:                                 [  OK  ]</pre>
<p>สามารถตรวจสอบโปรเซสของ ldap ได้จากคำสั่ง ps ดังนี้</p>
<pre>[root@fc9-min openldap]# <strong>ps -ef | grep ldap
</strong>ldap      2382     1  0 13:17 ?        00:00:00 /usr/sbin/slapd -h ldap:/// -u ldap</pre>
<p>ไฟล์ข้อมูลของ OpenLDAP Server จะถูกเก็บไว้ในไดเร็คทอรีที่ระบุในส่วนคอนฟิก directory ในไฟล์ slapd.conf จากตัวอย่างด้านบนจะเป็น /var/lib/ldap</p>
<pre>[root@fc9-min ~]# <strong>ls -l /var/lib/ldap
</strong>total 700
-rw-r--r-- 1 ldap ldap     2048 2008-10-12 01:39 alock
-rw------- 1 ldap ldap    24576 2008-10-12 01:39 __db.001
-rw------- 1 ldap ldap   278528 2008-10-12 01:39 __db.002
-rw------- 1 ldap ldap   270336 2008-10-12 01:39 __db.003
-rw------- 1 ldap ldap    98304 2008-10-12 01:39 __db.004
-rw------- 1 ldap ldap   352256 2008-10-12 01:39 __db.005
-rw------- 1 ldap ldap    24576 2008-10-12 01:39 __db.006
-rw------- 1 ldap ldap      921 2008-10-17 16:18 DB_CONFIG
-rw------- 1 ldap ldap     8192 2008-10-12 01:39 dn2id.bdb
-rw------- 1 ldap ldap    32768 2008-10-12 01:39 id2entry.bdb
-rw------- 1 ldap ldap 10485760 2008-10-12 01:39 log.0000000001</pre>
<h4>ทดสอบการดึงข้อมูลจาก LDAP</h4>
<p>ถ้า OpenLDAP Server รันได้ถูกต้อง เราสามารถใช้คำสั่ง ldapsearch เพื่อดึงข้อมูลจาก LDAP ตัวอย่างด้านล่างจะเป็นการทดสอบดึงข้อมูลทั้งหมดมา ซึ่งตอนนี้ยังไม่มีข้อมูล ดังนั้นผลลัพธ์จะแสดงดังนี้</p>
<pre>[root@fc9-min ldif]# <strong>ldapsearch -x -b "dc=test-ldap,dc=com" "(objectclass=*)"
</strong># extended LDIF
#
# LDAPv3
# base &lt;dc=test-ldap,dc=com&gt; with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#</pre>
<pre># search result
search: 2
result: 32 No such object</pre>
<pre># numResponses: 1</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/add_user_into_openldap">เพิ่มบัญชีผู้ใช้งานเข้าไปใน OpenLDAP</a></li>
<li><a href="http://spalinux.com/2008/10/add_modify_delete_user_in_openldap">เพิ่ม แก้ไข ลบ ผู้ใช้งานใน OpenLDAP</a></li>
<li><a href="http://www.openldap.org/" target="_blank">OpenLDAP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/10/install_openldap_server_on_fedora_9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>คอนฟิกให้ authenticate จาก Fedora Directory Server</title>
		<link>http://spalinux.com/2008/07/authenticate_user_on_fedora_directory_server</link>
		<comments>http://spalinux.com/2008/07/authenticate_user_on_fedora_directory_server#comments</comments>
		<pubDate>Fri, 04 Jul 2008 14:06:19 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=49</guid>
		<description><![CDATA[หลังจากที่เราติดตั้งและคอนฟิก Fedora Directory Server เรียบร้อยแล้ว ในบทความนี้จะอธิบายถึงการเก็บ UNIX User Account และ Group เข้าไปใน LDAP เพื่อที่จะใช้รองรับการ authentication จากโปรแกรมต่างได้ เช่น สำหรับการ login, secure shell และอื่นๆ โดยดีฟอลต์เมื่อติดตั้ง Fedora Directory Server ตัวโปรแกรมจะสร้างข้อมูลพื้นฐานขึ้นมาจำนวนหนึ่ง ซึ่งประกอบด้วย Base DN – ซึ่งจะเป็นชื่อพื้นฐานโดเมนที่เราใช้ตอนติดตั้ง ในบทความนี้จะคอนฟิกอยู่ในโดเมน (BASE) เป็น dc=your-domain, dc=com ที่รันอยู่บนเครื่องที่ชื่อ “server” ou=Users – มีไว้สำหรับเก็บข้อมูลของผู้ใช้งาน ซึ่งเราจะไว้เก็บ UNIX User Account จากไฟล์ /etc/passwd ou=Groups – จะเป็นส่วนที่เก็บข้อมูลกลุ่มของผู้ใช้งาน (Groups) ซึ่งเราจะไว้เก็บ UNIX Group [...]]]></description>
			<content:encoded><![CDATA[<p>หลังจากที่เราติดตั้งและคอนฟิก Fedora Directory Server เรียบร้อยแล้ว ในบทความนี้จะอธิบายถึงการเก็บ UNIX User Account และ Group เข้าไปใน LDAP  เพื่อที่จะใช้รองรับการ authentication จากโปรแกรมต่างได้ เช่น สำหรับการ login, secure shell และอื่นๆ</p>
<p><span id="more-49"></span></p>
<p>โดยดีฟอลต์เมื่อติดตั้ง Fedora Directory Server ตัวโปรแกรมจะสร้างข้อมูลพื้นฐานขึ้นมาจำนวนหนึ่ง ซึ่งประกอบด้วย</p>
<ul>
<li><strong>Base DN</strong> – ซึ่งจะเป็นชื่อพื้นฐานโดเมนที่เราใช้ตอนติดตั้ง ในบทความนี้จะคอนฟิกอยู่ในโดเมน (BASE) เป็น dc=your-domain, dc=com ที่รันอยู่บนเครื่องที่ชื่อ “server”</li>
<li><strong>ou=Users</strong> – มีไว้สำหรับเก็บข้อมูลของผู้ใช้งาน ซึ่งเราจะไว้เก็บ UNIX User Account จากไฟล์ /etc/passwd</li>
<li><strong>ou=Groups</strong> – จะเป็นส่วนที่เก็บข้อมูลกลุ่มของผู้ใช้งาน (Groups) ซึ่งเราจะไว้เก็บ UNIX Group  จากไฟล์ /etc/group</li>
</ul>
<p>ในการที่จะ authenticate รหัสผู้ใช้งานจาก LDAP ได้นั้น เราจะต้องนำข้อมูลของผู้ใช้งานจากไฟล์ /etc/passwd, /etc/group ไปเก็บไว้ใน LDAP โดยจะมีวิธีการอยู่หลายวิธี แต่ในที่นี้จะแนะนำวิธีการสร้างไฟล์ ldif ขึ้นมา แล้วค่อย import เข้าไปใน LDAP โดยที่ Directory Server กำลังทำงานอยู่</p>
<p><strong>สร้างไฟล์ passwd.ldif</strong><br />
เริ่มต้นสร้างไฟล์ passwd.ldif ซึ่งจะเก็บ user account และรายละเอียดของ user นั้นๆ อยู่ ซึ่งจากตัวอย่างด้านล้าง จะเป็นข้อมูลของผู้ใช้งานที่ใช้ login เป็น user01 (uid: user01)</p>
<pre>dn: uid=user01,ou=People,dc=your-domain,dc=com
uid: user01
cn: user01
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}*
shadowLastChange: 14050
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 601
gidNumber: 600
homeDirectory: /home/user01
gecos: user01</pre>
<p>ถ้าต้องการสร้างผู้ใช้หลายๆ คน ก็เพิ่มข้อมูลต่อท้ายลงไปในไฟล์นี้โดยให้เว้นไว้บรรทัดว่างไว้หนึ่งบรรทัด ระหว่างข้อมูลแต่ละ user</p>
<p><strong>สร้างไฟล์ group.ldif</strong><br />
ขั้นต่อไปสร้างไฟล์ group.ldif ซึ่งจะเก็บ UNIX Group และรายละเอียด ซึ่งจากตัวอย่างด้านล้าง จะเป็นข้อมูลของกลุ่มผู้ใช้งานที่ชื่อ ldapuser</p>
<pre>dn: cn=ldapusers,ou=Groups,dc=your-domain,dc=com
objectClass: posixGroup
objectClass: top
cn: ldapusers
userPassword: {crypt}x
gidNumber: 600</pre>
<p><strong>Import ข้อมูลจากไฟล์ ldif เข้าไปใน LDAP</strong><br />
เมื่อได้ไฟล์ ldif แล้ว ต้องใช้คำสั่ง ldif2ldap เพื่อนำข้อมูลจากไฟล์เข้าไปเก็บไว้ใน LDAP โดยก่อนที่จะรันคำสั่งนี้ได้ Directory Server ต้องรันทำงานอยู่แล้ว</p>
<p>เวลาที่รันคำสั่ง ldif2ldap จำเป็นต้องระบุ “cn=Directory Manager” และรหัสผ่านลงไปด้วย โดยรหัสผ่านนี้คือรหัสที่ใส่ตอนใช้คำสั่ง setup-ds-admin.pl ตอนที่คอนฟิก Directory Server ตั้งแต่ตอนแรกที่ติดตั้ง</p>
<p>ตัวอย่างการรันคำสั่ง ldif2ldap เพื่อนำข้อมูลจากไฟล์เข้าไปใน LDAP</p>
<pre>[root@server ~]#<strong> /usr/lib/dirsrv/slapd-server/ldif2ldap "cn=Directory Manager" &lt;password&gt; passwd.ldif</strong>
adding new entry uid=user01,ou=People,dc=your-domain,dc=com</pre>
<pre>[root@server ~]# <strong>/usr/lib/dirsrv/slapd-server/ldif2ldap "cn=Directory Manager" &lt;password&gt; group.ldif
</strong>adding new entry cn=ldapusers,ou=Groups,dc=your-domain,dc=com</pre>
<p>หมายเหตุ<br />
- ในที่นี้จะรันอยู่บนเครื่องที่ชื่อ server ดังนั้น path ที่ใช้จะเป็น /usr/lib/dirsrv/slapd-server/ ซึ่งถ้าคุณรันคำสั่งนี้บนชื่อเครื่องอื่นๆ ให้เปลี่ยนตรงคำว่า server<br />
- ให้สังเกตผลลัพธ์จากการรันคำสั่ง ldif2ldap ด้วย ว่าสำเร็จหรือไม่ ถ้าไม่สำเร็จ ให้แก้ไข ไฟล์และรันใหม่อีกครั้ง</p>
<p><strong>เปลี่ยนคอนฟิกของเครื่องให้อ่านข้อมูล User Account และ Group จาก LDAP ด้วย</strong><br />
โดยดีฟอลต์ของ Linux ข้อมูล User Account และ Group จะถูกอ่านจากไฟล์ /etc/passwd และ /etc/group ตามลำดับ ถ้าเราต้องการให้มาอ่านข้อมูลจาก LDAP ด้วย ให้ใช้คำสั่ง authconfig-tui เพื่อแก้คอนฟิก</p>
<pre>
[root@server ~]# <strong>authconfig-tui
</strong>┌────────────────┤ Authentication Configuration ├─────────────────┐
│                                                                 │
│  User Information        Authentication                         │
│  [*] Cache Information   [ ] Use MD5 Passwords                  │
│  [ ] Use Hesiod          [*] Use Shadow Passwords               │
│  <strong>[*] Use LDAP</strong>            <strong>[*] Use LDAP Authentication</strong>            │
│  [ ] Use NIS             [ ] Use Kerberos                       │
│  [ ] Use Winbind         [ ] Use SMB Authentication             │
│                          [ ] Use Winbind Authentication         │
│                          [*] Local authorization is sufficient  │
│                                                                 │
│            ┌────────┐                      ┌──────┐             │
│            │ Cancel │                      │ Next │             │
│            └────────┘                      └──────┘             │
│                                                                 │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘</pre>
<p>คลิ้กเลือก [*] Use LDAP และ [*] Use LDAP Authentication แล้วกดปุ่ม Next</p>
<pre>┌─────────────────┤ LDAP Settings ├─────────────────┐
│                                                   │
│          [ ] Use TLS                              │
│  Server: <strong>ldap://localhost/</strong>_______________________ │
│ Base DN: <strong>dc=your-domain,dc=com</strong>___________________ │
│                                                   │
│         ┌──────┐                  ┌────┐          │
│         │ Back │                  │ Ok │          │
│         └──────┘                  └────┘          │
│                                                   │
│                                                   │
└───────────────────────────────────────────────────┘</pre>
<p>ใส่คอนฟิกของ Server เป็น ldap://localhost และ ใส่ Base DN: เป็น dn=your-domain, dc=com แล้วกดปุ่ม Ok</p>
<p>คำสั่ง authconfig-tui จะไปแก้ไฟล์ /etc/ldap.conf และไฟล์ต่างๆ ใน /etc/pam.d/ ซึ่งหลังจากแก้ไขแล้ว ต่อไปเวลาตรวจสอบชื่อหรือรหัสผู้ใช้งาน ระบบจะตรวจสอบจากไฟล์ /etc/passwd และ /etc/group ก่อน ถ้าหาไม่พบถึงจะไปค้นหาใน LDAP อีกที</p>
<p><strong>ทดสอบการใช้งาน</strong><br />
สามารถใช้คำสั่ง id เพื่อตรวจสอบ User Account จาก LDAP ได้ โดยผลลัพธ์ที่ได้จะมี uid, group ของผู้ใช้งานนั้นๆ</p>
<p>ตัวอย่างการใช้คำสั่ง id เพื่อตรวจสอบ User จาก LDAP</p>
<pre>[root@server ~]# <strong>id user01
</strong>uid=601(user01) gid=600(ldapusers) groups=600(ldapusers)</pre>
<p>ถ้าต้องการเปลี่ยนแปลงข้อมูล เช่น password หรือต้องการลบ แนะนำให้ใช้ Management Console ได้ จากการรันคำสั่ง fedora-idm-console ใน X Window</p>
<p><strong>ข้อมูลอ้างอิง</strong></p>
<ul>
<li><a href="http://spalinux.com/2008/06/basic_install_configure_fedora_directory_server">ติดตั้งและคอนฟิก Fedora Directory Server เบื้องต้น</a></li>
<li><a href="http://directory.fedoraproject.org/wiki/Howto:PAM" target="_blank">PAM Configuration for LDAP Client Systems </a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/07/authenticate_user_on_fedora_directory_server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ติดตั้งและคอนฟิก Fedora Directory Server เบื้องต้น</title>
		<link>http://spalinux.com/2008/06/basic_install_configure_fedora_directory_server</link>
		<comments>http://spalinux.com/2008/06/basic_install_configure_fedora_directory_server#comments</comments>
		<pubDate>Fri, 27 Jun 2008 13:28:59 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Directory Server]]></category>
		<category><![CDATA[ldap]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=42</guid>
		<description><![CDATA[Fedora Directory Server เป็น LDAP Server โปรแกรมหนึ่ง  ซึ่งมีคุณสมบัติที่ใกล้เคียงกับ OpenLDAP แต่จะมีโปรแกรมหน้าจอ (console) ช่วยในการจัดการ ตั้งค่า คอนฟิกต่างๆ ใน LDAP Server ได้สะดวกมากขึ้น ในบทความนี้จะกล่าวถึงการติดตั้งโปรแกรมและคอนฟิก Fedora Directory Server เบื้องต้น เพื่อสร้างคอนฟิกของ directory พื้นฐานสำหรับการใช้งานต่อไป ส่วนประกอบของ Fedora Directory Server ในแกนหลักของโปรแกรมจะประกอบด้วย Directory Server: ทำหน้าที่เป็น LDAP Server (เหมือนกับ OpenLDAP) Directory Server Console: เป็นโปรแกรมที่รันบน X Window เพื่อช่วยในการจัดการ ตั้งค่า คอนฟิกต่างๆ ของ Directory Server Administration Server: รันเป็น Web Server อยู่บน [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://spalinux.com/wp-content/uploads/2008/06/fedora-idm-console-login.png"></a><a href="http://spalinux.com/wp-content/uploads/2008/06/fedora-idm-console-directory.png"></a>Fedora Directory Server เป็น LDAP Server โปรแกรมหนึ่ง  ซึ่งมีคุณสมบัติที่ใกล้เคียงกับ OpenLDAP แต่จะมีโปรแกรมหน้าจอ (console) ช่วยในการจัดการ ตั้งค่า คอนฟิกต่างๆ ใน LDAP Server ได้สะดวกมากขึ้น</p>
<p>ในบทความนี้จะกล่าวถึงการติดตั้งโปรแกรมและคอนฟิก Fedora Directory Server เบื้องต้น เพื่อสร้างคอนฟิกของ directory พื้นฐานสำหรับการใช้งานต่อไป</p>
<p><span id="more-42"></span></p>
<p><strong>ส่วนประกอบของ Fedora Directory Server</strong></p>
<p>ในแกนหลักของโปรแกรมจะประกอบด้วย</p>
<ul>
<li><strong>Directory Server</strong>: ทำหน้าที่เป็น LDAP Server (เหมือนกับ OpenLDAP)</li>
<li><strong>Directory Server Console</strong>: เป็นโปรแกรมที่รันบน X Window เพื่อช่วยในการจัดการ ตั้งค่า คอนฟิกต่างๆ ของ Directory Server</li>
<li><strong>Administration Server</strong>: รันเป็น Web Server อยู่บน LDAP Server เพื่อรองรับการเชื่อมต่อจาก Directory Server Console ผู้ใช้งานสามาถใช้ Browser เรียกเข้าใช้งานได้เหมือนกันแต่คุณสมบัติต่างๆ ที่ใช้ได้จะน้อยกว่าการใช้งานจาก Directory Server Console</li>
</ul>
<p><strong>ระบบที่ทดสอบและเวอร์ชั่นของโปรแกรมที่ใช้</strong></p>
<ul>
<li>fedora 9</li>
<li>fedora-ds-1.1 (based on RedHat Directory Server 8.0)</li>
</ul>
<p><strong>การติดตั้งโปรแกรม</strong><br />
ตัวอย่างการติดตั้งไฟล์ rpm ที่จะต้องติดตั้งก่อนใช้งาน Fedora Directory Server บน Fedora 9 (x64)</p>
<ul>
<li>svrcore-4.0.4-2.fc9.x86_64.rpm</li>
<li>mozldap-6.0.5-2.fc9.x86_64.rpm</li>
<li>mozldap-tools-6.0.5-2.fc9.x86_64.rpm</li>
<li>perl-Mozilla-LDAP-1.5.2-4.fc9.1.x86_64.rpm</li>
<li>cyrus-sasl-gssapi-2.1.22-13.fc9.i386.rpm</li>
<li>lm_sensors-3.0.1-5.fc9.i386.rpm</li>
<li>net-snmp-libs-5.4.1-14.fc9.i386.rpm</li>
<li>fedora-ds-base-1.1.0.1-4.fc9.x86_64.rpm</li>
<li>mod_nss-1.0.7-5.fc9.x86_64.rpm</li>
<li>adminutil-1.1.6-1.fc9.x86_64.rpm</li>
<li>fedora-ds-admin-1.1.4-1.fc9.x86_64.rpm</li>
<li>fedora-ds-console-1.1.1-3.fc9.noarch.rpm</li>
<li>fedora-ds-dsgw-1.1.0-1.fc9.x86_64.rpm</li>
<li>fedora-ds-admin-console-1.1.1-3.fc9.noarch.rpm</li>
<li>jss-4.2.5-2.fc9.x86_64.rpm</li>
<li>ldapjdk-4.18-1.fc9.x86_64.rpm</li>
<li>idm-console-framework-1.1.1-1.fc8.noarch.rpm</li>
<li>fedora-idm-console-1.1.1-2.fc9.x86_64.rpm</li>
<li>fedora-ds-1.1.1-3.fc9.x86_64.rpm</li>
</ul>
<p><strong>เริ่มต้นคอนฟิก</strong></p>
<p>ไฟล์คอนฟิกหลักของโปรแกรมจะอยู่ใน /etc/dirsrv/  เริ่มต้นต้องใช้คำสั่ง setup-ds-admin.pl เพื่อช่วยในการเริ่มคอนฟิกได้</p>
<p>หมายเหตุ ในตัวอย่างด้านล่างนี้จะรันเพื่อสร้างคอนฟิกทดสอบเท่านั้น จะเห็นว่ามีการตรวจสอบคอนฟิกพื้นฐานของเครื่องอยู่ ซึ่งจะมีข้อความหรือคำเตือนฟ้องขึ้นมา ว่าไม่เหมาะกับการใช้งานในระดับ production<br />
ตัวอย่างการใช้คำสั่ง setup-ds-admin.pl เพื่อสร้างคอนฟิก directory ของโดเมน your-domain.com</p>
<pre>[root@server dirsrv]# <strong>setup-ds-admin.pl</strong></pre>
<pre>==============================================================================
This program will set up the Fedora Directory and Administration Servers.</pre>
<pre>It is recommended that you have "root" privilege to set up the software.
Tips for using this program:
  - Press "Enter" to choose the default and go to the next screen
  - Type "Control-B" then "Enter" to go back to the previous screen
  - Type "Control-C" to cancel the setup program</pre>
<pre>Would you like to continue with set up? [yes]: <strong>yes</strong></pre>
<pre>==============================================================================
BY SETTING UP AND USING THIS SOFTWARE YOU ARE CONSENTING TO BE BOUND BY
AND ARE BECOMING A PARTY TO THE AGREEMENT FOUND IN THE
LICENSE.TXT FILE. IF YOU DO NOT AGREE TO ALL OF THE TERMS
OF THIS AGREEMENT, PLEASE DO NOT SET UP OR USE THIS SOFTWARE.</pre>
<pre>Do you agree to the license terms? [no]: <strong>yes</strong></pre>
<pre>==============================================================================
Your system has been scanned for potential problems, missing patches,
etc.  The following output is a report of the items found that need to
be addressed before running this software in a production
environment.</pre>
<pre>Fedora Directory Server system tuning analysis version 10-AUGUST-2007.</pre>
<pre>NOTICE : System is i686-unknown-linux2.6.25-14.fc9.i686 (1 processor).</pre>
<pre>WARNING: 502MB of physical memory is available on the system. 1024MB is recommended for best performance on large production system.</pre>
<pre>NOTICE : The net.ipv4.tcp_keepalive_time is set to 7200000 milliseconds
(120 minutes).  This may cause temporary server congestion from lost
client connections.</pre>
<pre>WARNING: There are only 1024 file descriptors (hard limit) available, which
limit the number of simultaneous connections.</pre>
<pre>WARNING: There are only 1024 file descriptors (soft limit) available, which
limit the number of simultaneous connections.</pre>
<pre>Would you like to continue? [no]: <strong>yes</strong></pre>
<pre>==============================================================================
Choose a setup type:</pre>
<pre>   1. Express
       Allows you to quickly set up the servers using the most
       common options and pre-defined defaults. Useful for quick
       evaluation of the products.</pre>
<pre>   2. Typical
       Allows you to specify common defaults and options.</pre>
<pre>   3. Custom
       Allows you to specify more advanced options. This is
       recommended for experienced server administrators only.</pre>
<pre>To accept the default shown in brackets, press the Enter key.</pre>
<pre>Choose a setup type [2]: <strong>2</strong></pre>
<pre>==============================================================================
Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
&lt;hostname&gt;.&lt;domainname&gt;
Example: eros.example.com.</pre>
<pre>To accept the default shown in brackets, press the Enter key.</pre>
<pre>Computer name [server.your-domain.com]: <strong>server.your-domain.com</strong></pre>
<pre>==============================================================================
The servers must run as a specific user in a specific group.
It is strongly recommended that this user should have no privileges
on the computer (i.e. a non-root user).  The setup procedure
will give this user/group some permissions in specific paths/files
to perform server-specific operations.</pre>
<pre>If you have not yet created a user and group for the servers,
create this user and group using your native operating
system utilities.</pre>
<pre>System User [nobody]: <strong>nobody</strong>
System Group [nobody]: <strong>nobody</strong></pre>
<pre>==============================================================================
Server information is stored in the configuration directory server.
This information is used by the console and administration server to
configure and manage your servers.  If you have already set up a
configuration directory server, you should register any servers you
set up or create with the configuration server.  To do so, the
following information about the configuration server is required: the
fully qualified host name of the form
&lt;hostname&gt;.&lt;domainname&gt;(e.g. hostname.example.com), the port number
(default 389), the suffix, the DN and password of a user having
permission to write the configuration information, usually the
configuration directory administrator, and if you are using security
(TLS/SSL).  If you are using TLS/SSL, specify the TLS/SSL (LDAPS) port
number (default 636) instead of the regular LDAP port number, and
provide the CA certificate (in PEM/ASCII format).</pre>
<pre>If you do not yet have a configuration directory server, enter 'No' to
be prompted to set up one.</pre>
<pre>Do you want to register this software with an existing
configuration directory server? [no]: <strong>no</strong></pre>
<pre>==============================================================================
Please enter the administrator ID for the configuration directory
server.  This is the ID typically used to log in to the console.  You
will also be prompted for the password.</pre>
<pre>Configuration directory server
administrator ID [admin]:
Password:
Password (confirm):</pre>
<pre>==============================================================================
The information stored in the configuration directory server can be
separated into different Administration Domains.  If you are managing
multiple software releases at the same time, or managing information
about multiple domains, you may use the Administration Domain to keep
them separate.</pre>
<pre>If you are not using administrative domains, press Enter to select the
default.  Otherwise, enter some descriptive, unique name for the
administration domain, such as the name of the organization
responsible for managing the domain.</pre>
<pre>Administration Domain [your-domain.com]: <strong>your-domain.com</strong></pre>
<pre>==============================================================================
The standard directory server network port number is 389.  However, if
you are not logged as the superuser, or port 389 is in use, the
default value will be a random unused port number greater than 1024.
If you want to use port 389, make sure that you are logged in as the
superuser, that port 389 is not in use.</pre>
<pre>Directory server network port [389]: <strong>389</strong></pre>
<pre>==============================================================================
Each instance of a directory server requires a unique identifier.
This identifier is used to name the various
instance specific files and directories in the file system,
as well as for other uses as a server instance identifier.</pre>
<pre>Directory server identifier [server]: <strong>server</strong></pre>
<pre>==============================================================================
The suffix is the root of your directory tree.  The suffix must be a valid DN.
It is recommended that you use the dc=domaincomponent suffix convention.
For example, if your domain is example.com,
you should use dc=example,dc=com for your suffix.
Setup will create this initial suffix for you,
but you may have more than one suffix.
Use the directory server utilities to create additional suffixes.</pre>
<pre>Suffix [dc=your-domain, dc=com]: <strong>dc=your-domain, dc=com</strong></pre>
<pre>==============================================================================
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and typically has a
bind Distinguished Name (DN) of cn=Directory Manager.
You will also be prompted for the password for this user.  The password must
be at least 8 characters long, and contain no spaces.</pre>
<pre>Directory Manager DN [cn=Directory Manager]:
Password:
Password (confirm):</pre>
<pre>==============================================================================
The Administration Server is separate from any of your web or application
servers since it listens to a different port and access to it is
restricted.</pre>
<pre>Pick a port number between 1024 and 65535 to run your Administration
Server on. You should NOT use a port number which you plan to
run a web or application server on, rather, select a number which you
will remember and which will not be used for anything else.</pre>
<pre>Administration port [9830]:</pre>
<pre>==============================================================================
The interactive phase is complete.  The script will now set up your
servers.  Enter No or go Back if you want to change something.</pre>
<pre>Are you ready to set up your servers? [yes]: <strong>yes</strong>
Creating directory server . . .
Your new DS instance 'server' was successfully created.
Creating the configuration directory server . . .
Beginning Admin Server creation . . .
Creating Admin Server files and directories . . .
Updating adm.conf . . .
Updating admpw . . .
Registering admin server with the configuration directory server . . .
Updating adm.conf with information from configuration directory server . . .
Updating the configuration for the httpd engine . . .
Starting admin server . . .
The admin server was successfully started.
Admin server was successfully created, configured, and started.
Exiting . . .
Log file is '/tmp/setupqDGNPJ.log'</pre>
<pre>[root@server dirsrv]#</pre>
<p><strong></strong> </p>
<p><strong>คอนฟิก dsgw (Fedora Directory Server Gateway)</strong></p>
<p>ใน Fedora Directory จะมีโปรแกรมหนึ่งชื่อว่า dsgw ช่วยให้ผู้ใช้งานสามารถสร้างและแก้ไขข้อมูลของ user ใน Directory ผ่านเว็บได้</p>
<p>ใช้คำสั่ง setup-ds-dsgw เพื่อเพิ่ม dsgw เข้าไปในหน้าเว็บ Administration server ด้วย</p>
<pre>[root@server dsgw]# <strong>setup-ds-dsgw
</strong>######################################################################
This shell script will configure the Directory Server
Gateway, Phonebook and Org Chart web applications to
work with the Administration Server.</pre>
<pre>Reading parameters from Administration Server config . . .
Using Administration Server URL <a href="http://server.your-domain.com:9830">http://server.your-domain.com:9830</a> . . .
Reading parameters from Directory Server /etc/dirsrv/slapd-server . . .
Using Directory Server URL <a href="ldap://server.your-domain.com:389/dc=your-domain">ldap://server.your-domain.com:389/dc=your-domain</a>, dc=com . . .
Generating config file /etc/dirsrv/dsgw/dsgw.conf . . .
Generating config file /etc/dirsrv/dsgw/pb.conf . . .
Generating config file /etc/dirsrv/dsgw/orgchart.conf . . .
Generating config file /etc/dirsrv/dsgw/default.conf . . .
Generating the credential database directory . . .
Adding configuration to httpd config file /etc/dirsrv/admin-serv/httpd.conf . . .
Enabling links to web apps from Administration Server home page . . .
/usr/share/dirsrv/html/admserv_dsgw.html already exists - not copying . . .
/usr/share/dirsrv/html/admserv_phonebook.html already exists - not copying . . .
/usr/share/dirsrv/html/admserv_orgchart.html already exists - not copying . . .</pre>
<pre>The Directory Server Gateway web applications have been successfully configured.
You will need to restart your Administration Server.
######################################################################</pre>
<p> </p>
<p><strong>ตรวจสอบสถานะของ Directory Server</strong></p>
<p>1. ตรวจสอบ process<br />
ตัวอย่างด้านล่างจะแสดง process ที่รันขึ้นมาโดยอัตโนมัติจากการใช้คำสั่ง setup-ds-admin.pl</p>
<pre>[root@server dirsrv]# <strong>ps –ef
</strong>…
nobody   26774     1  2 20:09 ?        00:00:00 ./ns-slapd -D /etc/dirsrv/slapd-server -i /var/run/dirsrv/slapd-server.pid -w /v
root     26859     1  0 20:09 ?        00:00:00 /usr/sbin/httpd.worker -k start -f /etc/dirsrv/admin-serv/httpd.conf
root     26860 26859  0 20:09 ?        00:00:00 /usr/sbin/httpd.worker -k start -f /etc/dirsrv/admin-serv/httpd.conf
nobody   26861 26859  0 20:09 ?        00:00:00 /usr/sbin/httpd.worker -k start -f /etc/dirsrv/admin-serv/httpd.conf</pre>
<p> </p>
<p>2. ใช้โปรแกรม Directory Server Console<br />
เข้าไปใน X Window ใช้คำสั่ง fedora-idm-console แล้วใส่ User ID, Password, Administration URL ให้ถูกต้อง</p>
<p><a href="http://spalinux.com/wp-content/uploads/2008/06/fedora-idm-console-login.png"><img class="alignnone size-medium wp-image-43" title="fedora-idm-console-login" src="http://spalinux.com/wp-content/uploads/2008/06/fedora-idm-console-login-300x107.png" alt="" width="300" height="107" /></a></p>
<p>ตัวอย่างการใช้โปรแกรม Directory Server Console เพื่อควบคุมสถานะของ LDAP Server</p>
<p><a href="http://spalinux.com/wp-content/uploads/2008/06/fedora-idm-console-directory.png"><img class="alignnone size-medium wp-image-44" title="fedora-idm-console-directory" src="http://spalinux.com/wp-content/uploads/2008/06/fedora-idm-console-directory-300x202.png" alt="" width="300" height="202" /></a></p>
<p>3. ใช้ Browser<br />
อีกวิธีหนึ่งคือทดสอบใช้ browser ตรวจสอบสถานะ โดยอ้างอิงไปที่ ip ของ Directory Server และระบุพอร์ตเป็น 9830 เช่น http://192.168.1.1:9830/</p>
<p><strong><br />
ข้อมูลอ้างอิง</strong></p>
<ul>
<li><a title="Fedora Directory Server" href="http://directory.fedoraproject.org/" target="_blank">Fedora Directory Server (Open Source LDAP)</a></li>
<li><a title="RedHat Directory Server Documentation" href="http://www.redhat.com/docs/manuals/dir-server/ " target="_blank">Red Hat Directory Server Documentation</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/06/basic_install_configure_fedora_directory_server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

