<?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>How to Config &#187; debian</title>
	<atom:link href="http://www.howtoconfig.com/category/os/debian/feed" rel="self" type="application/rss+xml" />
	<link>http://www.howtoconfig.com</link>
	<description>how to config - how to configure</description>
	<lastBuildDate>Fri, 29 Apr 2011 09:52:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>OpenVPN on UDP 53 &#8211; ไปที่ไหนก็เล่น Net ได้!!!</title>
		<link>http://www.howtoconfig.com/os/debian/openvpn-on-udp-53-%e0%b9%84%e0%b8%9b%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b9%84%e0%b8%ab%e0%b8%99%e0%b8%81%e0%b9%87%e0%b9%80%e0%b8%a5%e0%b9%88%e0%b8%99-net-%e0%b9%84%e0%b8%94%e0%b9%89.html</link>
		<comments>http://www.howtoconfig.com/os/debian/openvpn-on-udp-53-%e0%b9%84%e0%b8%9b%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b9%84%e0%b8%ab%e0%b8%99%e0%b8%81%e0%b9%87%e0%b9%80%e0%b8%a5%e0%b9%88%e0%b8%99-net-%e0%b9%84%e0%b8%94%e0%b9%89.html#comments</comments>
		<pubDate>Mon, 25 Oct 2010 08:07:42 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://www.siambox.com/blog/?p=43</guid>
		<description><![CDATA[สมัยนี้ไปไหนก็มีก็มี Wifi ให้เราใช้งาน ไม่ว่าจะเป็นแบบฟรี หรือ เสียเงิน    วันนี้ผมเอาจุดอ่อน ที่ผู้ให้บริการ Hotspot  มองข้ามคือ การเปิด Any DNS  หรือ การเปิดให้ Client สามารถ Query DNS ข้างน้อกได้ โดยไม่ได้ทำการ Auth      ซึ่ง Wifi หลายๆที่เปิดไว้เพื่อความสะดวก   แต่ตรงนี้แหละเป็นจุดอ่อน  ที่จะทำให้เราสามารถใช้งาน Internet ได้โดยไม่โดนจำกัด Bandwidth สิ่งที่ต้องเตรียม ต้องมี Server ที่เป็น Fix IP ไว้ข้างนอก ติดตั้ง OpenVPN ติดตั้ง Server apt-get install openvpn openvpn --genkey --secret /etc/openvpn/mysecret.key &#160; vi /etc/openvpn/server-udp-53.conf # File /etc/openvpn/server-udp-53.conf dev [...]]]></description>
			<content:encoded><![CDATA[<p>สมัยนี้ไปไหนก็มีก็มี Wifi ให้เราใช้งาน ไม่ว่าจะเป็นแบบฟรี หรือ เสียเงิน    วันนี้ผมเอาจุดอ่อน ที่ผู้ให้บริการ Hotspot  มองข้ามคือ การเปิด Any DNS  หรือ การเปิดให้ Client สามารถ Query DNS ข้างน้อกได้ โดยไม่ได้ทำการ Auth      ซึ่ง Wifi หลายๆที่เปิดไว้เพื่อความสะดวก   แต่ตรงนี้แหละเป็นจุดอ่อน  ที่จะทำให้เราสามารถใช้งาน Internet ได้โดยไม่โดนจำกัด Bandwidth</p>
<p>สิ่งที่ต้องเตรียม</p>
<ol>
<li>ต้องมี Server ที่เป็น Fix IP ไว้ข้างนอก</li>
<li>ติดตั้ง OpenVPN</li>
</ol>
<p>ติดตั้ง Server</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> openvpn
openvpn <span style="color: #660033;">--genkey</span> <span style="color: #660033;">--secret</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>mysecret.key
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>server-udp-<span style="color: #000000;">53</span>.conf</pre></div></div>

<pre># File /etc/openvpn/server-udp-53.conf
dev tap
mode p2p
proto udp
#ping 1
port 53
ifconfig 10.10.10.1 255.255.255.252
secret /etc/openvpn/mysecret.key
tun-mtu 1500
tun-mtu-extra 32
mssfix 1400

push "route 192.168.10.0 255.255.255.0"</pre>
<p>ติดตั้ง Client</p>
<p>Download Client จาก   http://openvpn.net/index.php/openvpn-client.html  และทำการติดตั้ง</p>
<p>Copy file  mysecret.key   มาไว้ในเครื่อง  และสร้างไฟล์ config   โดยใช้ชื่อ     client.ovpn</p>
<pre>#file client.ovpn
dev tap
mode p2p
proto udp
remote &lt;IP Server&gt;
#ping 1
port 53
ifconfig 10.10.30.2 255.255.255.252
secret mysecret.key

tun-mtu 1500
tun-mtu-extra 32
mssfix 1400
ping 5</pre>
<p>แค่นี้ก็สามารถ  Connect VPN ผ่าน  UDP/53 ได้แล้วครับ</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fdebian%2Fopenvpn-on-udp-53-%25e0%25b9%2584%25e0%25b8%259b%25e0%25b8%2597%25e0%25b8%25b5%25e0%25b9%2588%25e0%25b9%2584%25e0%25b8%25ab%25e0%25b8%2599%25e0%25b8%2581%25e0%25b9%2587%25e0%25b9%2580%25e0%25b8%25a5%25e0%25b9%2588%25e0%25b8%2599-net-%25e0%25b9%2584%25e0%25b8%2594%25e0%25b9%2589.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/debian/openvpn-on-udp-53-%e0%b9%84%e0%b8%9b%e0%b8%97%e0%b8%b5%e0%b9%88%e0%b9%84%e0%b8%ab%e0%b8%99%e0%b8%81%e0%b9%87%e0%b9%80%e0%b8%a5%e0%b9%88%e0%b8%99-net-%e0%b9%84%e0%b8%94%e0%b9%89.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Citrix &#8211; Missing gpg key</title>
		<link>http://www.howtoconfig.com/os/debian/citrix-missing-gpg-key.html</link>
		<comments>http://www.howtoconfig.com/os/debian/citrix-missing-gpg-key.html#comments</comments>
		<pubDate>Wed, 20 Oct 2010 18:39:43 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.siambox.com/blog/?p=30</guid>
		<description><![CDATA[วันนี้ติดตั้ง Xen Server  และลง Debian ในเครื่อง  Xen จะทำการ Add  source ของ citrix ให้เองอัตโนมัตติ   แต่เมื่อเราทำการ update  package   จะฟ้อง Error  ว่าไม่พบ GPG key ของ Citrix     เราสามารถติดตั้งได้  ดั่งนี้ server:~# wget -q http://updates.vmd.citrix.com/XenServer/5.5.0/GPG-KEY -O- &#124; apt-key add - แค่นี้เวลาเราสั่ง apt-get ก็จะไม่ฟ้อง error gpg key อีกแล้วครับ]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" style="margin: 10px;" title="Xen Server" src="http://www.citrix.com/site/resources/dynamic/additional/demos/bin/mm/inpg/landing_xenserver.jpg" alt="" width="576" height="198" />วันนี้ติดตั้ง Xen Server  และลง Debian ในเครื่อง  Xen จะทำการ Add  source ของ citrix ให้เองอัตโนมัตติ   แต่เมื่อเราทำการ update  package   จะฟ้อง Error  ว่าไม่พบ GPG key ของ Citrix     เราสามารถติดตั้งได้  ดั่งนี้</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">server:~<span style="color: #666666; font-style: italic;"># wget -q http://updates.vmd.citrix.com/XenServer/5.5.0/GPG-KEY -O- | apt-key add -</span></pre></div></div>

<p>แค่นี้เวลาเราสั่ง apt-get  ก็จะไม่ฟ้อง error gpg key อีกแล้วครับ</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fdebian%2Fcitrix-missing-gpg-key.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/debian/citrix-missing-gpg-key.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speedup Dynamic and Static Content with Nginx</title>
		<link>http://www.howtoconfig.com/os/debian/speedup-dynamic-static-content-nginx.html</link>
		<comments>http://www.howtoconfig.com/os/debian/speedup-dynamic-static-content-nginx.html#comments</comments>
		<pubDate>Sun, 09 May 2010 11:42:03 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Web Server]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=100</guid>
		<description><![CDATA[พูดถึงปัญหาของเว็บใหญ่ๆทั่วไป ก็คงไม่เว็บเรื่องระบบ File System เพราะปัจจุบันมีแค่ NFS เท่านั้นที่ทำการ Share ไฟล์ได้ใน Unix หากจะหันไปให้ SAN หรือ iSCSI ราคาก็แสนแพง เพราะฉนั้นระบบใหญ่แค่ไหนก็มีปัญหาที่ระบบไฟล์ทุกที เราจึงต้องลบ Traffic ที่จะวิ่งไปดึงจาก NFS ให้น้อยที่สุด วันนี้ผมมีอีกทางออกให้คือการแยก Static และ Dynamic Content ออกจากกัน เพราะหากเราแยกได้แล้ว เราสามารถที่จะ Sync Dynamic Content ให้ไปอยู่ใน Local disk ได้หรือ จะทำการเลือกใช้ Web Server ให้เหมาะสมกับระบบที่เราดูแลได้ง่ายขึ้น apt-get install nginx แก้ไขไฟล์ /etc/nginx/nginx.conf user www-data; &#160; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; &#160; worker_processes 16; [...]]]></description>
			<content:encoded><![CDATA[<p>พูดถึงปัญหาของเว็บใหญ่ๆทั่วไป ก็คงไม่เว็บเรื่องระบบ File System  เพราะปัจจุบันมีแค่ NFS เท่านั้นที่ทำการ Share ไฟล์ได้ใน Unix    หากจะหันไปให้ SAN หรือ iSCSI  ราคาก็แสนแพง เพราะฉนั้นระบบใหญ่แค่ไหนก็มีปัญหาที่ระบบไฟล์ทุกที   เราจึงต้องลบ Traffic ที่จะวิ่งไปดึงจาก NFS ให้น้อยที่สุด   วันนี้ผมมีอีกทางออกให้คือการแยก Static และ  Dynamic Content ออกจากกัน  เพราะหากเราแยกได้แล้ว เราสามารถที่จะ Sync Dynamic Content  ให้ไปอยู่ใน Local disk  ได้หรือ จะทำการเลือกใช้ Web Server ให้เหมาะสมกับระบบที่เราดูแลได้ง่ายขึ้น</p>
<p><img src="http://www.howtoconfig.com/content/uploads/2010/05/nginx.jpg" alt="" /><br />
<span id="more-100"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> nginx</pre></div></div>

<p>แก้ไขไฟล์  /etc/nginx/nginx.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user www-data;
&nbsp;
error_log  <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>error.log;
pid        <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>nginx.pid;
&nbsp;
worker_processes  <span style="color: #000000;">16</span>;
worker_rlimit_nofile <span style="color: #000000;">32768</span>;
events <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	worker_connections  <span style="color: #000000;">8192</span>;
	use epoll;
<span style="color: #7a0874; font-weight: bold;">&#125;</span> 
&nbsp;
http <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    include       <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>mime.types;
&nbsp;
    access_log	<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>access.log;
&nbsp;
    sendfile			on;
    <span style="color: #666666; font-style: italic;">#tcp_nopush		on;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">#keepalive_timeout	 0;</span>
    keepalive_timeout	<span style="color: #000000;">65</span>;
    tcp_nodelay		on;
&nbsp;
    <span style="color: #c20cb9; font-weight: bold;">gzip</span>			on;
&nbsp;
    include <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/*</span>.conf;
    include <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sites-enabled<span style="color: #000000; font-weight: bold;">/*</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>แก้ไขไฟล์   สร้างไฟล์ /etc/nginx/site-enable/default</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">upstream pool_dynamic <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	server 192.168.1.11:<span style="color: #000000;">80</span>;
	server 192.168.1.12:<span style="color: #000000;">80</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
upstream pool_static <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	server 192.168.1.11:<span style="color: #000000;">80</span>;
	server 192.168.1.12:<span style="color: #000000;">80</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
server <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	listen   <span style="color: #000000;">80</span>;
	server_name  _;
&nbsp;
	<span style="color: #666666; font-style: italic;">#access_log /var/log/nginx/localhost.access.log;</span>
	access_log	off;
&nbsp;
	location <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
		proxy_pass		http:<span style="color: #000000; font-weight: bold;">//</span>pool_dynamic;
		include		<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>proxy.conf;
		access_log		<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>dynamic.access.log;
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
	location ~<span style="color: #000000; font-weight: bold;">*</span> ^.+.<span style="color: #7a0874; font-weight: bold;">&#40;</span>jpg<span style="color: #000000; font-weight: bold;">|</span>jpeg<span style="color: #000000; font-weight: bold;">|</span>gif<span style="color: #000000; font-weight: bold;">|</span>png<span style="color: #000000; font-weight: bold;">|</span>ico<span style="color: #000000; font-weight: bold;">|</span>css<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">zip</span><span style="color: #000000; font-weight: bold;">|</span>tgz<span style="color: #000000; font-weight: bold;">|</span>gz<span style="color: #000000; font-weight: bold;">|</span>rar<span style="color: #000000; font-weight: bold;">|</span>bz2<span style="color: #000000; font-weight: bold;">|</span>doc<span style="color: #000000; font-weight: bold;">|</span>xls<span style="color: #000000; font-weight: bold;">|</span>exe<span style="color: #000000; font-weight: bold;">|</span>pdf<span style="color: #000000; font-weight: bold;">|</span>ppt<span style="color: #000000; font-weight: bold;">|</span>txt<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">tar</span><span style="color: #000000; font-weight: bold;">|</span>mid<span style="color: #000000; font-weight: bold;">|</span>midi<span style="color: #000000; font-weight: bold;">|</span>wav<span style="color: #000000; font-weight: bold;">|</span>bmp<span style="color: #000000; font-weight: bold;">|</span>rtf<span style="color: #000000; font-weight: bold;">|</span>js<span style="color: #000000; font-weight: bold;">|</span>swf<span style="color: #000000; font-weight: bold;">|</span>wma<span style="color: #000000; font-weight: bold;">|</span>wmv<span style="color: #7a0874; font-weight: bold;">&#41;</span>$ <span style="color: #7a0874; font-weight: bold;">&#123;</span>
		proxy_pass		http:<span style="color: #000000; font-weight: bold;">//</span>pool_static;
		include		<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>proxy.conf;
		<span style="color: #666666; font-style: italic;">#access_log	/var/log/nginx/static.access.log;</span>
		access_log		off;
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
	location ~ <span style="color: #000000; font-weight: bold;">/</span>\.ht <span style="color: #7a0874; font-weight: bold;">&#123;</span>
		deny  all;
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
	location <span style="color: #000000; font-weight: bold;">/</span>nginx_status <span style="color: #7a0874; font-weight: bold;">&#123;</span>
		<span style="color: #666666; font-style: italic;"># copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/</span>
		stub_status	on;
		access_log		off;
		allow			all;
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>สร้างไฟล์ /etc/nginx/proxy.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">proxy_redirect			off;
proxy_set_header		Host <span style="color: #007800;">$host</span>;
proxy_set_header		X-Real-IP <span style="color: #007800;">$remote_addr</span>;
proxy_set_header		X-Forwarded-For <span style="color: #007800;">$proxy_add_x_forwarded_for</span>;
client_max_body_size		10m;
client_body_buffer_size	128k;
proxy_connect_timeout	<span style="color: #000000;">90</span>;
proxy_send_timeout		<span style="color: #000000;">90</span>;
proxy_read_timeout		<span style="color: #000000;">90</span>;
proxy_buffer_size		4k;
proxy_buffers			<span style="color: #000000;">4</span> 32k;
proxy_busy_buffers_size	64k;
proxy_temp_file_write_size	64k;</pre></div></div>

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fdebian%2Fspeedup-dynamic-static-content-nginx.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/debian/speedup-dynamic-static-content-nginx.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD tip: SUDO Email alert</title>
		<link>http://www.howtoconfig.com/os/ubuntu/freebsdscurity_sudo_email_alert.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/freebsdscurity_sudo_email_alert.html#comments</comments>
		<pubDate>Sun, 09 May 2010 10:56:51 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=98</guid>
		<description><![CDATA[แนวคิดคือ Server ที่เราดูแลมี System Admin หลายคนที่สามารถ Access เป็น Root ได้ แล้วเราจะรู้ได้ไงว่า ใคร Login เข้าไปยัง Server ทางออกของผมคือ Allow User ที่ sshd ให้มีแค่ admin เท่านั้นที่เข้าได้ และให้ sudo เป็น root และจะมีอีเมล์แจ้งเตือนมายัง ผู้ดูแล เพื่อทราบว่าเข้าไปทำอะไร 1. sshd ให้แก้ไขไฟล์ /etc/ssh/sshd_config เพิ่ม AllowUsers เช่น AllowUsers auttasak 2. แก้ไข /usr/local/etc/sudoers ดั่งนี้ Defaults mailto=admin@domain.com,mail_always root ALL=(ALL) ALL auttasak ALL=(ALL) NOPASSWD: ALL หลังจากนั้นให้ทำการ Restart SSH [...]]]></description>
			<content:encoded><![CDATA[<p>แนวคิดคือ Server ที่เราดูแลมี System Admin หลายคนที่สามารถ Access เป็น Root ได้  แล้วเราจะรู้ได้ไงว่า ใคร Login เข้าไปยัง Server    ทางออกของผมคือ Allow User ที่ sshd  ให้มีแค่ admin เท่านั้นที่เข้าได้ และให้ sudo เป็น root   และจะมีอีเมล์แจ้งเตือนมายัง ผู้ดูแล เพื่อทราบว่าเข้าไปทำอะไร</p>
<p>1. sshd   ให้แก้ไขไฟล์ /etc/ssh/sshd_config  เพิ่ม          AllowUsers     เช่น<br />
AllowUsers auttasak</p>
<p>2. แก้ไข  /usr/local/etc/sudoers ดั่งนี้</p>
<p>Defaults mailto=admin@domain.com,mail_always<br />
root            ALL=(ALL) ALL<br />
auttasak      ALL=(ALL) NOPASSWD: ALL</p>
<p>หลังจากนั้นให้ทำการ Restart SSH ครับ     เมื่อใดที่มีคน sudo จะมีอีเมล์แจ้งไปยัง  admin@domain.com    แบบนี้ทำให้เราทราบได้ว่ามีคน sudo เป็น root เมื่อใดบ้าง</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Ffreebsdscurity_sudo_email_alert.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/freebsdscurity_sudo_email_alert.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPTables statefull firewall for Linux</title>
		<link>http://www.howtoconfig.com/os/ubuntu/iptables_statefull_firewall_linux_debian_centos.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/iptables_statefull_firewall_linux_debian_centos.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 11:04:18 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[INPUT]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=87</guid>
		<description><![CDATA[หายไปนานครับ วันี้เอาเรื่องเก่าๆมาหากินใหม่ IPTables ที่ทำๆอยู่ทุกวันนี้แหละครับ พอดีทำ Shell Script ทิ้งไว้เลยเอามาแจกจ่ายให้เพื่อนๆเอาไปใช้งาน หลายๆคนถามว่าทำไมต้องเขียนเอง ก็เหตุผลง่ายๆครับ เราเขียนเองเรารู้ทุกๆ rules ที่มันทำงานอย่างไร เวลาเกิดปัญหา เราสามารถแก้ไขปัญหาได้ รวดเร็ว มาดูความสามารถของ script firewall ตัวนี้ครับ ความสามารถ: &#8211; State full firewall &#8211; สามารถกำหนด Interface ที่ทำงานได้ &#8211; สามารถกำหนด VIP IP ได้ &#8211; สามารถกำหนด Band IP ได้ &#8211; มีการเก็บ Log ลง syslog &#8211; ป้องกันการ Scan port ได้ &#8211; ป้องกัน IP Spoofig &#8211; ป้องกัน [...]]]></description>
			<content:encoded><![CDATA[<p>     หายไปนานครับ วันี้เอาเรื่องเก่าๆมาหากินใหม่ IPTables ที่ทำๆอยู่ทุกวันนี้แหละครับ พอดีทำ Shell Script ทิ้งไว้เลยเอามาแจกจ่ายให้เพื่อนๆเอาไปใช้งาน   หลายๆคนถามว่าทำไมต้องเขียนเอง   ก็เหตุผลง่ายๆครับ   เราเขียนเองเรารู้ทุกๆ rules ที่มันทำงานอย่างไร เวลาเกิดปัญหา เราสามารถแก้ไขปัญหาได้ รวดเร็ว  มาดูความสามารถของ script firewall ตัวนี้ครับ</p>
<p>ความสามารถ:<br />
  &#8211; State full  firewall<br />
  &#8211; สามารถกำหนด Interface ที่ทำงานได้<br />
  &#8211; สามารถกำหนด VIP IP ได้<br />
  &#8211; สามารถกำหนด Band IP ได้<br />
  &#8211; มีการเก็บ Log ลง syslog<br />
  &#8211; ป้องกันการ Scan port ได้<br />
  &#8211; ป้องกัน IP Spoofig<br />
  &#8211; ป้องกัน SSH Attatch<br />
<span id="more-87"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># rc.firewall - Initial IP Firewall</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #007800;">INET_IFACE</span>=<span style="color: #ff0000;">&quot;eth0&quot;</span>
<span style="color: #007800;">IPTABLES</span>=<span style="color: #ff0000;">&quot;/sbin/iptables&quot;</span>
&nbsp;
<span style="color: #007800;">IP_ALLOW</span>=<span style="color: #ff0000;">&quot;61.19.249.66&quot;</span>
<span style="color: #007800;">IP_BAND</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">ICMP_ALLOW</span>=<span style="color: #ff0000;">&quot;0 3 5 11&quot;</span>
<span style="color: #007800;">TCP_ALLOW</span>=<span style="color: #ff0000;">&quot;22 25 53 80 8000 90 3128 20001&quot;</span> 
<span style="color: #007800;">UDP_ALLOW</span>=<span style="color: #ff0000;">&quot;53&quot;</span>
&nbsp;
<span style="color: #007800;">FTP_PORT</span>=<span style="color: #ff0000;">&quot;1024:65335&quot;</span>
<span style="color: #007800;">FTP_ENABLE</span>=<span style="color: #000000;">1</span>
&nbsp;
&nbsp;
<span style="color: #007800;">SSH_ATTACH</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">SSH_HITCOUNT</span>=<span style="color: #000000;">5</span>
<span style="color: #007800;">SSH_PORT</span>=<span style="color: #000000;">22</span>
&nbsp;
<span style="color: #007800;">PORTSCAN_CHECK</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">SPOOFINGIP_CHECK</span>=<span style="color: #000000;">1</span>
&nbsp;
<span style="color: #007800;">LOGLEVEL</span>=<span style="color: #ff0000;">&quot;DEBUG&quot;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Load IPTables Modules</span>
<span style="color: #666666; font-style: italic;">#</span>
modprobe ip_conntrack
modprobe ip_conntrack_ftp
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Reset IPTables</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-F</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-F</span> <span style="color: #660033;">-t</span> nat
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-X</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-X</span> <span style="color: #660033;">-t</span> nat
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Create separate chains for ICMP, TCP and UDP to traverse</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> vip_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> band_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> icmp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> tcp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> udp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> log_attach
&nbsp;
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> DROP_TRAFFIC
&nbsp;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Drop packet</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> DROP_TRAFFIC <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-j</span> REJECT <span style="color: #660033;">--reject-with</span> tcp-reset 
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> DROP_TRAFFIC <span style="color: #660033;">-p</span> UDP <span style="color: #660033;">-j</span> REJECT <span style="color: #660033;">--reject-with</span> icmp-port-unreachable
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Log Attack</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> log_attach <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;Attack:&quot;</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> log_attach <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># VIP IPaddress</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> ip <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$IP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> vip_packets <span style="color: #660033;">-s</span> <span style="color: #007800;">$ip</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Band IPaddress</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> ip <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$IP_BAND</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> band_packets <span style="color: #660033;">-s</span> <span style="color: #007800;">$ip</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># ICMP rules</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> icmp <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$ICMP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> icmp_packets <span style="color: #660033;">-p</span> ICMP <span style="color: #660033;">-s</span> <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> <span style="color: #660033;">--icmp-type</span> <span style="color: #007800;">$icmp</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># TCP rules</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> port <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TCP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> tcp_packets <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-s</span> <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$port</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># UDP rules</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> port <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$UDP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> udp_packets <span style="color: #660033;">-p</span> UDP <span style="color: #660033;">-s</span> <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$port</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># INPUT chain</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> ALL <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> ESTABLISHED,RELATED <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">--syn</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">-j</span> log_attach
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Rules for incoming packets from the internet</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SPOOFINGIP_CHECK</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> spoofing_check
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 10.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 169.254.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 172.16.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">12</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 127.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 224.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 224.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 240.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 240.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 0.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 0.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 239.255.255.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 255.255.255.255 <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> spoofing_check
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SSH_ATTACH</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> sshattach_check
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> sshattach_check <span style="color: #660033;">-m</span> recent <span style="color: #660033;">--set</span> <span style="color: #660033;">--name</span> SSH
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> sshattach_check <span style="color: #660033;">-m</span> recent <span style="color: #660033;">--update</span> <span style="color: #660033;">--seconds</span> <span style="color: #000000;">60</span> <span style="color: #660033;">--hitcount</span> <span style="color: #007800;">$SSH_HITCOUNT</span> <span style="color: #660033;">--name</span> SSH <span style="color: #660033;">-j</span> log_attach
&nbsp;
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #007800;">$SSH_PORT</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">-j</span> sshattach_check
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Port scan</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PORTSCAN_CHECK</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> check-flags
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL FIN,URG,PSH <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;NMAP:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL FIN,URG,PSH <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL ALL <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;XMAS:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL ALL <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL SYN,RST,ACK,FIN,URG <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;XMAS-PSH:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL SYN,RST,ACK,FIN,URG <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL NONE <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;NULL_SCAN:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL NONE <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,RST SYN,RST <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;SYN/RST:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,RST SYN,RST <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,FIN SYN,FIN <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;SYN/FIN:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,FIN SYN,FIN <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> check-flags
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$FTP_ENABLE</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #666666; font-style: italic;">#Allow FTP traffic (Control)</span>
        iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">21</span> <span style="color: #660033;">-j</span> ACCEPT
        iptables <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #000000;">21</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
        <span style="color: #666666; font-style: italic;">#Allow FTP traffic (Data)</span>
        iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">20</span> <span style="color: #660033;">-j</span> ACCEPT
        iptables <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #000000;">20</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> vip_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> band_packets
&nbsp;
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> ICMP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> icmp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> tcp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> UDP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> udp_packets
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># Default policy</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC</pre></div></div>

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fiptables_statefull_firewall_linux_debian_centos.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/iptables_statefull_firewall_linux_debian_centos.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SSH โดยไม่ต้องใส่รหัสผ่าน</title>
		<link>http://www.howtoconfig.com/os/ubuntu/ssh-login-without-password.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/ssh-login-without-password.html#comments</comments>
		<pubDate>Fri, 16 Jan 2009 12:30:01 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[*BSD]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[รหัสผ่าน]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=57</guid>
		<description><![CDATA[สำหรับผู้ดูแลระบบที่มีความจำเป็นต้องใช้งาน Remote Login ผ่าน OpenSSH Client อยู่เป็นประจำไม่ว่าจะใช้งานบน Linux, *BSD, Mac OS X คงจะเกิดอาการเบื่อไม่น้อยที่ต้องพิมพ์ Password ทุกๆ ครั้งที่ต้องการจะ Login (ไม่นับ Password จำพวก 123456 นะครับ) ทางออกสำหรับผู้ที่ต้องการ Login โดยไม่ต้องพิมพ์ Password แถมยังคงความปลอดภัยตามแบบฉบับของ OpenSSH สามารถทำได้ตามวิธีดังต่อไปนี้ครับ ระบบที่ทำการทดสอบ - OpenSSH Client บน Mac OS X 10.5.6 - OpenSSH Server บน Ubuntu 8.04 ขั้นตอนแรก ทำการสร้าง keys สำหรับยืนยันตัวตนระหว่าง Client และ Server (ทำบนเครื่อง Client ในที่นี้คือ Mac [...]]]></description>
			<content:encoded><![CDATA[<p>สำหรับผู้ดูแลระบบที่มีความจำเป็นต้องใช้งาน Remote Login ผ่าน OpenSSH Client อยู่เป็นประจำไม่ว่าจะใช้งานบน Linux, *BSD, Mac OS X คงจะเกิดอาการเบื่อไม่น้อยที่ต้องพิมพ์ Password ทุกๆ ครั้งที่ต้องการจะ Login (ไม่นับ Password จำพวก 123456 นะครับ) ทางออกสำหรับผู้ที่ต้องการ Login โดยไม่ต้องพิมพ์ Password แถมยังคงความปลอดภัยตามแบบฉบับของ OpenSSH สามารถทำได้ตามวิธีดังต่อไปนี้ครับ</p>
<p>ระบบที่ทำการทดสอบ<br />
- OpenSSH Client บน Mac OS X 10.5.6<br />
- OpenSSH Server บน Ubuntu 8.04</p>
<p>ขั้นตอนแรก ทำการสร้าง keys สำหรับยืนยันตัวตนระหว่าง Client และ Server (ทำบนเครื่อง Client ในที่นี้คือ Mac OS X)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/UserA/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/UserA/.ssh/id_rsa.
Your public key has been saved in /Users/UserA/.ssh/id_rsa.pub.
The key fingerprint is:
a4:74:0b:bc:2f:d1:f5:c7:4e:90:51:7f:f4:45:84:a0 UserA@MacClient</pre></div></div>

<p><span id="more-57"></span></p>
<p>ขั้นตอนต่อไป ใช้ ssh สร้าง directory ~/.ssh บน Server ปลายทาง (ทำบน Client ได้เลย โดยผ่าน ssh)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> UserA<span style="color: #000000; font-weight: bold;">@</span>UbuntuServer <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> .ssh</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ ssh UserA@UbuntuServer mkdir -p .ssh
UserA@vmtuserver's password:</pre></div></div>

<p>ขั้นตอนสุดท้าย ทำการเพิ่ม Public keys ที่สร้างขึ้นในขั้นตอนแรกไปยังไฟล์ ~/.ssh/authorized_keys บน Server ปลายทาง (ทำบน Client โดยผ่าน ssh เช่นเคย)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">cat</span> .ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> UserA<span style="color: #000000; font-weight: bold;">@</span>UbuntuServer <span style="color: #ff0000;">'cat &amp;gt;&amp;gt; .ssh/authorized_keys'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ cat .ssh/id_rsa | ssh UserA@UbuntuServer 'cat &amp;gt;&amp;gt; .ssh/authorized_keys'
UserA@vmtuserver's password:</pre></div></div>

<p>ทำการทดสอบ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> UserA<span style="color: #000000; font-weight: bold;">@</span>UbuntuServer</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ ssh UserA@UbuntuServer
Linux UbuntuServer 2.6.24-19-server #1 SMP Wed Jun 18 15:18:00 UTC 2008 i686
&nbsp;
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
&nbsp;
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
&nbsp;
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
You have mail.
Last login: Tue Jan 13 00:14:19 2009 from MacClient
UserA@UbuntuServer:~$</pre></div></div>

<p>*สามารถเพิ่ม Public keys ที่สร้างขึ้นไปยัง User ใดๆ ก็ได้ ไม่จำเป็นต้องมีชื่อเหมือนกับ User ที่มีอยู่บน Client</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fssh-login-without-password.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/ssh-login-without-password.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>วิธีตรวจสอบ Linux / Unix distribution version</title>
		<link>http://www.howtoconfig.com/os/ubuntu/how-to-check-linux-unix-distribution-version.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/how-to-check-linux-unix-distribution-version.html#comments</comments>
		<pubDate>Fri, 16 Jan 2009 12:10:15 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[*BSD]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[Distribution]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=53</guid>
		<description><![CDATA[กรณีที่ผู้ดูแลระบบได้รับมอบหมายให้ดูแล server ที่ตนเองไม่ได้ติดตั้ง คงจะอยากรู้ว่า Linux / Unix server ที่ใช้อยู่เป็น version อะไร &#8230; สามารถตรวจสอบได้จากคำสั่งต่อไปนี้ครับ cat /proc/version ได้ Output ประมาณนี้ครับ Linux version 2.6.27-9-generic &#40;buildd@rothera&#41; &#40;gcc version 4.3.2 &#40;Ubuntu 4.3.2-1ubuntu11&#41; &#41; #1 SMP Thu Nov 20 21:57:00 UTC 200 หรือดู version ในไฟล์ /etc/issue (issue &#8211; pre-login message and identification file) cat /etc/issue ได้ Output ประมาณนี้ครับ Ubuntu 8.10 \n [...]]]></description>
			<content:encoded><![CDATA[<p>กรณีที่ผู้ดูแลระบบได้รับมอบหมายให้ดูแล server ที่ตนเองไม่ได้ติดตั้ง คงจะอยากรู้ว่า Linux / Unix server ที่ใช้อยู่เป็น version อะไร &#8230;<br />
สามารถตรวจสอบได้จากคำสั่งต่อไปนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>version</pre></div></div>

<p>ได้ Output ประมาณนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Linux version 2.6.27-<span style="color: #000000;">9</span>-generic <span style="color: #7a0874; font-weight: bold;">&#40;</span>buildd<span style="color: #000000; font-weight: bold;">@</span>rothera<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">gcc</span> version 4.3.2 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Ubuntu 4.3.2-1ubuntu11<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;">#1 SMP Thu Nov 20 21:57:00 UTC 200</span></pre></div></div>

<p>หรือดู version ในไฟล์ /etc/issue<br />
(issue &#8211; pre-login message and identification file)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>issue</pre></div></div>

<p>ได้ Output ประมาณนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Ubuntu <span style="color: #000000;">8.10</span> \n \l</pre></div></div>

<p>* ทดสอบบน Ubuntu 8.10</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fhow-to-check-linux-unix-distribution-version.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/how-to-check-linux-unix-distribution-version.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenVPN on Debian</title>
		<link>http://www.howtoconfig.com/os/debian/openvpn-on-debian.html</link>
		<comments>http://www.howtoconfig.com/os/debian/openvpn-on-debian.html#comments</comments>
		<pubDate>Thu, 15 Jan 2009 16:43:25 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=50</guid>
		<description><![CDATA[สวัสดีอีกครั้งครับหลังจากหายหน้าหายตาไปนาน จริงๆก็ไม่ได้ไปไหนแค่หลังๆมางานที่ office ค่อนข้างมากแล้วผมเองก็ไปเที่ยวสะบ่อยๆ เลยไม่ค่อยได้มาเขียนบทความให้อ่านกัน   วันนี้เป็นเรื่องการทำ VPN  โดยใช้ OpenVPN    ทำไมต้องเป็น OpenVPN  สาเหตุของผมคือ ผมเองต้องติดตั้งระบบ Auth System (Radius + Chillispot + Syslog-ng)    แต่ละที่ดันเป็น Dynamic IP หมด  เวลาจะแก้ไขอะไรก็ต้องไป set router    ซึ่งมันไม่ใช่ทางเลือกที่ดีเลย    ทางแก้ผมเลย set up ที่ Center แล้วให้ Site แต่ละที่ทำการสร้าง VPN Connection ไปยัง Center Server# apt-get install openvpn Server# vi /etc/openvpn/server.conf # ไฟล์ /etc/openvpn/server.conf dev tap0 proto tcp-server ping [...]]]></description>
			<content:encoded><![CDATA[<p>สวัสดีอีกครั้งครับหลังจากหายหน้าหายตาไปนาน จริงๆก็ไม่ได้ไปไหนแค่หลังๆมางานที่ office ค่อนข้างมากแล้วผมเองก็ไปเที่ยวสะบ่อยๆ เลยไม่ค่อยได้มาเขียนบทความให้อ่านกัน   วันนี้เป็นเรื่องการทำ VPN  โดยใช้ OpenVPN    ทำไมต้องเป็น OpenVPN  สาเหตุของผมคือ ผมเองต้องติดตั้งระบบ Auth System (Radius + Chillispot + Syslog-ng)    แต่ละที่ดันเป็น Dynamic IP หมด  เวลาจะแก้ไขอะไรก็ต้องไป set router    ซึ่งมันไม่ใช่ทางเลือกที่ดีเลย    ทางแก้ผมเลย set up ที่ Center แล้วให้ Site แต่ละที่ทำการสร้าง VPN Connection ไปยัง Center</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Server<span style="color: #666666; font-style: italic;"># apt-get install openvpn</span>
Server<span style="color: #666666; font-style: italic;"># vi /etc/openvpn/server.conf</span></pre></div></div>

<p># ไฟล์ /etc/openvpn/server.conf</p>
<pre>
dev tap0
proto tcp-server
ping 1
ping-restart 5
port 10000
ifconfig 10.10.10.1 255.255.255.0
</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Client<span style="color: #666666; font-style: italic;"># apt-get install openvpn</span>
Client<span style="color: #666666; font-style: italic;"># vi /etc/openvpn/client.conf</span></pre></div></div>

<p># ไฟล์ /etc/openvpn/server.conf</p>
<pre>
dev tap0
proto tcp-client
ping 1
ping-restart 5
port 10003
ifconfig 10.10.10.2 255.255.255.0
remote 203.1.1.1
</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Server<span style="color: #666666; font-style: italic;"># /etc/init.d/openvpn start</span>
Client<span style="color: #666666; font-style: italic;"># /etc/init.d/openvpn start</span></pre></div></div>

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fdebian%2Fopenvpn-on-debian.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/debian/openvpn-on-debian.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check Transparent Proxy</title>
		<link>http://www.howtoconfig.com/os/debian/check-transparent-proxy.html</link>
		<comments>http://www.howtoconfig.com/os/debian/check-transparent-proxy.html#comments</comments>
		<pubDate>Mon, 01 Sep 2008 05:18:35 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[Transparent]]></category>
		<category><![CDATA[TransparentProxy]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=43</guid>
		<description><![CDATA[คือมี case ที่ต้องทำ transparent proxy ครับ  แต่ว่าเวลา proxy มีปัญหา ผมอยากให้ทำการ ปลด proxy ออกเอง  ผมเลยเขียน shell script  มาเพื่อทำการ ตรวจสอบว่า proxy ทำได้หรือเปล่า ถ้าทำงานได้ ก็จะเพิ่ม iptables  ทำการสร้าง DNAT  ไปยังเครื่อง Proxy ครับ หลักกาารง่ายๆคือ  จะใช้ curl แล้ว set proxy เป็นเครื่อง Proxy ที่เรากำหนด   เสร็จแล้วก็ให้ curl ทำการ connect ไปยัง web ปลายทาง   ถ้า connect ได้ content ที่ return มาจาก curl จะมากกว่า 0    และทำให้ [...]]]></description>
			<content:encoded><![CDATA[<p>คือมี case ที่ต้องทำ transparent proxy ครับ  แต่ว่าเวลา proxy มีปัญหา ผมอยากให้ทำการ ปลด proxy ออกเอง  ผมเลยเขียน shell script  มาเพื่อทำการ ตรวจสอบว่า proxy ทำได้หรือเปล่า ถ้าทำงานได้ ก็จะเพิ่ม iptables  ทำการสร้าง DNAT  ไปยังเครื่อง Proxy ครับ</p>
<p><span id="more-43"></span></p>
<p>หลักกาารง่ายๆคือ  จะใช้ curl แล้ว set proxy เป็นเครื่อง Proxy ที่เรากำหนด   เสร็จแล้วก็ให้ curl ทำการ connect ไปยัง web ปลายทาง   ถ้า connect ได้ content ที่ return มาจาก curl จะมากกว่า 0    และทำให้ script เพิ่ม iptables  เข้าไปครับผม</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#	Check Proxy	v.10</span>
<span style="color: #666666; font-style: italic;">#	By Auttasak Wongkitta</span>
<span style="color: #666666; font-style: italic;">#	http://howtoconfig.com</span>
&nbsp;
<span style="color: #007800;">PROXY</span>=<span style="color: #ff0000;">&quot;192.168.100.254:3128&quot;</span>
<span style="color: #007800;">URL</span>=<span style="color: #ff0000;">&quot;http://manager.co.th&quot;</span>
<span style="color: #007800;">LINUX_IP</span>=<span style="color: #ff0000;">&quot;192.168.100.254&quot;</span>
<span style="color: #007800;">LINUX_IF</span>=<span style="color: #ff0000;">&quot;eth2.1&quot;</span>
&nbsp;
<span style="color: #007800;">RESULT</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>curl <span style="color: #660033;">-x</span> <span style="color: #007800;">$PROXY</span>  <span style="color: #007800;">$URL</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -l<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">USEPROXY</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-L</span> PREROUTING <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #007800;">$PROXY</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -l<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RESULT</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$USEPROXY</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-D</span> PREROUTING <span style="color: #660033;">-i</span> <span style="color: #007800;">$LINUX_IF</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #007800;">$LINUX_IP</span> <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> http <span style="color: #660033;">-j</span> DNAT <span style="color: #660033;">--to</span> <span style="color: #007800;">$PROXY</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$USEPROXY</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-A</span> PREROUTING <span style="color: #660033;">-i</span> <span style="color: #007800;">$LINUX_IF</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #007800;">$LINUX_IP</span> <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> http <span style="color: #660033;">-j</span> DNAT <span style="color: #660033;">--to</span> <span style="color: #007800;">$PROXY</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fdebian%2Fcheck-transparent-proxy.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/debian/check-transparent-proxy.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>พรบ. การกระทำความผิดเกี่ยวกับคอมพิวเตอร์ &#8211; Revert Proxy Log Rotate</title>
		<link>http://www.howtoconfig.com/os/debian/revert_proxy_log_rotate.html</link>
		<comments>http://www.howtoconfig.com/os/debian/revert_proxy_log_rotate.html#comments</comments>
		<pubDate>Sat, 23 Aug 2008 19:19:50 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Log]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Revert]]></category>
		<category><![CDATA[Rotate]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[พรบ]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=39</guid>
		<description><![CDATA[ตามที่ พรบ  ได้กำหนดให้ &#8220;ผู้ให้บริการ&#8221; เก็บ log การใช้บริการ   โชคดีที่ผมมี Revert Proxy วางไว้หน้า Web Server  ทำให้สามารถเก็บ Log ได้ง่ายหน่อย   ตัว script ที่ผมเขียนนี้ จะทำการ rotate log และ compress log ไว้    ใน version ต่อไป จะทำการ ftp ไปไว้ยัง Log Server  อื่น แทนครับ #!/bin/sh # #    Howtoconfig.com #    Squid Log Rotate v0.1 #    By Mr. Auttasak Wongkitta &#160; SQUID_CONF=&#34;/etc/squid/squid.conf&#34; COMPRESS=yes LOG=&#34;/var/log/backup_log&#34; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>ตามที่ พรบ  ได้กำหนดให้ &#8220;ผู้ให้บริการ&#8221; เก็บ log การใช้บริการ   โชคดีที่ผมมี Revert Proxy วางไว้หน้า Web Server  ทำให้สามารถเก็บ Log ได้ง่ายหน่อย   ตัว script ที่ผมเขียนนี้ จะทำการ rotate log และ compress log ไว้    ใน version ต่อไป จะทำการ ftp ไปไว้ยัง Log Server  อื่น แทนครับ <img src='http://www.howtoconfig.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<span id="more-39"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#    Howtoconfig.com</span>
<span style="color: #666666; font-style: italic;">#    Squid Log Rotate v0.1</span>
<span style="color: #666666; font-style: italic;">#    By Mr. Auttasak Wongkitta</span>
&nbsp;
<span style="color: #007800;">SQUID_CONF</span>=<span style="color: #ff0000;">&quot;/etc/squid/squid.conf&quot;</span>
<span style="color: #007800;">COMPRESS</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">LOG</span>=<span style="color: #ff0000;">&quot;/var/log/backup_log&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">###############################</span>
<span style="color: #007800;">DATE</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">&quot;+%Y%m%d-%H&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">HOSTNAME</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">hostname</span> -s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">SQUID_PATH</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">whereis</span> squid <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #007800;">SQUID_LOG</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$SQUID_CONF</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^access_log&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$SQUID_LOG</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; * Error : access_log not found!!!&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #007800;">SQUID_LOG_NEW</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$SQUID_LOG</span>-<span style="color: #007800;">$HOSTNAME</span>-<span style="color: #007800;">$DATE</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">###############################</span>
Log<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #7a0874; font-weight: bold;">local</span> LogText;
<span style="color: #007800;">LogText</span>=<span style="color: #ff0000;">&quot;$@&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%d/%m/%y %T&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>  <span style="color: #ff0000;">&quot;   &quot;</span> <span style="color: #007800;">$LogText</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$LOG</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #666666; font-style: italic;">###############################</span>
<span style="color: #666666; font-style: italic;">###############################</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
Log <span style="color: #ff0000;">&quot;--------------------------------------------&quot;</span>
Log <span style="color: #ff0000;">&quot;Squid log rotate - startup&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
Log <span style="color: #ff0000;">&quot;Rotate Log&quot;</span>
<span style="color: #007800;">$SQUID_PATH</span> <span style="color: #660033;">-k</span> rotate
Log <span style="color: #ff0000;">&quot;done&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
Log <span style="color: #ff0000;">&quot;Loop check <span style="color: #007800;">$SQUID_LOG</span>.0&quot;</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$SQUID_LOG</span>.0 <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>;
<span style="color: #000000; font-weight: bold;">done</span>
Log <span style="color: #ff0000;">&quot;done&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
Log <span style="color: #ff0000;">&quot;Move <span style="color: #007800;">$SQUID_LOG</span>.0 <span style="color: #007800;">$SQUID_LOG_NEW</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$SQUID_LOG</span>.0 <span style="color: #007800;">$SQUID_LOG_NEW</span>
Log <span style="color: #ff0000;">&quot;done&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$SQUID_LOG_NEW</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
Log <span style="color: #ff0000;">&quot;MD5 Sum : <span style="color: #007800;">$SQUID_LOG_NEW</span>&quot;</span>
<span style="color: #007800;">SQUID_MD5</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>md5sum <span style="color: #007800;">$SQUID_LOG_NEW</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Log <span style="color: #ff0000;">&quot;Checksum : <span style="color: #007800;">$SQUID_MD5</span>&quot;</span>
Log <span style="color: #ff0000;">&quot;done&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$COMPRESS</span>==<span style="color: #ff0000;">'yes'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
Log <span style="color: #ff0000;">&quot;Compress log <span style="color: #007800;">$SQUID_LOG_NEW</span>&quot;</span>
<span style="color: #007800;">SIZE_OLD</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-sh</span> <span style="color: #007800;">$SQUID_LOG_NEW</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> jpcf <span style="color: #007800;">$SQUID_LOG_NEW</span>.tar.bz2 <span style="color: #007800;">$SQUID_LOG_NEW</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<span style="color: #007800;">SIZE_NEW</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-sh</span> <span style="color: #007800;">$SQUID_LOG_NEW</span>.tar.bz2 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Log <span style="color: #ff0000;">&quot;Compress from <span style="color: #007800;">$SIZE_OLD</span> -&amp;gt; <span style="color: #007800;">$SIZE_NEW</span>&quot;</span>
Log <span style="color: #ff0000;">&quot;done&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$SQUID_LOG_NEW</span>.tar.bz2 <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
Log <span style="color: #ff0000;">&quot;Remove file : <span style="color: #007800;">$SQUID_LOG_NEW</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$SQUID_LOG_NEW</span>
Log <span style="color: #ff0000;">&quot;done&quot;</span>
Log <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
Log <span style="color: #ff0000;">&quot;&quot;</span>
Log <span style="color: #ff0000;">&quot;End&quot;</span></pre></div></div>

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fdebian%2Frevert_proxy_log_rotate.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/debian/revert_proxy_log_rotate.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

