<?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; Security</title>
	<atom:link href="http://spalinux.com/category/security/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>Resources for Relaxing Linux System Administrators</description>
	<lastBuildDate>Mon, 26 Jul 2010 09:51:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ปัญหาการใช้ SSH Public Key Authentication บน Solaris</title>
		<link>http://spalinux.com/2010/06/ssh_public_key_authentication_problem_on_solaris</link>
		<comments>http://spalinux.com/2010/06/ssh_public_key_authentication_problem_on_solaris#comments</comments>
		<pubDate>Sat, 05 Jun 2010 10:40:51 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[secure shell]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1110</guid>
		<description><![CDATA[พยายามคอนฟิก Public Key Authentication เพื่อ login เข้าสู่เครื่องที่ติดตั้ง Solaris อยู่นาน ก็ไม่สามารถทำได้ แต่ในที่สุดก็สามารถหาปัญหาได้ เลยมาแชร์ประสบการณ์เผื่อจะเป็นประโยชน์ ทดสอบปัญหา เริ่มต้นเพิ่ม user บนเครื่องที่ติดตั้ง Solaris 10 สมมติว่าชื่อ user1 [root@solaris ~]# useradd user1 [root@solaris ~]# id user1 uid=502(user1) gid=1(other) groups=1(other) แก้ไข home ของ user1 ให้อยู่ใน /export/home/ และสร้างไดเร็คทอรี [root@solaris ~]# cat /etc/passwd ... user1:x:502:1::/export/home/user1:/bin/sh [root@solaris ~]# cd /export/home [root@solaris home]# mkdir user1 [root@solaris home]# chown [...]]]></description>
			<content:encoded><![CDATA[<p>พยายามคอนฟิก Public Key Authentication เพื่อ login เข้าสู่เครื่องที่ติดตั้ง Solaris อยู่นาน ก็ไม่สามารถทำได้ แต่ในที่สุดก็สามารถหาปัญหาได้ เลยมาแชร์ประสบการณ์เผื่อจะเป็นประโยชน์</p>
<p><span id="more-1110"></span></p>
<h4>ทดสอบปัญหา</h4>
<p>เริ่มต้นเพิ่ม user บนเครื่องที่ติดตั้ง Solaris 10 สมมติว่าชื่อ user1</p>
<pre>[root@solaris ~]# <strong>useradd user1
</strong>[root@solaris ~]# <strong>id user1
</strong>uid=502(user1) gid=1(other) groups=1(other)</pre>
<p>แก้ไข home ของ user1 ให้อยู่ใน /export/home/ และสร้างไดเร็คทอรี</p>
<pre>[root@solaris ~]# <strong>cat /etc/passwd
</strong>...
user1:x:502:1::<span style="color: #0000ff;">/export/home/user1</span>:/bin/sh</pre>
<pre>[root@solaris ~]# <strong>cd /export/home
</strong>[root@solaris home]# <strong>mkdir user1
</strong>[root@solaris home]# <strong>chown user1 user1/
</strong>[root@solaris home]# <strong>su - user1
</strong>[user1@solaris ~]$ <strong>pwd
</strong>/export/home/user1</pre>
<p>ต้องการให้ admin1 จากเครื่องที่ติดตั้ง linux สามารถ ssh ด้วย public key authentication เป็น user1 บนเครื่อง Solaris ได้</p>
<p>สร้าง public, private key ของ admin1</p>
<pre>[admin1@linux ~]$ <strong>ssh-keygen -t rsa
</strong>Generating public/private rsa key pair.
Enter file in which to save the key (/home/admin1/.ssh/id_rsa):
Created directory '/home/admin1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin1/.ssh/id_rsa.
Your public key has been saved in /home/admin1/.ssh/id_rsa.pub.</pre>
<pre>[admin1@linux ~]$ <strong>cat .ssh/id_rsa.pub
</strong><span style="color: #0000ff;">ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtMbbgeFnn6vEo3IAVh... admin1@linux</span></pre>
<p>copy ไฟล์ id_rsa.pub ของ admin1 ไปใส่ไว้ในไฟล์ authorized_keys ของ user1 บนเครื่อง Solaris</p>
<pre>[user1@solaris ~]$ <strong>cat .ssh/authorized_keys
</strong><span style="color: #0000ff;">ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtMbbgeFnn6vEo3IAVh... admin1@linux</span></pre>
<p>ทดสอบ ssh จากเครื่อง linux</p>
<pre>[admin1@linux ~]$ <strong>ssh -l user1 solaris
</strong>The authenticity of host 'solaris (192.168.1.2)' can't be established.
RSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'solaris' (RSA) to the list of known hosts.
Password:</pre>
<p>ขึ้นให้ใส่ password ไม่สามารถ login ด้วย public key authentication ได้</p>
<h4>วิธีการแก้ไขปัญหา</h4>
<p>หลังจากพยายามอยู่นาน ก็พบว่า ssh จะตรวจสอบสถานะ password ของผู้ใช้ด้วย ซึ่งถ้าดูในไฟล์ /etc/shadow จะเห็นว่า user1 จะถูก lock อยู่</p>
<pre>[root@solaris ~]# <strong>cat /etc/shadow
</strong>...
user1:<span style="color: #ff0000;"><strong>*LK*</strong></span>:::::::</pre>
<p>ฟิลด์ที่สองในไฟล์ /etc/shadow คือ encrypted password คำอธิบายจาก man ของ shadow คือ</p>
<pre># <strong>man shadow
</strong>...
     password        An encrypted password for the user generated
                     by crypt(3C), a lock string to indicate that
                     the login is not accessible, or  no  string,
                     which  shows  that  there is no password for
                     the login.</pre>
<pre>                     The lock string is defined as <span style="color: #ff0000;"> *LK*</span>  in  the
                     first four characters of the password field.
...</pre>
<p>การแก้ไขคือ ลบตัวอักษร LK ออก เช่นให้เหลือแต่เครื่องหมาย *</p>
<pre>[root@solaris ~]# <strong>cat /etc/shadow
</strong>...
user1:<span style="color: #ff0000;">*</span>:::::::</pre>
<p>ทดสอบ ssh จากเครื่อง linux อีกครั้ง ก็จะได้ตามที่ต้องการ</p>
<pre>[admin1@linux ~]$ <strong>ssh -l user1 solaris
</strong>[user1@solaris ~]$</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2008/10/ssh_secure_shell_login_using_public_key_authentication">SSH – Secure Shell ล็อกอินด้วย Public Key Authentication</a></li>
<li><a href="http://forums.sun.com/thread.jspa?threadID=5229706" target="_blank">Sun Networking Services and Protocols &#8211; SSH PermitEmptyPasswords with PASSREQ</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2010/06/ssh_public_key_authentication_problem_on_solaris/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>คอนฟิก Solaris IP Filter</title>
		<link>http://spalinux.com/2010/05/configure_solaris_ip_filter</link>
		<comments>http://spalinux.com/2010/05/configure_solaris_ip_filter#comments</comments>
		<pubDate>Sat, 22 May 2010 08:46:27 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[ip filter]]></category>
		<category><![CDATA[solaris 10]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=1104</guid>
		<description><![CDATA[บทความนี้กล่าวถึงวิธีการใช้คำสั่ง ipf เพื่อสร้าง rule ของ Solaris IP Filter แบบง่ายๆ เพื่อใช้กำหนด packet เข้าออกเครื่อง Solaris IP Filter เป็นโปรแกรม Firewall ที่ควบคุม packet เข้า/ออก เครื่องที่ติดตั้ง Solaris ได้ ipf เป็นคำสั่งที่ใช้ในการแก้ไขกฎ (rule) ของ Solaris IP Filter หมายเหตุ ตัวอย่างในบทความนี้ทดสอบบนเครื่องที่ติดตั้ง Solaris 10 10/09 s10x_u8wos_08a X86 ทดสอบกับเครื่องที่สามารถคอนโซลหน้าจอได้เท่านั้น เพราะถ้าคอนฟิก rule ของ Firewall ผิดพลาด อาจทำให้คุณไม่สามารถ remote เช่น Secure Shell ได้ 1. เปิด (Start) เซอร์วิส ipfilter โดยดีฟอลต์จากการติดตั้ง [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้กล่าวถึงวิธีการใช้คำสั่ง ipf เพื่อสร้าง rule ของ Solaris IP Filter แบบง่ายๆ เพื่อใช้กำหนด packet เข้าออกเครื่อง</p>
<p><span id="more-1104"></span></p>
<p>Solaris IP Filter เป็นโปรแกรม Firewall ที่ควบคุม packet เข้า/ออก เครื่องที่ติดตั้ง Solaris ได้</p>
<p>ipf เป็นคำสั่งที่ใช้ในการแก้ไขกฎ (rule) ของ Solaris IP Filter</p>
<p>หมายเหตุ</p>
<ul>
<li>ตัวอย่างในบทความนี้ทดสอบบนเครื่องที่ติดตั้ง Solaris 10 10/09 s10x_u8wos_08a X86</li>
<li>ทดสอบกับเครื่องที่สามารถคอนโซลหน้าจอได้เท่านั้น เพราะถ้าคอนฟิก rule ของ Firewall ผิดพลาด อาจทำให้คุณไม่สามารถ remote เช่น Secure Shell ได้</li>
</ul>
<h4>1. เปิด (Start) เซอร์วิส ipfilter</h4>
<p>โดยดีฟอลต์จากการติดตั้ง เซอร์วิส IP Filter จะถูกปิดการใช้งาน</p>
<p>ใช้คำสั่ง svcs ตรวจสอบสถานะ</p>
<pre># <strong>svcs -av | grep ipfilter
</strong>disabled       -             15:25:36      - svc:/network/ipfilter:default</pre>
<p>ใช้คำสั่ง svcadm เพื่อเปิดการเซอร์วิส</p>
<pre># <strong>svcadm enable ipfilter</strong></pre>
<pre># <strong>svcs -av | grep ipfilter
</strong>online         -             15:27:14      - svc:/network/ipfilter:default</pre>
<h4>2. เปิดคุณสมบัติ (Enable) IP Filter</h4>
<p>ขั้นต่อมา ใช้คำสั่ง ipf -E เพื่อเปิดคุณสมบัติ IP Filter</p>
<pre># <strong>ipf -E</strong></pre>
<h4>3. ทดลองการสร้าง rule แบบง่ายๆ</h4>
<p>สร้างไฟล์ /etc/ipf/ipf.conf เพื่อกำหนด rule ที่ต้องการ</p>
<p>ตัวอย่างเช่น ต้องการสร้าง rule เพื่อกำหนดให้เฉพาะเครื่องที่มี IP 192.168.1.2 เท่านั้นที่สามารถ ping (ICMP) เข้ามาที่เครื่องทางพอร์ต e1000g0 ได้</p>
<pre># <strong>cat /etc/ipf/ipf.conf</strong></pre>
<pre>block in on e1000g0 proto icmp from any to any
pass in on e1000g0 proto icmp from 192.168.1.2/32 to any</pre>
<p>หลังจากสร้างไฟล์เรียบร้อย พิมพ์คำสั่ง ipf -f ตามด้วยไฟล์ ipf.conf เพื่อเริ่มการบังคับใช้ rule ที่สร้างขึ้น</p>
<pre># <strong>ipf -f /etc/ipf/ipf.conf</strong></pre>
<p>*** 4. ลบ (Flush) rule ออกไป ***</p>
<p>หากต้องการยกเลิก rule ที่สร้างขึ้น ใช้คำสั่ง ipf -F เพื่อ ลบ (flush) rule ที่มีออกไป</p>
<pre># <strong>ipf -F a</strong></pre>
<h4>5. ปิดคุณสมบัติ (Disable) IP Filter</h4>
<p>ใช้คำสั่ง ipf -D เพื่อปิดคุณสมบัติ IP Filter</p>
<pre># <strong>ipf -D</strong></pre>
<h4>ตัวอย่าง rule</h4>
<p>มีตัวอย่างการสร้างไฟล์ ipf.conf เพื่อกำหนด rule แบบต่างๆ /usr/share/ipfilter/examples/</p>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li>man ipf</li>
<li><a href="http://docs.sun.com/app/docs/doc/816-4554/eupsq?l=en&amp;a=view" target="_blank">System Administration Guide: Solaris IP Filter (Overview)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2010/05/configure_solaris_ip_filter/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ติดตั้งและทดสอบ FreeRADIUS เบื้องต้น</title>
		<link>http://spalinux.com/2009/11/basic_install_freeradius</link>
		<comments>http://spalinux.com/2009/11/basic_install_freeradius#comments</comments>
		<pubDate>Sat, 28 Nov 2009 07:44:09 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Authentication]]></category>
		<category><![CDATA[RADIUS]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=974</guid>
		<description><![CDATA[FreeRADIUS เป็นโปรแกรมที่ทำหน้าที่ RADIUS แบบฟรี ที่คนใช้งานกันมากที่สุด โดยมีคุณสมบัติเทียบเท่ากับ commercial RADIUS หลายๆ ตัว บทความนี้จะกล่าวถึงวิธีการติดตั้ง และทดสอบ FreeRADIUS ในเบื้องต้น เพื่อจะสามารถต่อยอด และคอนฟิกอื่นๆ เพิ่มเติมได้ ติดตั้งไฟล์ rpm ในที่นี้จะทดสอบบน Fedora 11 (x86_64) โดยใช้ไฟล์ rpm ในส่วน updates เพื่อติดตั้งและใช้งาน ใช้คำสั่ง rpm เพื่อติดตั้งไฟล์ ต่างๆ ดังนี้ [root@fc11-64a ~]# rpm -i freeradius-libs-2.1.7-1.fc11.x86_64.rpm [root@fc11-64a ~]# rpm -i freeradius-2.1.7-1.fc11.x86_64.rpm [root@fc11-64a ~]# rpm -i freeradius-utils-2.1.7-1.fc11.x86_64.rpm หมายเหตุ การติดตั้ง freeradius-utils จำเป็นต้องมี perl(DBI) ติดตั้งอยู่ก่อนแล้ว ตัวอย่าง [...]]]></description>
			<content:encoded><![CDATA[<p>FreeRADIUS เป็นโปรแกรมที่ทำหน้าที่ RADIUS แบบฟรี ที่คนใช้งานกันมากที่สุด โดยมีคุณสมบัติเทียบเท่ากับ commercial RADIUS หลายๆ ตัว</p>
<p>บทความนี้จะกล่าวถึงวิธีการติดตั้ง และทดสอบ FreeRADIUS ในเบื้องต้น เพื่อจะสามารถต่อยอด และคอนฟิกอื่นๆ เพิ่มเติมได้</p>
<h4><span id="more-974"></span><br />
ติดตั้งไฟล์ rpm</h4>
<p>ในที่นี้จะทดสอบบน Fedora 11 (x86_64) โดยใช้ไฟล์ rpm ในส่วน updates เพื่อติดตั้งและใช้งาน</p>
<p>ใช้คำสั่ง rpm เพื่อติดตั้งไฟล์ ต่างๆ ดังนี้</p>
<pre>[root@fc11-64a ~]# <strong>rpm -i freeradius-libs-2.1.7-1.fc11.x86_64.rpm
</strong>[root@fc11-64a ~]# <strong>rpm -i freeradius-2.1.7-1.fc11.x86_64.rpm
</strong>[root@fc11-64a ~]# <strong>rpm -i freeradius-utils-2.1.7-1.fc11.x86_64.rpm</strong></pre>
<p>หมายเหตุ การติดตั้ง freeradius-utils จำเป็นต้องมี perl(DBI) ติดตั้งอยู่ก่อนแล้ว</p>
<p>ตัวอย่าง error หากไม่มี perl(DBI) ติดตั้งอยู่</p>
<pre>[root@fc11-64a ~]# <strong>rpm -i freeradius-utils-2.1.7-1.fc11.x86_64.rpm
</strong>error: Failed dependencies:
        perl(DBI) is needed by freeradius-utils-2.1.7-1.fc11.x86_64</pre>
<p>วิธีการแก้ไขปัญหา</p>
<pre>[root@fc11-64a ~]# <strong>rpm -i perl-DBI-1.607-2.fc11.x86_64.rpm</strong></pre>
<h4>รันเซอร์วิส radiusd</h4>
<p>หลังจากการติดตั้ง ใช้คำสั่ง service เพื่อรันเซอร์วิส radiusd</p>
<pre>[root@fc11-64a ~]# <strong>service radiusd start
</strong>Starting RADIUS server:                                    [<strong><span style="color: #ff0000;">FAILED</span></strong>]</pre>
<p>หากยังไม่แก้ไขไฟล์คอนฟิกเลย จะไม่สามารถรันเซอร์วิส radiusd ได้ ขึ้น [FAILED]</p>
<p>เมื่อเกิดปัญหาในการใช้งาน radiusd ไฟล์หนึ่งที่สามารถตรวจสอบปัญหาได้คือไฟล์ /var/log/radius/radius.log</p>
<pre>[root@fc11-64a ~]# <strong>tail /var/log/radius/radius.log
</strong>Sat Nov 28 12:15:09 2009 : Error: rlm_eap: SSL error error:02001002:system library:fopen:<span style="color: #ff0000;">No such file or directory
</span>Sat Nov 28 12:15:09 2009 : Error: rlm_eap_tls: <span style="color: #ff0000;">Error reading certificate file /etc/raddb/certs/server.pem
</span>Sat Nov 28 12:15:09 2009 : Error: rlm_eap: Failed to initialize type tls
Sat Nov 28 12:15:09 2009 : Error: /etc/raddb/eap.conf[17]: Instantiation failed for module "eap"
Sat Nov 28 12:15:09 2009 : Error: /etc/raddb/sites-enabled/inner-tunnel[223]: Failed to find module "eap".
Sat Nov 28 12:15:09 2009 : Error: /etc/raddb/sites-enabled/inner-tunnel[176]: Errors parsing authenticate section.
Sat Nov 28 12:15:09 2009 : Error: Failed to load virtual server inner-tunnel</pre>
<p>ปัญหานี้คือไม่มีไฟล์ /etc/raddb/certs/server.pem ซึ่งเป็น certificate สำหรับการทำ EAP</p>
<p>วิธีการแก้ไขคือสร้างไฟล์ server.pem โดยเข้าไปในไดเร็คทอรี /etc/raddb/certs/ แล้วรันคำสั่ง bootstrap ซึ่งจะสร้างไฟล์ certificate ขึ้นมา</p>
<p>หมายเหตุ เพื่อความง่าย ในที่นี้จะสร้าง certificate ไฟล์ เพื่อทดสอบการใช้งาน radiusd เท่านั้น ในการใช้งานจริงก่อนที่จะสร้าง ควรจะแก้ไขคอนฟิก เพื่อระบุ Certificate Details เพื่อแสดงชื่อหน่วยงานให้ถูกต้อง</p>
<pre>[root@fc11-64a ~]# c<strong>d /etc/raddb/certs/
</strong>[root@fc11-64a certs]# <strong>./bootstrap
</strong>openssl dhparam -out dh 1024
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
.................+......................................................................................................+...+.........+.....+.......................+...................................................................................................+......................................+........................................................................................................+.................................................................+....................+...................................................................................+...................+.......................................+............................................................................+..........................................+.............+....................................+..............................................+...+.....................+...+.....+...............+.............................+..................+...................................................+.....+.................+............................................+.......+................................................................................................+....+.....+............................................................................................................................................................................................................................................+......................+........................................................................................................................................................................................................................................+............+............................+..................+.............................................................................................................................+.....................................................++*++*++*
openssl req -new  -out server.csr -keyout server.key -config ./server.cnf
Generating a 2048 bit RSA private key
.......................+++
.....+++
writing new private key to 'server.key'
-----
openssl req -new -x509 -keyout ca.key -out ca.pem \
                -days `grep default_days ca.cnf | sed 's/.*=//;s/^ *//'` -config ./ca.cnf
Generating a 2048 bit RSA private key
....................................+++
........+++
writing new private key to 'ca.key'
-----
openssl ca -batch -keyfile ca.key -cert ca.pem -in server.csr  -key `grep output_password ca.cnf | sed 's/.*=//;s/^ *//'` -out server.crt -extensions xpserver_ext -extfile xpextensions -config ./server.cnf
Using configuration from ./server.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 1 (0x1)
        Validity
            Not Before: Nov 28 05:20:32 2009 GMT
            Not After : Nov 28 05:20:32 2010 GMT
        Subject:
            countryName               = FR
            stateOrProvinceName       = Radius
            organizationName          = Example Inc.
            commonName                = Example Server Certificate
            emailAddress              = admin@example.com
        X509v3 extensions:
            X509v3 Extended Key Usage:
                TLS Web Server Authentication
Certificate is to be certified until Nov 28 05:20:32 2010 GMT (365 days)</pre>
<pre>Write out database with 1 new entries
Data Base Updated
openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12  -passin pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` -passout pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'`
openssl pkcs12 -in server.p12 -out <span style="color: #3366ff;">server.pem </span>-passin pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'` -passout pass:`grep output_password server.cnf | sed 's/.*=//;s/^ *//'`
MAC verified OK
openssl x509 -inform PEM -outform DER -in ca.pem -out ca.der</pre>
<p>หลังจากสร้างแล้ว ใช้คำสั่ง service เพื่อรันเซอร์วิส radiusd อีกครั้ง</p>
<pre>[root@fc11-64a certs]# <strong>service radiusd start
</strong>Starting RADIUS server:                                    [<span style="color: #ff0000;">FAILED</span>]</pre>
<p>รันครั้งนี้ ก็ยัง [FAILED] อยู่ ถ้าตรวจสอบดูไฟล์ radius.log มีข้อความ &#8220;Permission denied&#8221; ขึ้น ซึ่งหมายถึง radiusd ไม่สามารถอ่านไฟล์ server.pem ได้</p>
<pre>[root@fc11-64a ~]# <strong>tail /var/log/radius/radius.log
</strong>...
Sat Nov 28 12:21:38 2009 : Error: rlm_eap: SSL error error:0200100D:system library:fopen:<span style="color: #ff0000;">Permission denied
</span>Sat Nov 28 12:21:38 2009 : Error: rlm_eap_tls: <span style="color: #ff0000;">Error reading certificate file /etc/raddb/certs/server.pem
</span>Sat Nov 28 12:21:38 2009 : Error: rlm_eap: Failed to initialize type tls
Sat Nov 28 12:21:38 2009 : Error: /etc/raddb/eap.conf[17]: Instantiation failed for module "eap"
Sat Nov 28 12:21:38 2009 : Error: /etc/raddb/sites-enabled/inner-tunnel[223]: Failed to find module "eap".
Sat Nov 28 12:21:38 2009 : Error: /etc/raddb/sites-enabled/inner-tunnel[176]: Errors parsing authenticate section.
Sat Nov 28 12:21:38 2009 : Error: Failed to load virtual server inner-tunnel</pre>
<p>ปัญหานี้เกิดจากเราใช้ root เพื่อรันคำสั่ง bootstrap แล้วไฟล์ที่ถูกสร้างขึ้น owner, group จะเป็น root ทั้งหมด แต่ radiusd รันภายใต้ owner, group ที่ชื่อ radiusd ทำให้ไม่สามารถอ่านไฟล์ ที่ root สร้างขึ้นได้</p>
<p>ใช้คำสั่ง ls เพื่อตรวจสอบไฟล์ที่ root สร้างขึ้น</p>
<pre>[root@fc11-64a certs]# <strong>ls -lrt
</strong>total 108
-rw-r----- 1 root radiusd  578 2009-09-15 22:29 xpextensions
-rw-r----- 1 root radiusd 1123 2009-09-15 22:29 server.cnf
-rw-r----- 1 root radiusd 7819 2009-09-15 22:29 README
-rw-r----- 1 root radiusd 4302 2009-09-15 22:29 Makefile
-rw-r----- 1 root radiusd 1109 2009-09-15 22:29 client.cnf
-rw-r----- 1 root radiusd 1288 2009-09-15 22:29 ca.cnf
-rwxr-x--- 1 root radiusd 2072 2009-09-15 22:29 bootstrap
-rw-r----- 1 root root     245 2009-11-28 12:20 dh
-rw-r----- 1 root root    5120 2009-11-28 12:20 random
-rw-r----- 1 root root    1751 2009-11-28 12:20 server.key
-rw-r----- 1 root root    1062 2009-11-28 12:20 server.csr
-rw-r----- 1 root root    1743 2009-11-28 12:20 ca.key
-rw-r----- 1 root root    1675 2009-11-28 12:20 ca.pem
-rw-r----- 1 root root       0 2009-11-28 12:20 index.txt.old
-rw-r----- 1 root root       3 2009-11-28 12:20 serial.old
-rw-r----- 1 root root       3 2009-11-28 12:20 serial
-rw-r----- 1 root root      21 2009-11-28 12:20 index.txt.attr
-rw-r----- 1 root root     120 2009-11-28 12:20 index.txt
-rw-r----- 1 root root    4210 2009-11-28 12:20 server.crt
-rw-r----- 1 root root    4210 2009-11-28 12:20 01.pem
-rw-r----- 1 root root    2533 2009-11-28 12:20 server.p12
<span style="color: #ff0000;">-rw-r----- 1 root root    3503 2009-11-28 12:20 server.pem
</span>-rw-r----- 1 root root    1195 2009-11-28 12:20 ca.der</pre>
<p>การแก้ไขปัญหา ทำได้โดยการเปลี่ยน permission ของไฟล์ เพื่อให้ radiusd สามารถอ่านไฟล์ได้ ในที่นี้เปลี่ยนแค่ group ของไฟล์ก็เพียงพอแล้ว และเพื่อความปลอดภัยของระบบด้วย</p>
<p>ใช้คำสั่ง chgrp เพื่อเปลี่ยน group ของไฟล์</p>
<pre>[root@fc11-64a certs]# <strong>chgrp radiusd *
</strong>[root@fc11-64a certs]# <strong>ls -lrt
</strong>total 108
-rw-r----- 1 root radiusd  578 2009-09-15 22:29 xpextensions
-rw-r----- 1 root radiusd 1123 2009-09-15 22:29 server.cnf
-rw-r----- 1 root radiusd 7819 2009-09-15 22:29 README
-rw-r----- 1 root radiusd 4302 2009-09-15 22:29 Makefile
-rw-r----- 1 root radiusd 1109 2009-09-15 22:29 client.cnf
-rw-r----- 1 root radiusd 1288 2009-09-15 22:29 ca.cnf
-rwxr-x--- 1 root radiusd 2072 2009-09-15 22:29 bootstrap
-rw-r----- 1 root radiusd  245 2009-11-28 12:20 dh
-rw-r----- 1 root radiusd 5120 2009-11-28 12:20 random
-rw-r----- 1 root radiusd 1751 2009-11-28 12:20 server.key
-rw-r----- 1 root radiusd 1062 2009-11-28 12:20 server.csr
-rw-r----- 1 root radiusd 1743 2009-11-28 12:20 ca.key
-rw-r----- 1 root radiusd 1675 2009-11-28 12:20 ca.pem
-rw-r----- 1 root radiusd    0 2009-11-28 12:20 index.txt.old
-rw-r----- 1 root radiusd    3 2009-11-28 12:20 serial.old
-rw-r----- 1 root radiusd    3 2009-11-28 12:20 serial
-rw-r----- 1 root radiusd   21 2009-11-28 12:20 index.txt.attr
-rw-r----- 1 root radiusd  120 2009-11-28 12:20 index.txt
-rw-r----- 1 root radiusd 4210 2009-11-28 12:20 server.crt
-rw-r----- 1 root radiusd 4210 2009-11-28 12:20 01.pem
-rw-r----- 1 root radiusd 2533 2009-11-28 12:20 server.p12
<span style="color: #0000ff;">-rw-r----- 1 root radiusd 3503 2009-11-28 12:20 server.pem
</span>-rw-r----- 1 root radiusd 1195 2009-11-28 12:20 ca.der</pre>
<p>ใช้คำสั่ง service เพื่อรันเซอร์วิส radiusd อีกครั้ง</p>
<pre>[root@fc11-64a certs]# <strong>service radiusd start
</strong>Starting RADIUS server:                                    [  OK  ]</pre>
<p>ครั้งนี้จะสามารถรันได้ [ OK ] หากดูในไฟล์ radius.log จะมีข้อความดังนี้เกิดขึ้น</p>
<pre>[root@fc11-64a ~]# <strong>tail /var/log/radius/radius.log
</strong>...
Sat Nov 28 12:23:10 2009 : Info: Loaded virtual server inner-tunnel
Sat Nov 28 12:23:11 2009 : Info: Loaded virtual server &lt;default&gt;
Sat Nov 28 12:23:11 2009 : Info: Ready to process requests.</pre>
<p>ใช้คำสั่ง ps เพื่อ ตรวจสอบ process ของ radiusd</p>
<pre>[root@fc11-64a certs]# <strong>ps -ef | grep radiusd
</strong>radiusd   1772     1  0 12:23 ?        00:00:00 /usr/sbin/radiusd
root      1783  1393  0 12:23 pts/0    00:00:00 grep radiusd</pre>
<p>ใช้คำสั่ง netstat เพื่อตรวจสอบพอร์ตของ radiusd ที่ใช้</p>
<pre>[root@fc11-64a raddb]# <strong>netstat -a | grep udp
</strong>...
udp        0      0 *:radius                    *:*
udp        0      0 *:radius-acct               *:*
udp        0      0 *:tdp-suite                 *:*</pre>
<p>โดยดีฟอลต์ของ FreeRADIUS จะใช้พอร์ต UDP 1812, 1813, 1814 ในการทำงาน</p>
<p>ดูการ map ชื่อพอร์ตและเลขหมายของพอร์ตในไฟล์ /etc/services</p>
<pre>[root@fc11-64a ~]# <strong>cat /etc/services
</strong>...
radius          1812/udp                        # Radius
radius-acct     1813/udp        radacct         # Radius Accounting
tdp-suite       1814/udp                # TDP Suite</pre>
<h4>ทดสอบด้วย radtest</h4>
<p>จากการติดตั้ง freeradius-utils จะมีโปรแกรม radius client มาให้ด้วย คำสั่งหนึ่งที่ใช้ในการทดสอบอย่างง่ายๆ คือ radtest</p>
<pre>[root@fc11-64a ~]# <strong>radtest</strong>
Usage: radtest user passwd radius-server[:port] nas-port-number secret [ppphint] [nasname]</pre>
<p>พารามิเตอร์ที่ต้องระบุในการใช้คำสั่ง radtest คือ</p>
<ul>
<li>user                              ชื่อ username ที่ต้องการ authenticate</li>
<li>passwd                        รหัสผ่าน password สำหรับ username</li>
<li>radius-server            เป็น IP Address ของเครื่องที่รัน radiusd ทำหน้าที่เป็น RADIUS Server</li>
<li>nas-port-number    ระบุหมายเลขพอร์ต สำหรับการทดสอบจะใช้เป็นตัวเลขอะไรก็ได้</li>
<li>secret                           เป็น shared secret เพื่อต้องระบุใน RADIUS Server เพื่อเป็นการอนุญาตว่า เครื่อง RADIUS Client ใดสามารถมา authenticate ได้บ้าง</li>
</ul>
<p>ทดสอบการส่ง user, password ไปยัง radius server ที่ติดตั้ง ในที่นนี้ทดสอบบนเครื่องเดียวกัน ระบุเป็น 127.0.0.1</p>
<pre>[root@fc11-64a ~]# <strong>radtest user1 password1 127.0.0.1 1 secret1
</strong>Sending Access-Request of id 207 to 127.0.0.1 port 1812
        User-Name = "user1"
        User-Password = "password1"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: <strong><span style="color: #ff0000;">Access-Reject</span></strong> packet from host 127.0.0.1 port 1812, id=207, length=20
rad_verify: Received Access-Reject packet from client 127.0.0.1 port 1812 with invalid signature (err=2)!  (<span style="color: #ff0000;">Shared secret is incorrect.</span>)
Sending Access-Request of id 207 to 127.0.0.1 port 1812
        User-Name = "user1"
        User-Password = "password1"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: Access-Reject packet from host 127.0.0.1 port 1812, id=207, length=20
rad_verify: Received Access-Reject packet from client 127.0.0.1 port 1812 with invalid signature (err=2)!  (Shared secret is incorrect.)
Sending Access-Request of id 207 to 127.0.0.1 port 1812
        User-Name = "user1"
        User-Password = "password1"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: Access-Reject packet from host 127.0.0.1 port 1812, id=207, length=20
rad_verify: Received Access-Reject packet from client 127.0.0.1 port 1812 with invalid signature (err=2)!  (Shared secret is incorrect.)
radclient: no response from server for ID 207 socket 3</pre>
<p>ผลจากการรันคำสั่ง radtest จะฟ้อง &#8220;Access-Reject&#8221; เนื่องจาก &#8220;Shared secret is incorrect&#8221;</p>
<p>การแก้ไข คือต้องระบุ shared secret ให้ถูกต้อง</p>
<p>ในไฟล์ /etc/raddb/clients.conf จะมีคอนฟิกระบุ เครื่อง client ที่สามารถส่งข้อมูลมา authenticate ได้ แต่ต้องระบุ shared secret ให้ถูกต้อง</p>
<p>หากตัดส่วน comment &#8221;#&#8221; ออก ดีฟอลต์จากการติดตั้ง จะมีคอนฟิกสำหรับเครื่อง localhost ดังนี้</p>
<pre>client localhost {
    ipaddr = 127.0.0.1
    secret      = testing123
    require_message_authenticator = no
    nastype     = other
}</pre>
<p>จากคอนฟิก แปลว่าหากมีการส่ง request จากเครื่อง localhost หรือ 127.0.01 ต้องระบุ shared secret เป็น testing123 จึงจะใช้ server ได้</p>
<p>ทดสอบคำสั่ง radtest ด้วย shared secret ที่ถูกต้อง</p>
<pre>[root@fc11-64a ~]# <strong>radtest user1 password1 127.0.0.1 1 testing123
</strong>Sending Access-Request of id 58 to 127.0.0.1 port 1812
        User-Name = "user1"
        User-Password = "password1"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: <span style="color: #ff0000;">Access-Reject packet</span> from host 127.0.0.1 port 1812, id=58, length=20</pre>
<p>ผลการรันยังคงได้เป็น &#8220;Access-Reject&#8221; อยู่ เนื่องจาก ไม่มี username ที่ใช้ใน Server</p>
<p>ดีฟอลต์คอนฟิกเบื้องต้น จะเก็บไฟล์ username, password ไว้ในไฟล์ /etc/raddb/users โดยมีบรรทัดสุดท้ายอธิบายว่า ถ้าไม่ match หรือไม่มี username, password ที่คอนฟิกไว้ จะ denied การใช้งาน</p>
<p># On no match, the user is denied access.</p>
<p>แก้ไขไฟล์ /etc/raddb/users โดยเพิ่ม username, password ที่ต้องการ</p>
<pre>...
<span style="color: #0000ff;">user1  Cleartext-Password := "password1"
       Reply-Message = "Hello, %{User-Name}"</span></pre>
<pre># On no match, the user is denied access.</pre>
<p>ใช้คำสั่ง service เพื่อรีโหลดคอนฟิกของ radius ใหม่</p>
<pre>[root@fc11-64a ~]# <strong>service radiusd reload
</strong>Reloading RADIUS server:                                   [  OK  ]</pre>
<p>ทดสอบคำสั่ง radtest โดยระบุ user, password ที่ถูกต้องจากไฟล์ /etc/raddb/users จะได้รับ &#8220;Access-Accept&#8221;</p>
<pre>[root@fc11-64a raddb]# <strong>radtest user1 password1 127.0.0.1 1 testing123
</strong>Sending Access-Request of id 49 to 127.0.0.1 port 1812
        User-Name = "user1"
        User-Password = "password1"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: <strong><span style="color: #0000ff;">Access-Accept</span></strong> packet from host 127.0.0.1 port 1812, id=49, length=34
<span style="color: #0000ff;">        Reply-Message = "Hello, user1"</span></pre>
<p>ทดสอบด้วย user ที่มีอยู่ในไฟล์ /etc/raddb/users แต่ระบุ password ผิด จะได้รับ &#8220;Access-Reject&#8221; แต่จะได้ &#8220;Reply-Message&#8221; ของ username นั้น กลับมาด้วย</p>
<pre>[root@fc11-64a raddb]# <strong>radtest user1 password2 127.0.0.1 1 testing123
</strong>Sending Access-Request of id 76 to 127.0.0.1 port 1812
        User-Name = "user1"
        User-Password = "password2"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: <span style="color: #ff0000;"><strong>Access-Reject</strong></span> packet from host 127.0.0.1 port 1812, id=76, length=34
<span style="color: #0000ff;">        Reply-Message = "Hello, user1"</span></pre>
<p>ทดสอบด้วย user ที่ไม่มีอยู่ในไฟล์ /etc/raddb/users  จะได้รับ &#8220;Access-Reject&#8221;</p>
<pre>[root@fc11-64a raddb]# <strong>radtest user2 password2 127.0.0.1 1 testing123
</strong>Sending Access-Request of id 91 to 127.0.0.1 port 1812
        User-Name = "user2"
        User-Password = "password2"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: <span style="color: #ff0000;"><strong>Access-Reject </strong></span>packet from host 127.0.0.1 port 1812, id=91, length=20</pre>
<h4>รัน radiusd ในโหมด debug</h4>
<p>เมื่อเกิดปัญหาการคอนฟิกหรือการทำงานของ FreeRADIUS สิ่งหนึ่งที่ช่วยทำให้สามารถตรวจสอบรายละเอียดและแก้ไขปัญหาที่เกิดขึ้นได้ คือรัน radiusd ในโหมด debug ซึ่งหน้าจอจะแสดงขั้นตอนการทำงานของ radiusd อย่างละเอียด ทำให้เราสามารถทราบได้ว่า ปัญหาเกิดขึ้นที่จุดไหน</p>
<p>ใช้คำสั่ง service เพื่อหยุดรัน radiusd ในโหมดปกติ</p>
<pre>[root@fc11-64a ~]# <strong>service radiusd stop
</strong>Stopping RADIUS server:                                    [  OK  ]</pre>
<p>รันคำสั่ง radiusd ตามด้วย ออปชั่น &#8216;-X&#8217; เพื่อรันในโหมด debug หน้าจอจะแสดงรายละเอียดในการทำงานของ radiusd สังเกตว่าเมื่อรันโหมด debug จะไม่กลับคืนสู่ prompt</p>
<p>หากต้องการหยุดรันในโหมด debug สามารถทำได้โดยกด [Ctrl-C]</p>
<p>ตัวอย่างการรัน radiusd ในโหมด debug</p>
<pre>[root@fc11-64a ~]# <strong>radiusd -X
</strong>FreeRADIUS Version 2.1.7, for host x86_64-redhat-linux-gnu, built on Sep 15 2009 at 11:29:29
Copyright (C) 1999-2009 The FreeRADIUS server project and contributors.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
You may redistribute copies of FreeRADIUS under the terms of the
GNU General Public License v2.
Starting - reading configuration files ...
including configuration file /etc/raddb/radiusd.conf
including configuration file /etc/raddb/proxy.conf
including configuration file /etc/raddb/clients.conf
including files in directory /etc/raddb/modules/
including configuration file /etc/raddb/modules/acct_unique
including configuration file /etc/raddb/modules/always
including configuration file /etc/raddb/modules/attr_filter
including configuration file /etc/raddb/modules/attr_rewrite
including configuration file /etc/raddb/modules/chap
including configuration file /etc/raddb/modules/checkval
including configuration file /etc/raddb/modules/counter
including configuration file /etc/raddb/modules/cui
including configuration file /etc/raddb/modules/detail
including configuration file /etc/raddb/modules/detail.example.com
including configuration file /etc/raddb/modules/detail.log
including configuration file /etc/raddb/modules/digest
including configuration file /etc/raddb/modules/echo
including configuration file /etc/raddb/modules/etc_group
including configuration file /etc/raddb/modules/exec
including configuration file /etc/raddb/modules/expiration
including configuration file /etc/raddb/modules/expr
including configuration file /etc/raddb/modules/files
including configuration file /etc/raddb/modules/inner-eap
including configuration file /etc/raddb/modules/ippool
including configuration file /etc/raddb/modules/linelog
including configuration file /etc/raddb/modules/logintime
including configuration file /etc/raddb/modules/mac2ip
including configuration file /etc/raddb/modules/mac2vlan
including configuration file /etc/raddb/modules/mschap
including configuration file /etc/raddb/modules/otp
including configuration file /etc/raddb/modules/pam
including configuration file /etc/raddb/modules/pap
including configuration file /etc/raddb/modules/passwd
including configuration file /etc/raddb/modules/perl
including configuration file /etc/raddb/modules/policy
including configuration file /etc/raddb/modules/preprocess
including configuration file /etc/raddb/modules/radutmp
including configuration file /etc/raddb/modules/realm
including configuration file /etc/raddb/modules/smbpasswd
including configuration file /etc/raddb/modules/smsotp
including configuration file /etc/raddb/modules/sql_log
including configuration file /etc/raddb/modules/sqlcounter_expire_on_login
including configuration file /etc/raddb/modules/sradutmp
including configuration file /etc/raddb/modules/unix
including configuration file /etc/raddb/modules/wimax
including configuration file /etc/raddb/eap.conf
including configuration file /etc/raddb/policy.conf
including files in directory /etc/raddb/sites-enabled/
including configuration file /etc/raddb/sites-enabled/control-socket
including configuration file /etc/raddb/sites-enabled/default
including configuration file /etc/raddb/sites-enabled/inner-tunnel
group = radiusd
user = radiusd
including dictionary file /etc/raddb/dictionary
main {
        prefix = "/usr"
        localstatedir = "/var"
        logdir = "/var/log/radius"
        libdir = "/usr/lib64/freeradius"
        radacctdir = "/var/log/radius/radacct"
        hostname_lookups = no
        max_request_time = 30
        cleanup_delay = 5
        max_requests = 1024
        allow_core_dumps = no
        pidfile = "/var/run/radiusd/radiusd.pid"
        checkrad = "/usr/sbin/checkrad"
        debug_level = 0
        proxy_requests = yes
 log {
        stripped_names = no
        auth = no
        auth_badpass = no
        auth_goodpass = no
 }
 security {
        max_attributes = 200
        reject_delay = 1
        status_server = yes
 }
}
radiusd: #### Loading Realms and Home Servers ####
 proxy server {
        retry_delay = 5
        retry_count = 3
        default_fallback = no
        dead_time = 120
        wake_all_if_all_dead = no
 }
 home_server localhost {
        ipaddr = 127.0.0.1
        port = 1812
        type = "auth"
        secret = "testing123"
        response_window = 20
        max_outstanding = 65536
        require_message_authenticator = no
        zombie_period = 40
        status_check = "status-server"
        ping_interval = 30
        check_interval = 30
        num_answers_to_alive = 3
        num_pings_to_alive = 3
        revive_interval = 120
        status_check_timeout = 4
        irt = 2
        mrt = 16
        mrc = 5
        mrd = 30
 }
 home_server_pool my_auth_failover {
        type = fail-over
        home_server = localhost
 }
 realm example.com {
        auth_pool = my_auth_failover
 }
 realm LOCAL {
 }
radiusd: #### Loading Clients ####
 client localhost {
        ipaddr = 127.0.0.1
        require_message_authenticator = no
        secret = "testing123"
        nastype = "other"
 }
radiusd: #### Instantiating modules ####
 instantiate {
 Module: Linked to module rlm_exec
 Module: Instantiating exec
  exec {
        wait = no
        input_pairs = "request"
        shell_escape = yes
  }
 Module: Linked to module rlm_expr
 Module: Instantiating expr
 Module: Linked to module rlm_expiration
 Module: Instantiating expiration
  expiration {
        reply-message = "Password Has Expired  "
  }
 Module: Linked to module rlm_logintime
 Module: Instantiating logintime
  logintime {
        reply-message = "You are calling outside your allowed timespan  "
        minimum-timeout = 60
  }
 }
radiusd: #### Loading Virtual Servers ####
server inner-tunnel {
 modules {
 Module: Checking authenticate {...} for more modules to load
 Module: Linked to module rlm_pap
 Module: Instantiating pap
  pap {
        encryption_scheme = "auto"
        auto_header = no
  }
 Module: Linked to module rlm_chap
 Module: Instantiating chap
 Module: Linked to module rlm_mschap
 Module: Instantiating mschap
  mschap {
        use_mppe = yes
        require_encryption = no
        require_strong = no
        with_ntdomain_hack = no
  }
 Module: Linked to module rlm_unix
 Module: Instantiating unix
  unix {
        radwtmp = "/var/log/radius/radwtmp"
  }
 Module: Linked to module rlm_eap
 Module: Instantiating eap
  eap {
        default_eap_type = "md5"
        timer_expire = 60
        ignore_unknown_eap_types = no
        cisco_accounting_username_bug = no
        max_sessions = 2048
  }
 Module: Linked to sub-module rlm_eap_md5
 Module: Instantiating eap-md5
 Module: Linked to sub-module rlm_eap_leap
 Module: Instantiating eap-leap
 Module: Linked to sub-module rlm_eap_gtc
 Module: Instantiating eap-gtc
   gtc {
        challenge = "Password: "
        auth_type = "PAP"
   }
 Module: Linked to sub-module rlm_eap_tls
 Module: Instantiating eap-tls
   tls {
        rsa_key_exchange = no
        dh_key_exchange = yes
        rsa_key_length = 512
        dh_key_length = 512
        verify_depth = 0
        pem_file_type = yes
        private_key_file = "/etc/raddb/certs/server.pem"
        certificate_file = "/etc/raddb/certs/server.pem"
        CA_file = "/etc/raddb/certs/ca.pem"
        private_key_password = "whatever"
        dh_file = "/etc/raddb/certs/dh"
        random_file = "/etc/raddb/certs/random"
        fragment_size = 1024
        include_length = yes
        check_crl = no
        cipher_list = "DEFAULT"
        make_cert_command = "/etc/raddb/certs/bootstrap"
    cache {
        enable = no
        lifetime = 24
        max_entries = 255
    }
   }
 Module: Linked to sub-module rlm_eap_ttls
 Module: Instantiating eap-ttls
   ttls {
        default_eap_type = "md5"
        copy_request_to_tunnel = no
        use_tunneled_reply = no
        virtual_server = "inner-tunnel"
        include_length = yes
   }
 Module: Linked to sub-module rlm_eap_peap
 Module: Instantiating eap-peap
   peap {
        default_eap_type = "mschapv2"
        copy_request_to_tunnel = no
        use_tunneled_reply = no
        proxy_tunneled_request_as_eap = yes
        virtual_server = "inner-tunnel"
   }
 Module: Linked to sub-module rlm_eap_mschapv2
 Module: Instantiating eap-mschapv2
   mschapv2 {
        with_ntdomain_hack = no
   }
 Module: Checking authorize {...} for more modules to load
 Module: Linked to module rlm_realm
 Module: Instantiating suffix
  realm suffix {
        format = "suffix"
        delimiter = "@"
        ignore_default = no
        ignore_null = no
  }
 Module: Linked to module rlm_files
 Module: Instantiating files
  files {
        usersfile = "/etc/raddb/users"
        acctusersfile = "/etc/raddb/acct_users"
        preproxy_usersfile = "/etc/raddb/preproxy_users"
        compat = "no"
  }
 Module: Checking session {...} for more modules to load
 Module: Linked to module rlm_radutmp
 Module: Instantiating radutmp
  radutmp {
        filename = "/var/log/radius/radutmp"
        username = "%{User-Name}"
        case_sensitive = yes
        check_with_nas = yes
        perm = 384
        callerid = yes
  }
 Module: Checking post-proxy {...} for more modules to load
 Module: Checking post-auth {...} for more modules to load
 Module: Linked to module rlm_attr_filter
 Module: Instantiating attr_filter.access_reject
  attr_filter attr_filter.access_reject {
        attrsfile = "/etc/raddb/attrs.access_reject"
        key = "%{User-Name}"
  }
 } # modules
} # server
server {
 modules {
 Module: Checking authenticate {...} for more modules to load
 Module: Checking authorize {...} for more modules to load
 Module: Linked to module rlm_preprocess
 Module: Instantiating preprocess
  preprocess {
        huntgroups = "/etc/raddb/huntgroups"
        hints = "/etc/raddb/hints"
        with_ascend_hack = no
        ascend_channels_per_line = 23
        with_ntdomain_hack = no
        with_specialix_jetstream_hack = no
        with_cisco_vsa_hack = no
        with_alvarion_vsa_hack = no
  }
 Module: Checking preacct {...} for more modules to load
 Module: Linked to module rlm_acct_unique
 Module: Instantiating acct_unique
  acct_unique {
        key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port"
  }
 Module: Checking accounting {...} for more modules to load
 Module: Linked to module rlm_detail
 Module: Instantiating detail
  detail {
        detailfile = "/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d"
        header = "%t"
        detailperm = 384
        dirperm = 493
        locking = no
        log_packet_header = no
  }
 Module: Instantiating attr_filter.accounting_response
  attr_filter attr_filter.accounting_response {
        attrsfile = "/etc/raddb/attrs.accounting_response"
        key = "%{User-Name}"
  }
 Module: Checking session {...} for more modules to load
 Module: Checking post-proxy {...} for more modules to load
 Module: Checking post-auth {...} for more modules to load
 } # modules
} # server
radiusd: #### Opening IP addresses and Ports ####
listen {
        type = "auth"
        ipaddr = *
        port = 0
}
listen {
        type = "acct"
        ipaddr = *
        port = 0
}
listen {
        type = "control"
 listen {
        socket = "/var/run/radiusd/radiusd.sock"
 }
}
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on command file /var/run/radiusd/radiusd.sock
Listening on proxy address * port 1814
Ready to process requests.</pre>
<p>ตัวอย่างการรัน radtest และ ข้อความในหน้าจอโหมด debug ที่แสดง</p>
<pre>[root@fc11-64a raddb]# <strong>radtest user1 password1 127.0.0.1 1 testing123
</strong>Sending Access-Request of id 118 to 127.0.0.1 port 1812
        User-Name = "user1"
        User-Password = "password1"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=118, length=34
        Reply-Message = "Hello, user1"</pre>
<p>หน้าจอโหมด debug ที่แสดง พร้อมเน้นข้อความที่เกี่ยวข้องกับการทำงานของ radiusd เมื่อได้รับการ request จากการรันคำสั่ง radtest แบบคร่าวๆ</p>
<pre>rad_recv: <span style="color: #0000ff;">Access-Request </span>packet from host 127.0.0.1 port 53435, id=118, length=57
<span style="color: #0000ff;">        User-Name = "user1"
</span><span style="color: #0000ff;">        User-Password = "password1"
        NAS-IP-Address = 192.168.1.1
        NAS-Port = 1
</span>+- entering group authorize {...}
++[preprocess] returns ok
++[chap] returns noop
++[mschap] returns noop
[suffix] <span style="color: #0000ff;">No '@' in User-Name = "user1", looking up realm NULL
</span>[suffix] No such realm "NULL"
++[suffix] returns noop
[eap] <span style="color: #0000ff;">No EAP-Message, not doing EAP
</span>++[eap] returns noop
++[unix] returns notfound
[files] <span style="color: #0000ff;">users: Matched entry user1 at line 203
</span>[files]         <span style="color: #0000ff;">expand: Hello, %{User-Name} -&gt; Hello, user1
</span>++[files] <span style="color: #0000ff;">returns ok
</span>++[expiration] returns noop
++[logintime] returns noop
++[pap] returns updated
Found Auth-Type = PAP
+- entering group PAP {...}
[pap] login attempt with password "password1"
[pap] <span style="color: #0000ff;">Using clear text password "password1"
</span>[pap] <span style="color: #0000ff;">User authenticated successfully
</span>++[pap] <span style="color: #0000ff;">returns ok
</span>+- entering group post-auth {...}
++[exec] returns noop
<span style="color: #0000ff;">Sending Access-Accept of id 118 to 127.0.0.1 port 53435
        Reply-Message = "Hello, user1"
</span>Finished request 0.
Going to the next request
Waking up in 4.9 seconds.
Cleaning up request 0 ID 118 with timestamp +58
Ready to process requests.</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://freeradius.org/" target="_blank">FreeRADIUS: The world&#8217;s most popular RADIUS Server</a></li>
<li><a href="http://mirrors.kernel.org/fedora/updates/11/x86_64/" target="_blank">Fedora 11 x86_64 updates</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/11/basic_install_freeradius/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>แก้ไขคอนฟิก iptables firewall rule</title>
		<link>http://spalinux.com/2009/07/customize_iptables_firewall_rules</link>
		<comments>http://spalinux.com/2009/07/customize_iptables_firewall_rules#comments</comments>
		<pubDate>Sat, 18 Jul 2009 06:40:45 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=842</guid>
		<description><![CDATA[การติดตั้งลีนุกซ์ส่วนใหญ่รวมทั้ง fedora จะติดตั้ง และเปิดคุณสมบัติ firewall มาด้วย ซึ่งโดยดีฟอลต์แล้ว จะอนุญาตให้ packet ขาเข้า (INPUT) ได้เฉพาะ ping และ SSH เท่านั้น ลีนุกซ์จะใช้โปรแกรมที่ชื่อ iptables ทำหน้าที่เป็น firewall และใช้คำสั่งนี้ในการแสดงและแก้ไขคอนฟิก (rules) ของ firewall ตัวอย่างการใช้คำสั่ง iptables เพื่อแสดง rule [root@fc11-64min ~]# iptables -L -v Chain INPUT (policy ACCEPT 0 packets, 0 bytes)  pkts bytes target     prot opt in     out     source               destination    42  2148 ACCEPT     all  [...]]]></description>
			<content:encoded><![CDATA[<p>การติดตั้งลีนุกซ์ส่วนใหญ่รวมทั้ง fedora จะติดตั้ง และเปิดคุณสมบัติ firewall มาด้วย ซึ่งโดยดีฟอลต์แล้ว จะอนุญาตให้ packet ขาเข้า (INPUT) ได้เฉพาะ ping และ SSH เท่านั้น</p>
<p>ลีนุกซ์จะใช้โปรแกรมที่ชื่อ iptables ทำหน้าที่เป็น firewall และใช้คำสั่งนี้ในการแสดงและแก้ไขคอนฟิก (rules) ของ firewall</p>
<p><span id="more-842"></span></p>
<p>ตัวอย่างการใช้คำสั่ง iptables เพื่อแสดง rule</p>
<pre>[root@fc11-64min ~]# <strong>iptables -L -v
</strong>Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
   42  2148 ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED
<span style="color: #0000ff;">    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere
</span>    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere
<span style="color: #0000ff;">    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            state NEW tcp dpt:ssh
</span>    0     0 REJECT     all  --  any    any     anywhere             anywhere            reject-with icmp-host-prohibited</pre>
<pre>Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 REJECT     all  --  any    any     anywhere             anywhere            reject-with icmp-host-prohibited</pre>
<pre>Chain OUTPUT (policy ACCEPT 63 packets, 7412 bytes)
 pkts bytes target     prot opt in     out     source               destination</pre>
<p>ถ้าเราติดตั้งและคอนฟิกโปรแกรมเพิ่มเติมบนเครื่องนี้ เช่น ลงเว็บเซิร์ฟเวอร์ จะทำให้ไม่สามารถเรียกมาจากเครื่องอื่นๆ ได้ นอกจากต้องแก้ไขคอนฟิกของ firewalll ก่อน</p>
<p>บน Fedora จะมี script ชื่อ system-config-firewall-tui ช่วยในการคอนฟิกของ iptables เช่น ถ้าต้องการอนุญาตให้ เครื่องอื่นสามารถเรียกเว็บเซิร์ฟเวอร์ที่รันพอร์ตดีฟอลต์ http (TCP 80) ได้ ต้องแก้ไขดังนี้</p>
<pre>[root@fc11-64min ~]# <strong>system-config-firewall-tui</strong></pre>
<pre>                                      ┌────────────┤ Firewall Configuration ├────────────┐
                                      │                                                  │
                                      │ A firewall protects against unauthorized         │
                                      │ network intrusions. Enabling a firewall blocks   │
                                      │ all incoming connections. Disabling a firewall   │
                                      │ allows all connections and is not recommended.   │
                                      │                                                  │
                                      │              Firewall: [*] Enabled               │
                                      │                                                  │
                                      │    ┌────┐      ┌───────────┐      ┌────────┐     │
                                      │    │ OK │      │ <strong><span style="color: #0000ff;">Customize</span></strong> │      │ Cancel │     │
                                      │    └────┘      └───────────┘      └────────┘     │
                                      │                                                  │
                                      │                                                  │
                                      └──────────────────────────────────────────────────┘</pre>
<p>กด [tab] เพื่อเลื่อนไปที่ &#8220;Customize&#8221;</p>
<pre>                                 ┌───────────────────┤ Trusted Services ├────────────────────┐
                                 │                                                           │
                                 │ Here you can define which services are trusted. Trusted   │
                                 │ services are accessible from all hosts and networks.      │
                                 │                                                           │
                                 │           [ ] RADIUS                        ↑             │
                                 │           [*] SSH                           ▒             │
                                 │           [ ] Samba                         ▒             │
                                 │           [ ] Samba Client                  ▒             │
                                 │           [ ] Secure WWW (HTTPS)            ▮             │
                                 │           <strong><span style="color: #0000ff;">[*] WWW (HTTP)</span></strong>                    ↓             │
                                 │                                                           │
                                 │                                 ┌─────────┐   ┌───────┐   │
                                 │                                 │ Forward │   │ <strong><span style="color: #0000ff;">Close</span></strong> │   │
                                 │                                 └─────────┘   └───────┘   │
                                 │                                                           │
                                 │                                                           │
                                 └───────────────────────────────────────────────────────────┘</pre>
<p>ในหน้า &#8220;Trusted Services&#8221; กดปุ่มลูกศรเพื่อเลื่อนลงมาบรรทัด [x] WWW (HTTP) แล้วกดปุ่ม [space-bar] เพื่อเลือก แล้วกด &#8220;Close&#8221;</p>
<p>หน้าจอจะขึ้นถามให้ บันทึกคอนฟิกใหม่ เลือก [Yes]</p>
<pre>                                         ┌────────────────┤ Warning ├─────────────────┐
                                         │                                            │
                                         │ Clicking the 'Yes' button will override    │
                                         │ any existing firewall configuration. Are   │
                                         │ you sure that you want to do this?         │
                                         │                                            │
                                         │ Please remember to check if the services   │
                                         │ iptables and ip6tables are enabled.        │
                                         │                                            │
                                         │        ┌─────┐              ┌────┐         │
                                         │        │ <strong><span style="color: #0000ff;">Yes</span></strong> │              │ No │         │
                                         │        └─────┘              └────┘         │
                                         │                                            │
                                         │                                            │
                                         └────────────────────────────────────────────┘</pre>
<p>ใช้คำสั่ง iptables อีกครั้ง เพื่อแสดงคอนฟิก firewall ปัจจุบัน หลังการแก้ไข</p>
<pre>[root@fc11-64min ~]# <strong>iptables -L -v
</strong>Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
   11   752 ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED
    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            state NEW tcp dpt:ssh
<span style="color: #0000ff;"><strong>    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere            state NEW tcp dpt:http
</strong></span>    0     0 REJECT     all  --  any    any     anywhere             anywhere            reject-with icmp-host-prohibited</pre>
<pre>Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 REJECT     all  --  any    any     anywhere             anywhere            reject-with icmp-host-prohibited</pre>
<pre>Chain OUTPUT (policy ACCEPT 10 packets, 1072 bytes)
 pkts bytes target     prot opt in     out     source               destination</pre>
<p>หลังจากอนุญาต http แล้ว ตอนนี้เครื่องอื่น ก็สามารถเรียกเว็บเซิร์ฟเวอร์ที่รันบนเครื่องนี้ได้แล้ว</p>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/07/customize_iptables_firewall_rules/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>เพิ่มความปลอดภัยให้ Solaris 10 แบบง่าย</title>
		<link>http://spalinux.com/2009/05/basic_secure_solaris_10</link>
		<comments>http://spalinux.com/2009/05/basic_secure_solaris_10#comments</comments>
		<pubDate>Sat, 23 May 2009 14:55:46 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[X Window]]></category>
		<category><![CDATA[solaris 10]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=681</guid>
		<description><![CDATA[วันนี้ขอเขียนเกี่ยวกับ Solaris 10 ซะหน่อย ช่วงนี้ได้รับมอบหมายให้เพิ่มความปลอดภัย (secure) ให้กับเครื่อง Solaris  แต่มีข้อแม้ไม่อยากให้ลง JASS (Solaris Security Toolkit) ก็เลยลองทำดู และเรียบเรียงมาเป็นบทความให้ผู้สนใจทั่วไป การเพิ่มความปลอดภัยในบทความนี้  คือการปิดเซอร์วิสที่ไม่ได้ใช้งานโดยไม่กระทบกับงานที่ลูกค้าใช้  ซึ่งนอกจากจะปิดช่องโหว่ที่อาจเกิดขึ้นแล้ว ยังได้ free memory เพิ่มคืนมาอีกด้วย ปิด remote services ตอนติดตั้ง Solaris วิธีการหนึ่งที่ช่วยปิดเซอร์วิสเก่าๆ สำหรับการ remote services ไม่ว่าจะเป็น telnet, rlogin, ftp  เหลือแค่ Secure Shell (SSH) สามารถทำได้ตั้งแต่ระหว่างการติดตั้ง Solaris ในหน้าจอที่เลือก &#8220;Enabling remote services&#8221; ให้เลือก [x] No สำหรับ &#8220;Remote services enabled&#8221; ปิดเซอร์วิส CDE-Login (X [...]]]></description>
			<content:encoded><![CDATA[<p>วันนี้ขอเขียนเกี่ยวกับ Solaris 10 ซะหน่อย ช่วงนี้ได้รับมอบหมายให้เพิ่มความปลอดภัย (secure) ให้กับเครื่อง Solaris  แต่มีข้อแม้ไม่อยากให้ลง JASS (Solaris Security Toolkit) ก็เลยลองทำดู และเรียบเรียงมาเป็นบทความให้ผู้สนใจทั่วไป</p>
<p>การเพิ่มความปลอดภัยในบทความนี้  คือการปิดเซอร์วิสที่ไม่ได้ใช้งานโดยไม่กระทบกับงานที่ลูกค้าใช้  ซึ่งนอกจากจะปิดช่องโหว่ที่อาจเกิดขึ้นแล้ว ยังได้ free memory เพิ่มคืนมาอีกด้วย<span id="more-681"></span></p>
<h4>ปิด remote services ตอนติดตั้ง Solaris</h4>
<p>วิธีการหนึ่งที่ช่วยปิดเซอร์วิสเก่าๆ สำหรับการ remote services ไม่ว่าจะเป็น telnet, rlogin, ftp  เหลือแค่ Secure Shell (SSH) สามารถทำได้ตั้งแต่ระหว่างการติดตั้ง Solaris ในหน้าจอที่เลือก &#8220;<strong>Enabling remote services</strong>&#8221; ให้เลือก <strong>[x] No</strong> สำหรับ &#8220;<strong>Remote services enabled</strong>&#8221;</p>
<p><img class="alignnone size-full wp-image-683" title="Solaris 10 Installation - Disable Remote Services" src="http://spalinux.com/wp-content/uploads/2009/05/00_install_solaris_10_disable_remote_services.png" alt="Solaris 10 Installation - Disable Remote Services" width="720" height="400" /></p>
<h4>ปิดเซอร์วิส CDE-Login (X Window)</h4>
<p>หากคุณไม่เคยเดินไปที่หน้าจอคอนโซลของเครื่อง login เข้า CDE หรือ W Window แล้ว  สามารถปิดเซอร์วิสนี้ไปได้เลย เหลือแค่เป็นคอนโซล แบบ text ธรรมดา ให้สามารถ login ได้</p>
<p>ใช้คำสั่ง svcs เพื่อตรวจสอบสถานะ cde-login</p>
<pre># <strong>svcs cde-login</strong>
 STATE          STIME    FMRI
 online         13:34:58 svc:/application/graphical-login/cde-login:default</pre>
<p>ตัวอย่างหน้าจอ cde-login</p>
<p><img class="alignnone size-full wp-image-684" title="Solaris 10 - CDE Login" src="http://spalinux.com/wp-content/uploads/2009/05/01_solaris_10_cde_login.png" alt="Solaris 10 - CDE Login" width="727" height="414" /></p>
<p>ใช้คำสั่ง svcadm disable เพื่อปิดเซอร์วิส cde-login</p>
<pre># <strong>svcadm disable cde-login</strong></pre>
<p>ตรวจสอบสถานะ cde-login หลังจากปิดเซอร์วิสแล้ว</p>
<pre># <strong>svcs cde-login</strong>
 STATE          STIME    FMRI
 disabled       13:36:59 svc:/application/graphical-login/cde-login:default</pre>
<p>ตัวอย่าง text console login หลังจากปิดเซอร์วิส cde-login</p>
<p><img class="alignnone size-full wp-image-685" title="After Disable CDE Login" src="http://spalinux.com/wp-content/uploads/2009/05/02_after_disable_cde.png" alt="After Disable CDE Login" width="720" height="400" /></p>
<h4></h4>
<h4>ปิดเซอร์วิส Sun Java Web Console</h4>
<p>Sun Java Web Console เป็นเซอร์วิสของ Solaris เพื่อสร้างเป็นจุดรวมของโปรแกรมประเภท system management ผ่านทาง web-based โดยผู้ใช้สามารถเรียกผ่าน https ได้</p>
<p><img class="alignnone size-full wp-image-688" title="Sun Java Web Console" src="http://spalinux.com/wp-content/uploads/2009/05/03_sun_java_web_console.png" alt="Sun Java Web Console" width="762" height="653" /></p>
<p>หากเราใช้แต่ command line เพื่อแก้ไขคอนฟิกเครื่อง เราสามารถปิดเซอร์วิสนี้ได้</p>
<p>ใช้คำสั่ง svcs เพื่อตรวจสอบสถานะ webconsole</p>
<pre># <strong>svcs webconsole</strong>
 STATE          STIME    FMRI
 online         14:01:06 svc:/system/webconsole:console</pre>
<p>ใช้คำสั่ง svcadm disable เพื่อปิดเซอร์วิส webconsole</p>
<pre># <strong>svcadm disable webconsole</strong></pre>
<p>ตรวจสอบสถานะ webconsole หลังจากปิดเซอร์วิสแล้ว</p>
<pre># <strong>svcs webconsole</strong>
 STATE          STIME    FMRI
 disabled       14:41:47 svc:/system/webconsole:console</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://www.sun.com/software/security/jass/" target="_blank">Solaris Security Toolkit (JumpStart Architecture and Security Scripts &#8211; JASS &#8211; Toolkit)</a></li>
<li><a href="http://docs.sun.com/app/docs/doc/817-1985/ewpor?a=view" target="_blank">Working With the Sun Java Web Console</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/05/basic_secure_solaris_10/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>การกำหนด access list ใน Squid Proxy Server ตอนที่ 2</title>
		<link>http://spalinux.com/2009/01/define_access_list_in_squid_proxy_server_part_2</link>
		<comments>http://spalinux.com/2009/01/define_access_list_in_squid_proxy_server_part_2#comments</comments>
		<pubDate>Sat, 17 Jan 2009 06:12:49 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=436</guid>
		<description><![CDATA[ในตอนที่สองนี้จะอธิบายดีฟอลต์คอนฟิก acl ที่ติดตั้งมากับ Fedora 10 โดยจะแยกเป็นส่วนๆ พร้อมทั้งแนะนำวิธีการแก้ไขคอนฟิกและการ reload เซอร์วิสหลังจากการแก้ไข ดีฟอลต์คอนฟิก acl ของ Squid เวอร์ชั่น squid-3.0.STABLE10 ที่ติดตั้งมากับ Fedora 10 จะแตกต่างจากเวอร์ชั่นก่อนๆ คือ อนุญาตเครื่องไคลเอนต์ที่มี ip address เป็น private  (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) มีสิทธิใช้ proxy ซี่งแนะนำให้มีการแก้ไขก่อนนำไปใช้งานจริง อนุญาตให้ใช้งานและจัดการเกี่ยวกับ cache_object ได้จากในเครื่องที่ติดตั้ง (localhost) acl manager proto cache_object acl localhost src 127.0.0.1/32 acl to_localhost dst 127.0.0.0/8 http_access allow manager localhost http_access deny manager http_access [...]]]></description>
			<content:encoded><![CDATA[<p>ในตอนที่สองนี้จะอธิบายดีฟอลต์คอนฟิก acl ที่ติดตั้งมากับ Fedora 10 โดยจะแยกเป็นส่วนๆ พร้อมทั้งแนะนำวิธีการแก้ไขคอนฟิกและการ reload เซอร์วิสหลังจากการแก้ไข</p>
<p>ดีฟอลต์คอนฟิก acl ของ Squid เวอร์ชั่น squid-3.0.STABLE10 ที่ติดตั้งมากับ Fedora 10 จะแตกต่างจากเวอร์ชั่นก่อนๆ คือ อนุญาตเครื่องไคลเอนต์ที่มี ip address เป็น private  (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) มีสิทธิใช้ proxy ซี่งแนะนำให้มีการแก้ไขก่อนนำไปใช้งานจริง</p>
<p><span id="more-436"></span></p>
<hr />
<h4>อนุญาตให้ใช้งานและจัดการเกี่ยวกับ cache_object ได้จากในเครื่องที่ติดตั้ง (localhost)</h4>
<pre>acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8

http_access allow manager localhost
http_access deny manager
http_access allow localhost
</pre>
<hr />
<h4>อนุญาตเครื่องไคลเอนต์ที่มี ip address เป็น private สามารถใช้งานได้</h4>
<pre>
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network

http_access allow localnet
</pre>
<p>แนะนำให้ปิด (comment) ทั้งสี่บรรทัด ด้านบน แล้วค่อยกำหนด ip address ของไคลเอนต์ที่มีสิทธิใช้งาน proxy ได้อีกที</p>
<p>ปิดการอนุญาตเครื่องไคลเอนต์ที่มี ip address เป็น private</p>
<pre>
#acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16 # RFC1918 possible internal network

#http_access allow localnet
</pre>
<hr />
<h4>ปฏิเสธการเชื่อมต่อโดยใช้พอร์ตของเว็บไซต์ ที่ไม่ใช่พอร์ต Safe_ports</h4>
<p>เบอร์พอร์ต Safe_ports มีดังนี้ 80, 21, 443, 70, 210, 280, 488, 597, 777, 1025-65535</p>
<pre>
acl Safe_ports port 80      # http
acl Safe_ports port 21      # ftp
acl Safe_ports port 443     # https
acl Safe_ports port 70      # gopher
acl Safe_ports port 210     # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280     # http-mgmt
acl Safe_ports port 488     # gss-http
acl Safe_ports port 591     # filemaker
acl Safe_ports port 777     # multiling http

http_access deny !Safe_ports
</pre>
<hr />
<h4>ปฏิเสธการเชื่อมต่อแบบ SSL ไปยังพอร์ตที่ไม่ใช่พอร์ตเบอร์ 443</h4>
<pre>
acl SSL_ports port 443
acl CONNECT method CONNECT

http_access deny CONNECT !SSL_ports
</pre>
<hr />
<h4>ปฏิเสธการใช้งานอื่นๆ ที่ไม่ match จาก acl ที่กำหนดไว้</h4>
<pre>http_access deny all</pre>
<hr />
<h4>วิธีการแก้ไขไฟล์คอนฟิก /etc/squid/squid.conf</h4>
<p>เพื่อสะดวกในการอ้างอิงภายหลัง การแก้ไขเพิ่มเติม acl ทั้งในส่วนกำหนดชื่อ aclname และการอนุญาตหรือปฏิเสธ ในไฟล์ /etc/squid/squid.conf ให้แก้ไขใต้บรรทัด ที่มีคำว่า</p>
<pre>
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS</pre>
<p>หลังจากแก้ไขไฟล์คอนฟิกของ squid ต้องใช้คำสั่ง service reload เซอร์วิส เพื่อให้คอนฟิกใหม่มีผล</p>
<pre>[root@proxy ~]# <strong>service squid reload</strong></pre>
<p>หากมีข้อผิดพลาดในคอนฟิก จะมี error ฟ้องขึ้นมา ต้องแก้ไขให้ถูกต้อง คอนฟิกใหม่ถึงจะมีผล</p>
<p>ตัวอย่างการกำหนด ip address ผิดในไฟล์คอนฟิก</p>
<pre>
[root@proxy ~]# <strong>service squid reload</strong>
2009/01/17 12:58:36| aclParseIpData: Bad host/IP: '192.168.1.02-'
FATAL: Bungled squid.conf line 643: acl acl_client1 src 192.168.1.02-
Squid Cache (Version 3.0.STABLE10): Terminated abnormally.
CPU Usage: 0.005 seconds = 0.001 user + 0.004 sys
Maximum Resident Size: 0 KB
Page faults with physical i/o: 0
</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/01/define_access_list_in_squid_proxy_server_part_1">การกำหนด access list ใน Squid Proxy Server ตอนที่ 1</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/01/define_access_list_in_squid_proxy_server_part_2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>การใช้ GPG Public Key ตรวจสอบไฟล์ rpm</title>
		<link>http://spalinux.com/2008/12/using_gpg_public_key_to_verify_rpm</link>
		<comments>http://spalinux.com/2008/12/using_gpg_public_key_to_verify_rpm#comments</comments>
		<pubDate>Sat, 27 Dec 2008 18:13:10 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Linux Installation]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Utility]]></category>
		<category><![CDATA[rpm]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=409</guid>
		<description><![CDATA[ก่อนที่จะติดตั้งไฟล์ rpm ที่ได้มา ไม่ว่าจากแผ่นดีวีดีติดตั้งของ distribution ต่างๆ หรือดาวน์โหลดมาจากอินเตอร์เน็ต แนะนำให้อิมพอร์ต Public Key ของไฟล์ rpm ลงในเครื่องที่จะติดตั้งก่อน เพื่อใช้ตรวจสอบความถูกต้องของไฟล์ rpm ว่าไฟล์ที่ใช้ในการติดตั้งเป็นไฟล์ที่มาจากผู้พัฒนาหรือสร้างไฟล์ rpm จริงๆ ไม่ได้ถูกเปลี่ยนแปลงใดๆ การอิมพอร์ต Public Key ไฟล์ Public Key ที่จะอิมพอร์ตนั้น แนะนำให้ดาวน์โหลดจากแหล่งที่น่าเชื่อถือได้ เช่น mirror site ที่เป็นทางการต่างๆ ซึ่งสามารถตรวจสอบได้จากเว็บไซต์ผู้ผลิต หรือถ้าเราดาวน์โหลดไฟล์ rpm จาก mirror site ที่นึง แนะนำให้โหลดไฟล์ Public Key จากเว็บอีกทีหนึ่ง ในบทความนี้จะทดสอบกับไฟล์ rpm ที่มีอยู่ในแผ่นดีวีดีติดตั้ง Fedora 10 แต่จะโหลดไฟล์ Public Key จาก http://mirrors.kernel.org/ โดยส่วนใหญ่แล้วไฟล์ rpm ที่อยู่ในแผ่นติดตั้ง [...]]]></description>
			<content:encoded><![CDATA[<p>ก่อนที่จะติดตั้งไฟล์ rpm ที่ได้มา ไม่ว่าจากแผ่นดีวีดีติดตั้งของ distribution ต่างๆ หรือดาวน์โหลดมาจากอินเตอร์เน็ต แนะนำให้อิมพอร์ต Public Key ของไฟล์ rpm ลงในเครื่องที่จะติดตั้งก่อน เพื่อใช้ตรวจสอบความถูกต้องของไฟล์ rpm ว่าไฟล์ที่ใช้ในการติดตั้งเป็นไฟล์ที่มาจากผู้พัฒนาหรือสร้างไฟล์ rpm จริงๆ ไม่ได้ถูกเปลี่ยนแปลงใดๆ</p>
<p><span id="more-409"></span></p>
<h4>การอิมพอร์ต Public Key</h4>
<p>ไฟล์ Public Key ที่จะอิมพอร์ตนั้น แนะนำให้ดาวน์โหลดจากแหล่งที่น่าเชื่อถือได้ เช่น mirror site ที่เป็นทางการต่างๆ ซึ่งสามารถตรวจสอบได้จากเว็บไซต์ผู้ผลิต หรือถ้าเราดาวน์โหลดไฟล์ rpm จาก mirror site ที่นึง แนะนำให้โหลดไฟล์ Public Key จากเว็บอีกทีหนึ่ง ในบทความนี้จะทดสอบกับไฟล์ rpm ที่มีอยู่ในแผ่นดีวีดีติดตั้ง Fedora 10 แต่จะโหลดไฟล์ Public Key จาก http://mirrors.kernel.org/ โดยส่วนใหญ่แล้วไฟล์ rpm ที่อยู่ในแผ่นติดตั้ง จะใช้ไฟล์ Public Key เดียวกันในการตรวจสอบ เพราะฉะนั้น ถ้าเราอิมพอร์ตคีย์ครั้งหนึ่งลงไปแล้ว เราก็สามารถใช้ตรวจสอบไฟล์อื่นๆ ที่อยู่ในแผ่นติดตั้งได้ โดยไม่ต้องอิมพอร์ตซ้ำ</p>
<p>ตัวอย่างการตรวจสอบไฟล์ rpm ก่อนการอิมพอร์ต Public Key</p>
<pre>[root@fc10 ~]# <strong>mount /dev/dvd /media</strong>/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@fc10 ~]# <strong>cd /media/Packages/</strong></pre>
<pre>[root@fc10 Packages]# <strong>rpm --checksig samba-client-3.2.4-0.22.fc10.i386.rpm</strong>
samba-client-3.2.4-0.22.fc10.i386.rpm: (SHA1) DSA sha1 md5 <span style="color: #ff0000;"><strong>(GPG) NOT OK (MISSING KEYS:GPG#4ebfc273)</strong></span></pre>
<p>ออปชั่น &#8216;&#8211;checksig&#8217; หรือ &#8216;-K&#8217; ใช้เพื่อการตรวจสอบความถูกต้องเช่น digest, signature ของไฟล์ rpm ด้วยเทคนิคต่างๆ ผลลัพธ์จะแสดงค่าหลายอย่าง ในที่นี้จะเห็นว่ามีคำว่า (GPG) NOT OK (MISSING KEYS:&#8230;) ฟ้องขึ้นมา แสดงว่าการตรวจสอบ Public Key ของไฟล์ไม่ถูกต้อง ซึ่งอาจเป็นเพราะว่าไฟล์ที่ดาวน์โหลดนั้นถูกเปลี่ยนแปลงไปจริงๆ โหลดมาไม่สมบูรณ์ หรืออีกเหตุผลนึงในที่นี้คือ ไม่มี Public Key ของไฟล์นั้น</p>
<p>สำหรับ Fedora 10 (i386) สามารถดาวน์โหลด Public Key ได้จาก <a href="http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/RPM-GPG-KEY-fedora-10-primary">http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/RPM-GPG-KEY-fedora-10-primary</a></p>
<p>หมายเหตุ ในแต่ละเวอร์ชั่น จะใช้ Public Key ไม่เหมือนกัน</p>
<pre>ตัวอย่างไฟล์ Public Key ของ Fedora 10 (i386) (ผลลัพธ์ถูกตัดออกไปบางส่วน)
 
[root@fc10 ~]# <strong>cat RPM-GPG-KEY-fedora-10-primary</strong>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (GNU/Linux)</pre>
<pre>mQGiBEi12/MRBADL6fpbRejYViiVzY/Y0T6pmgChOykrsq1oc9mX9+ss1lZZit1z
DRrgvOYG67wnRQaskXnKulw3XoNEAT/OjCNzDwrS3gMbHaz+T9wQN5WeO52ihozp
...
gX4TCgPMjjjT0hmTfDpliEkEGBECAAkFAki12/MCGwwACgkQvyJvzE6/wnM+4wCe
KkKsIfsmCT0MpuYxHh4vRS/ix58AoLfjES8VpN+3ku9hC3QT97Fa/bK4
=s6iX
-----END PGP PUBLIC KEY BLOCK-----</pre>
<p>ใช้คำสั่ง rpm ด้วยออปชั่น &#8216;&#8211;import&#8217; เพื่ออิมพอร์ตไฟล์ Public Key เข้าไปในเครื่อง</p>
<pre>[root@fc10 ~]# <strong>rpm --import RPM-GPG-KEY-fedora-10-primary</strong></pre>
<p>ตรวจสอบไฟล์ rpm ที่อยู่ในแผ่นติดตั้งอีกครั้ง</p>
<pre>[root@fc10 ~]# <strong>cd /media/Packages/</strong>
[root@fc10 Packages]# <strong>rpm --checksig samba-client-3.2.4-0.22.fc10.i386.rpm</strong>
samba-client-3.2.4-0.22.fc10.i386.rpm: (sha1) dsa sha1 md5 <span style="color: #339966;"><strong>gpg OK</strong></span></pre>
<p>หลังจากที่อิมพอร์ตคีย์เข้าไปแล้ว ผลลัพธ์การตรวจสอบ gpg จะแสดงผลว่าถูกต้อง</p>
<h4>ตรวจสอบ Public Key ที่อิมพอร์ตเข้าเครื่องแล้ว</h4>
<p>เราสามารถใช้คำสั่ง rpm ด้วยออปชั่น &#8216;-q&#8217; เพื่อตรวจสอบ Public Key ที่ถูกอิมพอร์ตเข้าเครื่องแล้ว ดังตัวอย่าง</p>
<p>ตัวอย่างการตรวจสอบ Public Key ที่อิมพอร์ต</p>
<pre>[root@fc10 ~]# <strong>rpm -qa gpg-pubkey*</strong>
gpg-pubkey-4ebfc273-48b5dbf3</pre>
<pre>[root@fc10 ~]# <strong>rpm -qil gpg-pubkey-4ebfc273-48b5dbf3</strong>
Name        : gpg-pubkey                   Relocations: (not relocatable)
Version     : 4ebfc273                          Vendor: (none)
Release     : 48b5dbf3                      Build Date: Sat 27 Dec 2008 11:27:03 PM ICT
Install Date: Sat 27 Dec 2008 11:27:03 PM ICT      Build Host: localhost
Group       : Public Keys                   Source RPM: (none)
Size        : 0                                License: pubkey
Signature   : (none)
Summary     : gpg(Fedora (10) &lt;fedora@fedoraproject.org&gt;)
Description :
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: rpm-4.6.0-rc1 (NSS-3)</pre>
<pre>mQGiBEi12/MRBADL6fpbRejYViiVzY/Y0T6pmgChOykrsq1oc9mX9+ss1lZZit1z
DRrgvOYG67wnRQaskXnKulw3XoNEAT/OjCNzDwrS3gMbHaz+T9wQN5WeO52ihozp
...
gX4TCgPMjjjT0hmTfDpliEkEGBECAAkFAki12/MCGwwACgkQvyJvzE6/wnM+4wCe
KkKsIfsmCT0MpuYxHh4vRS/ix58AoLfjES8VpN+3ku9hC3QT97Fa/bK4
=s6iX
-----END PGP PUBLIC KEY BLOCK-----</pre>
<pre>(contains no files)</pre>
<h4>ถอด Public Key ออกจากเครื่อง</h4>
<p>ถ้าเราต้องการถอด Public Key ออกจากเครื่อง (uninstall) สามารถใช้คำสั่ง rpm ด้วยออปชั่น &#8216;-e&#8217; ได้ดังนี้</p>
<p>ตัวอย่างการถอด Public Key และผลลัพธ์ที่เกิดขึ้น</p>
<pre>[root@fc10 ~]# <strong>rpm -ev gpg-pubkey
</strong>[root@fc10 ~]# <strong>rpm -qa gpg-pubkey*</strong></pre>
<pre>[root@fc10 ~]# <strong>cd /media/Packages/</strong></pre>
<pre>[root@fc10 Packages]# <strong>rpm --checksig samba-client-3.2.4-0.22.fc10.i386.rpm
</strong>samba-client-3.2.4-0.22.fc10.i386.rpm: (SHA1) DSA sha1 md5 <span style="color: #ff0000;"><strong>(GPG) NOT OK (MISSING KEYS:GPG#4ebfc273)</strong></span></pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li>Manual Page &#8211; rpm(8)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/12/using_gpg_public_key_to_verify_rpm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ปิดโมดูลที่ไม่ใช้งานของ Apache เว็บเซิร์ฟเวอร์</title>
		<link>http://spalinux.com/2008/09/disable_unused_apache_modules</link>
		<comments>http://spalinux.com/2008/09/disable_unused_apache_modules#comments</comments>
		<pubDate>Mon, 29 Sep 2008 16:40:23 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Server]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=220</guid>
		<description><![CDATA[โดยดีฟอลต์คอนฟิกของ Apache เว็บเซิร์ฟเวอร์ที่ติดตั้งมากับลีนุกซ์เวอร์ชั่นต่างๆ จะเปิด (enable) การใช้งานโมดูลต่างๆ ทั้งหมด ทั้งนี้เพื่อสะดวกและง่ายต่อการเริ่มต้นใช้งาน แต่การใช้งานจริงๆ ในระบบ production แนะนำให้ปิด (disable) คอนฟิกของโมดูลที่ไม่ได้ใช้งาน ทั้งนี้เพื่อประโยชน์ทางด้านความปลอดภัย (security) และประหยัดหน่วยความจำ Memory ที่ต้องถูกใช้งานโดยเปล่าประโยชน์ด้วย (แนะนำให้ใช้คำสั่ง ps เปรียบเทียบขนาด memory ที่ใช้ก่อนและหลังการปิดโมดูล) บทความนี้ได้รวบรวมจัดกลุ่มโมดูลตามลักษณะการใช้งาน ซึ่งถ้าคุณไม่ได้ใช้คุณสมบัติในโมดูลนั้นๆ สามารถที่จะปิดได้ ด้วยการใส่เครื่องหมาย # หน้าบรรทัดของ LoadModule โดยคอนฟิกทั้งหมดจะเป็นตัวอย่างที่ทำบน Fedora 9 และหลังจากการแก้ไขทั้งหมดเพื่อปิดโมดูลทั้งหมดนี้แล้ว เว็บยังสามารถรัน PHP ได้ตามปกติ คำเตือน กรุณาทดสอบการเปลี่ยนแปลงคอนฟิกทุกอย่างให้แน่ใจว่า การปิดโมดูลไป จะไม่กระทบต่อการรันโปรแกรมที่ทำงานอยู่บนเว็บเซิร์ฟเวอร์ Apache Module: Authentication and Authorization โมดูลในกลุ่มนี้ถูกใช้เพื่อตรวจสอบผู้ใช้งาน (Authentication) และระบุสิทธิที่ผู้ใช้งานสามารถทำได้ (Authorization) ลักษณะการตรวจสอบคือจะมีหน้าต่าง popup ขึ้นมาให้ใส่ User [...]]]></description>
			<content:encoded><![CDATA[<p>โดยดีฟอลต์คอนฟิกของ Apache เว็บเซิร์ฟเวอร์ที่ติดตั้งมากับลีนุกซ์เวอร์ชั่นต่างๆ จะเปิด (enable) การใช้งานโมดูลต่างๆ ทั้งหมด ทั้งนี้เพื่อสะดวกและง่ายต่อการเริ่มต้นใช้งาน</p>
<p>แต่การใช้งานจริงๆ ในระบบ production แนะนำให้ปิด (disable) คอนฟิกของโมดูลที่ไม่ได้ใช้งาน ทั้งนี้เพื่อประโยชน์ทางด้านความปลอดภัย (security) และประหยัดหน่วยความจำ Memory ที่ต้องถูกใช้งานโดยเปล่าประโยชน์ด้วย (แนะนำให้ใช้คำสั่ง ps เปรียบเทียบขนาด memory ที่ใช้ก่อนและหลังการปิดโมดูล)</p>
<p>บทความนี้ได้รวบรวมจัดกลุ่มโมดูลตามลักษณะการใช้งาน ซึ่งถ้าคุณไม่ได้ใช้คุณสมบัติในโมดูลนั้นๆ สามารถที่จะปิดได้ ด้วยการใส่เครื่องหมาย # หน้าบรรทัดของ LoadModule โดยคอนฟิกทั้งหมดจะเป็นตัวอย่างที่ทำบน Fedora 9 และหลังจากการแก้ไขทั้งหมดเพื่อปิดโมดูลทั้งหมดนี้แล้ว เว็บยังสามารถรัน PHP ได้ตามปกติ</p>
<p><span id="more-220"></span></p>
<p>คำเตือน  กรุณาทดสอบการเปลี่ยนแปลงคอนฟิกทุกอย่างให้แน่ใจว่า การปิดโมดูลไป จะไม่กระทบต่อการรันโปรแกรมที่ทำงานอยู่บนเว็บเซิร์ฟเวอร์</p>
<hr />
<h4>Apache Module: Authentication and Authorization</h4>
<p>โมดูลในกลุ่มนี้ถูกใช้เพื่อตรวจสอบผู้ใช้งาน (Authentication) และระบุสิทธิที่ผู้ใช้งานสามารถทำได้ (Authorization)  ลักษณะการตรวจสอบคือจะมีหน้าต่าง popup ขึ้นมาให้ใส่ User name และ Password  แล้วส่งข้อมูลนี้ตรวจสอบกับไฟล์ที่เก็บรหัสผู้ใช้งาน ว่าถูกต้องหรือไม่</p>
<p>ตัวอย่างไฟล์คอนฟิก .htaccess และไฟล์ .htpasswd เพื่อระบุว่า ก่อนที่จะเข้าดูเว็บไซต์นี้ได้ ต้องใส่ User name และ Password ให้ถูกต้องก่อน โดยตรวจสอบข้อมูลรหัสผ่านที่อยู่ในไฟล์ /var/www/html/.htpasswd</p>
<pre>[root@web-server html]# <strong>cat .htaccess</strong>
AuthType Basic
AuthName "Password Required"
AuthUserFile /var/www/html/.htpasswd
Require valid-user</pre>
<pre>[root@web-server html]# <strong>cat .htpasswd
</strong>john:&lt;password&gt;</pre>
<p>การตรวจสอบสิทธิผู้ใช้งานแบบนี้ เป็นคุณสมบัติของโมดูลหนี่งของ Apache ไม่เกี่ยวข้องกับการเขียนโปรแกรมเว็บเอง เช่น PHP แล้วใช้ SESSION ในการตรวจสอบ</p>
<p>ถ้าเว็บเซิร์ฟเวอร์ไม่มีการใช้การตรวจสอบสิทธิแบบนี้ สามารถปิดคอนฟิกของโมดูลในบรรทัดต่อไปนี้ได้</p>
<p>ตัวอย่างการปิดโมดูล Authentication and Authorization</p>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf/httpd.conf
</strong>...
#LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_alias_module modules/mod_authn_alias.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_default_module modules/mod_authn_default.so
<span style="color: #3366ff;">LoadModule authz_host_module modules/mod_authz_host.so
</span>#LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_default_module modules/mod_authz_default.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
...</pre>
<p><strong>ข้อควรระวัง</strong> โมดูล <strong>authz_host_module</strong> จะเป็นการตรวจสอบสิทธิโดยสามารถระบุเป็น ip address หรือ host name ในไฟล์คอนฟิก httpd.conf จะมีการเรียกใช้คอนฟิกของโมดลูนี้หลายที่  ไม่แนะนำให้ปิด</p>
<hr />
<h4>Apache Module: Dynamic Content with CGI</h4>
<p>หากไม่มีโปรแกรมที่เป็น CGI รันอยู่บนเว็บเซิร์ฟเวอร์ สามารถที่จะปิดโมดูล cgi_module ได้ (การปิดโมดูลนี้ไม่กระทบกับเว็บที่เขียนเป็น PHP)</p>
<p>ตัวอย่างการปิดโมดูล cgi_module</p>
<pre>[root@web-server ~]# <strong>/etc/httpd/conf/httpd.conf
</strong>...
#LoadModule cgi_module modules/mod_cgi.so
...</pre>
<hr />
<h4>Apache Module: Server Side Includes (SSI)</h4>
<p>หากไม่มีโปรแกรมที่เป็น Sever Side Includes หรือ SSI รันอยู่บนเว็บเซิร์ฟเวอร์ สามารถที่จะปิดโมดูล include_module ได้ (การปิดโมดูลนี้ไม่กระทบกับเว็บที่เขียนเป็น PHP)</p>
<p>ตัวอย่างการปิดโมดูล include_module</p>
<pre>[root@web-server ~]# <strong>/etc/httpd/conf/httpd.conf
</strong>...
#LoadModule include_module modules/mod_include.so
...</pre>
<hr />
<h4>Apache Module: Apache Proxy Server</h4>
<p>นอกจากจะสามารถรันเป็นเว็บเซิร์ฟเวอร์ได้แล้ว โปรแกรม Apache ยังสามารถทำหน้าที่เป็น Proxy Server ได้อีกด้วย เช่นเดียวกับ Squid ถ้าเครื่องทำหน้าที่เป็นเว็บเซิร์ฟเวอร์อย่างเดียว คุณสามารถปิดโมดูลนี้ได้ ใน Fedora 9 การปิดโมดูล Proxy ของ Apache ต้องแก้ไขสองไฟล์คือในไฟล์ /etc/httpd/conf/httpd.conf และไฟล์ /etc/httpd/conf.d/proxy_ajp.conf</p>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf/httpd.conf
</strong>...
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
...</pre>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf.d/proxy_ajp.conf</strong></pre>
<pre>LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
...</pre>
<hr />
<h4>Apache Module: Distributed Authoring and Versioning (WebDAV)</h4>
<p>หากไม่ได้ใช้คุณสมบัติของโมดูล WebDAV นี้ สามารถแก้ไขไฟล์ได้ดังนี้</p>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf/httpd.conf
</strong>...
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
...</pre>
<hr />
<h4>Apache Module: Server Status</h4>
<p>โมดูลนี้มีทั้งข้อดีข้อเสีย ข้อดีคือสามารถดูสถานะโดยละเอียดของเว็บเซิร์ฟเวอร์ได้ ในกรณีที่เครื่องช้า แต่ข้อเสียคืออาจเป็นปัญหาทางด้านความปลอดภัยของเครื่องได้ คอนฟิกโดยดีฟอลต์จะอนุญาตให้ดูได้จาก localhost หรือเครื่องที่รันเว็บอยู่เท่านั้น แต่ถ้าเครื่องของคุณทดสอบแล้วทำงานได้ตามปกติ สามารถจะปิดโมดูลนี้ได้</p>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf/httpd.conf</strong>
...
#LoadModule status_module modules/mod_status.so
#LoadModule info_module modules/mod_info.so
...</pre>
<hr />
<h4>Apache Module: mod_perl</h4>
<p>หากไม่มีเว็บโปรแกรมที่เขียนเป็น mod_perl รันอยู่บนเว็บเซิร์ฟเวอร์ สามารถที่จะปิดโมดูล mod_perl ได้ (การปิดโมดูลนี้ไม่กระทบกับเว็บที่เขียนเป็น PHP)</p>
<p>ตัวอย่างการปิดโมดูล mod_perl</p>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf.d/perl.conf</strong>
...
LoadModule perl_module modules/mod_perl.so
...</pre>
<hr />
<h4>Apache Module: mod_python</h4>
<p>หากไม่มีเว็บโปรแกรมที่เขียนเป็น mod_python รันอยู่บนเว็บเซิร์ฟเวอร์ สามารถที่จะปิดโมดูล mod_python ได้ (การปิดโมดูลนี้ไม่กระทบกับเว็บที่เขียนเป็น PHP)</p>
<p>ตัวอย่างการปิดโมดูล mod_python</p>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf.d/python.conf
</strong>...
#LoadModule python_module modules/mod_python.so</pre>
<pre># Override type-map handler for /var/www/manual
#&lt;Directory "/var/www/manual/mod/mod_python"&gt;
#    &lt;Files *.html&gt;
#        SetHandler default-handler
#    &lt;/Files&gt;
#&lt;/Directory&gt;
...</pre>
<hr />
<h4>Apache Module: Others</h4>
<p>โมดูลอื่นๆ ที่น่าจะปิดคือ</p>
<ul>
<li>speling_module – แก้ไข url ที่พิมพ์ผิด</li>
<li>
<pre>userdir_module – อนุญาตผู้ที่มีแอคเคานต์อยู่บนเซิร์ฟเวอร์สามารถมีเว็บส่วนตัวได้</pre>
</li>
</ul>
<pre>[root@web-server ~]# <strong>cat /etc/httpd/conf/httpd.conf
</strong>...
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
...</pre>
<hr />
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://httpd.apache.org/docs/2.2/mod/" target="_blank">Module Index &#8211; Apache HTTP Server</a></li>
<li><a href="http://spalinux.com/2008/09/basic_tuning_apache_web_server">ปรับแต่งคอนฟิกพื้นฐานของ Apache เว็บเซิร์ฟเวอร์</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/09/disable_unused_apache_modules/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ยกเลิกการรัน service ที่ไม่ใช้ใน Fedora 9</title>
		<link>http://spalinux.com/2008/06/disable_unused_service_in_fedora_9</link>
		<comments>http://spalinux.com/2008/06/disable_unused_service_in_fedora_9#comments</comments>
		<pubDate>Sat, 07 Jun 2008 10:39:20 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Linux Installation]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=36</guid>
		<description><![CDATA[จากบทความ [ติดตั้ง Fedora 9 แบบประหยัดพื้นที่สุด] ถึงแม้ว่าตอนติดตั้ง Fedora 9 เราจะไม่เลือก Package Group ใดๆ ตอนติดตั้ง แต่ก็ยังมีโปรแกรม (หรือ service) รันขึ้นมาตั้งแต่แรกเลยอีกพอสมควร ในบทความนี้จะแนะนำการปิด service ที่ไม่จำเป็น หรือยกเลิกการรันซะ เพื่อประหยัดทั้ง CPU และ Memory แล้วยังเพิ่มความปลอดภัยให้กับเครื่องเราอีกระดับหนึ่งด้วย ตรวจสอบ service ที่รันตอนบู๊ตเครื่อง ใช้คำสั่ง ntsysv เพื่อตรวจสอบว่าตอนเริ่มต้นบู๊ตเครื่องจะมี service ไหน รันขึ้นมาบ้าง จากรูป เครื่องหมายดอกจัน [*] คือ service ที่จะรันตอนบู๊ตเครื่อง ถ้าเราต้องการจะยกเลิกให้เอาเครื่องหมายดอกจัน ออกหน้า service ที่ต้องการ แล้วกดปุ่ม OK หลังจากนั้นให้บู๊ตเครื่องอีกรอบ คุณสามารถดู [รายละเอียดของแต่ละ service ใน Fedora 9] ข้อมูลอ้างอิง [...]]]></description>
			<content:encoded><![CDATA[<p>จากบทความ [<a title="ติดตั้ง Fedora 9 แบบประหยัดพื้นที่สุด" href="http://spalinux.com/2008/06/install_minimal_fedora_9">ติดตั้ง Fedora 9 แบบประหยัดพื้นที่สุด</a>] ถึงแม้ว่าตอนติดตั้ง Fedora 9 เราจะไม่เลือก Package Group ใดๆ ตอนติดตั้ง แต่ก็ยังมีโปรแกรม (หรือ service) รันขึ้นมาตั้งแต่แรกเลยอีกพอสมควร</p>
<p>ในบทความนี้จะแนะนำการปิด service ที่ไม่จำเป็น หรือยกเลิกการรันซะ เพื่อประหยัดทั้ง CPU และ Memory แล้วยังเพิ่มความปลอดภัยให้กับเครื่องเราอีกระดับหนึ่งด้วย</p>
<p><span id="more-36"></span></p>
<p><strong>ตรวจสอบ service ที่รันตอนบู๊ตเครื่อง</strong><br />
ใช้คำสั่ง ntsysv เพื่อตรวจสอบว่าตอนเริ่มต้นบู๊ตเครื่องจะมี service ไหน รันขึ้นมาบ้าง<br />
<img src="http://spalinux.com/wp-content/uploads/2008/06/fc9_min_ntsysv.png" alt="Fedora 9 - Use ntsysv to Check Start-up Services" /></p>
<p>จากรูป เครื่องหมายดอกจัน [*] คือ service ที่จะรันตอนบู๊ตเครื่อง ถ้าเราต้องการจะยกเลิกให้เอาเครื่องหมายดอกจัน ออกหน้า service ที่ต้องการ แล้วกดปุ่ม OK หลังจากนั้นให้บู๊ตเครื่องอีกรอบ คุณสามารถดู [<a title="รายละเอียดของแต่ละ service ใน Fedora 9&lt;" href="http://spalinux.com/2008/06/fedora_9_minimal_service_description">รายละเอียดของแต่ละ service ใน Fedora 9</a>]</p>
<p><strong>ข้อมูลอ้างอิง</strong></p>
<ul>
<li><a href="http://spalinux.com/2008/06/install_minimal_fedora_9">ติดตั้ง Fedora 9 แบบประหยัดพื้นที่สุด</a></li>
<li><a href="http://spalinux.com/2008/06/fedora_9_minimal_service_description">รายละเอียดของแต่ละ service ใน Fedora 9</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/06/disable_unused_service_in_fedora_9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>รายละเอียดของแต่ละ service ใน Fedora 9</title>
		<link>http://spalinux.com/2008/06/fedora_9_minimal_service_description</link>
		<comments>http://spalinux.com/2008/06/fedora_9_minimal_service_description#comments</comments>
		<pubDate>Sat, 07 Jun 2008 10:21:06 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Linux Installation]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=35</guid>
		<description><![CDATA[รายละเอียดของแต่ละ service ที่มาจากการติดตั้ง Fedora 9 แบบไม่เลือก Package Group ใดๆ เลย พร้อมคำแนะนำว่าจะปิดหรือเปิด service สำหรับการใช้งาน NetworkManager เป็น service ที่สามารถปรับเปลี่ยนคอนฟิกของ network เพื่อให้ต่อเชื่อมกับ network เช่น WiFi ได้อย่างอัตโนมัติ คำแนะนำ ปิด – สำหรับ server เปิด – สำหรับ notebook ที่มีการเปลี่ยนที่ใช้งานเป็นประจำ acpid เป็น service สำหรับตรวจสอบสถานะของเครื่อง โดยจะใช้ได้สำหรับ BIOS บางรุ่น วิธีทดสอบง่ายๆ คือเข้าไปดูใน /proc/acpi/ แล้วใช้คำสั่ง cat ดูไฟล์ต่างๆ ว่าสามารถตรวจสอบสถานะของอุปกรณ์ได้หรือไม่ คำแนะนำ เปิด – สำหรับเครื่องที่ตรวจสอบสถานะได้ ปิด &#8211; ถ้าเราไม่สนใจตรวจสอบ anacron [...]]]></description>
			<content:encoded><![CDATA[<p>รายละเอียดของแต่ละ service ที่มาจากการติดตั้ง Fedora 9 แบบไม่เลือก Package Group ใดๆ เลย พร้อมคำแนะนำว่าจะปิดหรือเปิด service สำหรับการใช้งาน</p>
<p><span id="more-35"></span></p>
<p><strong>NetworkManager</strong><br />
เป็น service ที่สามารถปรับเปลี่ยนคอนฟิกของ network เพื่อให้ต่อเชื่อมกับ network เช่น WiFi ได้อย่างอัตโนมัติ<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – สำหรับ server</li>
<li>เปิด – สำหรับ notebook ที่มีการเปลี่ยนที่ใช้งานเป็นประจำ</li>
</ul>
<p><strong>acpid</strong><br />
เป็น service สำหรับตรวจสอบสถานะของเครื่อง โดยจะใช้ได้สำหรับ BIOS บางรุ่น วิธีทดสอบง่ายๆ คือเข้าไปดูใน /proc/acpi/ แล้วใช้คำสั่ง cat ดูไฟล์ต่างๆ ว่าสามารถตรวจสอบสถานะของอุปกรณ์ได้หรือไม่<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด – สำหรับเครื่องที่ตรวจสอบสถานะได้</li>
<li>ปิด &#8211; ถ้าเราไม่สนใจตรวจสอบ</li>
</ul>
<p><strong>anacron</strong><br />
การปิด/เปิด บ่อยๆ อาจทำให้ crontab ที่ตั้งไว้ไม่สามารถทำงานได้เลย เช่นโดยดีฟอลต์แล้วจะมี crontab รันอยู่ทุกวันเวลา 4:02 AM แต่ถ้าเราไม่ได้เปิดเครื่องเวลานี้ crontab นี้ ก็จะไม่ถูกรันเลย<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด &#8211; สำหรับ notebook, desktop ที่มีการปิด/เปิด อยู่เรื่อยๆ</li>
<li>ปิด – สำหรับ server ที่เปิดเครื่องตลอดเวลา</li>
</ul>
<p><strong>atd</strong><br />
เป็น service สำหรับการตั้งเวลาในการรันโปรแกรมได้ ซึ่งตามประสบการณ์ส่วนตัวของผมแล้ว แทบไม่เคยใช้เลย<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – ยกเว้นมีคนต้องการใช้จริงๆ</li>
</ul>
<p><strong>avahi-daemon</strong><br />
ใช้สำหรับหาอุปกรณ์เช่น printer, scanner ที่เชื่อมอยู่โดยอัตโนมัติ<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – เวลาจะใช้อุปกรณ์ แล้วค่อยคอนฟิกเองดีกว่า</li>
</ul>
<p><strong>bluetooth</strong><br />
สำหรับเชื่อมต่อกับ bluetooth<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด &#8211; ยกเว้นต้องการใช้งาน</li>
</ul>
<p><strong>capi</strong><br />
สำหรับต่อเชื่อมอุปกรณ์ประเภท ISDN<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>cpuspeed</strong><br />
เป็นการปรับความเร็วของ CPU ตามการใช้งาน<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – สำหรับ server</li>
<li>เปิด – สำหรับ notebook เพื่อการประหยัดไฟ</li>
</ul>
<p><strong>crond</strong><br />
เป็น service สำหรับการตั้งเวลาในการรันโปรแกรมต่างๆ จำเป็นต้องรันทุกเครื่อง<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิดเท่านั้น</li>
</ul>
<p><strong>cups</strong><br />
สำหรับต่อเชื่อมกับ printer ไม่ว่าจะเป็นแบบต่อโดยตรง หรือสั่งผ่าน network<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด &#8211; ยกเว้นต้องการใช้งาน printer เช่น สั่งพิมพ์งานจากโปรแกรมที่รันอยู่ใน Linux</li>
</ul>
<p><strong>dund</strong><br />
เป็นโปรแกรมที่ทำให้สามารถสั่ง dial-up ได้ผ่านอุปกรณ์ Bluetooth<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>gpm</strong><br />
ทำให้เราสามารถใช้ mouse ผ่านหน้าจอ console โดยตรงของเครื่องได้ เช่น copy, paste ไม่เกี่ยวกับใช้งาน mouse ผ่าน X Window หรือใช้งานผ่านโปรแกรมที่เรา Secure Shell เข้าไป<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>haldaemon</strong><br />
ตรวจสอบสถานะของอุปกรณ์<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด</li>
</ul>
<p><strong>ip6tables</strong><br />
เป็น iptables firewall ที่รองรับ IPv6<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – ไว้ IPv6 ใช้งานอย่างแพร่หลายแล้ว ค่อยมาว่ากันใหม่</li>
</ul>
<p><strong>iptables</strong><br />
ทำหน้าที่เป็น firewall<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด – โดยดีฟอลต์แล้ว จะอนุญาต เฉพาะ ping หรือ Secure Shell เข้ามายังเครื่องเราเท่านั้น แต่จากเครื่องเราสามารถออกไปข้างนอกได้หมด</li>
</ul>
<p><strong>irda</strong><br />
รองรับพอร์ต Infrared<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>irqbalance</strong><br />
เพิ่มประสิทธิภาพในการทำงานสำหรับเครื่องที่มี multiprocessor ซึ่งรวมทั้ง multi-core ด้วย<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด – ยกเว้นเครื่องจะเก่ามากเป็นแบบ CPU เดียว</li>
</ul>
<p><strong>isdn</strong><br />
รองรับอุปกรณ์ ISDN<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>mdmonitor</strong><br />
ตรวจสอบสถานะของ Software RAID ซึ่งไม่รวมถึง Hardware RAID<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด &#8211; ยกเว้นในเครื่องมีคอนฟิกฮาร์ดดิสก์เป็นแบบ Software RAID</li>
</ul>
<p><strong>messagebus</strong><br />
สำหรับส่งข้อมูลระหว่างโปรแกรม<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด</li>
</ul>
<p><strong>microcode_ctl</strong><br />
สำหรับปรับปรุงค่าใน CPU Intel เท่านั้น<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด – สำหรับ CPU Intel</li>
</ul>
<p><strong>multipathd</strong><br />
รองรับการเชื่อมต่อกับ Multi-path Storage Device พร้อมๆ กันหลายเครื่องได้<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด &#8211; ยกเว้นมีการเชื่อมต่อกับอุปกรณ์ประเภทนี้</li>
</ul>
<p><strong>netconsole</strong><br />
สำหรับส่ง console logging ผ่าน network<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>netfs</strong><br />
เป็น service สำหรับใช้งานดิสก์ (mount) ผ่านทาง network ไม่ว่าจะเป็น NFS, Samba<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>netplugd</strong><br />
ตรวจสอบและเปลี่ยนค่าคอนฟิกของ network interface เมื่อมีการเปลี่ยนแปลงสถานะ<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>network</strong><br />
คอนฟิกค่า IP Address, Subnet mask และอื่นๆ สำหรับการเชื่อมต่อกับ network<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิดเท่านั้น – ยกเว้นคุณต้องการให้เครื่องอยู่อย่างโดดเดี่ยว (standalone) ไม่คุยกับใคร</li>
</ul>
<p><strong>nfs<br />
nfslock</strong><br />
เป็น service เพื่อให้สามารถใช้งานดิสก์ผ่านทาง network แบบ NFS ได้<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด &#8211; ยกเว้นเมื่อต้องการใช้งาน</li>
</ul>
<p><strong>nscd</strong><br />
เก็บค่าสำรอง (cache) สำหรับข้อมูลเช่น password ในการใช้งาน NIS, LDAP<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>pand</strong><br />
รองรับอุปกรณ์ bluetooth<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>pcscd</strong><br />
มีไว้สำหรับรองรับอุปกรณ์ประเภท Smart Card ที่ต่อเชื่อมกับเครื่องโดยตรง<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>psacct</strong><br />
เก็บข้อมูลการใช้งาน process ว่าผู้ใช้งาน ใช้คำสั่ง อะไรบ้าง เมื่อเวลาเท่าไร โดยถ้ารัน service นี้แล้ว เราสามารถใช้คำสั่ง lastcomm เพื่อดูข้อมูลย้อนหลังได้<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – ยกเว้นมีนโยบายในการตรวจสอบจริงๆ</li>
</ul>
<p><strong>rdisc</strong><br />
ไว้สำหรับค้นหา router ที่ต่อเชื่อมกับ network โดยอัตโนมัติ<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – แล้วคอนฟิกเองดีกว่า</li>
</ul>
<p><strong>restorecond</strong><br />
เป็น service สำหรับตรวจสอบสถานะและปรับปรุงคอนฟิกของ SELinux<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด – ถ้าคุณตัดสินใจใช้ SELinux</li>
</ul>
<p><strong>rpcbind</strong><br />
ทำหน้าที่จัดการโปรแกรม NFS, NIS เหมือนกับ portmap<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>rpcgssd<br />
rpcidmapd<br />
rpcsvcgssd</strong><br />
เป็น service สำหรับ NFSv4<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>rsyslog</strong><br />
เป็นโปรแกรมที่ใช้แทนที่ syslog สำหรับเก็บ log ของเครื่อง<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิดเท่านั้น</li>
</ul>
<p><strong>saslauthd</strong><br />
รองรับโปรแกรมที่ใช้แบบ SASL เช่นโปรแกรมประเภท Mail Server<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – แนะนำให้ปิดไว้ก่อน ถ้าจะคอนฟิก Mail Server แล้วค่อยมาเปิดกันอีกที</li>
</ul>
<p><strong>sendmail</strong><br />
โดยคอนฟิกที่มาตอนติดตั้ง จะทำหน้าที่เป็น Mail Server แต่ใช้งานเฉพาะในเครื่องเท่านั้น (localhost, 127.0.0.1) ไม่รองรับการเชื่อมต่อจากเครื่องอื่นๆ บางคนก็แนะนำให้เปิดไว้ เพราะจะมี log บางอย่างเช่น จาก crontab ส่งไปยัง root แต่ถ้าคุณไม่สนใจ log พวกนี้ ก็ปิดไปได้เลย<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>smartd</strong><br />
มีไว้สำหรับตรวจสอบสถานะเช่นอุณหภูมิของฮาร์ดดิสก์ได้ แต่ดิสก์บางรุ่นก็ไม่รองรับ หรืออาจมีปัญหาในการรัน service นี้ได้<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด – สำหรับเครื่องที่ตรวจสอบสถานะได้ แล้วไม่มีปัญหาในการรัน</li>
</ul>
<p><strong>sshd</strong><br />
เป็น service ที่ทำให้เราสามารถที่จะ remote login แบบ Secure Shell เข้าไปในเครื่องได้ โดยใช้โปรแกรมเช่น PuTTY<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด – สำหรับ server</li>
<li>ปิด – สำหรับ notebook, desktop ที่ใช้งานส่วนตัว และไม่ต้องการให้เครื่องอื่น remote เข้ามาได้</li>
</ul>
<p><strong>udev-post</strong><br />
ใช้ตรวจสอบ แก้ไข คอนฟิกของอุปกรณ์ที่มีการเปลี่ยนแปลงได้<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>เปิด</li>
</ul>
<p><strong>winbind</strong><br />
ทำงานร่วมกับ Samba File Sharing<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>wpa_supplicant</strong><br />
เป็น service เพื่อรองรับการเชื่อมต่อกับ Wireless แล้วมีการใช้งานแบบ WPA<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด – สำหรับเครื่องที่ไม่ได้ใช้ Wireless ในการเชื่อมต่อ network</li>
</ul>
<p><strong>ypbind</strong><br />
ทำให้เครื่องเป็น NIS Client<br />
<span style="text-decoration: underline;">คำแนะนำ</span></p>
<ul>
<li>ปิด</li>
</ul>
<p><strong>ข้อมูลอ้างอิง</strong></p>
<ul>
<li> <a href="http://spalinux.com/2008/06/install_minimal_fedora9">ติดตั้ง Fedora 9 แบบประหยัดพื้นที่สุด</a>
<li> <a href="http://spalinux.com/2008/06/disable_unused_service_in_fedora_9">ยกเลิกการรัน service ที่ไม่ใช้ใน Fedora 9</a>
<li> <a href="http://fedoranews.org/mediawiki/index.php/Which_Services_Can_I_Disable%3F">Which Services Can I Disable?</a></li>
<li> <a href="http://www.mjmwired.net/resources/mjm-services-f9.html">Services in Fedora 9</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/06/fedora_9_minimal_service_description/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
