<?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; Firewall</title>
	<atom:link href="http://spalinux.com/category/firewall/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>คอนฟิก 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>แก้ไขคอนฟิก 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>
	</channel>
</rss>
