<?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>Linux How to..</title>
	<atom:link href="http://blog.thaieasydns.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.thaieasydns.com</link>
	<description>Linux How to ,Share Knowledge</description>
	<lastBuildDate>Wed, 10 Jun 2015 06:37:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.3.21</generator>
	<item>
		<title>Reverse Proxy Varnish Cache With Apache On CentOS 6</title>
		<link>http://blog.thaieasydns.com/346/how-to-install-varnish-cache-with-apache-on-centos-6.html</link>
				<pubDate>Wed, 10 Jun 2015 06:34:39 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Server install and setup.]]></category>
		<category><![CDATA[How to Install Varnish Cache With Apache On CentOS 6]]></category>
		<category><![CDATA[Reverse Proxy]]></category>
		<category><![CDATA[Varnish Cache]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=346</guid>
				<description><![CDATA[TAG : How to Install Varnish Cache With Apache On CentOS 6.x Before Varnish :  client &#8211;http port tcp 80 &#8211;&#62;  Apache Web Server After Install Varnish :  client &#8211;http port tcp 80 &#8211;&#62; Varnish &#8211; http port tcp 8088 -&#62;  Apache Web Server Setup varnish repo : [root@centos ~]# wget http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm [root@centos ~]# rpm [&#8230;]]]></description>
								<content:encoded><![CDATA[<p><strong>TAG : How to Install Varnish Cache With Apache On CentOS 6.x</strong></p>
<p><span id="more-346"></span></p>
<p> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<strong>Before Varnish : </strong><br />
client &#8211;http port tcp 80 &#8211;&gt;  Apache Web Server</p>
<p><strong>After Install Varnish : </strong><br />
client &#8211;http port tcp 80 &#8211;&gt; Varnish &#8211; http port tcp 8088 -&gt;  Apache Web Server</p>
<p><strong>Setup varnish repo :</strong><br />
[root@centos ~]# wget http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm<br />
[root@centos ~]# rpm &#8211;nosignature -i varnish-release-3.0-1.el6.noarch.rpm</p>
<p><strong>Install Varnish and Apache :<br />
</strong>[root@centos ~]# yum install varnish -y<br />
[root@centos ~]# yum install httpd -y</p>
<p><strong>chkconfig for start at boot :</strong><br />
[root@centos ~]# chkconfig &#8211;level 345 varnish on<br />
[root@centos ~]# chkconfig &#8211;level 345 httpd on</p>
<p><strong>Configure apache to listen to port 8088 :</strong><br />
[root@centos ~]# vi /etc/httpd/conf/httpd.conf</p>
<p>Modify below :<br />
change :<br />
Listen 80</p>
<p>to<br />
Listen 8088</p>
<p><strong>Configuring Varnish Cache:</strong><br />
[root@centos ~]# vim /etc/sysconfig/varnish</p>
<p>========================== Config Varnish Start =================</p>
<p># Configuration file for varnish<br />
#<br />
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this<br />
# shell script fragment.<br />
#</p>
<p># Maximum number of open files (for ulimit -n)<br />
NFILES=131072</p>
<p># Locked shared memory (for ulimit -l)<br />
# Default log size is 82MB + header<br />
MEMLOCK=82000</p>
<p># Set this to 1 to make init script reload try to switch vcl without restart.<br />
# To make this work, you need to set the following variables<br />
# explicit: VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_ADDRESS,<br />
# VARNISH_ADMIN_LISTEN_PORT, VARNISH_SECRET_FILE, or in short,<br />
# use Alternative 3, Advanced configuration, below<br />
RELOAD_VCL=1</p>
<p># This file contains 4 alternatives, please use only one.<br />
DAEMON_OPTS=&#8221;-a :80 \<br />
-T localhost:6082 \<br />
-f /etc/varnish/default.vcl \<br />
-S /etc/varnish/secret \<br />
-s malloc,1G&#8221;</p>
<p>========================== Config Varnish End  =================</p>
<p><strong>Add the following in /etc/varnish/default.vcl :</strong><br />
[root@centos ~]# vim /etc/varnish/default.vcl</p>
<p>===== config default.vcl start =======</p>
<p># This is a basic VCL configuration file for varnish. See the vcl(7)<br />
# man page for details on VCL syntax and semantics.<br />
#<br />
# Default backend definition. Set this to point to your content<br />
# server.<br />
#<br />
backend default {<br />
.host = &#8220;127.0.0.1&#8221;;<br />
.port = &#8220;8088&#8221;;<br />
}</p>
<p># Respond to incoming requests<br />
sub vcl_recv {<br />
# Set the director to cycle between web servers.<br />
#set req.backend = web_director;</p>
<p>if (req.url ~ &#8220;^/server_status\.php$&#8221;) {<br />
return (pass);<br />
}</p>
<p># Always cache the following file types for all users.<br />
if (req.url ~ &#8220;(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js|html|htm)(\?[a-z0-9]+)?$&#8221;) {<br />
unset req.http.Cookie;<br />
}<br />
}</p>
<p>sub vcl_hash {<br />
}</p>
<p># Code determining what to do when serving items from the Apache servers.<br />
sub vcl_fetch {<br />
# Don&#8217;t allow static files to set cookies.<br />
if (req.url ~ &#8220;(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js|html|htm)(\?[a-z0-9]+)?$&#8221;) {<br />
# beresp == Back-end response from the web server.<br />
unset beresp.http.set-cookie;<br />
}</p>
<p># Allow items to be stale if needed.<br />
set beresp.grace = 6h;<br />
}</p>
<p>## Deliver</p>
<p>sub vcl_deliver {</p>
<p>## We&#8217;d like to hide the X-Powered-By headers. Nobody has to know we can run PHP and have version xyz of it.<br />
remove resp.http.X-Powered-By;<br />
}</p>
<p>===== config default.vcl End =======</p>
<p><strong>Start Varnish and Apache<br />
</strong>[root@centos ~]# service varnish start<br />
Starting Varnish Cache: [ OK ]<br />
[root@centos ~]# service httpd restart<br />
Starting httpd: [ OK ]</p>
<p><strong>verify Port Service varnish and Apache :<br />
</strong>[root@centos ~]# netstat -plunt | grep :80</p>
<p>tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 6054/httpd<br />
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 8507/varnishd<br />
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 6054/httpd<br />
tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 6054/httpd<br />
tcp 0 0 :::80 :::* LISTEN 8507/varnishd</p>
<p><strong>Verify the Varnish run Reverse Proxy for  pache the following command.</strong></p>
<p>[root@centos ~]# curl -I http://blog.thaieasydns.com</p>
<p>HTTP/1.1 200 OK<br />
Server: Apache/2.2.15 (CentOS)<br />
X-Pingback: http://blog.thaieasydns.com/xmlrpc.php<br />
Content-Type: text/html; charset=UTF-8<br />
Content-Length: 32942<br />
Date: Wed, 10 Jun 2015 06:25:01 GMT<br />
X-Varnish: 1112037056<br />
Age: 0<br />
<span style="color: #ff0000;">Via: 1.1 varnish</span><br />
Connection: keep-alive</p>
<p><strong>ApacheBench performance test without Varnish Cache</strong></p>
<p>[root@centos ~]# ab -k -n 1000 -c 50 http://blog.thaieasydns.com:8088/</p>
<p>This is ApacheBench, Version 2.3 &lt;$Revision: 655654 $&gt;<br />
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br />
Licensed to The Apache Software Foundation, http://www.apache.org/</p>
<p>Benchmarking blog.thaieasydns.com (be patient)<br />
Completed 100 requests<br />
Completed 200 requests<br />
Completed 300 requests<br />
Completed 400 requests<br />
Completed 500 requests<br />
Completed 600 requests<br />
Completed 700 requests<br />
Completed 800 requests<br />
Completed 900 requests<br />
Completed 1000 requests<br />
Finished 1000 requests<br />
Server Software: Apache/2.2.15<br />
Server Hostname: blog.thaieasydns.com<br />
Server Port: 8088</p>
<p>Document Path: /<br />
Document Length: 0 bytes</p>
<p>Concurrency Level: 50<br />
Time taken for tests: 7.485 seconds<br />
Complete requests: 1000<br />
Failed requests: 0<br />
Write errors: 0<br />
Non-2xx responses: 1000<br />
Keep-Alive requests: 1000<br />
Total transferred: 336512 bytes<br />
HTML transferred: 0 bytes<br />
Requests per second: 133.59 [#/sec] (mean)<br />
Time per request: 374.270 [ms] (mean)<br />
Time per request: 7.485 [ms] (mean, across all concurrent requests)<br />
Transfer rate: 43.90 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
min mean[+/-sd] median max<br />
Connect: 0 0 0.5 0 5<br />
Processing: 30 163 493.4 97 6860<br />
Waiting: 30 163 493.4 97 6859<br />
Total: 30 163 493.9 97 6864</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50% 97<br />
66% 105<br />
75% 114<br />
80% 122<br />
90% 139<br />
95% 156<br />
98% 1758<br />
99% 2905<br />
100% 6864 (longest request)</p>
<p>&nbsp;</p>
<p><strong>ApacheBench performance test with Varnish Cache</strong></p>
<p>[root@centos ~]# ab -k -n 1000 -c 50 http://blog.thaieasydns.com/</p>
<p>This is ApacheBench, Version 2.3 &lt;$Revision: 655654 $&gt;<br />
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br />
Licensed to The Apache Software Foundation, http://www.apache.org/</p>
<p>Benchmarking blog.thaieasydns.com (be patient)<br />
Completed 100 requests<br />
Completed 200 requests<br />
Completed 300 requests<br />
Completed 400 requests<br />
Completed 500 requests<br />
Completed 600 requests<br />
Completed 700 requests<br />
Completed 800 requests<br />
Completed 900 requests<br />
Completed 1000 requests<br />
Finished 1000 requests<br />
Server Software: Apache/2.2.15<br />
Server Hostname: blog.thaieasydns.com<br />
Server Port: 80</p>
<p>Document Path: /<br />
Document Length: 32942 bytes</p>
<p>Concurrency Level: 50<br />
Time taken for tests: 0.408 seconds<br />
Complete requests: 1000<br />
Failed requests: 0<br />
Write errors: 0<br />
Keep-Alive requests: 1000<br />
Total transferred: 33494360 bytes<br />
HTML transferred: 33205075 bytes<br />
Requests per second: 2449.02 [#/sec] (mean)<br />
Time per request: 20.416 [ms] (mean)<br />
Time per request: 0.408 [ms] (mean, across all concurrent requests)<br />
Transfer rate: 80105.74 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
min mean[+/-sd] median max<br />
Connect: 0 0 1.2 0 7<br />
Processing: 1 13 32.6 4 251<br />
Waiting: 0 10 32.7 1 247<br />
Total: 1 13 33.7 4 256</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50% 4<br />
66% 4<br />
75% 4<br />
80% 5<br />
90% 25<br />
95% 46<br />
98% 182<br />
99% 183<br />
100% 256 (longest request)</p>
<p><strong><span style="color: #ff0000;">Complete !!!!</span></strong></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
<p>&nbsp;</p>
]]></content:encoded>
										</item>
		<item>
		<title>Command Test Performance harddisk</title>
		<link>http://blog.thaieasydns.com/338/linux-command-test-performance-harddisk.html</link>
				<pubDate>Fri, 05 Jun 2015 07:20:39 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Commandline.]]></category>
		<category><![CDATA[hdparm]]></category>
		<category><![CDATA[Test Performance harddisk]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=338</guid>
				<description><![CDATA[TAG : Linux Command Test Performance harddisk #ATA66 hdparm -Tt /dev/hdc /dev/hdc: Timing cached reads: 1200 MB in 2.00 seconds = 598.89 MB/sec Timing buffered disk reads: 82 MB in 3.03 seconds = 27.10 MB/sec #ATA100 hdparm -Tt /dev/hda /dev/hda: Timing cached reads: 1036 MB in 2.00 seconds = 516.79 MB/sec Timing buffered disk reads: 146 [&#8230;]]]></description>
								<content:encoded><![CDATA[<p>TAG : Linux Command Test Performance harddisk</p>
<p><span id="more-338"></span> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
#ATA66<br />
hdparm -Tt /dev/hdc<br />
/dev/hdc:<br />
Timing cached reads: 1200 MB in 2.00 seconds = 598.89 MB/sec<br />
Timing buffered disk reads: 82 MB in 3.03 seconds = 27.10 MB/sec</p>
<p>#ATA100<br />
hdparm -Tt /dev/hda<br />
/dev/hda:<br />
Timing cached reads: 1036 MB in 2.00 seconds = 516.79 MB/sec<br />
Timing buffered disk reads: 146 MB in 3.04 seconds = 48.10 MB/sec<br />
if new SATAII better than not forget set mode AHCI in bios and set jumper on Harddisk<br />
speed up within interface but disc is slow.</p>
<p>#SATAII<br />
hdparm -t /dev/sda<br />
/dev/sda:<br />
Timing cached reads: 2572 MB in 2.00 seconds = 1287.07 MB/sec<br />
Timing buffered disk reads: 236 MB in 3.02 seconds = 78.06 MB/sec</p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
]]></content:encoded>
										</item>
		<item>
		<title>Linux Service SSH PermitRootLogin</title>
		<link>http://blog.thaieasydns.com/334/linux-service-ssh-permitrootlogin.html</link>
				<pubDate>Tue, 26 May 2015 06:06:40 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Server install and setup.]]></category>
		<category><![CDATA[Linux Service SSH PermitRootLogin]]></category>
		<category><![CDATA[SSH PermitRootLogin]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=334</guid>
				<description><![CDATA[TAG : Service SSH PermitRootLogin vi /etc/ssh/sshd_config change line below : PermitRootLogin yes yes = Allow first login to root no = Deny root login Before user login after user root login]]></description>
								<content:encoded><![CDATA[<p>TAG : Service SSH PermitRootLogin</p>
<p><span id="more-334"></span></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>vi /etc/ssh/sshd_config</p>
<p>change line below :<br />
PermitRootLogin yes</p>
<p>yes = Allow first login to root<br />
no = Deny root login Before user login after user root login</p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
]]></content:encoded>
										</item>
		<item>
		<title>kernel: Neighbour table overflow.</title>
		<link>http://blog.thaieasydns.com/331/kernel-neighbour-table-overflow.html</link>
				<pubDate>Tue, 26 May 2015 05:58:45 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Troubleshooting]]></category>
		<category><![CDATA[kernel: Neighbour table overflow.]]></category>
		<category><![CDATA[Neighbour table overflow.]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=331</guid>
				<description><![CDATA[TAG : message Error : kernel: Neighbour table overflow. input line in file : /etc/sysctl.conf if error message on dmesg and message file Nov 2 17:07:20 server kernel: printk: 153 messages suppressed. Nov 2 17:07:20 server kernel: Neighbour table overflow. #fixed Error : Neighbour table overflow. net.ipv4.neigh.default.gc_thresh1 = 4096 net.ipv4.neigh.default.gc_thresh2 = 8192 net.ipv4.neigh.default.gc_thresh3 = 8192 net.ipv4.neigh.default.base_reachable_time [&#8230;]]]></description>
								<content:encoded><![CDATA[<p>TAG : message Error : kernel: Neighbour table overflow.</p>
<p><span id="more-331"></span></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>input line in file : /etc/sysctl.conf<br />
if error message on dmesg and message file</p>
<p>Nov 2 17:07:20 server kernel: printk: 153 messages suppressed.<br />
Nov 2 17:07:20 server kernel: Neighbour table overflow.<br />
#fixed Error : Neighbour table overflow.<br />
net.ipv4.neigh.default.gc_thresh1 = 4096<br />
net.ipv4.neigh.default.gc_thresh2 = 8192<br />
net.ipv4.neigh.default.gc_thresh3 = 8192<br />
net.ipv4.neigh.default.base_reachable_time = 86400<br />
net.ipv4.neigh.default.gc_stale_time = 86400</p>
<p>apply config sysctl above :<br />
sysctl -p</p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
]]></content:encoded>
										</item>
		<item>
		<title>netstat check active connection status : ESTABLISHED , SYN_RECV</title>
		<link>http://blog.thaieasydns.com/328/netstat-check-active-connection-status-established-syn_recv.html</link>
				<pubDate>Tue, 26 May 2015 05:54:55 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Commandline.]]></category>
		<category><![CDATA[netstat]]></category>
		<category><![CDATA[netstat -ntu]]></category>
		<category><![CDATA[netstat check active connection status : ESTABLISHED]]></category>
		<category><![CDATA[SYN_RECV]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=328</guid>
				<description><![CDATA[TAG : command netstat check active connection status : ESTABLISHED , SYN_RECV ตรวจสอบว่ามีคนส่ง syn เข้ามาเพื่อขอติดต่อแต่ละ ip เป็นจำนวนเท่าไหร่ หากเกิน 10 ก็ให้ทำการ block ได้เลย # netstat -ntu &#124; grep SYN_RECV &#124; awk &#8220;{print $5}&#8221; &#124; cut -d: -f1 &#124; sort &#124; uniq -c &#124; sort -nr ตรวจสอบว่าแต่ละ ip connect server กี่ connection ไม่ควรเกิน 10-20 connection ต่อ ip # [&#8230;]]]></description>
								<content:encoded><![CDATA[<p>TAG : command netstat check active connection status : ESTABLISHED , SYN_RECV</p>
<p><span id="more-328"></span></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>ตรวจสอบว่ามีคนส่ง syn เข้ามาเพื่อขอติดต่อแต่ละ ip เป็นจำนวนเท่าไหร่ หากเกิน 10 ก็ให้ทำการ block ได้เลย<br />
# netstat -ntu | grep SYN_RECV | awk &#8220;{print $5}&#8221; | cut -d: -f1 | sort | uniq -c | sort -nr<br />
ตรวจสอบว่าแต่ละ ip connect server กี่ connection ไม่ควรเกิน 10-20 connection ต่อ ip<br />
# netstat -ntu | grep ESTABLISHED | awk &#8220;{print $5}&#8221; | cut -d: -f1</p>
<p>&nbsp;</p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
]]></content:encoded>
										</item>
		<item>
		<title>safe-rm : Protect important file and folder with rm command</title>
		<link>http://blog.thaieasydns.com/326/safe-rm-protect-important-file-and-folder-with-rm-command.html</link>
				<pubDate>Mon, 25 May 2015 09:03:30 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Server install and setup.]]></category>
		<category><![CDATA[safe-rm]]></category>
		<category><![CDATA[safe-rm : Protect important file and folder with rm command]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=326</guid>
				<description><![CDATA[TAG : safe-rm  Protect important file and folder with rm command cd /root/installed/ wget http://linux.thaieasydns.com/downloads/safe-rm-0.9.tar.gz tar -zxvf safe-rm-0.9.tar.gz cd safe-rm-0.9 cp safe-rm /usr/local/bin/ cd /usr/local/bin/ ln -s safe-rm rm create file config /etc/safe-rm.conf vim /etc/safe-rm.conf input line below : /root/test/test :wq! test delete from list above : rm -rf /root/test/test safe-rm: skipping /root/test/test comment : [&#8230;]]]></description>
								<content:encoded><![CDATA[<p><strong>TAG : safe-rm </strong></p>
<p><span id="more-326"></span></p>
<p> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<strong>Protect important file and folder with rm command</strong></p>
<p><span class="bbc_size"><span class="bbc_size">cd /root/installed/<br />
wget <a class="bbc_link" href="http://linux.thaieasydns.com/downloads/safe-rm-0.9.tar.gz" target="_blank">http://linux.thaieasydns.com/downloads/safe-rm-0.9.tar.gz</a></p>
<p>tar -zxvf safe-rm-0.9.tar.gz<br />
cd safe-rm-0.9<br />
cp safe-rm /usr/local/bin/<br />
cd /usr/local/bin/<br />
ln -s safe-rm rm</p>
<p><strong>create file config /etc/safe-rm.conf</strong><br />
vim /etc/safe-rm.conf</p>
<p><strong>input line below :</strong><br />
/root/test/test</p>
<p>:wq!</p>
<p><strong>test delete from list above :</strong></p>
<p>rm -rf /root/test/test<br />
safe-rm: skipping /root/test/test</p>
<p><strong>comment : if protect folder /root/test<br />
config on safe-rm.conf  </strong><br />
/root/test   !!!! not use /root/test/<br />
<strong>if protect all file in /root/test/  use /root/test/* but protect sub file on folder /root/test/xxx/*</strong></p>
<p>rm -rf /root/test/<br />
safe-rm: skipping /root/test/</p>
<p>rm -rf /root/test<br />
safe-rm: skipping /root/test</p>
<p><strong>Success&#8230;</strong></span></span></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
]]></content:encoded>
										</item>
		<item>
		<title>How To Install Nginx as a Reverse Proxy for Apache Web Server</title>
		<link>http://blog.thaieasydns.com/324/how-to-install-nginx-as-a-reverse-proxy-for-apache-web-server.html</link>
				<pubDate>Mon, 25 May 2015 09:02:37 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Server install and setup.]]></category>
		<category><![CDATA[How To Install Nginx as a Reverse Proxy for Apache Web Server]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=324</guid>
				<description><![CDATA[Nginx(fontend) as a reverse Proxy for Apache(Backend) Before Apply Solution โค๊ด: [Select] client --http port tcp 80 --&#62;  Apache Web Server After Apply Solution โค๊ด: [Select] client --http port tcp 80 --&#62; Nginx - http port tcp 8080 -&#62;  Apache Web Server Server OS :Centos &#8211; Install Apache #yum install httpd httpd-devel -y Configure the [&#8230;]]]></description>
								<content:encoded><![CDATA[<p>Nginx(fontend) as a reverse Proxy for Apache(Backend)</p>
<p><span id="more-324"></span></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><strong>Before Apply Solution</strong></p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">client --http port tcp 80 --&gt;  Apache Web Server</code></p>
<p><strong>After Apply Solution </strong></p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">client --http port tcp 80 --&gt; Nginx - http port tcp 8080 -&gt;  Apache Web Server</code><br />
<strong>Server OS :Centos </strong></p>
<p><strong>&#8211; Install Apache</strong><br />
#yum install httpd httpd-devel -y</p>
<p><strong>Configure the Reverse Proxy settings on Apache</strong><br />
#vim /etc/httpd/conf/httpd.conf</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">Listen 80<br />
to<br />
Listen 8080</code></p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">NameVirtualHost *:80<br />
to<br />
NameVirtualHost *:8080</p>
<p>&lt;VirtualHost *:8080&gt;<br />
ServerName www.yourdomain.com<br />
ServerAlias yourdomain.com<br />
DocumentRoot /var/www/yourdomain.com<br />
&lt;Directory "/var/www/yourdomain.com"&gt;<br />
Options FollowSymLinks -Includes<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;<br />
RewriteEngine on</p>
<p>&lt;/VirtualHost&gt;<br />
</code><br />
#/etc/init.d/httpd restart</p>
<p><strong>Install Nginx with yum </strong><br />
#yum install nginx -y</p>
<p>#vim /etc/nginx/nginx.conf</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">user nginx;<br />
worker_processes  4;<br />
error_log  logs/error.log crit;<br />
#error_log  logs/error.log info;</p>
<p># set open fd limit to 30000<br />
worker_rlimit_nofile 30000;</p>
<p>events {<br />
worker_connections  8192; # you might need to increase this setting for busy servers<br />
multi_accept on;<br />
use epoll; #  Linux kernels 2.6.x change to epoll<br />
}</p>
<p>http {<br />
server_names_hash_max_size 2048;<br />
server_names_hash_bucket_size 512;</p>
<p>server_tokens off;</p>
<p>include    mime.types;<br />
default_type  application/octet-stream;</p>
<p>sendfile on;<br />
tcp_nopush on;<br />
tcp_nodelay on;<br />
keepalive_timeout  10;</p>
<p># Gzip on<br />
gzip on;<br />
gzip_min_length  1100;<br />
gzip_buffers  4 32k;<br />
gzip_types    text/plain application/x-javascript text/xml text/css;</p>
<p># Other configurations<br />
ignore_invalid_headers on;<br />
client_max_body_size    8m;<br />
client_header_timeout  3m;<br />
client_body_timeout 3m;<br />
send_timeout     3m;<br />
connection_pool_size  256;<br />
client_header_buffer_size 4k;<br />
large_client_header_buffers 4 32k;<br />
request_pool_size  4k;<br />
output_buffers   4 32k;<br />
postpone_output  1460;</p>
<p># Cache most accessed static files<br />
open_file_cache          max=10000 inactive=10m;<br />
open_file_cache_valid    2m;<br />
open_file_cache_min_uses 1;<br />
open_file_cache_errors   on;</p>
<p># virtual hosts includes<br />
include "/etc/nginx/conf.d/*.conf";</p>
<p>}<br />
</code><br />
<strong>and create virtual host on nginx</strong></p>
<p>/etc/nginx/conf.d/yourdomainname.com.conf</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">server {<br />
listen    80;<br />
server_name  www.yourdomainname.com yourdomainname.com;<br />
access_log off;<br />
error_log  logs/www.yourdomainname.com-error_log crit;</p>
<p>location ~* .(gif|jpg|jpeg|png|ico|wmv|3gp|avi|mpg|mpeg|mp4|flv|mp3|mid|js|css|html|htm|wml)$ {<br />
root /var/www/yourdomainname.com;<br />
expires 365d;<br />
}</p>
<p>location / {<br />
client_max_body_size    10m;<br />
client_body_buffer_size 128k;</p>
<p>proxy_send_timeout   90;<br />
proxy_read_timeout   90;<br />
proxy_buffer_size    128k;<br />
proxy_buffers     4 256k;<br />
proxy_busy_buffers_size 256k;<br />
proxy_temp_file_write_size 256k;<br />
proxy_connect_timeout 30s;</p>
<p>proxy_redirect  http://www.yourdomainname.com:8080   http://www.yourdomainname.com;<br />
proxy_redirect  http://yourdomainname.com:8080   http://yourdomainname.com;</p>
<p>proxy_pass   http://127.0.0.1:8080/;</p>
<p>proxy_set_header   Host   $host;<br />
proxy_set_header   X-Real-IP  $remote_addr;<br />
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;<br />
}<br />
}<br />
</code><strong>Install mod_rpaf</strong><br />
mod_rpaf will help Apache to know who connects to it (otherwise the only IP address you will see in your logs is 127.0.0.1):</p>
<p>mkdir /root/installed/<br />
cd /root/installed/<br />
wget <a class="bbc_link" href="https://github.com/y-ken/mod_rpaf/archive/master.zip" target="_blank">https://github.com/y-ken/mod_rpaf/archive/master.zip</a><br />
unzip master.zip<br />
cd mod_rpaf-master/<br />
apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c</p>
<p>#vim /etc/httpd/conf.d/rpaf.conf</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">LoadModule rpaf_module /usr/lib64/httpd/modules/mod_rpaf-2.0.so</p>
<p>#Reverse proxy<br />
RPAFenable On<br />
RPAFsethostname On<br />
RPAFproxy_ips 127.0.0.1 Your_Real_Server_IP<br />
</code>#/etc/init.d/httpd restart</p>
<p>curl -I <a class="bbc_link" href="http://www.yourdomainname.com/" target="_blank">http://www.yourdomainname.com/</a></p>
<p>output :</p>
<p>HTTP/1.1 200 OK<br />
Server: nginx</p>
<p><span class="bbc_color"><strong>Complete!!!!!</strong></span></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
]]></content:encoded>
										</item>
		<item>
		<title>HA Proxy with session support</title>
		<link>http://blog.thaieasydns.com/322/ha-proxy-with-session-support.html</link>
				<pubDate>Mon, 25 May 2015 09:01:28 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Server install and setup.]]></category>
		<category><![CDATA[ha proxy with session support]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=322</guid>
				<description><![CDATA[TAG : how to install HA Proxy with session support &#160; example  :  HA Proxy user internet  access to http://10.1.228.137/  round robin to Web1 and Web2  with web server  session support โค๊ด: [Select] HAProxy: 10.1.228.137 port 80 Web1 : 10.1.228.52 port 80 Web2 : 10.1.228.53 port 80 install haproxy wget http://blog.up2box.com/downloads/haproxy-1.4.20.tar.gz Compile the sources with [&#8230;]]]></description>
								<content:encoded><![CDATA[<p><span class="bbc_size">TAG : how to insta</span><span class="bbc_size">ll HA Proxy with session support<br />
</span></p>
<p>&nbsp;</p>
<p><span id="more-322"></span></p>
<p><span class="bbc_size"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
example  :  HA Proxy user internet  access to <a class="bbc_link" href="http://10.1.228.137/" target="_blank">http://10.1.228.137/</a>  round robin to Web1 and Web2  with web server  session support</p>
<p></span></p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">HAProxy: 10.1.228.137 port 80</p>
<p>Web1 : 10.1.228.52 port 80</p>
<p>Web2 : 10.1.228.53 port 80</code><br />
install haproxy<br />
wget <a class="bbc_link" href="http://blog.up2box.com/downloads/haproxy-1.4.20.tar.gz" target="_blank">http://blog.up2box.com/downloads/haproxy-1.4.20.tar.gz</a><br />
Compile the sources with `make install`<br />
#tar -zxvf  haproxy-1.4.20.tar.gz</p>
<p>#cd haproxy-1.4.20</p>
<p>#make install</p>
<p>#cp haproxy /usr/sbin/haproxy</p>
<p>+Download a sample config file<br />
#wget <a class="bbc_link" href="http://blog.up2box.com/downloads/haproxy-standard.cfg" target="_blank">http://blog.up2box.com/downloads/haproxy-standard.cfg</a> -O /etc/haproxy.cfg<br />
+Download a launcher<br />
#wget <a class="bbc_link" href="http://blog.up2box.com/downloads/haproxy.init" target="_blank">http://blog.up2box.com/downloads/haproxy.init</a> -O /etc/init.d/haproxy<br />
+adjust the startup settings<br />
#chmod +x /etc/init.d/haproxy<br />
#chkconfig &#8211;add haproxy<br />
#chkconfig haproxy on</p>
<p>vim /etc/haproxy.cfg</p>
<p>input line below :</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">listen webfarm 10.1.228.137:80<br />
mode http<br />
balance source<br />
cookie JSESSIONID prefix<br />
option httpchk HEAD /check.txt HTTP/1.0<br />
option httpclose<br />
option forwardfor<br />
server web1 10.1.228.52:80 cookie A check<br />
server web2 10.1.228.53:80 cookie B check</code>installed success</p>
<p>&nbsp;</p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
										</item>
		<item>
		<title>Apache mod_rewrite redirect all page to index.html</title>
		<link>http://blog.thaieasydns.com/320/apache-mod_rewrite-redirect-all-page-to-index-html.html</link>
				<pubDate>Mon, 25 May 2015 09:00:36 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Server install and setup.]]></category>
		<category><![CDATA[Apache mod_rewrite redirect all page to index.html]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=320</guid>
				<description><![CDATA[TAG: mod_rewrite redirect all page to index.html ให้เปิดการทำงาน ของ mod_rewrite ใน apache httpd.conf ก่อน ดังนี้ ตัวอย่างนี้จะเลือกเปิด mod_rewrite ภายใน folder /var/vweb/domainname.com/ เท่านั้น โค๊ด: [Select] ServerAdmin postmaster@domainname.com DocumentRoot /var/vweb/domainname.com/ ServerName www.domainname.com AllowOverride All ErrorLog logs/www.domainname.com-error_log CustomLog logs/www.domainname.com-access_log common save file httpd.conf แล้ว reload config apache ถ้า centos ก็ใช้คำสั่ง /etc/init.d/httpd reload แล้วให้สร้าง file .htaccess ไปไว้ที่ /var/vweb/domainname.com/ เขียน .htaccess [&#8230;]]]></description>
								<content:encoded><![CDATA[<div class="postarea">
<div class="post">
<div id="msg_14" class="inner"><span class="bbc_size">TAG: mod_rewrite redirect all page to index.html</span></div>
</div>
</div>
<div class="inner"></div>
<div class="inner"></div>
<p><span id="more-320"></span></p>
<div class="postarea">
<div class="post">
<div class="inner"><span class="bbc_size"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
ให้เปิดการทำงาน ของ mod_rewrite ใน apache httpd.conf ก่อน ดังนี้<br />
ตัวอย่างนี้จะเลือกเปิด mod_rewrite ภายใน folder /var/vweb/domainname.com/ เท่านั้น</p>
<p></span></p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">ServerAdmin postmaster@domainname.com<br />
DocumentRoot /var/vweb/domainname.com/<br />
ServerName www.domainname.com</p>
<p>AllowOverride All</p>
<p>ErrorLog logs/www.domainname.com-error_log<br />
CustomLog logs/www.domainname.com-access_log common<br />
</code>save file httpd.conf แล้ว reload config apache<br />
ถ้า centos ก็ใช้คำสั่ง /etc/init.d/httpd reload</p>
<p>แล้วให้สร้าง file .htaccess ไปไว้ที่ /var/vweb/domainname.com/</p>
<p>เขียน .htaccess ดังนี้</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /index.html [L]</code><br />
ผลลัพท์ที่ได้คือ ถ้ามีการ access เข้า <a class="bbc_link" href="http://www.domainname.com/" target="_blank">http://www.domainname.com/</a> page ไหนก็ตามก็จะถูกบังคับ redirect เข้าหน้า index.html[/size]</div>
</div>
</div>
<div class="smalltext modified"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
<div class="smalltext modified"></div>
<p><!--more--></p>
]]></content:encoded>
										</item>
		<item>
		<title>How Protect FTP Server with fail2ban on Centos5.x</title>
		<link>http://blog.thaieasydns.com/318/how-protect-ftp-server-with-fail2ban-on-centos5-x.html</link>
				<pubDate>Mon, 25 May 2015 08:49:44 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Linux Server install and setup.]]></category>
		<category><![CDATA[fail2ban for ftp sever]]></category>
		<category><![CDATA[How Protect FTP Server with fail2ban on Centos5.x]]></category>

		<guid isPermaLink="false">http://blog.thaieasydns.com/?p=318</guid>
				<description><![CDATA[TAG : How Protect FTP Server with fail2ban on Centos5.x ================ installed fail2ban ================ yum install -y fail2ban vim /etc/fail2ban/fail2ban.conf             edit red word โค๊ด: [Select] # Fail2Ban configuration file # # Author: Cyril Jaquier # # $Revision: 629 $ # [Definition] # Option:  loglevel # Notes.:  Set the log level [&#8230;]]]></description>
								<content:encoded><![CDATA[<p><span class="bbc_size">TAG : How Protect FTP Server with fail2ban on Centos5.x</span></p>
<p><span id="more-318"></span></p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><span class="bbc_size"><br />
================<br />
installed fail2ban<br />
================<br />
yum install -y fail2ban<br />
vim /etc/fail2ban/fail2ban.conf             edit red word<br />
</span></p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code"># Fail2Ban configuration file<br />
#<br />
# Author: Cyril Jaquier<br />
#<br />
# $Revision: 629 $<br />
#<br />
[Definition]<br />
# Option:  loglevel<br />
# Notes.:  Set the log level output.<br />
#          1 = ERROR<br />
#          2 = WARN<br />
#          3 = INFO<br />
#          4 = DEBUG<br />
# Values:  NUM  Default:  3<br />
#<br />
loglevel = 3<br />
# Option:  logtarget<br />
# Notes.:  Set the log target. This could be a file, SYSLOG, STDERR or STDOUT.<br />
#          Only one log target can be specified.<br />
# Values:  STDOUT STDERR SYSLOG file  Default:  /var/log/fail2ban.log<br />
#<br />
logtarget = /var/log/fail2ban.log<br />
# Option: socket<br />
# Notes.: Set the socket file. This is used to communicate with the daemon. Do<br />
#         not remove this file when Fail2ban runs. It will not be possible to<br />
#         communicate with the server afterwards.<br />
# Values: FILE  Default:  /var/run/fail2ban/fail2ban.sock<br />
#<br />
socket = /var/run/fail2ban/fail2ban.sock<br />
=========================================<br />
vim /etc/fail2ban/jail.conf   --&gt; edit red word<br />
# Fail2Ban configuration file<br />
#<br />
# Author: Cyril Jaquier<br />
#<br />
# $Revision: 617 $<br />
#<br />
# The DEFAULT allows a global definition of the options. They can be override<br />
# in each jail afterwards.<br />
[DEFAULT]<br />
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not<br />
# ban a host which matches an address in this list. Several addresses can be<br />
# defined using space separator.<br />
ignoreip = 127.0.0.1<br />
# "bantime" is the number of seconds that a host is banned.<br />
bantime  = 600<br />
# A host is banned if it has generated "maxretry" during the last "findtime"<br />
# seconds.<br />
findtime  = 600<br />
# "maxretry" is the number of failures before a host get banned.<br />
# maxretry = 3<br />
maxretry = 5<br />
# "backend" specifies the backend used to get files modification. Available<br />
# options are "gamin", "polling" and "auto". This option can be overridden in<br />
# each jail too (use "gamin" for a jail and "polling" for another).<br />
#<br />
# gamin:   requires Gamin (a file alteration monitor) to be installed. If Gamin<br />
#          is not installed, Fail2ban will use polling.<br />
# polling: uses a polling algorithm which does not require external libraries.<br />
# auto:    will choose Gamin if available and polling otherwise.<br />
backend = auto<br />
# This jail corresponds to the standard configuration in Fail2ban 0.6.<br />
# The mail-whois action send a notification e-mail with a whois request<br />
# in the body.<br />
[ssh-iptables]<br />
enabled  = false<br />
filter   = sshd<br />
action   = iptables[name=SSH, port=ssh, protocol=tcp]<br />
sendmail-whois[name=SSH, dest=you@mail.com, sender=fail2ban@mail.com]<br />
logpath  = /var/log/sshd.log<br />
maxretry = 5<br />
[proftpd-iptables]<br />
enabled  = false<br />
filter   = proftpd<br />
action   = iptables[name=ProFTPD, port=ftp, protocol=tcp]<br />
sendmail-whois[name=ProFTPD, dest=you@mail.com]<br />
logpath  = /var/log/proftpd/proftpd.log<br />
maxretry = 6<br />
# This jail forces the backend to "polling".<br />
[sasl-iptables]<br />
enabled  = false<br />
filter   = sasl<br />
backend  = polling<br />
action   = iptables[name=sasl, port=smtp, protocol=tcp]<br />
sendmail-whois[name=sasl, dest=you@mail.com]<br />
logpath  = /var/log/mail.log<br />
# Here we use TCP-Wrappers instead of Netfilter/Iptables. "ignoreregex" is<br />
# used to avoid banning the user "myuser".<br />
[ssh-tcpwrapper]<br />
enabled     = false<br />
filter      = sshd<br />
action      = hostsdeny<br />
sendmail-whois[name=SSH, dest=you@mail.com]<br />
ignoreregex = for myuser from<br />
logpath     = /var/log/sshd.log<br />
# This jail demonstrates the use of wildcards in "logpath".<br />
# Moreover, it is possible to give other files on a new line.<br />
[apache-tcpwrapper]<br />
enabled  = false<br />
filter   = apache-auth<br />
action   = hostsdeny<br />
logpath  = /var/log/apache*/*error.log<br />
/home/www/myhomepage/error.log<br />
maxretry = 6<br />
# The hosts.deny path can be defined with the "file" argument if it is<br />
# not in /etc.<br />
[postfix-tcpwrapper]<br />
enabled  = false<br />
filter   = postfix<br />
action   = hostsdeny[file=/not/a/standard/path/hosts.deny]<br />
sendmail[name=Postfix, dest=you@mail.com]<br />
logpath  = /var/log/postfix.log<br />
bantime  = 300<br />
# Do not ban anybody. Just report information about the remote host.<br />
# A notification is sent at most every 600 seconds (bantime).<br />
[vsftpd-notification]<br />
enabled  = false<br />
filter   = vsftpd<br />
#action   = sendmail-whois[name=VSFTPD, dest=you@mail.com]<br />
action   = sendmail-whois[name=VSFTPD, dest=email_admin@domain.com]<br />
logpath  = /var/log/vsftpd.log<br />
maxretry = 5<br />
bantime  = 600<br />
# Same as above but with banning the IP address.<br />
[vsftpd-iptables]<br />
enabled  = true<br />
filter   = vsftpd<br />
action   = iptables[name=VSFTPD, port=ftp, protocol=tcp]<br />
sendmail-whois[name=VSFTPD, dest=email_admin@domain.com]<br />
logpath  = /var/log/vsftpd.log<br />
maxretry = 5<br />
bantime  = 600<br />
# Ban hosts which agent identifies spammer robots crawling the web<br />
# for email addresses. The mail outputs are buffered.<br />
[apache-badbots]<br />
enabled  = false<br />
filter   = apache-badbots<br />
action   = iptables-multiport[name=BadBots, port="http,https"]<br />
sendmail-buffered[name=BadBots, lines=5, dest=you@mail.com]<br />
logpath  = /var/www/*/logs/access_log<br />
bantime  = 172800<br />
maxretry = 1<br />
# Use shorewall instead of iptables.<br />
[apache-shorewall]<br />
enabled  = false<br />
filter   = apache-noscript<br />
action   = shorewall<br />
sendmail[name=Postfix, dest=you@mail.com]<br />
logpath  = /var/log/apache2/error_log<br />
# This jail uses ipfw, the standard firewall on FreeBSD. The "ignoreip"<br />
# option is overridden in this jail. Moreover, the action "mail-whois" defines<br />
# the variable "name" which contains a comma using "". The characters '' are<br />
# valid too.<br />
[ssh-ipfw]<br />
enabled  = false<br />
filter   = sshd<br />
action   = ipfw[localhost=192.168.0.1]<br />
sendmail-whois[name="SSH,IPFW", dest=you@mail.com]<br />
logpath  = /var/log/auth.log<br />
ignoreip = 168.192.0.1<br />
# These jails block attacks against named (bind9). By default, logging is off<br />
# with bind9 installation. You will need something like this:<br />
#<br />
# logging {<br />
#     channel security_file {<br />
#         file "/var/log/named/security.log" versions 3 size 30m;<br />
#         severity dynamic;<br />
#         print-time yes;<br />
#     };<br />
#     category security {<br />
#         security_file;<br />
#     };<br />
# }<br />
#<br />
# in your named.conf to provide proper logging.<br />
# This jail blocks UDP traffic for DNS requests.<br />
[named-refused-udp]<br />
enabled  = false<br />
filter   = named-refused<br />
action   = iptables-multiport[name=Named, port="domain,953", protocol=udp]<br />
sendmail-whois[name=Named, dest=you@mail.com]<br />
logpath  = /var/log/named/security.log<br />
ignoreip = 168.192.0.1<br />
# This jail blocks TCP traffic for DNS requests.<br />
[named-refused-tcp]<br />
enabled  = false<br />
filter   = named-refused<br />
action   = iptables-multiport[name=Named, port="domain,953", protocol=tcp]<br />
sendmail-whois[name=Named, dest=you@mail.com]<br />
logpath  = /var/log/named/security.log<br />
ignoreip = 168.192.0.1</code>=========================<br />
iptables config for support fail2ban</p>
<p>=========================</p>
<p>start fail2ban :</p>
<p>/etc/init.d/fail2ban start</p>
<p>or</p>
<p>service fail2ban start</p>
<p>service start when Linux boot :</p>
<p>chkconfig fail2ban on</p>
<p>note : fail2ban blocked public ip user ftp when login fails 5 time  and block time 600 seconds.<br />
with fail2ban automatic add rule on iptables below :<br />
iptables -N fail2ban-VSFTPD</p>
<p>&nbsp;</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">iptables -I INPUT -p tcp -m tcp --dport 21 -j fail2ban-VSFTPD</code><br />
when user ftp login fails 5 time  . fail2ban add rule below:</p>
<div class="codeheader">โค๊ด: <a class="codeoperation">[Select]</a></div>
<p><code class="bbc_code">iptables -t filter -I fail2ban-VSFTPD 1 -s public_ip_user_ftp_fails -j DROP</code><br />
Good Luck. fail2ban can apply to ssh , apache and other services with plus Security policy blocked hacker login fails.</p>
<p>&nbsp;</p>
 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<ins class="adsbygoogle"
     style="display:inline-block;width:500px;height:90px"
     data-ad-client="ca-pub-1054476802140885"
     data-ad-slot="6850175249"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><!--more--></p>
]]></content:encoded>
										</item>
	</channel>
</rss>
