<?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>PinQ &#124; st. Mudo &#187; Networking</title>
	<atom:link href="http://blog.nazmi.web.id/category/networking/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nazmi.web.id</link>
	<description>Lembar Coretan Memori ku</description>
	<lastBuildDate>Thu, 24 Jun 2010 11:28:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Cara blok situs porno dengan squid proxy di linux</title>
		<link>http://blog.nazmi.web.id/2008/11/05/cara-blok-situs-porno-dengan-squid-proxy-di-linux/</link>
		<comments>http://blog.nazmi.web.id/2008/11/05/cara-blok-situs-porno-dengan-squid-proxy-di-linux/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 09:49:06 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/?p=111</guid>
		<description><![CDATA[Akses browsing ke situs-situs porno dapat diblok jika kita menggunakan squid sebagai  proxy pada linux/unix server, ada beberapa teman yang bertanya bagaimana cara blokir situs porno pada squid proxy tersebut, nah dibawah ini saya jelaskan salah satu tips untuk blok situs porno tersebut.
Squid memiliki Access List atau ACL yang bisa digunakan sebagai sarana untuk [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.nazmi.web.id/wp-content/uploads/2008/11/no-porn.gif"><img class="alignleft size-medium wp-image-119" title="no-porn" src="http://blog.nazmi.web.id/wp-content/uploads/2008/11/no-porn.gif" alt="" width="86" height="86" /></a>Akses browsing ke situs-situs porno dapat diblok jika kita menggunakan squid sebagai  proxy pada linux/unix server, ada beberapa teman yang bertanya <strong>bagaimana cara blokir situs porno pada squid proxy</strong> tersebut, nah dibawah ini saya jelaskan salah satu tips untuk blok situs porno tersebut.</p>
<p>Squid memiliki <em>Access List</em> atau <em>ACL</em> yang bisa digunakan sebagai sarana untuk memfilter akses terhadap alamat url (situs) tertentu, <em>acl</em> yang digunakan disini adalah &#8220;<em>url_regex</em>&#8220;.</p>
<p><strong><em>url_regex</em></strong> ini digunakan untuk memfilter berdasarkan alamat <em>url</em>-nya, misalkan kita ingin blok situs &#8220;<strong>www.playboy.com</strong>&#8220;, nah yang kita gunakan sebagai keyword untuk &#8220;<em>url_regex</em>&#8221; nya adalah &#8220;<strong>playboy.com</strong>&#8220;. Efek dari <em>acl</em> ini adalah akses ke seluruh situs yang menggunakan alamat domain &#8220;<strong>*.playboy.com</strong>&#8221; akan diblokir.</p>
<p>Namun jika kita hanya ingin blok akses ke subdomain saja dan akses ke domain induknya tetap bisa, maka kita bisa gunakan subdomain-nya sebagai keyword <em>acl</em> nya. Misalnya disini kita mau blok akses ke situs &#8220;<em>pornstar.playboy.com</em>&#8221; saja dan akses ke &#8220;<em>www.playboy.com</em>&#8221; dibolehkan, maka disini kita masukkan &#8220;<em>pornstar.playboy.com</em>&#8221; sebagai keyword <em>acl</em>-nya.</p>
<p>Cukup dengan penjelasan dan teori-teorinya, bosan kali yaa&#8230;pengennya langsung praktek..Kita lanjuut..<span id="more-111"></span></p>
<p>Kita asumsikan disini anda telah menginstall squid proxy dengan baik dan sudah berfungsi, dan file konfigurasi squid berada pada lokasi &#8220;<em>/etc/squid/squid.conf</em>&#8221;</p>
<p><strong>Langkah-langkah yang kita lakukan untuk konfigurasi squid nya :</strong></p>
<p>1. Bikin file baru untuk simpan list dari alamat situs yang akan kita blok aksesnya, disini saya  menggunakan &#8220;<em>vi</em>&#8221; karena memang editor favorit saya..</p>
<p><strong># vi /etc/squid/porn.block.txt</strong></p>
<p>2. Tambahkan list alamat situs yang sudah kita data untuk di blok pada file &#8220;<em>/etc/squid/porn.block.txt</em>&#8220;, contoh penulisannya adalah sbb :</p>
<p><em>playboy.com<br />
penthouse.com<br />
duniasex.com<br />
17tahun.com<br />
bangbros.com</em></p>
<p>Jumlah baris dari alamat tersebut, tergantung dari jumlah situs yang ingin anda blok, untuk database   situs porno lainnya bisa anda ambil dari <em>squidguard.org</em>. Kemudian simpanlah file tersebut.</p>
<p>3. Edit file &#8220;<em>/etc/squid/squid.conf</em>&#8221; dan tambahkan konfigurasi <em>ACL url_regex </em>berikut :</p>
<p><strong> acl porn url_regex &#8220;/etc/squid/porn.block.txt&#8221;</strong></p>
<p>konfigurasi ini ditambahkan pada bagian <em>acl</em> dari file &#8220;<em>squid.conf</em>&#8221; nya, contohnya spt dibawah ini :</p>
<p><em>&#8212;&#8211;potongan file squid.conf &#8212;&#8212;</em></p>
<p><em>acl all src 0.0.0.0/0.0.0.0<br />
acl manager proto cache_object<br />
acl localhost src 127.0.0.1/255.255.255.255<br />
acl Lan src 192.168.10.0/24<br />
<strong> acl porn url_regex &#8220;/etc/squid/porn.block.txt&#8221; </strong></em>&lt;&#8212; ACL ditambahkan pada baris ini</p>
<p><em>&#8212;&#8211;potongan file squid.conf &#8212;&#8212;</em></p>
<p>Penjelasan terhadap <em>acl</em> ini adalah, kita mendefinisikan &#8220;<em>porn</em>&#8221; sebagai nama <em>access list</em> dengan tipe &#8220;<em>url_regex</em>&#8220;, dimana list dari <em>url</em> tersebut disimpan pada file dengan nama &#8220;<em>/etc/squid/porn.block.txt</em>&#8221;</p>
<p>4. Setelah <em>acl porn</em> kita definisikan, kita lanjutkan dengan definisi <em>http_access</em> terhadap list <em>url</em> dari <em>acl porn</em> tadi, dengan cara kita tambahkan lagi pada file &#8220;<em>squid.conf</em>&#8221; konfigurasi berikut :</p>
<p><strong><em>http_access deny porn</em></strong></p>
<p>konfigurasi ini ditambahkan pada bagian <em>http_access</em> dari <em>squid.conf</em>, contohnya spt dibawah ini :</p>
<p><em>&#8212;&#8211; potongan file squid.conf &#8212;&#8211;</em></p>
<p><strong><em>http_access deny porn </em></strong>&lt;&#8212; ditambahkan pada urutan paling atas dari http_access nya<em><br />
http_access allow manager localhost<br />
http_access allow lan<br />
http_access deny manager<br />
http_access deny !Safe_ports<br />
http_access deny CONNECT !SSL_ports<br />
http_access allow CONNECT !irc_ports<br />
http_access deny all</em></p>
<p><em>&#8212;&#8211; potongan file squid.conf &#8212;&#8211;</em></p>
<p>penjelasan dari <em>http_access</em> ini adalah, akses http terhadap acl dengan nama &#8220;<em>porn</em>&#8221; akan diblok (<em>deny</em>),<br />
dimana isi dari <em>acl porn</em> ini adalah alamat-alamat situs porno yang memang ingin kita blok.</p>
<p>Contoh file <em>squid.conf </em>setelah dikonfigurasi akan seperti ini :</p>
<p><em>&#8212;&#8211;potongan file squid.conf &#8212;&#8212;</em></p>
<p><em>acl all src 0.0.0.0/0.0.0.0<br />
acl manager proto cache_object<br />
acl localhost src 127.0.0.1/255.255.255.255<br />
acl Lan src 192.168.10.0/24<br />
<strong>acl porn url_regex &#8220;/etc/squid/porn.block.txt&#8221; </strong></em></p>
<p><em><strong>http_access deny porn </strong><br />
http_access allow manager localhost<br />
http_access allow lan<br />
http_access deny manager<br />
http_access deny !Safe_ports<br />
http_access deny CONNECT !SSL_ports<br />
http_access allow CONNECT !irc_ports<br />
http_access deny all</em></p>
<p><em>&#8212;&#8211;potongan file squid.conf &#8212;&#8212;</em></p>
<p>5. Selanjutnya kita instruksikan supaya <strong><em>squid</em></strong> untuk membaca ulang file konfigurasi &#8220;<em>squid.conf</em>&#8221; nya, kita lakukan dengan perintah berikut ini :</p>
<p><strong><em># squid -k reconfigure</em></strong></p>
<p>6. Sekarang kita ujicoba blok akses ke situs pornonya, buka browser favorit kamu misalnya Firefox, kemudian ketikkan salah satu alamat situs yang ada pada file acl porn, misalnya &#8220;<em>www.playboy.com</em>&#8220;. Jika muncul halaman error &#8220;<em>acess denied</em>&#8221; maka blokir situs dengan squid nya sukses..</p>
<p>kalo masih bisa diakses..coba di croscheck lagi langkah-langkah diatas&#8230;Good Luck..!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2008/11/05/cara-blok-situs-porno-dengan-squid-proxy-di-linux/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Transparent proxy di squid versi 2.6.xx</title>
		<link>http://blog.nazmi.web.id/2008/02/16/transparent-proxy-di-squid-versi-26xx/</link>
		<comments>http://blog.nazmi.web.id/2008/02/16/transparent-proxy-di-squid-versi-26xx/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 04:12:03 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/2008/02/16/transparent-proxy-di-squid-versi-26xx/</guid>
		<description><![CDATA[Untuk menjadikan squid sebagai Transparent proxy pada squid versi 2.6.xx, terdapat perbedaan pada settingan squid.conf nya. Untuk versi 2.5.xx ke bawah biasanya ditambahkan konfigurasi berikut :
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
Namun untuk squid dengan versi 2.6.xx cukup dengan menambahkan konfigurasi berikut pada squid.conf nya :
http_port 3128 transparent
always_direct allow all
Sepertinya untuk versi squid 2.6.xx, transparent proxy bisa [...]]]></description>
			<content:encoded><![CDATA[<p>Untuk menjadikan squid sebagai Transparent proxy pada squid versi 2.6.xx, terdapat perbedaan pada settingan squid.conf nya. Untuk versi 2.5.xx ke bawah biasanya ditambahkan konfigurasi berikut :</p>
<p>httpd_accel_host virtual<br />
httpd_accel_port 80<br />
httpd_accel_with_proxy on<br />
httpd_accel_uses_host_header on</p>
<p>Namun untuk squid dengan versi 2.6.xx cukup dengan menambahkan konfigurasi berikut pada squid.conf nya :</p>
<p>http_port 3128 transparent<br />
always_direct allow all</p>
<p>Sepertinya untuk versi squid 2.6.xx, transparent proxy bisa di set lebih gampang <img src='http://blog.nazmi.web.id/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2008/02/16/transparent-proxy-di-squid-versi-26xx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>DDoS dan DoS</title>
		<link>http://blog.nazmi.web.id/2007/07/20/ddos-dan-dos/</link>
		<comments>http://blog.nazmi.web.id/2007/07/20/ddos-dan-dos/#comments</comments>
		<pubDate>Fri, 20 Jul 2007 06:38:52 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/20/07/2007/ddos-dan-dos/</guid>
		<description><![CDATA[Denial of Service (DoS)
Varian pertama serangan berupa pengiriman air bah data ke target itu adalah DoS (Denial of Service). Dalam serangan ini penyerang hanya menggunakan satu komputer untuk menyemburkan data ke korbannya.
Penjelasan sederhananya seperti ini: Suatu ketika handphone anda berbunyi. Sebelum anda sempat menggangkatnya handphone anda telah berhenti berbunyi. Tiba-tiba handphone anda berbunyi lagi dan [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Denial of Service (DoS)<img src="http://www.ntt-neo.com/service/qsafe/term/img/dos.gif" align="right" border="2" height="152" hspace="10" vspace="10" width="265" /></strong></p>
<p>Varian pertama serangan berupa pengiriman air bah data ke target itu adalah DoS (Denial of Service). Dalam serangan ini penyerang hanya menggunakan satu komputer untuk menyemburkan data ke korbannya.</p>
<p>Penjelasan sederhananya seperti ini: Suatu ketika handphone anda berbunyi. Sebelum anda sempat menggangkatnya handphone anda telah berhenti berbunyi. Tiba-tiba handphone anda berbunyi lagi dan tanpa sempat anda mengangkatnya, bunyi itupun segera berhenti. Beberapa kali anda biarkan tapi masalah ini tak kunjung selesai. Beberapa kolega anda yang hendak menghubungi anda terpaksa tidak bisa melakukannya karena handphone anda sibuk terus. Itulah gambaran sederhana serangan DoS di dunia non-cyber.</p>
<p>Di dunia cyber, kasus anda tersebut merupakan serangan salah satu jenis DOS (Denial of Service). Yang pasti, sebegitu mudahnya DOS ini diterapkan tapi mencegahnya bukanlah suatu hal yang gampang. Target-target serangan DOS biasanya adalah server-server ISP, Internet Banking, E-commerce, Web perusahaan, dan pemerintah.<span id="more-96"></span></p>
<p>Serangan DoS dapat dilakukan dengan mengirimkan query sebanyak mungkin hingga target tidak bisa lagi menanganinya sehingga target lumpuh. Cara lain melakukan serangan DoS adalah dengan mengirimkan data rusak atau data yang tidak mampu di tangani oleh server target sehingga server tersebut menjadi hang (tidak bisa berfungsi sebagaimana mestinya dan perlu di restart ulang).</p>
<p><strong>DDOS (Distributed Denial of Service)</strong></p>
<p>Mengirimkan data secara terus menerus dengan menggunakan satu komputer tidak begitu efektif karena biasanya sumber daya server yang diserang lebih besar dari komputer penyerang. Daya bunuh serangan juga akhirnya menjadi lemah.</p>
<p>Hacker penyerangpun memutar otaknya. Serangan dapat lebih mematikan jika tenaga banyak komputer dijadikan satu untuk menciptakan banjir data yang lebih besar.</p>
<p>Komputer-komputer yang diambil alih oleh hacker tersebut disebut zombie. Zombie berfungsi sebagai anak buah atau agent penyerang yang siap beraksi saat mendapat perintah dari “tuannya.”</p>
<p>Semakin banyak zombie yang dkuasai seorang penyerang, semakin berkuasalah sang hacker tersebut karena besarnya tenaga yang ia genggam. Dengan tenaga besar yang dikumpulkan dari komputer-komputer yang dikuasai (secara illegal tentunya) tersebut, serangan DDoS hampir tidak dapat ditangkal. Karena itulah serangan tipe ini sangat populer di kalangan hacker.</p>
<p>Beberapa situs raksasa seperti Amazon.com, eBay, dan Yahoo pada Februari 2000 rontok selama beberapa jam karena serbuan ini. Gedung Putih juga sempat boyongan karena serangan tipe ini. Gedung Putih terpaksa “memindahkan” IP address situsnya karena jengah menerima serangan DDoS yang sudah dirancang untuk muncul pada tanggal dan jam tertentu dengan memanfaatkan virus tertentu tanpa mampu mencegahnya.</p>
<p>DDoS adalah tipe serangan dengan konsep sederhana. Namun efeknya bisa memindahkan “istana negara.”</p>
<p><strong>Menghadapi Serangan DDOS<br />
</strong><br />
Serangan DDoS adalah serangan dengan teori sederhana namun dengan dampak yang sangat besar. Sayangnya, sampai saat ini belum ditemukan cara paling tepat untuk menghindari serangan ini secara total.</p>
<p>Meski sampai saat ini belum ada sistem yang kebal terhadap serangan ini, ada sejumlah langkah yang dapat dilakukan untuk memperkecil resiko serangan DDoS ini.</p>
<p>Karena serangan DDoS dapat dilakukan dengan memanfaatkan kelemahan operating system yang anda gunakan, jangan pernah lupa mengupdate patch untuk memerbaiki sistem pengoperasian anda. Ingatlah bahwa tidak ada satupun sistem operasi di dunia ini yang aman dan 100 persen bebas dari kelemahan.</p>
<p>Gunakan hardware/server yang kuat. Server tersebut harus mampu menangani beban yang cukup berat sehingga server anda tidak mudah down. Anda bisa mendesain network yang saling membackup dan akan lebih bagus jika berada pada beberapa daerah sekaligus.</p>
<p>Gunakan firewall untuk mengeblok port-port (pintu masuk) yang tidak di perlukan di server-server anda.</p>
<p>Gunakan IDS (Intrusion Detection System) untuk mendeteksi penyusup dan melakukan pencegahan yang lebih cerdik.</p>
<p><strong>Terminologi dan Tools Pada DDoS (uzi)</strong></p>
<p>Terminologi-terminologi yang umum dalam serangan DDoS antara lain adalah Client – sebuah aplikasi yang digunakan untuk memicu serangan dengan mengirimkan perintah ke komponen-komponen lain, Daemon – sebuah proses dalam menjalankan agent yang bertanggung jawab menerima dan melaksanakan perintah yang dikeluarkan client, Master – host yang menjalankan client, Agent – host yang menjalankan Daemon, dan Target – korban (berupa host atau jaringan) yang dihantam serangan DDoS. Alur serangan DDoS adalah:</p>
<p>Penyerang (Master) -&gt; Client -&gt; Daemon -&gt; Korban (Target)</p>
<p><strong>Tools</strong></p>
<p>Program-program yang dapat digunakan hacker untuk melancarkan serangan DDoS semakin mudah didapatkan dari Internet. Karenanya semakin berbahaya pula ancaman ini dengan semakin banyaknya orang yang dapat melakukannya.</p>
<p>Beberapa tool paling terkenal yang sering digunakan untuk melancarkan serangan DDoS adalah TFN2K, Trinoo dan Stacheldraht</p>
<p><strong>TFN2K</strong></p>
<p>TFN2K (Tribe Flood Network 2000) adalah tool untuk melancarkan serangan DDoS. TFN2K adalah turunan Trojan TFN.</p>
<p>TFN2K memungkinkan master mengeksploitasi sejumlah agent untuk mengkoordinasikan serangan pada satu atau beberapa target yang diincar. Saat ini, Unix, Solaris, dan Windows NT adalah platform-platform yang rentan terhadap serangan ini.</p>
<p>TFN2K adalah sistem dengan dua komponen. Yang pertama adalah client yang dikomando oleh master dan sebuah proses daemon yang beroperasi pada sebuah agent. Master menginstruksikan para agent yang telah ditaklukkannya untuk menyerang target yang telah ditentukan. Para agent tersebut kemudian merespon dengan membanjirkan serbuan paket data. Sejumlah agent, dengan perintah Master, dapat bekerjasama selama serangan ini untuk mematahkan akses target. Komunikasi master-to-agent telah dienkripsi dan bercampur dengan paket-paket yang diluncurkan. Baik komunikasi master-to-agent maupun serangan itu sendiri dapat dikirimkan melalui paket-paket TCP, UDP, dan ICMP yang telah diacak. Master juga dapat melakukan pemalsuan IP address (spoofing). Hal ini membuat penagkalan TFN2K sangat sukar dilakukan.</p>
<p><strong>Trinoo</strong></p>
<p>Trinoo (a.k.a. trin00) adalah program slave/master terkenal yang digunakan dalam serangan DDoS. Daemon Trinoo awalnya ditemukan pada format binary sejumlah sistem Solaris 2.x, yang diidentifikasi dapat dimanfaatkan dengan mengeksploitasi bug buffer overrun.</p>
<p>Jaringan Trinoo dapat berupa ratusan bahkan ribuan sistem di Internet yang diambilalih dengan eksploitasi buffer overrun secara remote. Akses ke sistem-sistem yang dijadikan agent tersebut didapatkan dengan menanamkan program back door sekaligus daemon Trinoo.</p>
<p>Sebuah jaringan Trinoo yang paling tidak terdiri atas 227 sistem – 114 diantaranya merupakan situs-situs Internet – yang pada 17 Agustus 1999 digunakan untuk membanjiri satu sistem yang ada di University of Minnessota. Akibatnya, server malang itu ambruk dan koma selama dua hari. Saat penanganan terhadap serangan 17 Agustus itu dilakukan, banjir besar data juga diketahui sedang menyerang paling tidak 16 sistem lain, yang sebagian terdapat di luar AS.</p>
<p><strong>Stacheldraht</strong></p>
<p>Stacheldraht (Bahasa Jerman yang artinya adalah kawat berduri) adalah tool lain yang populer untuk melancarkan serangan DDoS.</p>
<p>Tool ini sangat unik karena ia menggabungkan fitur-fitur yang dimiliki oleh Trinoo dan TFN generasi pertama. Tool ini juga mempunyai enkripsi komunikasi antara penyerang dan master-master Stacheldraht serta mampu melakukan update agent secara otomatis.</p>
<p>Seperti Trinoo, Stacheldraht terdiri atas program-program master (handler) dan daemon atau bcast (agent). Fitur TFN yang dimiliki Stacheldraht adalah gaya-gaya serangan ICMP flood, SYN flood, UDP flood, dan &#8220;Smurf.” (uzi)</p>
<p>Sumber: http://forum.webgaul.com/</p>
<p>Bahan Bacaan:</p>
<p>http://www10.org/cdrom/papers/409/<br />
http://panoptis.sourceforge.net/<br />
http://www.grc.com/dos/drdos.htm<br />
http://www.icir.org/vern/papers/reflectors.CCR.01/reflectors.html<br />
http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_7-4/dos_attacks.html<br />
http://staff.washington.edu/dittrich/misc/ddos/</p>
<p><em>from adminpreman.web.id</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/07/20/ddos-dan-dos/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Script for monitoring memory usage with MRTG</title>
		<link>http://blog.nazmi.web.id/2007/06/21/monitor-your-memory-usage-with-mrtg/</link>
		<comments>http://blog.nazmi.web.id/2007/06/21/monitor-your-memory-usage-with-mrtg/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 04:26:11 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/21/06/2007/monitor-your-memory-usage-with-mrtg/</guid>
		<description><![CDATA[ With MRTG you can graph your network traffic, but you can also use it to gather other network information, such as monitoring your system&#8217;s swap and memory usage. MRTG is useful for more than just graphing network traffic. If you look at the MRTG Companion Sites page, you&#8217;ll see numerous links to different scripts [...]]]></description>
			<content:encoded><![CDATA[<p class="clearfix" id="story"><img src="http://oss.oetiker.ch/mrtg/images/mrtg_logo.gif" width="205" vspace="5" hspace="10" height="71" align="left" /> With MRTG you can graph your network traffic, but you can also use it to gather other network information, such as monitoring your system&#8217;s swap and memory usage. MRTG is useful for more than just graphing network traffic. If you look at the MRTG Companion Sites page, you&#8217;ll see numerous links to different scripts and tools to put all kinds of information into an MRTG graph.</p>
<p>Here, we will look at monitoring the local system&#8217;s swap and memory usage over time. This assumes that MRTG is already configured or you have an understanding of how to configure MRTG .The first step is to create the script, which is very simplistic. Save it as <em>/usr/local/bin/memstat.sh</em> with the following contents:<span id="more-94"></span>
<pre>#!/bin/sh/usr/bin/free -b | /bin/awk 'NR==2 {ramUsed = $3 }NR==4 {swapUsed = $3 }END { print swapUsed "n" ramUsed "n0n0" }'</pre>
<p>The output, for a human, is not very interesting:
<pre># /usr/local/bin/memstat.sh0154800947200</pre>
<p>For MRTG, however, with the appropriate configuration, it becomes very interesting. Add the following snippet to <em>/etc/mrtg.cfg</em>. Ideally, MRTG should be running every five minutes for a good sampling.
<pre>Target[localmem]: `/usr/local/bin/memstat.sh`Title[localmem]: Mem and Swap Usage [surtr]PageTop[localmem]: &lt;h1&gt;Memory and Swap Usage [surtr]&lt;/h1&gt;MaxBytes[localmem]: 100000000000ShortLegend[localmem]: BYLegend[localmem]: MemoryLegendI[localmem]: SwapLegendO[localmem]: MemLegend1[localmem]: SwapLegend2[localmem]: MemOptions[localmem]: gauge,growright,nopercentkMG[localmem]: k,M,G,T,P,XColours[localmem]: RED#bb0000,BLUE#1000ff,GREEN#006600,VIOLET#ff00ff</pre>
<p>This code tells MRTG to execute the <em>/usr/local/bin/memstat.sh</em> script and take the numbers it provides as output as input for itself, which will then be used to create a typical MRTG graph of the data. This will then give you a sampling of memory and swap usage over time. MRTG will create graphs for yearly, monthly, weekly, and daily statistics.Using the same, you could perform the same data analysis for CPU usage, disk usage, e-mail statistics, Web traffic, and much more.<em>(from  www.builderau.com.au)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/06/21/monitor-your-memory-usage-with-mrtg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squid &#8211; File Descriptor Limits</title>
		<link>http://blog.nazmi.web.id/2007/06/20/squid-file-descriptor-limits/</link>
		<comments>http://blog.nazmi.web.id/2007/06/20/squid-file-descriptor-limits/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 08:00:31 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/20/06/2007/squid-file-descriptor-limits/</guid>
		<description><![CDATA[File descriptor limits are a common problem for new Squid users.   This happens because some operating systems have relatively low   per-process and system-wide limits.  In some cases, you must take   steps to tune your system before compiling Squid.A file descriptor is simply a number that represents an open [...]]]></description>
			<content:encoded><![CDATA[<p><span id="intelliTxt">File descriptor limits are a common problem for new Squid users.   This happens because some operating systems have relatively low   per-process and system-wide limits.  In some cases, you must take   steps to tune your system before compiling Squid.</span>A file descriptor is simply a number that represents an open file   or socket.  Every time a process opens a new file or socket, it   allocates a new file descriptor.  These descriptors are reused   after the file or socket is closed.  Most Unix systems place a limit   on the number of simultaneously open file descriptors.  There are   both per-process and per-system limits.<!-- sidebar begins --> <!-- don't move sidebars --> <!-- sidebar ends -->How many file descriptors does Squid need?  The answer depends   on how many users you have, the size of your cache, and which particular   features that you have enabled.  Here are some of the things that   consume file descriptors in Squid:<span id="intelliTxt"></span>
<ul>
<li>Client-side TCP connections</li>
<li>Server-side TCP connections</li>
<li>Writing cachable responses to disk</li>
<li>Reading cache hits from disk</li>
<li>Log files</li>
<li>Communication with external helper processes, such as redirectors and authenticators</li>
<li>Idle (persistent) HTTP connections</li>
</ul>
<p><span id="more-93"></span>Even when Squid is not doing anything, it has some number of file   descriptors open for log files and helpers.  In most cases, this   is between 10 and 25, so it&#8217;s probably not a big deal.  If   you have a lot of external helpers, that number goes up.  However,   the file descriptor count really goes up once Squid starts serving   requests.  In the worst case, each concurrent request requires   three file descriptors: the client-side connection, a server-side   connection for cache misses, and a disk file for reading hits or   writing misses.A Squid cache with just a few users might be able to get by with   a file descriptor limit of 256.  For a moderately busy Squid,   1024 is a better limit.  Very busy caches should use 4096 or more.   One thing to keep in mind is that file descriptor usage often   surges above the normal level for brief amounts of time.  This   can happen during short, temporary network outages or other   interruptions in service.There are a number of ways to determine the file descriptor limit   on your system.  One is to use the built-in shell commands <code>limit</code>   or <code>ulimit</code>.For Bourne shell users:<span id="intelliTxt"></span>
<pre><code>root# ulimit -n1024</code></pre>
<p>For C shell users:
<pre><code>root# limit descdescriptors     1024</code></pre>
<p>If you already have Squid compiled and installed, you can   just look at the <em>cache.log</em> file for a line like this:
<pre><code>2003/12/12 11:10:54| With 1024 file descriptors available</code></pre>
<p>If Squid detects a file descriptor shortage while it is running,   you&#8217;ll see a warning like this in <em>cache.log</em>:
<pre><code>WARNING! Your cache is running out of file descriptors</code></pre>
<p>If you see the warning, or know in advance that you&#8217;ll need more   file descriptors, you should increase the limits.   The technique for increasing the file descriptor limit varies   between operating systems.<br />
<h4>For Linux Users</h4>
<p>Linux users need to edit one of the system include files and   twiddle one of the system parameters via the <code>/proc</code> interface.   First, edit <em>/usr/include/bits/types.h</em> and change the value for   <code>__FD_SETSIZE</code>.  Then, give the kernel a new limit with this command:
<pre><code>root# echo 1024 &gt; /proc/sys/fs/file-max</code></pre>
<p>Finally, before compiling or running Squid, execute this shell command   to set the process limit equal to the kernel limit:
<pre><code>root# ulimit -Hn 1024</code></pre>
<p>After you have set the limit in this manner, you&#8217;ll need to   reconfigure, recompile, and reinstall Squid.  Also note that these   two commands do not permanently set the limit.  They must be   executed each time your system boots.  You&#8217;ll want to add them to   your system startup scripts.<br />
<h3>For NetBSD/OpenBSD/FreeBSD Users</h3>
<p>On BSD-based systems, you&#8217;ll need to compile a new kernel.   The kernel   configuration file lives in a directory such as <em>/usr/src/sys/i386/conf</em> or   <em>/usr/src/sys/arch/i386/conf</em>.  There you&#8217;ll find a file, possibly named   <em>GENERIC</em>, to which you should add a line like this:
<pre><code>options       MAXFILES=8192</code></pre>
<p>For OpenBSD, use <code>option</code> instead of <code>options</code>.  Reboot your   system after you&#8217;ve finished configuring, compiling, and installing   your new kernel.  Then, reconfigure, recompile, and reinstall   Squid.<br />
<h4>For Solaris Users</h4>
<p>Add this line to your <em>/etc/system</em> file:
<pre><code>set rlim_fd_max = 1024</code></pre>
<p>Then, reboot the system, reconfigure, recompile, and reinstall Squid.For further information on file descriptor limits, see Chapter 3, &#8220;Compiling and Installing&#8221;, of <em>Squid: The Definitive Guide</em> or section 11.4 of   the <a href="http://www.squid-cache.org/Doc/FAQ/FAQ.html">Squid FAQ</a>.  </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/06/20/squid-file-descriptor-limits/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Squid: WARNING! Your cache is running out of filedescriptors</title>
		<link>http://blog.nazmi.web.id/2007/06/20/squid-warning-your-cache-is-running-out-of-filedescriptors/</link>
		<comments>http://blog.nazmi.web.id/2007/06/20/squid-warning-your-cache-is-running-out-of-filedescriptors/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 07:49:25 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/20/06/2007/squid-warning-your-cache-is-running-out-of-filedescriptors/</guid>
		<description><![CDATA[So you have a LAN with 50+ users and you set up a nice Squid w3cache as a transparent proxy with 100GB of space reserved for the cache (hdds are so cheap nowadays…). Weeks pass and suddenly you notice that something is messing up your
web experience as Firefox suddenly decides to run painfully slow. About [...]]]></description>
			<content:encoded><![CDATA[<p class="entry">So you have a LAN with 50+ users and you set up a nice Squid w3cache as a transparent proxy with 100GB of space reserved for the cache (hdds are so cheap nowadays…). Weeks pass and suddenly you notice that something is messing up your</p>
<p class="entry"><em>web experience</em> as Firefox suddenly decides to run painfully slow. About 30 minutes wasted on finding the culprit (like changing your DNS servers, clearing browser cache, etc.) until you decide to check the router and then <a href="http://www.squid-cache.org/">Squid</a> and then its logs. And then you find something <em>fishy</em>:</p>
<pre class="code">WARNING! Your cache is running out of filedescriptors</pre>
<p><span id="more-92"></span><br />
I won’t be explaining why this happens. Others <a href="http://www.onlamp.com/pub/a/onlamp/2004/02/12/squid.html">have</a> <a href="http://www.onlamp.com/pub/a/onlamp/2004/02/12/squid.html">done it</a> <a href="http://wiki.squid-cache.org/SquidFaq/TroubleShooting#head-eb3240fe8e61368056af86138a2b5dcbc9781a54">before</a>. What I’m going to do is present you with a solution that <strong>does not</strong> require a complete Squid recompilation/reinstallation procedure.</p>
<p>However, I <em>believe</em> it requires a fairly modern setup to work. I was using Squid 2.6 STABLE6 on Fedora Core 6 with 2.6.18 kernel. Your mileage may vary.</p>
<h3>Stopping the Squid</h3>
<p>This is important:</p>
<pre class="code">/etc/init.d/squid stop</pre>
<h3>/etc/squid/squid.conf</h3>
<p>At the very end of this file there is a line which needs adding/changing so it reads:</p>
<pre class="code">max_filedesc 8192</pre>
<h3>/etc/init.d/squid</h3>
<p>Just after the comments (before any code) add this line:</p>
<pre class="code">ulimit -HSn 8192</pre>
<h3>/usr/include/bits/typesizes.h</h3>
<p>Edit the <code>__FD_SETSIZE</code> line so it reads:</p>
<pre class="code">#define __FD_SETSIZE            8192</pre>
<h3>Starting the squid</h3>
<pre class="code">/etc/init.d/squid start</pre>
<p>And now watch the <code>/var/log/squid/cache.log</code> for a similar line:</p>
<pre class="code">2007/01/01 18:32:27| With 8192 file descriptors available</pre>
<p>If it still says <code>1024 file descriptors available</code> (or similarly low value) you are out of luck (or you’ve just messed something up).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/06/20/squid-warning-your-cache-is-running-out-of-filedescriptors/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Controlling Squid&#8217;s Memory Usage</title>
		<link>http://blog.nazmi.web.id/2007/06/20/controlling-squids-memory-usage/</link>
		<comments>http://blog.nazmi.web.id/2007/06/20/controlling-squids-memory-usage/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 06:56:16 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/20/06/2007/controlling-squids-memory-usage/</guid>
		<description><![CDATA[Squid tends to be a bit of a memory hog.  It uses memory for many   different things, some of which are easier to control than others.   Memory usage is important because if the Squid process size exceeds   your system&#8217;s RAM capacity, some chunks of the process must be [...]]]></description>
			<content:encoded><![CDATA[<p><span id="intelliTxt">Squid tends to be a bit of a memory hog.  It uses memory for many   different things, some of which are easier to control than others.   Memory usage is important because if the Squid process size exceeds   your system&#8217;s RAM capacity, some chunks of the process must be   temporarily swapped to disk.  Swapping can also happen if you   have other memory-hungry applications running on the same system.   Swapping causes Squid&#8217;s performance to degrade very quickly.</span></p>
<p>An easy way to monitor Squid&#8217;s memory usage is with standard   system tools such as <code>top</code> and <code>ps</code>.  You can also ask Squid   itself how much memory it is using, through either the cache   manager or SNMP interfaces.  If the process size becomes too large,   you&#8217;ll want to take steps to reduce it.  A good rule of thumb is   to not let Squid&#8217;s process size exceed 60% to 80% of your RAM capacity.<span id="more-91"></span></p>
<p>One of the most important uses for memory is the main cache index.   This is a hash table that contains a small amount of metadata for   each object in the cache.  Unfortunately, all of these &#8220;small&#8221; data   structures add up to a lot when Squid contains millions of objects.   The only way to control the size of the in-memory index is to   change Squid&#8217;s disk cache size (with the <code>cache_dir</code> directive).   Thus, if you have plenty of disk space, but are short on RAM, you   may have to leave the disk space underutilized.</p>
<p>Squid&#8217;s in-memory cache can also use significant amounts of RAM.   This is where Squid stores incoming and recently retrieved objects.   Its size is controlled by setting the <code>cache_mem</code> directive.  Note   that the <code>cache_mem</code> directive only affects the size of the memory   cache, not Squid&#8217;s entire memory footprint.</p>
<p>Squid also uses some memory for various I/O buffers.  For example,   each time a client makes an HTTP request to Squid, a number of   memory buffers are allocated and then later freed.  Squid uses   similar buffers when forwarding requests to origin servers, and   when reading and writing disk files.  Depending on the amount and   type of traffic coming to Squid, these I/O buffers may require a   lot of memory.  There&#8217;s not much you can do to control memory   usage for these purposes.  However, you can try changing the TCP   receive buffer size with the <code>tcp_recv_bufsize</code> directive.</p>
<p>If you have a large number of clients accessing Squid, you may   find that the &#8220;client DB&#8221; consumes more memory than you would   like.  It keeps a small number of counters for each client IP   address that sends requests to Squid.  You can reduce Squid&#8217;s   memory usage a little by disabling this feature.  Simply put   <code>client_db off</code> in <em>squid.conf</em>.</p>
<p>Another thing that can help is to simply restart Squid periodically,   say, once per week.  Over time, something may happen (such as a   network outage) that causes Squid to temporarily allocate a large   amount of memory.  Even though Squid may not be using that memory,   it may still be attached to the Squid process.  Restarting Squid   allows your operating system to truly free up the memory for other   uses.</p>
<p>You can use Squid&#8217;s <code>high_memory_warning</code> directive to warn you   when its memory size exceeds a certain limit.  For example, add   a line like this to <em>squid.conf</em>:</p>
<pre><code>high_memory_warning 400 MB</code></pre>
<p>Then, if the process grows beyond that value, Squid writes warnings   to <em>cache.log</em> and syslog if configured.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/06/20/controlling-squids-memory-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Block spam relay with squid.conf</title>
		<link>http://blog.nazmi.web.id/2007/06/20/block-spam-relay-with-squid-conf/</link>
		<comments>http://blog.nazmi.web.id/2007/06/20/block-spam-relay-with-squid-conf/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 06:51:14 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/20/06/2007/squid-how-to-not-be-a-spam-relay/</guid>
		<description><![CDATA[Unless you&#8217;ve been living under a rock, you&#8217;re aware of the spam   problem on the Internet.  Spam senders used to take advantage of   open email relays.  These days, a lot of spam comes from open   proxies.  An open proxy is one that allows outsiders to make [...]]]></description>
			<content:encoded><![CDATA[<p><span id="intelliTxt">Unless you&#8217;ve been living under a rock, you&#8217;re aware of the spam   problem on the Internet.  Spam senders used to take advantage of   open email relays.  These days, a lot of spam comes from open   proxies.  An open proxy is one that allows outsiders to make   requests through it.  If others on the Internet receive spam email   from your proxy, your IP address will be placed on one or more   of the various blackhole lists.  This will adversely affect your   ability to communicate with other Internet sites.</span></p>
<p>Use the following access control rules to make sure this never   happens to you.  First, always deny all requests that don&#8217;t come   from your local network.  Define an ACL element for your subnet:</p>
<pre><code>acl MyNetwork src 10.0.0.0/16</code></pre>
<p><span id="more-90"></span><br />
Then, place a deny rule near the top of your <code>http_access</code> rules   that matches requests from anywhere else:</p>
<pre><code>http_access deny !MyNetwork
http_access ...
http_access ...</code></pre>
<p>While that may stop outsiders, it may not be good enough.  It   won&#8217;t stop insiders who intentionally, or unintentionally, try   to forward spam through Squid.   To add even more security, you   should make sure that Squid never connects to another server&#8217;s   SMTP port:</p>
<pre><code>acl SMTP_port port 25
http_access deny SMTP_port</code></pre>
<p>In fact, there are many well-known TCP ports, in addition to SMTP,   to which Squid should never connect.  The default <em>squid.conf</em> includes some rules to address this.  There, you&#8217;ll see a   <code>Safe_ports</code> ACL element that defines good ports.  A <code>deny   !Safe_ports</code> rule ensures that Squid does not connect to any of   the bad ports, including SMTP.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/06/20/block-spam-relay-with-squid-conf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding Squid ACL Regex</title>
		<link>http://blog.nazmi.web.id/2007/06/20/understanding-squids-access-control-syntax/</link>
		<comments>http://blog.nazmi.web.id/2007/06/20/understanding-squids-access-control-syntax/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 06:41:21 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/20/06/2007/understanding-squids-access-control-syntax/</guid>
		<description><![CDATA[Squid has an extensive, but somewhat confusing, set of access   controls.  The most important thing to understand is the difference   between ACL types, elements, and rules, and how they work together   to allow or deny access.
Squid has about 20 different ACL types.  These refer to certain  [...]]]></description>
			<content:encoded><![CDATA[<p><span id="intelliTxt">Squid has an extensive, but somewhat confusing, set of access   controls.  The most important thing to understand is the difference   between ACL types, elements, and rules, and how they work together   to allow or deny access.</span></p>
<p>Squid has about 20 different ACL types.  These refer to certain   aspects of an HTTP request or response, such as the client&#8217;s IP   address (the <code>src</code> type), the origin server&#8217;s hostname (the   <code>dstdomain</code> type), and the HTTP request method (the <code>method</code>   type).</p>
<p>An ACL element consists of three components: a type, a name, and one or   more type-specific values.  Here are some simple examples:</p>
<pre><code>acl Foo src 1.2.3.4
acl Bar dstdomain www.cnn.com
acl Baz method GET</code></pre>
<p><span id="more-89"></span><br />
The above ACL element named <code>Foo</code> would match a request that comes from   the IP address 1.2.3.4.  The ACL named <code>Bar</code> matches a www.cnn.com URL.   The <code>Baz</code> ACL matches an HTTP <code>GET</code> request.  Note that we are not allowing   or denying anything yet.</p>
<p>For most of the ACL types, an element can have multiple values, like this:</p>
<pre><code>acl Argle src 1.1.1.8 1.1.1.28 1.1.1.88
acl Bargle dstdomain www.nbc.com www.abc.com www.cbs.com
acl Fraggle method PUT POST</code></pre>
<p>A multi-valued ACL matches a request when any one of the values   is a match.  They use <code>OR</code> logic.  The <code>Argle</code> ACL matches a request   from 1.1.1.8, from 1.1.1.28, or from 1.1.1.88.  The <code>Bargle</code> ACL   matches requests to NBC, ABC, or CBS web sites.  The Fraggle ACL   matches a request with the methods <code>PUT</code> or <code>POST</code>.</p>
<p>Now that you&#8217;re an expert in ACL elements, its time to graduate   to ACL rules.  These are where you say that a request is allowed   or denied.  Access list rules refer to ACL elements by their names   and contain either the <code>allow</code> or <code>deny</code> keyword.  Here are some   simple examples:</p>
<pre><code>http_access allow Foo
http_access deny Bar
http_access allow Baz</code></pre>
<p>It is important to understand that access list rules are checked   in order and that the decision is made when a match is found.   Given the above list, let&#8217;s see what happens when a user from   1.2.3.4 makes a <code>GET</code> request for www.cnn.com.  Squid   encounters the <code>allow Foo</code> rule first.  Our request matches the   <code>Foo</code> ACL, because the source address is 1.2.3.4, and the request   is allowed to proceed.  The remaining rules are not checked.</p>
<p>How about a <code>PUT</code> request for www.cnn.com from 5.5.5.5?  The request   does not match the first rule.  It does match the second rule,   however.  This access list rule says that the request must be   denied, so the user receives an error message from Squid.</p>
<p>How about a <code>GET</code> request for www.oreilly.com from 5.5.5.5?  The   request does not match the first rule (<code>allow Foo</code>).  It does not   match the second rule, either, because www.oreilly.com is different   than www.cnn.com.  However, it does match the third rule, because   the request method is <code>GET</code>.</p>
<p>Of course, these simple ACL rules are not very interesting.  The   real power comes from Squid&#8217;s ability to combine multiple elements   on a single rule.  When a rule contains multiple elements, each   element must be a match in order to trigger the rule.  In other   words, Squid uses <code>AND</code> logic for access list rules.  Consider this   example:</p>
<pre><code>http_access allow Foo Bar
http_access deny Foo</code></pre>
<p>The first rule says that a request from 1.2.3.4 <code>AND</code> for www.cnn.com   will be allowed.  However, the second rule   says that any other request from 1.2.3.4 will be denied.  These   two lines restrict the user at 1.2.3.4 to visiting only the   www.cnn.com site.  Here&#8217;s an even more complex example:</p>
<pre><code>http_access deny Argle Bargle Fraggle
http_access allow Argle Bargle
http_access deny Argle</code></pre>
<p>These three lines allow the <code>Argle</code> clients (1.1.1.8, 1.1.1.28, and 1.1.1.88)   to access the <code>Bargle</code> servers (www.nbc.com, www.abc.com, and www.cbs.com), but   not with <code>PUT</code> or <code>POST</code> methods.  Furthermore, the <code>Argle</code> clients are not   allowed to access any other servers.</p>
<p>One of the common mistakes often made by new users is to write a   rule that can never be true.  It is easy to do if you forget that   Squid uses <code>AND</code> logic on rules and <code>OR</code> logic on elements.  Here is   a configuration that can never be true:</p>
<pre><code>acl A 1.1.1.1
acl B 2.2.2.2
http_access allow A B</code></pre>
<p>The reason is that a request cannot be from both 1.1.1.1 <code>AND</code>   2.2.2.2 at the same time.  Most likely, it should be written   like this:</p>
<pre><code>acl A 1.1.1.1 2.2.2.2
http_access allow A</code></pre>
<p>Then, requests from either 1.1.1.1 or 2.2.2.2 are allowed.</p>
<p>Access control rules can become long and complicated.   When   adding a new rule, how do you know where it should go?  You should   put more-specific rules before less-specific ones.  Remember that   the rules are checked in order.  When adding a rule, go through   the current rules in your head and see where the new one fits.   For example, let&#8217;s say that you want to deny requests to a certain   site, but allow all others.  It should look like this:</p>
<pre><code>acl XXX www.badsite.net
acl All src 0/0
http_access deny XXX
http_access allow All</code></pre>
<p>Now, what if you need to make an exception for one user, so that she   can visit that site?  The new ACL element is:</p>
<pre><code>acl Admin 3.3.3.3</code></pre>
<p>and the new rule should be:</p>
<pre><code>http_access allow Admin XXX</code></pre>
<p>but where does it go?  Since this rule is more specific than the   <code>deny XXX</code> rule, it should go first:</p>
<pre><code>http_access allow Admin XXX
http_access deny XXX
http_access allow All</code></pre>
<p>If we place the new rule after <code>deny XXX</code>, it will never even get   checked.  The first rule will always match the request and she   will not be able to visit the site.</p>
<p>When you first install Squid, the access control rules will deny   every request.  To get things working, you&#8217;ll need to add an ACL   element and a rule for your local network.  The easiest way is to   write an source IP address ACL element for your subnet(s).  For   example:</p>
<pre><code>acl MyNetwork src 192.168.0.0/24</code></pre>
<p>Then, search through <em>squid.conf</em> for this line:</p>
<pre><code># INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS</code></pre>
<p>After that line, add an <code>http_access</code> line with an allow rule:</p>
<pre><code>http_access allow MyNetwork</code></pre>
<p>Once you get this simple configuration working, feel free to move on to   some of the more advanced ACL features, such as username-based proxy   authentication.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/06/20/understanding-squids-access-control-syntax/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rotating Squid Log Files</title>
		<link>http://blog.nazmi.web.id/2007/06/20/rotating-squid-log-files/</link>
		<comments>http://blog.nazmi.web.id/2007/06/20/rotating-squid-log-files/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 06:16:20 +0000</pubDate>
		<dc:creator>Irving</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tips & Trik]]></category>

		<guid isPermaLink="false">http://blog.nazmi.web.id/20/06/2007/rotating-squid-log-files/</guid>
		<description><![CDATA[  Squid writes to various log and journal files as it runs.  These   files will continually increase in size unless you take steps to   &#8220;rotate&#8221; them.  Rotation refers to the process of closing a log   file, renaming it, and opening a new log file.   [...]]]></description>
			<content:encoded><![CDATA[<p><span id="intelliTxt">  Squid writes to various log and journal files as it runs.  These   files will continually increase in size unless you take steps to   &#8220;rotate&#8221; them.  Rotation refers to the process of closing a log   file, renaming it, and opening a new log file.   It&#8217;s similar to   the way that most systems deal with their syslog files, such   as <em>/var/log/messages</em>.</span></p>
<p>If you don&#8217;t rotate the log files, they may eventually consume   all free space on that partition.  Some operating systems, such   as Linux, cannot support files larger than 2Gb.  When   this happens, you&#8217;ll get a &#8220;File too large&#8221; error message and   Squid will complain and restart.</p>
<p>To avoid such problems, create a <code>cron</code> job that periodically rotates   the log files.  It can be as simple as this: <span id="more-88"></span></p>
<pre><code>0 0 * * * /usr/local/squid/sbin/squid -k rotate</code></pre>
<p>In most cases, daily log file rotation is the most appropriate.   A not-so-busy cache can get by with weekly or monthly rotation.</p>
<p>Squid appends numeric suffixes to rotated log files.  Each time   you run <code>squid -k rotate</code>, each file&#8217;s numeric suffix is incremented   by one.  Thus, <em>cache.log.0</em> becomes <em>cache.log.1</em>, <em>cache.log.1</em> becomes   <em>cache.log.2</em>, and so on.  The <code>logfile_rotate</code> directive specifies   the maximum number of old files to keep around.</p>
<p>Logfile rotation affects more than just the log files in  <em>/usr/local/squid/var/logs</em>.  It also generates new <em>swap.state</em>   files for each cache directory.  However, Squid does not keep old   copies of the <em>swap.state</em> files.  It simply writes a new file from   the in-memory index and forgets about the old one.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nazmi.web.id/2007/06/20/rotating-squid-log-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

