<?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>OFF TOPIC! &#187; Debian</title>
	<atom:link href="http://www.luizxx.com/archives/tag/debian/feed" rel="self" type="application/rss+xml" />
	<link>http://www.luizxx.com</link>
	<description>Luizxx Expansion Set</description>
	<lastBuildDate>Fri, 16 Jul 2010 04:13:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>[Iptables] Armazenando regras no Debian Linux</title>
		<link>http://www.luizxx.com/archives/600</link>
		<comments>http://www.luizxx.com/archives/600#comments</comments>
		<pubDate>Sun, 14 Feb 2010 13:28:38 +0000</pubDate>
		<dc:creator>Luiz</dc:creator>
				<category><![CDATA[Unix / Linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://www.luizxx.com/?p=600</guid>
		<description><![CDATA[Configurar regras de firewall com iptables é uma tarefa bem comum no cotidiano de qualquer administrador de sistemas Linux, porém assim como outros tipos de configuração o serviço possui suas recomendações de acordo com a distribuição utilizada. Primeiramente vamos criar um arquivo temporário para a validação das regras: # vim /etc/iptables.test.rules E então colocamos nossas [...]]]></description>
			<content:encoded><![CDATA[<p>Configurar regras de firewall com <em>iptables</em> é uma tarefa bem comum no cotidiano de qualquer administrador de sistemas Linux, porém assim como outros tipos de configuração o serviço possui suas recomendações de acordo com a distribuição utilizada.</p>
<p>Primeiramente vamos criar um arquivo temporário para a validação das regras:</p>
<p># vim /etc/iptables.test.rules</p>
<p>E então colocamos nossas regras dentro dele seguindo o padrão do próprio iptables, como no exemplo abaixo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">*</span>filter
&nbsp;
 <span style="color: #666666; font-style: italic;"># Allows loopback traffic and drop all traffic to 127/8 that doesn't use lo0</span>
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> lo <span style="color: #660033;">-j</span> ACCEPT
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #000000; font-weight: bold;">!</span> lo <span style="color: #660033;">-d</span> 127.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> REJECT
&nbsp;
 <span style="color: #666666; font-style: italic;"># Accepts all established inbound connections</span>
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> ESTABLISHED,RELATED <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
 <span style="color: #666666; font-style: italic;"># Allows all outbound traffic</span>
 <span style="color: #666666; font-style: italic;"># You could modify this to only allow certain traffic</span>
 <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
 <span style="color: #666666; font-style: italic;"># Allows HTTP and HTTPS connections from anywhere</span>
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-j</span> ACCEPT
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">443</span> <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
 <span style="color: #666666; font-style: italic;"># Allows SSH connections</span>
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">--dport</span> <span style="color: #000000;">22</span> <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
 <span style="color: #666666; font-style: italic;"># Allow ping</span>
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> icmp <span style="color: #660033;">-m</span> icmp <span style="color: #660033;">--icmp-type</span> <span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
 <span style="color: #666666; font-style: italic;"># log iptables denied calls (access via 'dmesg' command)</span>
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>min <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;iptables denied: &quot;</span> <span style="color: #660033;">--log-level</span> <span style="color: #000000;">7</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># Reject all other inbound - default deny unless explicitly allowed policy:</span>
 <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-j</span> REJECT
 <span style="color: #660033;">-A</span> FORWARD <span style="color: #660033;">-j</span> REJECT
&nbsp;
 COMMIT</pre></div></div>

<p>Após a criação do arquivo com suas regras carregue-as com:</p>
<p># iptables-restore < /etc/iptables.test.rules</p>
<p>Verifique se as regras estão corretas e se é necessária alguma alteração, e caso seja necessário simplesmente repita os procedimentos citados acima.</p>
<p>Depois de todas as regras carregadas corretamente salve-as em um arquivo definitivo como no exemplo abaixo:</p>
<p># iptables-save > /etc/iptables.up.rules</p>
<p>Para garantir que nossas regras sejam carregadas durante o boot do sistema é necessário criar uma entrada para o <em>iptables</em> juntamente com os scripts de inicialização da rede:</p>
<p># vim /etc/network/if-pre-up.d/iptables</p>
<p>Adicionando o seguinte conteúdo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables-restore <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>iptables.up.rules</pre></div></div>

<p>Não podemos esquecer de dar permissão de execução para nosso script de chamada:</p>
<p># chmod +x /etc/network/if-pre-up.d/iptables</p>
<p>Outra maneira muito comum de armazenar e carregar regras de iptables em sistemas Linux é com a utilização de um script de init, por exemplo <em>/etc/init.d/firewall</em>, adicionando sua inicialização nos <em>runlevels</em> do sistema.</p>
<p>Lembrando que todos os procedimentos e informações a respeito deste tipo de configuração em sistemas Debian Linux podem ser encontrados no wiki e também na documentação oficial do Debian em <a href="http://wiki.debian.org">http://wiki.debian.org/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luizxx.com/archives/600/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configurando Timezone no Debian Linux</title>
		<link>http://www.luizxx.com/archives/561</link>
		<comments>http://www.luizxx.com/archives/561#comments</comments>
		<pubDate>Thu, 14 Jan 2010 03:28:24 +0000</pubDate>
		<dc:creator>Luiz</dc:creator>
				<category><![CDATA[Unix / Linux]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://www.luizxx.com/?p=561</guid>
		<description><![CDATA[Normalmente cada distribuição Linux tem seu próprio método de configuração para o timezone, que geralmente é bem simples, porém muitas vezes encontro servidores com timezone configurado de forma incorreta, o que pode trazer problemas durante a execução de diversas aplicações. Como grande parte das distribuições atuais seguem o padrão Red Hat ou Debian, vou postar [...]]]></description>
			<content:encoded><![CDATA[<p>Normalmente cada distribuição Linux tem seu próprio método de configuração para o timezone, que geralmente é bem simples, porém muitas vezes encontro servidores com timezone configurado de forma incorreta, o que pode trazer problemas durante a execução de diversas aplicações.</p>
<p>Como grande parte das distribuições atuais seguem o padrão Red Hat ou Debian, vou postar aqui inicialmente os métodos para configuração do timezone na plataforma Debian e no próximo artigo os procedimentos para Red Hat / CentOS.</p>
<p>Primeiramente verifique em qual timezone seu sistema está configurado com:</p>
<blockquote><p>luizxx@kanu:~# tzconfig<br />
<em>Your current time zone is set to America/Sao_Paulo<br />
Do you want to change that? [n]:</em></p></blockquote>
<p>Caso o timezone apresentado esteja incorreto pressione y para configurá-lo corretamente seguindo as instruções apresentadas na tela.</p>
<p>Caso você queira configurar o timezone de um local dentro do Brasil, instale o pacote tz-brasil para agilizar as configurações de horário de verão:</p>
<blockquote><p>luizxx@kanu:~# apt-get install tz-brasil</p></blockquote>
<p>No Debian temos algumas particularidades na estrutura de configuração dependendo da versão do sistema operacional, na versão Etch e posteriores o arquivo /etc/localtime é uma cópia idêntica do datafile original, já nas versões anteriores ao Sarge ele é um link para o arquivo original, como apresentado no exemplo abaixo:</p>
<p><em>Debian Etch:</em><br />
<em>$ diff -s /etc/localtime /usr/share/zoneinfo/`cat /etc/timezone`<br />
Files /etc/localtime and /usr/share/zoneinfo/America/New_York are identical</em></p>
<p><em>Debian Sarge:</em><br />
<em>$ ls -l /etc/localtime<br />
lrwxrwxrwx    1 root     root           48 Mar 31 11:19 /etc/localtime -> /usr/share/zoneinfo/America/Sao_Paulo</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.luizxx.com/archives/561/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
