<?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>Fogo na Caixa dAgua &#187; Linux</title>
	<atom:link href="http://www.fogonacaixadagua.com.br/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fogonacaixadagua.com.br</link>
	<description>http://www.fogonacaixadagua.com.br</description>
	<lastBuildDate>Tue, 20 Sep 2011 21:39:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SARG 2.3.1 erro ao compilar no Fedora 14</title>
		<link>http://www.fogonacaixadagua.com.br/2011/03/sarg-2-3-1-erro-ao-compilar-no-fedora-14/</link>
		<comments>http://www.fogonacaixadagua.com.br/2011/03/sarg-2-3-1-erro-ao-compilar-no-fedora-14/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 15:22:52 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Pânico]]></category>
		<category><![CDATA[Troubleshoot]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[sarg]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1492</guid>
		<description><![CDATA[SARG é um gerador de relatório pro squid e é bom no que faz. Tudo vai bem no ./configure O comando make parece que vai terminar tudo certo, até que nos 45 minutos do segundo tempo: /usr/bin/ld: grepday.o: undefined reference to symbol 'exp@@GLIBC_2.0' /usr/bin/ld: note: 'exp@@GLIBC_2.0' is defined in DSO /lib/libm.so.6 so try adding it [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2011/03/sarg-2-3-1-erro-ao-compilar-no-fedora-14/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>SARG é um gerador de relatório pro squid e é bom no que faz.</p>
<p>Tudo vai bem no</p>
<pre class="brush:shell">
./configure
</pre>
<p>O comando make parece que vai terminar tudo certo, até que nos 45 minutos do segundo tempo:</p>
<pre class="brush:text">
/usr/bin/ld: grepday.o: undefined reference to symbol 'exp@@GLIBC_2.0'
/usr/bin/ld: note: 'exp@@GLIBC_2.0' is defined in DSO /lib/libm.so.6 so try adding it to the linker command line
/lib/libm.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [sarg] Error 1
</pre>
<p>pau.</p>
<p>Pra resolver:</p>
<pre class="brush:text">
export LDFLAGS="$LDFLAGS -lm"
./configure
make
</pre>
<p>Fera!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2011/03/sarg-2-3-1-erro-ao-compilar-no-fedora-14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rootsh: Keylogger para CLI do Linux</title>
		<link>http://www.fogonacaixadagua.com.br/2010/04/rootsh-keylogger-para-cli-do-linux/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/04/rootsh-keylogger-para-cli-do-linux/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 14:11:43 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Seguranca]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Keylogger]]></category>
		<category><![CDATA[Log]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1452</guid>
		<description><![CDATA[rootsh é um shell que loga tudo o que um usuário root vê no terminal. É útil se você tem vários administradores com acesso root num servidor e você quer gravar exatamente o que o usuário faz. Fazer o download do rootsh-1.5.3.tar.gz. wget http://www.virtualxp.org/downloads/rootsh-1.5.3.tar.gz Descompactar, configurar, compilar e instalar: tar zxvf rootsh-1.5.3.tar.gz -C /usr/src cd [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/04/rootsh-keylogger-para-cli-do-linux/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>rootsh é um shell que loga tudo o que um usuário root vê no terminal. É útil se você tem vários administradores com acesso root num servidor e você quer gravar exatamente o que o usuário faz.</p>
<p>Fazer o download do <a href=http://www.virtualxp.org/downloads/rootsh-1.5.3.tar.gz>rootsh-1.5.3.tar.gz</a>.</p>
<pre class="brush: plain">
wget http://www.virtualxp.org/downloads/rootsh-1.5.3.tar.gz
</pre>
<p>Descompactar, configurar, compilar e instalar:</p>
<pre class="brush: shell">
tar zxvf rootsh-1.5.3.tar.gz -C /usr/src
cd /usr/src/rootsh-1.5.3
./configure --disable-syslog --disable-linenumbering
make
make install
</pre>
<p>Depois de instalado os binários, o sistema está quase pronto. A única necessidade que falta é criar o diretório do rootsh em <tt>/var/log</tt> onde serão gravados os logs. Esse procedimento não está documentado, mas é necessário.</p>
<pre class="brush:plain">
mkdir /var/log/rootsh
</pre>
<h2>Garantindo que o usuário root usará o rootsh como shell padrão</h2>
<p>Para garantir que o usuário <tt>root</tt> usará o <tt>rootsh</tt> como shell padrão, adicione o <tt>rootsh</tt> ao arquivo <tt>/etc/shells</tt>:</p>
<pre class="brush:plain">
echo /usr/local/bin/rootsh >> /etc/shells
</pre>
<p>Após esse passo, definir o shell para o usuário <tt>root</tt></p>
<pre class="brush: plain">
usermod -s /usr/local/bin/rootsh root
</pre>
<p>Então, toda vez que o usuário <tt>root</tt> fizer login, seja direto por <tt>ssh</tt> ou por <tt>su</tt> será criado um arquivo de log em <tt>/var/log/rootsh</tt> com a seguinte estrutura:</p>
<pre class="brush: plain">
< user >.< date >< time >.< process id ></pre>
<p>A formatação de cada arquivo de log é exatamente a mesma que o usuário vê no terminal.</p>
<pre class="brush: shell">
cd /var/log/rootsh
ls
root.20100420105208.00a0a.closed
#
</pre>
<h2>Conclusão</h2>
<p>Se você não confia em seus sysadmins, ou se você quer ter um controle a mais do que está sendo feito no seu sistema, não tem erro com <tt>rootsh</tt></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/04/rootsh-keylogger-para-cli-do-linux/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>grep, sed, cut e cat: Script parser para log do Oracle Listener</title>
		<link>http://www.fogonacaixadagua.com.br/2010/04/grep-sed-cut-e-cat-script-parser-para-log-do-oracle-listener/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/04/grep-sed-cut-e-cat-script-parser-para-log-do-oracle-listener/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 14:32:21 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Log]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1447</guid>
		<description><![CDATA[O que o script faz? Faz um parse no arquivo de log do Oracle Listener e extrai o HOST do usuário, o USER e o HOST e PORTA que o usuário está conectando. #!/bin/bash # ############################################################################### # # Descrição: Fazer o parse do LOG e extrair apenas o HOST e USER, também # HOST e [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/04/grep-sed-cut-e-cat-script-parser-para-log-do-oracle-listener/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><h2>O que o script faz?</h2>
<p>Faz um parse no arquivo de log do Oracle Listener e extrai o HOST do usuário, o USER e o HOST e PORTA que o usuário está conectando.</p>
<pre class="brush:shell">
#!/bin/bash
#
###############################################################################
#
# Descrição: Fazer o parse do LOG e extrair apenas o HOST e USER, também
#            HOST e PORT
# Autor: Daniel K Lima
# Data : 10/03/2010
# Uso  : ./parser.sh arquivo.log
#
###############################################################################

# Parâmetros
LOG=${1}
SED=$(which sed)
CUT=$(which cut)
GREP=$(which grep)
CAT=$(which cat)

# Arquivo temporário
TMP="/tmp/parser.tmp"

# Validação
if [ -z ${LOG} ]; then
        echo "Arquivo não existe ou não informado."
        echo "Utilize o formato ./parser.sh arquivo.log"
        exit 1
fi      

# Faz um grep no arquivo do LOG e só processa as linhas com CONNECT e
# substituir os ( ) por ,
$(${GREP} "CONNECT" ${LOG} | ${SED} -e 's/)/,/g' -e 's/(/,/g' > ${TMP})

# Processar cada linha que o filtro do GREP passou
${CAT} ${TMP} | while read line
do
	# Extrair do campo os valores e jogar pra uma variável própria
	USERHOST=$(echo ${line} | ${CUT} -d',' -f 10 | ${CUT} -d'=' -f 2)
	USERNAME=$(echo ${line} | ${CUT} -d',' -f 12 | ${CUT} -d'=' -f 2)
	SERVERHOST=$(echo ${line} | ${CUT} -d',' -f 19 | ${CUT} -d'=' -f 2)
	SERVERPORT=$(echo ${line} | ${CUT} -d',' -f 21 | ${CUT} -d'=' -f 2)

	# Imprimir os resultados
	echo "   HOST Usuário: ${USERHOST} "
	echo "       Username: ${USERNAME}"
	echo "  HOST Servidor: ${SERVERHOST}"
	echo "          Porta: ${SERVERPORT}"
	echo " "
done
</pre>
<p>Para customizar o resultado, é só editar as linhas 44 a 48 para adequar a sua necessidade.</p>
<h2>Exemplo do arquivo do Log</h2>
<p><b>Arquivo: </b> connect.log</p>
<pre class="brush: plain">
04-MAR-2010 19:09:18 * ,CONNECT_DATA=,SERVER=DEDICATED,,SERVICE_NAME=cmt,,CID=,PROGRAM=C:\Arquivos de programas\Quest Software\Toad for Oracle\TOAD.exe,,HOST=APBMZ-001062,,USER=Dario,,, * ,ADDRESS=,PROTOCOL=tcp,,HOST=10.100.5.2,,PORT=2898,, * establish * cmt * 0
04-MAR-2010 19:09:22 * ,CONNECT_DATA=,SERVER=DEDICATED,,SERVICE_NAME=cmt,,CID=,PROGRAM=C:\Arquivos de programas\Quest Software\Toad for Oracle\TOAD.exe,,HOST=APBMZ-001062,,USER=Dario,,, * ,ADDRESS=,PROTOCOL=tcp,,HOST=10.100.5.2,,PORT=2901,, * establish * cmt * 0
05-MAR-2010 12:01:40 * ,CONNECT_DATA=,SERVER=DEDICATED,,SERVICE_NAME=cmt,,CID=,PROGRAM=C:\TFSRoot\APB.Mercury.Fork.CMT\Main\Source\APB.Mercury\Mercury.WindowsService\WindowsService.IntgCmtBv\APB.Mercury.WindowsService.IntgCmtBv\bin\Debug\APB.Mercury.WindowsService.IntgCmtBv.vshost.exe,,HOST=ASD001,,USER=Igor,,, * ,ADDRESS=,PROTOCOL=tcp,,HOST=10.100.5.2,,PORT=53725,, * establish * cmt * 0
05-MAR-2010 13:01:12 * ,CONNECT_DATA=,SERVER=dedicated,,SERVICE_NAME=cmt,,CID=,PROGRAM=C:\Program Files\Quest Software\Toad for Oracle\toad.exe,,HOST=APB-RJZ2BM87D3X,,USER=jcb,,, * ,ADDRESS=,PROTOCOL=tcp,,HOST=10.100.5.2,,PORT=1421,, * establish * cmt * 0
05-MAR-2010 13:01:17 * ,CONNECT_DATA=,SERVER=dedicated,,SERVICE_NAME=cmt,,CID=,PROGRAM=C:\Program Files\Quest Software\Toad for Oracle\toad.exe,,HOST=APB-RJZ2BM87D3X,,USER=jcb,,, * ,ADDRESS=,PROTOCOL=tcp,,HOST=10.100.5.2,,PORT=1422,, * establish * cmt * 0
05-MAR-2010 13:22:05 * ,CONNECT_DATA=,SERVER=dedicated,,SERVICE_NAME=cmt,,CID=,PROGRAM=C:\Program Files\Quest Software\Toad for Oracle\toad.exe,,HOST=APB-RJZ2BM87D3X,,USER=jcb,,, * ,ADDRESS=,PROTOCOL=tcp,,HOST=10.100.5.2,,PORT=2701,, * establish * cmt * 0
</pre>
<h2>Exemplo do resultado do parse feito pelo script</h2>
<p>Resultado:</p>
<pre class="brush: plain">
   HOST Usuário: APBMZ-001062
       Username: Dario
  HOST Servidor: 10.100.5.2
          Porta: 2898

   HOST Usuário: APBMZ-001062
       Username: Dario
  HOST Servidor: 10.100.5.2
          Porta: 2901

   HOST Usuário: ASD001
       Username: Igor
  HOST Servidor: 10.100.5.2
          Porta: 53725

   HOST Usuário: APB-RJZ2BM87D3X
       Username: jcb
  HOST Servidor: 10.100.5.2
          Porta: 1421

   HOST Usuário: APB-RJZ2BM87D3X
       Username: jcb
  HOST Servidor: 10.100.5.2
          Porta: 1422

   HOST Usuário: APB-RJZ2BM87D3X
       Username: jcb
  HOST Servidor: 10.100.5.2
          Porta: 2701
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/04/grep-sed-cut-e-cat-script-parser-para-log-do-oracle-listener/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CLI: Converter um PDF para uma imagem</title>
		<link>http://www.fogonacaixadagua.com.br/2010/04/cli-converter-um-pdf-para-uma-imagem/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/04/cli-converter-um-pdf-para-uma-imagem/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 03:18:04 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1431</guid>
		<description><![CDATA[Ter um PDF é bom, é prático e tudo o mais, mas é necessário ter um programa específico para poder abrir os arquivos .pdf como o Acrobat Reader, o evince e outros. As vezes não é necessário ou não é desejado ter um programa específico para poder abrir PDFs, sendo mais prático, no entanto, utilizar [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/04/cli-converter-um-pdf-para-uma-imagem/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Ter um PDF é bom, é prático e tudo o mais, mas é necessário ter um programa específico para poder abrir os arquivos .pdf como o Acrobat Reader, o evince e outros.</p>
<p>As vezes não é necessário ou não é desejado ter um programa específico para poder abrir PDFs, sendo mais prático, no entanto, utilizar o próprio navegador que suporta abrir as imagens diretamente sem auxílio externo.</p>
<p>Caso essa seja a sua necessidade, converter os PDFs que estejam num servidor ou o que seja, vou mostrar abaixo como converter PDF para imagem através da linha de comando do Linux utilizando o programa ImageMagick.</p>
<h2>Instalando o ImageMagick no CentOS / Red Hat</h2>
<p>No Red Hat / CentOS é bem simples:</p>
<pre class="brush: shell">
yum install ImageMagick
</pre>
<p>Será instalado o ImageMagick e todas as dependências. Não se assuste se dentre elas ter alguma biblioteca do x.org, é necessário para várias bibliotecas de imagem.</p>
<h2>Convertendo o PDF em imagem</h2>
<p>Para converter o PDF propriamente dito para um arquivo de imagem, simplesmente execute o comando <tt>convert</tt> mais o destino, por exemplo:</p>
<pre class="brush: shell">
convert Relatorio2010.pdf Relatorio2010.png
</pre>
<p>Será gerado uma imagem do PDF no formato .png, mas caso seja necessário que o PDF seja convertido para JPEG, altere a extensão do arquivo de destino:</p>
<pre class="brush: shell">
convert Relatorio2010.pdf Relatorio2010.jpg
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/04/cli-converter-um-pdf-para-uma-imagem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache: Autenticação com eDirectory</title>
		<link>http://www.fogonacaixadagua.com.br/2010/04/apache-autenticacao-com-edirectory/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/04/apache-autenticacao-com-edirectory/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 19:52:14 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[eDirectory]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1423</guid>
		<description><![CDATA[Quando há um LDAP server na rede, nesse caso o eDirectory, é interessante manter uma centralização dos usuários pois não é necessário ficar criando usuários manualmente nem os usuários terão várias senhas para guardar. Parto do princípio que já tenha o Apache instalado e funcionando. É necessário o mod_authz_ldap para configurar essa autenticação com o [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/04/apache-autenticacao-com-edirectory/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Quando há um LDAP server na rede, nesse caso o eDirectory, é interessante manter uma centralização dos usuários pois não é necessário ficar criando usuários manualmente nem os usuários terão várias senhas para guardar.</p>
<p>Parto do princípio que já tenha o Apache instalado e funcionando.</p>
<p>É necessário o <tt>mod_authz_ldap</tt> para configurar essa autenticação com o LDAP.</p>
<h2>Instalando o mod_authz_ldap</h2>
<p>No CentOS / Red Hat, para instalar:</p>
<pre class="brush: plain">yum install mod_authz_ldap</pre>
<h2>Configurando o diretório que deverá ser autenticado</h2>
<p>O que é necessário saber do eDirectory server para poder autenticar com sucesso:</p>
<ul>
<li>IP do server</li>
<li>Usuário para fazer o bind, ou seja, é o usuário que tem permissão para realizar a busca na árvore</li>
<li>Se for fazer a autenticação baseada em grupo, saber qual grupo e em que contexto está esse grupo</li>
</ul>
<h3>Usando vhost</h3>
<p>Nesse exemplo, utilizarei o conceito de <tt>vhost</tt> para a configuração da restrição de acesso.</p>
<p>Para isso, criar um arquivo de configuração no diretório <tt>/etc/httpd/conf.d</tt> chamado <tt>wordpress.conf</tt> e seu conteúdo é como abaixo</p>
<h4>Controle por grupo</h4>
<p>No caso, o grupo chama-se <b>GRP_Wordpress</b>.</p>
<p><b>Arquivo</b>: <tt>/etc/httpd/conf.d/wordpress.conf</tt></p>
<pre class="brush: plain">
<virtualhost *:80>
    DocumentRoot /var/www/html/wordpress
    <directory /var/www/html/wordpress>
        AuthName "Utilize o login da rede Novell Netware"
        AuthType basic
        AuthBasicProvider file ldap

        AuthLDAPBindDN cn=dklima,ou=FCA,o=FogoNaCaixadAgua
        AuthLDAPBindPassword P45sw0rD

        AuthLDAPURL "ldap://192.168.11.10:389/ou=FCA,o=FogoNaCaixadAgua?cn?sub?(securityEquals=cn=GRP_Wordpress,ou=FCA,o=FogoNaCaixadAgua)"
        Require valid-user
        AuthzLDAPAuthoritative off
    </directory>
    ServerName wordpress.fogonacaixadagua
</virtualhost>
</pre>
<h4>Validar apenas usuário</h4>
<p><b>Arquivo</b>: <tt>/etc/httpd/conf.d/wordpress.conf</tt></p>
<pre class="brush: plain">
<virtualhost *:80>
    DocumentRoot /var/www/html/wordpress
    <directory /var/www/html/wordpress>
        AuthName "Utilize o login da rede Novell Netware"
        AuthType basic
        AuthBasicProvider file ldap

        AuthLDAPBindDN cn=dklima,ou=FCA,o=FogoNaCaixadAgua
        AuthLDAPBindPassword P45sw0rD

        AuthLDAPURL "ldap://192.168.11.10:389/ou=FCA,o=FogoNaCaixadAgua?cn?sub"
        Require valid-user
        AuthzLDAPAuthoritative off
    </directory>
    ServerName wordpress.fogonacaixadagua
</virtualhost>
</pre>
<p>Com isso, quando foi solicitado acesso ao diretório <tt>/var/www/html/wordpress</tt>, o será solicitado um usuário válido para pode acessar o site.</p>
<p>É necessário reiniciar o processo do Apache</p>
<pre class="brush: plain">
service httpd restart</pre>
<h3>Usando .htaccess</h3>
<p>Nesse exemplo, o conceito usado é para utilizar um arquivo <tt>.htaccess</tt> dentro do diretório que será restrito o acesso.</p>
<p>Criar o arquivo <tt>.htaccess</tt> no diretório, nesse exemplo <tt>/var/www/html/wordpress</tt> com o seguinte conteúdo:</p>
<h4>Controle por grupo</h4>
<p>No caso, o grupo chama-se <b>GRP_Wordpress</b>.</p>
<p><b>Arquivo: </b><tt>/var/www/html/wordpress/.htaccess</tt></p>
<pre class="brush:plain">
        AuthName "Utilize o login da rede Novell Netware"
        AuthType basic
        AuthBasicProvider file ldap

        AuthLDAPBindDN cn=dklima,ou=FCA,o=FogoNaCaixadAgua
        AuthLDAPBindPassword P45sw0rD

        AuthLDAPURL "ldap://192.168.11.10:389/ou=FCA,o=FogoNaCaixadAgua?cn?sub?(securityEquals=cn=GRP_Wordpress,ou=FCA,o=FogoNaCaixadAgua)"
        Require valid-user
        AuthzLDAPAuthoritative off
</pre>
<h4>Validar apenas usuários</h4>
<p><b>Arquivo: </b><tt>/var/www/html/wordpress/.htaccess</tt></p>
<pre class="brush:plain">
        AuthName "Utilize o login da rede Novell Netware"
        AuthType basic
        AuthBasicProvider file ldap

        AuthLDAPBindDN cn=dklima,ou=FCA,o=FogoNaCaixadAgua
        AuthLDAPBindPassword P45sw0rD

        AuthLDAPURL "ldap://192.168.11.10:389/ou=FCA,o=FogoNaCaixadAgua?sn?sub
        Require valid-user
        AuthzLDAPAuthoritative off
</pre>
<p>Não é necessário reiniciar o apache.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/04/apache-autenticacao-com-edirectory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enabling Remote Access to the Installation System &#8211; RedHat based</title>
		<link>http://www.fogonacaixadagua.com.br/2010/04/enabling-remote-access-to-the-installation-system-redhat-based/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/04/enabling-remote-access-to-the-installation-system-redhat-based/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 17:25:55 +0000</pubDate>
		<dc:creator>Juca</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[Red Hat]]></category>
		<category><![CDATA[vnc]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/2010/04/enabling-remote-access-to-the-installation-system-redhat-based/</guid>
		<description><![CDATA[Enabling Remote Access to the Installation System You may access either graphical or text interfaces for the installation system from any other system. Access to a text mode display requires telnet, which is installed by default on Fedora systems. To remotely access the graphical display of an installation system, use client software that supports the [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/04/enabling-remote-access-to-the-installation-system-redhat-based/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><h1>Enabling Remote Access to the Installation System</h1>
<p>You may access either graphical or text interfaces for the installation system from any other system. <br />
 Access to a text mode display requires telnet, which is installed by default on Fedora systems. <br />
 To remotely access the graphical display of an installation system, use client software that supports the VNC (Virtual Network Computing) display protocol. <br />
 A number of providers offer VNC clients for Microsoft Windows and Mac OS, as well as UNIX-based systems.</p>
<p>The installation system supports two methods of establishing a VNC connection. <br />
 You may start the installation, and manually login to the graphical display with a VNC client on another system. <br />
 Alternatively, you may configure the installation system to automatically connect to a VNC client on the network that is running in listening mode.</p>
<h2>Enabling Remote Access with VNC</h2>
<p>To enable remote graphical access to the installation system, enter two options at the boot prompt:</p>
<pre class="brush: shell">
linux vnc vncpassword=qwerty
</pre>
<p> (The VNC password must be at least six characters long.)</p>
<p>The <tt>vnc</tt> option enables the VNC service. The <tt>vncpassword</tt> option sets a password for remote access. The example shown above sets the password as <tt>qwerty</tt> .</p>
<p>Specify the language, keyboard layout and network settings for the installation system with the screens that follow. You may then access the graphical interface through a VNC client. The installation system displays the correct connection setting for the VNC client:</p>
<h3>Starting VNC&#8230;</h3>
<p> The VNC server is now running.<br />
 Please connect to <tt>computer.mydomain.com:1</tt> to begin the install&#8230;<br />
 Starting graphical installation&#8230;<br />
 Press <enter> for a shell</enter></p>
<p>You may then login to the installation system with a VNC client. To run the <tt>vncviewer</tt> client on Fedora, choose <tt>Applications -> Accessories -> VNC Viewer</tt> , or type the command <tt>vncviewer</tt> in a terminal window. Enter the server and display number in the VNC Server dialog. For the example above, the VNC Server is <tt>computer.mydomain.com:1</tt> .</p>
<h3>Connecting the Installation System to a VNC Listener</h3>
<p>To have the installation system automatically connect to a VNC client, first start the client in listening mode. On Fedora systems, use the <tt>-listen</tt> option to run vncviewer as a listener. In a terminal window, enter the command:</p>
<pre class="brush: plain">vncviewer -listen</pre>
<h3>Firewall Reconfiguration Required </h3>
<p>By default, vncviewer uses TCP port 5500 when in listening mode. To permit connections to this port from other systems, choose <tt>System -> Administration -> Security Level and Firewall</tt> . Select <tt>Other ports</tt> , and <tt>Add</tt> . Enter <tt>5500</tt> in the Port(s) field, and specify <tt>tcp</tt> as the Protocol .</p>
<p>Once the listening client is active, start the installation system and set the VNC options at the <tt>boot:</tt> prompt. In addition to <tt>vnc</tt> and <tt>vncpassword</tt> options, use the <tt>vncconnect</tt> option to specify the name or IP address of the system that has the listening client. To specify the TCP port for the listener, add a colon and the port number to the name of the system.</p>
<p>For example, to connect to a VNC client on the system <tt>desktop.mydomain.com</tt> on the port <tt>5500</tt>, enter the following at the <tt>boot:</tt> prompt:</p>
<pre class="brush: plain">linux vnc vncpassword=qwerty vncconnect=desktop.mydomain.com:5500</pre>
<h2>Enabling Remote Access with Telnet</h2>
<p>To enable remote access to a text mode installation, use the <tt>telnet</tt> option at the <tt>boot:</tt> prompt:</p>
<pre class="brush: plain">linux text telnet</pre>
<p>You may then connect to the installation system with the telnet utility. The telnet command requires the name or IP address of the installation system:</p>
<pre class="brush: shell">telnet computer.mydomain.com</pre>
<p> (Telnet Access Requires No Password)</p>
<p>To ensure the security of the installation process, only use the telnet option to install systems on networks with restricted access.</p>
<p><b>Source:</b> <a title='Original Link: http://www.linuxtopia.org/online_books/installation_guides/redhat_fedora_core_5_installation_guide/sn-remoteaccess-installation.html'  href="http://www.fogonacaixadagua.com.br/?1g5Lg3Sa">Linuxtopia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/04/enabling-remote-access-to-the-installation-system-redhat-based/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH: adicionar um banner quando alguém tentar fazer Login</title>
		<link>http://www.fogonacaixadagua.com.br/2010/04/ssh-adicionar-um-banner-quando-alguem-tentar-fazer-login/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/04/ssh-adicionar-um-banner-quando-alguem-tentar-fazer-login/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 12:27:41 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1369</guid>
		<description><![CDATA[Isto é definido pelo parâmetro Banner do arquivo /etc/ssh/sshd_config. Primeiro, crie o arquivo que conterá a mensagem que será apresentada quando o usuário tentar fazer login via SSH no servidor. Arquivo: /etc/ssh/banner.txt ************************************************ NOTICE TO USERS WARNING! The use of this system is restricted to authorized users, unauthorized access is forbidden and will be prosecuted [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/04/ssh-adicionar-um-banner-quando-alguem-tentar-fazer-login/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Isto é definido pelo parâmetro <tt>Banner</tt> do arquivo <tt>/etc/ssh/sshd_config</tt>. </p>
<p>Primeiro, crie o arquivo que conterá a mensagem que será apresentada quando o usuário tentar fazer login via SSH no servidor.</p>
<p><b>Arquivo:</b> <tt>/etc/ssh/banner.txt</tt></p>
<pre class="brush: plain">
************************************************

            NOTICE TO USERS WARNING! 

The use of this system is restricted to authorized
users, unauthorized access is forbidden and will
be prosecuted by law. 

All information and communications on this system
are subject to review, monitoring and recording at
any time, without notice or permission. 

Users should have no expectation of privacy. 

*************************************************
</pre>
<p>Edite o arquivo <tt>/etc/ssh/sshd_config</tt> e procure pelo parâmetro <tt>Banner</tt>, geralmente está próximo do final desse arquivo.</p>
<p>Provavelmente esse parâmetro estará comentado:</p>
<pre class="brush: shell">
#Banner /some/path
</pre>
<p>Altere essa linha para:</p>
<pre class="brush: plain">
Banner /etc/ssh/banner.txt
</pre>
<p>Grave a alteração e reinicie o servidor do ssh:</p>
<pre class="brush: shell">
service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]
</pre>
<p>ou</p>
<pre class="brush: shell">
/etc/init.d/sshd restart
</pre>
<p>Para testar se tudo está OK, tente conectar-se via SSH no host que foi feita a alteração:</p>
<pre class="brush:shell">
ssh localhost
</pre>
<p>Deverá ser apresentada uma tela parecida com a seguinte:</p>
<pre class="brush:plain">
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is e8:86:ca:cc:e5:fd:cc:76:c3:57:55:5b:67:f8:98:c3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
************************************************

            NOTICE TO USERS WARNING! 

The use of this system is restricted to authorized
users, unauthorized access is forbidden and will
be prosecuted by law. 

All information and communications on this system
are subject to review, monitoring and recording at
any time, without notice or permission. 

Users should have no expectation of privacy. 

*************************************************

root@localhost's password:
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/04/ssh-adicionar-um-banner-quando-alguem-tentar-fazer-login/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SED: adicionar 1 string a cada 2 caracteres</title>
		<link>http://www.fogonacaixadagua.com.br/2010/03/sed-adicionar-1-string-a-cada-2-caracteres/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/03/sed-adicionar-1-string-a-cada-2-caracteres/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 13:47:26 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1353</guid>
		<description><![CDATA[Estou colocando aqui um exemplo que pode ser adaptado para sua necessidade. No caso, essa linha adiciona o caracter &#8220;:&#8221; (sem as aspas) a cada 2 caracteres. Utilizei para formatar uma lista enorme de MAC address que me foi passado no formato 00106037614C O arquivo texto original continha várias linhas: Arquivo: mac1.txt 001060376173 001060376124 00106037614C [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/03/sed-adicionar-1-string-a-cada-2-caracteres/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Estou colocando aqui um exemplo que pode ser adaptado para sua necessidade.</p>
<p>No caso, essa linha adiciona o caracter &#8220;:&#8221; (sem as aspas) a cada 2 caracteres.</p>
<p>Utilizei para formatar uma lista enorme de MAC address que me foi passado no formato <tt>00106037614C</tt></p>
<p>O arquivo texto original continha várias linhas:</p>
<p><b>Arquivo:</b> <tt>mac1.txt</tt></p>
<pre class="brush: plain">
001060376173
001060376124
00106037614C
001060374840
001060376125
00106037612A
001060376176
001060375D9A
001060375D97
</pre>
<p>E executando sed, na linha abaixo</p>
<pre class="brush: shell">
sed -e :a -e 's/\(.*[0-9,A-Z]\)\([0-9,A-Z]\{2\}\)/\1:\2/;ta' mac1.txt > mac2.txt
</pre>
<p>O resultado que foi direcionado para o arquivo <tt>mac2.txt</tt> é o desejado:</p>
<pre class="brush: plain">
00:10:60:37:61:73
00:10:60:37:61:24
00:10:60:37:61:4C
00:10:60:37:48:40
00:10:60:37:61:25
00:10:60:37:61:2A
00:10:60:37:61:76
00:10:60:37:5D:9A
00:10:60:37:5D:97
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/03/sed-adicionar-1-string-a-cada-2-caracteres/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Samba com Antivírus ClamAV no Red Hat 5.x / CentOS 5.x</title>
		<link>http://www.fogonacaixadagua.com.br/2010/03/samba-com-antivirus-clamav-no-red-hat-centos/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/03/samba-com-antivirus-clamav-no-red-hat-centos/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 21:51:48 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Seguranca]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[samba]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1317</guid>
		<description><![CDATA[Não é preciso descrever como é importante em um ambiente onde haja computadores Windows envolvidos que é necessário ter um antivírus no servidor de arquivos Linux ou FreeBSD com o Samba. Essa versão do artigo irá cobrir Red Hat / CentOS versão 5.x. Pré-requisitos Instalação mínima do CentOS e RedHat 5.3 Utilizando o repositório Yum [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/03/samba-com-antivirus-clamav-no-red-hat-centos/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Não é preciso descrever como é importante em um ambiente onde haja computadores Windows envolvidos que é necessário ter um antivírus no servidor de arquivos Linux ou FreeBSD com o Samba.</p>
<p>Essa versão do artigo irá cobrir Red Hat / CentOS versão 5.x.</p>
<h2>Pré-requisitos</h2>
<ul>
<li><a href="http://www.fogonacaixadagua.com.br/2009/08/instalacao-minima-do-centos-e-redhat-5-3/">Instalação mínima do CentOS e RedHat 5.3</a></li>
<li><a href="http://www.fogonacaixadagua.com.br/2009/08/utilizando-o-repositorio-yum-rpmforge/">Utilizando o repositório Yum RPMforge</a></li>
</ul>
<h2>1.0 Instalando o ClamAV</h2>
<p>É necessário o repositório Yum RPMforge estar instalado e configurado. Veja &#8220;Pré-requisitos&#8221;.</p>
<pre class="brush: shell">yum install clamav clamav-db clamd
</pre>
<h3>1.1 Configurando o clamd</h3>
<p>Após a instalação do clamav, edite o arquivo <tt>/etc/clamd.conf</tt> e adeque as suas necessidades.</p>
<p>Para uma utilização geral, a seguinte configuração é suficiente:</p>
<p><strong>Arquivo: </strong><tt>/etc/clamd.conf</tt></p>
<pre class="brush: plain">LogFile /var/log/clamav/clamd.log
LogFileMaxSize 0
LogTime yes
LogSyslog yes
PidFile /var/run/clamav/clamd.pid
TemporaryDirectory /var/tmp
DatabaseDirectory /var/clamav
LocalSocket /var/run/clamav/clamd.sock
FixStaleSocket yes
TCPSocket 3310
TCPAddr 127.0.0.1
MaxConnectionQueueLength 30
MaxThreads 50
ReadTimeout 300
User root
AllowSupplementaryGroups yes
ScanPE yes
ScanELF yes
DetectBrokenExecutables yes
ScanOLE2 yes
ScanMail yes
ScanArchive yes
ArchiveBlockEncrypted no
</pre>
<p>Por que o usuário &#8216;root&#8217;? Porque por padrão o Clamd roda como usuário &#8216;clamav&#8217; e quando o Samba chamar o clamav e for necessário apagar algum arquivo com vírus ele não vai ter permissão.</p>
<p>Inicar e garantir que iniciará no boot:</p>
<pre class="brush: plain">
chkconfig --levels 35 clamd on
service clamd start
</pre>
<pre class="brush: plain">Starting Clam AntiVirus Daemon:                            [  OK  ]
</pre>
<h3>1.2 Configurando freshclam para atualizações</h3>
<p>Editar o arquivo de configuração do freshclam que ficará parecido com o seguinte:</p>
<p><strong>Arquivo:</strong> <tt>/etc/freshclam.conf</tt></p>
<pre class="brush: plain; gutter: true">DatabaseDirectory /var/clamav
UpdateLogFile /var/log/clamav/freshclam.log
LogTime yes
DatabaseMirror db.br.clamav.net
DatabaseMirror database.clamav.net
DatabaseOwner root
NotifyClamd /etc/clamd.conf
SubmitDetectionStats /etc/clamd.conf
</pre>
<p>Criar o arquivo de log pro Freshclam</p>
<pre class="brush:plain">
touch /var/log/clamav/freshclam.log
chown clamav:clamav /var/log/clamav/freshclam.log
</pre>
<p>Caso seu servidor não tenha acesso diretamente à internet mas você possui um proxy na rede, coloque os seguintes parâmetros no arquivo <tt>/etc/freshclam.conf</tt> com as informações do proxy.</p>
<p><strong>Arquivo:</strong> <tt>/etc/freshclam.conf</tt></p>
<pre class="brush: plain">HTTPProxyServer 192.168.1.1
HTTPProxyPort 3128
HTTPProxyUsername user
HTTPProxyPassword s3nh4
</pre>
<p>Após isso, a permissão do arquivo <tt>/etc/freshclam.conf</tt> deverá ser <tt>0600</tt>.</p>
<pre class="brush: shell">chmod 0600 /etc/freshclam.conf
</pre>
<p>Pode-se executar o comando <tt>freshclam</tt> para atualizar a assinatura de vírus.</p>
<pre class="brush: shell">freshclam
</pre>
<h2>2.0 Instalando o Samba</h2>
<p>A versão que vem por padrão com o Red Hat / CentOS não é possível utilizar em conjunto com o vscan, por isso será necessário compilar o Samba para que tenha suporte ao samba-vscan.</p>
<h4>2.0.1 RPMs 64 bits gerados</h4>
<p>Se o seu SO é 64 bits, então os pacotes do Samba eu compilei e estou disponbilizando aqui, pra facilitar o trabalho e não ser necessário instalar o ambiente de desenvolvimento no servidor.</p>
<ul>
<li><a href="http://www.virtualxp.org/downloads/samba-3.0.33/x86_64/samba-3.0.33-3.14.x86_64.rpm">samba-3.0.33-3.14.x86_64.rpm</a></li>
<li><a href="http://www.virtualxp.org/downloads/samba-3.0.33/x86_64/samba-client-3.0.33-3.14.x86_64.rpm">samba-client-3.0.33-3.14.x86_64.rpm</a></li>
<li><a href="http://www.virtualxp.org/downloads/samba-3.0.33/x86_64/samba-common-3.0.33-3.14.x86_64.rpm">samba-common-3.0.33-3.14.x86_64.rpm</a></li>
</ul>
<p>Caso queira compilar, prossiga para o próximo passo</p>
<h4>2.0.2 Preparando o Samba para gerar o pacote .rpm</h4>
<p>Faça o download do RPM source do samba:</p>
<pre class="brush: plain">cd ~
wget http://netops.nexicom.net/centos/5.4/updates/SRPMS/samba-3.0.33-3.14.el5.src.rpm</pre>
<p>Instalar os arquivos:</p>
<pre class="brush: plain">rpm -ivh samba-3.0.33-3.14.el5.src.rpm
</pre>
<p>É necessário descompacatar o .tar.gz do código fonte e depois compactá-lo.</p>
<pre class="brush:shell">cd /usr/src/redhat/SOURCES
tar zxvf samba-3.0.33.tar.gz
cd samba-3.0.33/source
./autogen.sh &amp;&amp; ./configure
make proto
</pre>
<p>Se ao tentar compilar o Samba, ao executar os comandos acima você tiver a seguinte mensagem:</p>
<pre class="brush: plain">
./autogen.sh &#038;&#038; ./configure
./autogen.sh: running script/mkversion.sh
./script/mkversion.sh: 'include/version.h' created for Samba("3.0.33")
./autogen.sh: running autoheader -I. -Ilib/replace
./autogen.sh: running autoconf -I. -Ilib/replace
Now run ./configure and then make.
SAMBA VERSION: 3.0.33
LIBREPLACE_LOCATION_CHECKS: START
...
LIBREPLACE_LOCATION_CHECKS: END
LIBREPLACE_CC_CHECKS: START
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
</pre>
<p>É por que não tem os pacotes de desenvolvimento instalado, para resolver isso, instale-os:</p>
<pre class="brush: plain">
yum install rpm-build gcc gcc-c++ make autoconf automake libtool</pre>
<h3>2.1 Fazer o download do vscan</h3>
<h4>2.1.1 Binário 64bits do vscan</h4>
<p>Caso seu SO seja 64 bits, estou dispobilizando a biblioteca do vscan-clamav já compilada.</p>
<ul>
<li><a href="http://www.virtualxp.org/downloads/samba-vscan-0.3.6c-beta5/x86_64/vscan-clamav.so">vscan-clamav.so</a></li>
</ul>
<p>Caso seja 32 bits ou queira compilar o código fonte, prossiga para o próximo tópico.</p>
<h4>2.1.2 Compilando pelo código fonte</h4>
<pre class="brush: shell">cd ~
wget http://www.openantivirus.org/download/samba-vscan-0.3.6c-beta5.tar.gz
</pre>
<p>Descompactar:</p>
<pre class="brush: shell">tar zxvf ~/samba-vscan-0.3.6c-beta5.tar.gz -C /usr/src
</pre>
<p>Compilar o samba-vscan:</p>
<pre class="brush: shell">cd /usr/src/samba-vscan-0.3.6c-beta5/
./configure --with-libclamav --with-samba-source=/usr/src/redhat/SOURCES/samba-3.0.33/source/
</pre>
<p>Ao final, você terá algo como:</p>
<pre class="brush: plain">** Configuration summary for samba-vscan 0.3.6c beta5 :

 Compile samba-vscan for Samba      : "3.0.33"
 Compile samba-vscan with sources in: /usr/src/redhat/SOURCES/samba-3.0.33/source/
 Compile samba-vscan backends       : oav sophos fprotd fsav trend icap mksd kavp clamav nai antivir
 Use GLOBAL_LIBS                    : -lmagic
 Use libmksd as                     : builtin
 Use libkavdc as                    : builtin
</pre>
<p>Hora de começar a compilar o samba-vscan:</p>
<pre class="brush: shell">cd /usr/src/samba-vscan-0.3.6c-beta5
make
</pre>
<p>Por enquanto é isso. Não execute <tt>make install</tt>.</p>
<h3>2.1 Gerando o .rpm para o samba com vscan</h3>
<h4>2.1.1 Gerar o .rpm do samba</h4>
<p>Agora é necessário compactar o diretório <tt>samba-3.0.33</tt> novamente pra gerar o .rpm com tudo certo dentro.</p>
<p>Instalar dependências:</p>
<pre class="brush: shell">yum install cups-devel gnutls-devel pam-devel readline-devel ncurses-devel libacl-devel openldap-devel openssl-devel
</pre>
<pre class="brush: shell">cd /usr/src/redhat/SOURCES/
mv samba-3.0.33.tar.gz samba-3.0.33.tar.gz.orig
tar zcvf samba-3.0.33.tar.gz samba-3.0.33
</pre>
<p>Gerar o .rpm do samba-3.0.33:</p>
<pre class="brush: shell">cd /usr/src/redhat/SPECS/
rpmbuild -bb samba.spec
</pre>
<p>Ao final do processo, você terá algo como:</p>
<pre class="brush: plain">Wrote: /usr/src/redhat/RPMS/x86_64/samba-3.0.33-3.14.x86_64.rpm
Wrote: /usr/src/redhat/RPMS/x86_64/samba-client-3.0.33-3.14.x86_64.rpm
Wrote: /usr/src/redhat/RPMS/x86_64/samba-common-3.0.33-3.14.x86_64.rpm
Wrote: /usr/src/redhat/RPMS/x86_64/samba-swat-3.0.33-3.14.x86_64.rpm
Wrote: /usr/src/redhat/RPMS/x86_64/samba-debuginfo-3.0.33-3.14.x86_64.rpm
...
</pre>
<p>Para instalar, utilizaremos o próprio <tt>rpm</tt>.</p>
<pre class="brush: plain">rpm -iUvh /usr/src/redhat/RPMS/x86_64/samba-3.0.33-3.14.x86_64.rpm /usr/src/redhat/RPMS/x86_64/samba-client-3.0.33-3.14.x86_64.rpm /usr/src/redhat/RPMS/x86_64/samba-common-3.0.33-3.14.x86_64.rpm
</pre>
<p>Eu já tinha o samba instalado e nesse caso não me deixou instalar por cima e finalizou com as seguintes mensagens:</p>
<pre class="brush: plain">Preparing...                ########################################### [100%]
	package samba-common-3.0.33-3.15.el5_4.1.x86_64 (which is newer than samba-common-3.0.33-3.14.x86_64) is already installed
	package samba-3.0.33-3.15.el5_4.1.x86_64 (which is newer than samba-3.0.33-3.14.x86_64) is already installed
	package samba-client-3.0.33-3.15.el5_4.1.x86_64 (which is newer than samba-client-3.0.33-3.14.x86_64) is already installed
</pre>
<p>Nesse caso é seguro executar o <tt>rpm</tt> com o parâmetro <tt>--force</tt></p>
<pre class="brush: plain">rpm -iUvh --force /usr/src/redhat/RPMS/x86_64/samba-3.0.33-3.14.x86_64.rpm /usr/src/redhat/RPMS/x86_64/samba-client-3.0.33-3.14.x86_64.rpm /usr/src/redhat/RPMS/x86_64/samba-common-3.0.33-3.14.x86_64.rpm
</pre>
<pre class="brush: plain">Preparing...                ########################################### [100%]
   1:samba-common           ########################################### [ 33%]
   2:samba                  ########################################### [ 67%]
   3:samba-client           ########################################### [100%]
</pre>
<h2>3.0 Configuração do vscan</h2>
<p>No diretório <tt>/etc/samba</tt> crie o arquivo de configuração para o samba-vscan (um exemplo desse arquivo está em: <tt>/usr/src/samba-vscan-0.3.6c-beta5/clamav/vscan-clamav.conf)</tt></p>
<p><strong>Arquivo: </strong><tt>/etc/samba/vscan-clamav.conf</tt></p>
<pre class="brush:plain">max file size = 0
verbose file logging = no
scan on open = yes
scan on close = yes
deny access on error = yes
deny access on minor error = yes
send warning message = yes
infected file action = delete
quarantine directory  = /tmp
quarantine prefix = vir-
max lru files entries = 100
lru file entry lifetime = 5
exclude file types =
exclude file regexp =
clamd socket name = /var/run/clamav/clamd.sock
scan archives = yes
libclamav max files in archive = 1000
libclamav max archived file size = 10485760
libclamav max recursion level = 5
</pre>
<h3>64 bits</h3>
<p>Copie a lib gerada do vscan para o ClamAV que está em <tt>/usr/src/samba-vscan-0.3.6c-beta5/</tt></p>
<pre class="brush: plain">cd /usr/src/samba-vscan-0.3.6c-beta5/
cp vscan-clamav.so /usr/lib64/samba/vfs
</pre>
<h3>32 bits</h3>
<p>Copie a lib gerada do vscan para o ClamAV que está em <tt>/usr/src/samba-vscan-0.3.6c-beta5/</tt></p>
<pre class="brush: plain">cd /usr/src/samba-vscan-0.3.6c-beta5/
cp vscan-clamav.so /usr/lib/samba/vfs</pre>
<h2>4.0 Configuração do Samba para utilizar o vscan</h2>
<p>Edite o arquivo <tt>/etc/samba/smb.conf</tt> e adicione as entradas em <tt>[global]</tt></p>
<p><strong>Arquivo: </strong><tt>/etc/samba/smb.conf</tt></p>
<pre class="brush: plain">        vfs object = vscan-clamav
        vscan-clamav: config-file = /etc/samba/vscan-clamav.conf
</pre>
<p>Pronto.</p>
<p>Só falta iniciar ou reiniciar o Samba:</p>
<pre class="brush: shell">service smb start
Starting SMB services:                                     [  OK  ]
Starting NMB services:                                     [  OK  ]
</pre>
<p>Os logs dos arquivos scanneados são mostrados em <tt>/var/log/messages</tt>.</p>
<h2>5.0 Não permitir que o yum atualize o Samba</h2>
<p>É interessante não permitir que o yum atualize o Samba, se isso acontecer, as alterações feitas pelo samba-vscan quando compilamos ele serão perdidas e você perderá as funcionalidade de antivírus do Samba.</p>
<p>Para fazer isso, é bem simples, adicione a seguinte linha no arquivo <tt>/etc/yum.conf</tt> na sessão <tt>[main]</tt></p>
<pre class="brush: plain">
exclude=samba*
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/03/samba-com-antivirus-clamav-no-red-hat-centos/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>LibClamAV Error: cli_loaddb()</title>
		<link>http://www.fogonacaixadagua.com.br/2010/03/libclamav-error-cli_loaddb/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/03/libclamav-error-cli_loaddb/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 22:29:23 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Troubleshoot]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1301</guid>
		<description><![CDATA[This error can happen with Linux or FreeBSD or whichever SO that ClamAV support. When you run clamscan You get this error LibClamAV Error: cli_loaddb(): No supported database files found in /var/db/clamav ERROR: Can't open file or directory ----------- SCAN SUMMARY ----------- Known viruses: 0 Engine version: 0.95.1 Scanned directories: 0 Scanned files: 0 Infected [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/03/libclamav-error-cli_loaddb/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>This error can happen with Linux or FreeBSD or whichever SO that ClamAV support.</p>
<p>When you run</p>
<pre class="brush:plain">clamscan</pre>
<p>You get this error</p>
<pre class="brush:plain">
LibClamAV Error: cli_loaddb(): No supported database files found in /var/db/clamav
ERROR: Can't open file or directory

----------- SCAN SUMMARY -----------
Known viruses: 0
Engine version: 0.95.1
Scanned directories: 0
Scanned files: 0
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 0.001 sec (0 m 0 s)
</pre>
<p>It means that you have no database virus.</p>
<p>Just configure and run <tt>freshclam</tt>.</p>
<p>A sample freshclam.conf file:</p>
<pre class="brush:plain">
DatabaseDirectory /var/lib/clamav
UpdateLogFile /var/log/freshclam.log
LogTime yes
LogSyslog yes
PidFile /var/run/clamd/freshclam.pid
DatabaseOwner clamav
DNSDatabaseInfo current.cvd.clamav.net
DatabaseMirror db.br.clamav.net
DatabaseMirror database.clamav.net
NotifyClamd /usr/local/etc/clamd.conf
SubmitDetectionStats /usr/local/etc/clamd.conf
DetectionStatsCountry BR
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/03/libclamav-error-cli_loaddb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install GOsa2 on RedHat / CentOS (rpm based)</title>
		<link>http://www.fogonacaixadagua.com.br/2010/03/how-to-install-gosa2-on-redhat-centos-rpm-based/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/03/how-to-install-gosa2-on-redhat-centos-rpm-based/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 14:29:26 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[GOsa2]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/2010/03/how-to-install-gosa2-on-redhat-centos-rpm-based/</guid>
		<description><![CDATA[1.0 About this The goal of this article is to be a base for a complete installarion of GOsa2, it will be used by future articles on what maters with integrating with others services. 2.0 What GOsa2 means? GOsa2 is the constrict form for GOnicus System Administration. From author&#8217;s site gosa-project.org A mighty System-/Config-management frontend [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/03/how-to-install-gosa2-on-redhat-centos-rpm-based/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><h2>1.0 About this</h2>
<p>The goal of this article is to be a base for a complete installarion of GOsa2, it will be used by future articles on what maters with integrating with others services.</p>
<h2>2.0 What GOsa2 means?</h2>
<p>GOsa2 is the constrict form for GOnicus System Administration.<br />
 From author&#8217;s site gosa-project.org</p>
<blockquote><p>A mighty System-/Config-management frontend using LDAP as a backend. It is able to manage POSIX, Samba, Mail, Kolab, FAX, Asterisk and many more services.</p>
</blockquote>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-1.png"><img class="aligncenter size-medium wp-image-1245" title="Screenshot-1" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-1-300x197.png" alt="" width="300" height="197" /></a></p>
<h2>3.0 Prerequisites</h2>
<ul>
<li><a href="http://www.fogonacaixadagua.com.br/2009/08/instalacao-minima-do-centos-e-redhat-5-3/">A minimal install of CentOS e RedHat 5.3</a> (This guide is in Portuguese only :( )</li>
<li>Apache 2.2.x</li>
<li>PHP 5.2</li>
<li>OpenLDAP</li>
<li>Repository yum EPEL</li>
</ul>
<h2>4.0 Instaling pre-requisites</h2>
<p>As said before, I&#8217;m assuming that you already have an installation of CentOS or Red Hat, therefore, I&#8217;ll be covering the system requisites to get a functional GOsa2.</p>
<h4>4.1 Installing the yum EPEL repository</h4>
<pre class="brush: shell">rpm -ivh http://virtualxp.org/downloads/epel-release-5-3.noarch.rpm
</pre>
<h4>4.2 Setting the repository for GOsa2</h4>
<p>Go to <tt>/etc/yum.repos.d</tt> and create the file <tt>GOsa2.repo</tt> with your favorite text editor.<br />
 File: <tt>/etc/yum.repos.d/GOsa2.repo</tt></p>
<pre class="brush: text">[GOsa]
name=GOsa Repository
baseurl=http://oss.gonicus.de/pub/gosa/redhat
enabled=1
gpgcheck=0
</pre>
<h4>4.3 Setting the repository for PHP 5.2</h4>
<p>GOsa2 needs the PHP 5.2 to run, however, there&#8217;s no PHP 5.2 on official repository. With that said, we need to set up a third party repository. For this article I&#8217;ll be using the repository from <a title='Original Link: http://www.jasonlitka.com/yum-repository/'  href="http://www.fogonacaixadagua.com.br/?5DR0pKUz">Utter Ramblings</a>. It&#8217;s a nice and reliable repo, you can use it with no fear.<br />
 Go to <tt>/etc/yum.repos.d</tt> and with your favorite text editor create a file called <tt>utterramblings.repo</tt>.<br />
 File: <tt>/etc/yum.repos.d/utterramblings.repo</tt></p>
<pre class="brush:text">[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
</pre>
<p>This repo already have a version of Apache 2.2.x (2.2.14 at this momment) that we&#8217;ll be using.</p>
<h4>4.4 Installing OpenLDAP Server</h4>
<p>We&#8217;ll use the offical version (which means the one into the repository or Media).<br />
 To accomplish this, execute the following command:</p>
<pre class="brush: shell">yum install openldap openldap-clients openldap-servers
</pre>
<h2>5.0 Installing GOsa2 via yum</h2>
<p>With the prerequisites satisfied, continue the installation of GOsa2</p>
<p>There are a couple of plugins availiable from GOsa2 respository, doing a search over it, it is possible to get an idea of which of them you really need to install. Install those that suit to your environment.</p>
<pre class="brush: shell">yum search gosa
</pre>
<p>WARNING: Avoid to install the package <tt>gosa-desktop</tt>, as it will install Gnome and X.org as dependence.</p>
<p>Below are the packs that we will use in this article. Feel free to alter it.</p>
<pre class="brush: shell">yum install gosa-schema.noarch gosa-plugin-systems.noarch gosa-plugin-sudo.noarch gosa-plugin-squid.noarch gosa-plugin-samba.noarch gosa-plugin-rolemanagement.noarch gosa-plugin-pureftpd.noarch gosa-plugin-mail.noarch gosa-plugin-log.noarch gosa-plugin-ldapmanager.noarch gosa-plugin-dns.noarch gosa-plugin-dhcp.noarch gosa-plugin-connectivity.noarch gosa-plugin-addressbook.noarch gosa-help-en.noarch gosa.noarch
</pre>
<h4>5.1 Edit PHP (php.ini) params to suit GOsa2</h4>
<p>To GOsa2 run happy, it&#8217;s necessary to alter 2 parameters in file <tt>/etc/php.ini</tt>. Edit it and save it.</p>
<p>Before:</p>
<ul>
<li>expose_php = On</li>
<li>magic_quotes_gpc = Off</li>
</ul>
<p>After:</p>
<ul>
<li>expose_php = Off</li>
<li>magic_quotes_gpc = On</li>
</ul>
<h4>5.2 Making sure the services start at boot time</h4>
<pre class="brush:shell">chkconfig --levels 35 ldap on
chkconfig --levels 35 httpd on
</pre>
<h2>6.0 Setting OpenLDAP to suit GOsa2 needs</h2>
<p>With all those work we have done so far, now it&#8217;s a critical time, but simple to do.<br />
 Will be necessary to suit OpenLDAP to talk to GOsa2, this means showing the right <tt>schemas</tt> to OpenLDAP.<br />
 Make a backup copy from the original <tt>slapd.conf</tt> file.</p>
<pre class="brush: shell">cd /etc/openldap
cp slapd.conf slapd.conf.orig
</pre>
<p>To generate the <tt>cn=Manager</tt> password hash.</p>
<pre class="brush: shell">slappasswd -h {SSHA}
New password:
Re-enter new password:
{SSHA}Nag4FWwXLoGO/WpdpFJUlMVCBYwB94wt
</pre>
<p>The result will be the hash from the entered password, this case I used &#8220;fogonacaixadagua&#8221;. Keep this hash, we will use it soon.</p>
<p>Now, make your <tt>/etc/openldap/slapd.conf</tt> look like the one below:<br />
 File: <tt>/etc/openldap/slapd.conf</tt></p>
<pre class="brush: text">include         /etc/openldap/schema/corba.schema
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/dyngroup.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/java.schema
include         /etc/openldap/schema/misc.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/openldap.schema
include         /etc/openldap/schema/ppolicy.schema

include /etc/openldap/schema/gosa/samba3.schema
include /etc/openldap/schema/gosa/pureftpd.schema
include /etc/openldap/schema/gosa/gofon.schema
include /etc/openldap/schema/gosa/gosystem.schema
include /etc/openldap/schema/gosa/goto.schema
include /etc/openldap/schema/gosa/gosa-samba3.schema
include /etc/openldap/schema/gosa/gofax.schema
include /etc/openldap/schema/gosa/goserver.schema
include /etc/openldap/schema/gosa/goto-mime.schema
include /etc/openldap/schema/gosa/trust.schema
include /etc/openldap/schema/gosa/dnszone.schema
include /etc/openldap/schema/gosa/gosa_custom.schema

pidfile		/var/run/openldap/slapd.pid
argsfile	/var/run/openldap/slapd.args

database	bdb
suffix		"dc=FogoNaCaixadAgua"
rootdn		"cn=Manager,dc=FogoNaCaixadAgua"

# Senha gerada pelo comando slappasswd -h {SSHA}
rootpw		{SSHA}Nag4FWwXLoGO/WpdpFJUlMVCBYwB94wt

directory	/var/lib/ldap

index entryCSN,entryUUID eq
index uid,mail eq
index gosaMailAlternateAddress,gosaMailForwardingAddress eq
index cn,sn,givenName,ou pres,eq,sub
index objectClass pres,eq
index uidNumber,gidNumber,memberuid eq
index gosaSubtreeACL,gosaObject,gosaUser pres,eq
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq

cachesize 100000
</pre>
<p>To copy some schemas that aren&#8217;t on schemas&#8217; dir:</p>
<pre class="brush: shell">cp /usr/share/gosa/plugins/pureftpd/contrib/pureftpd.schema /etc/openldap/schema/gosa
cp /usr/share/gosa/plugins/dns/contrib/dnszone.schema /etc/openldap/schema/gosa
</pre>
<p>Create the file <tt>/etc/openldap/schema/gosa_custom.schema</tt> with the following content:</p>
<p>File: <tt>/etc/openldap/schema/gosa_custom.schema</tt></p>
<pre class="brush: plain">#$Id: authldap.schema,v 1.8 2005/03/20 19:10:30 mrsam Exp $
#
# OID prefix: 1.3.6.1.4.1.25981
#
# Attributes: 1.3.6.1.4.1.25981.1.1
#
# Depends on: gosa.schema and cosine.schema

attributetype ( 1.3.6.1.4.1.25981.1.1.1 NAME 'gosaMailHome'
	DESC 'The absolute path to the mail message stor directory in a virtual mail setup.'
        EQUALITY caseExactIA5Match
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

#
# Objects: 1.3.6.1.4.1.25981.1.2
#

objectclass ( 1.3.6.1.4.1.25981.1.2.1 NAME 'gosaVirtualMailAccount' SUP top AUXILIARY
	DESC 'Objectclass to mark Virtual MailAccounts for GOsa (v2.4)'
        MAY ( gosaMailHome ) )
</pre>
<h2>7.0 Starting OpenLDP</h2>
<p>With OpenLDAP server configured and the schemas on the right place, copy DB_CONFIG.example to LDAP&#8217;s dir:</p>
<pre class="brush: shell">cd /etc/openldap
cp DB_CONFIG.example /var/lib/ldap/DB_CONFIG
</pre>
<p>Now, you can start OpenLDAP and you can verify if it&#8217;s gonna ok.</p>
<pre class="brush: shell">service ldap start
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
</pre>
<h2>8.0 Starting Apache</h2>
<p>Apache was installed with the GOsa2. The GOsa2 package created the config file to apache, this file can be found at <tt>/etc/httpd/conf.d/gosa-apache.conf</tt></p>
<p>File: <tt>/etc/httpd/conf.d/gosa-apache.conf</tt></p>
<pre class="brush: plain"># Include GOsa to your web service
Alias /gosa /usr/share/gosa/html

    php_admin_flag engine on
    php_admin_flag register_globals off
    php_admin_flag allow_call_time_pass_reference off
    php_admin_flag expose_php off
    php_admin_flag zend.ze1_compatibility_mode off
    php_admin_flag register_long_arrays off
    php_admin_flag magic_quotes_gpc on
    php_admin_value upload_tmp_dir /var/spool/gosa/
    php_admin_value session.cookie_lifetime 0
    include /etc/gosa/gosa.secrets

   PHP_Fix_Pathinfo_Enable 1

     Options +ExecCGI
     AddHandler fcgid-script .php
     FCGIWrapper /var/www/php-fcgi/php-fcgi-starter .php
     include /etc/gosa/gosa.secrets
</pre>
<p>Isnt&#8217; recommended to edit it, do it only if it&#8217;s really necessary.<br />
 Time to start Apache:</p>
<pre class="brush: shell">service httpd start
Starting httpd:                                            [  OK  ]
</pre>
<h2>9.0 Setting GOsa2 through Web interface</h2>
<p>After starting Apache, access through of server IP.</p>
<h4>9.1 Initial screen of GOsa2 set up</h4>
<pre>http://192.168.11.13/gosa/
</pre>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-2.png"><img class="aligncenter size-full wp-image-1257" title="Screenshot-2" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-2.png" alt="" width="991" height="590" /></a></p>
<p>Note the highlighted part on image, it&#8217;s necessary to execute the above command to GOsa2 installer know that you have control over server.</p>
<pre class="brush: shell">echo -n 93esjraq6baopmpchl1qsksc84 &gt; /tmp/gosa.auth
</pre>
<p>After you executed the command, click &#8220;Next&#8221;.</p>
<h4>9.2 Language selection</h4>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-3.png"><img class="aligncenter size-full wp-image-1260" title="Screenshot-3" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-3.png" alt="" width="791" height="630" /></a></p>
<p>Pick up the correct one and Click &#8220;Next&#8221;.</p>
<h4>9.3 Environment checking</h4>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-4.png"><img class="aligncenter size-full wp-image-1262" title="Screenshot-4" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-4.png" alt="" width="774" height="680" /></a></p>
<p>If you got any error here, get back to: 5.1 Edit PHP (php.ini) params to suit GOsa2.</p>
<p>After all field being marked with Ok, click &#8220;Next&#8221;.</p>
<h4>License agreement</h4>
<p>This screen you must accept the license.<br />
 <a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-5.png"><img class="alignEscolha a linguagem e clique em " title="Screenshot-5" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-5.png" alt="" width="808" height="638" /></a><br />
 After you check it, click &#8220;Next.</p>
<h4>9.4 LDAP Connection</h4>
<p>Here you set the connection between GOsa2 and OpenLDAP that we configured before.</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-6.png"><img class="aligncenter size-full wp-image-1265" title="Screenshot-6" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-6.png" alt="" width="808" height="645" /></a><br />
 The parts tha need to be changed are marked in 1 and 2:<br />
 1. Put the conext to Manager user: &#8220;cn=Manager,dc=FogoNaCaixadAgua&#8221;<br />
 2. Password hash, &#8220;fogonacaixadagua&#8221;</p>
<p>Click &#8220;Next&#8221;".</p>
<h4>9.5 Schema validation</h4>
<p>Yeah!<br />
 <a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-7.png"><img class="aligncenter size-full wp-image-1266" title="Screenshot-7" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-7.png" alt="" width="808" height="621" /></a><br />
 Click &#8220;Next&#8221;.</p>
<h4>9.6 Setting GOsa2 1/3</h4>
<p>Let the default ones and click &#8220;Next&#8221;.<br />
 <a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-8.png"><img class="aligncenter size-full wp-image-1267" title="Screenshot-8" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-8.png" alt="" width="808" height="719" /></a></p>
<h4>9.7 Setting GOsa2 2/3</h4>
<p>Some settings to GOsa2.<br />
 <a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-9.png"><img class="aligncenter size-full wp-image-1268" title="Screenshot-9" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-9.png" alt="" width="791" height="756" /></a><br />
 Below I&#8217;ll explain the changes done, based on the number into above picture, change them as show.<br />
 1. the context that will have the Workstations info from Windows Domain.<br />
 2. Timezone for GOsa2.<br />
 3. Enable Copy &amp; Paster, it&#8217;s a nice function, very interesting when you change some entry into an Organizational Unit, for example.<br />
 4. Enable snapshots, they are useful to revert some bat change, for example<br />
 5. Put the Manager password, &#8220;fogonacaixadagua&#8221;.</p>
<p>Click &#8220;Next&#8221; after you finish it.</p>
<h4>9.8 Setting GOsa2 3/3</h4>
<p>Last part on setting GOsa2.</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-10.png"><img class="aligncenter size-full wp-image-1269" title="Screenshot-10" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-10.png" alt="" width="790" height="840" /></a></p>
<p>1. Enter your SNMP community, if you have one in your network, otherwise put &#8216;public&#8217;.<br />
 2. To enable the SUDO config from GOsa2 Interface</p>
<p>Click &#8220;Next&#8221;.</p>
<h4>9.9 Inspecting OpenLDAP</h4>
<p>In this screen will have a full check to verify if you have some tree in LDAP, as we started from scratch, it have nothing, because of this you see a lot of &#8220;Fails&#8221;. Do not worry, soon it will be all Green ;)</p>
<p>To create a root object, click the button as highlighted on pic below:</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-11.png"><img class="aligncenter size-full wp-image-1270" title="Screenshot-11" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-11.png" alt="" width="792" height="837" /></a></p>
<p>After clicking &#8220;Try to create a root object&#8221; look that the things are starting to getting better :D</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-12.png"><img class="aligncenter size-full wp-image-1271" title="Screenshot-12" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-12.png" alt="" width="811" height="739" /></a></p>
<p>First click the button &#8220;Migrate&#8221;, in &#8220;Inspecting object classes in root object&#8221; then you will be redirected to the following page:</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-13.png"><img class="aligncenter size-full wp-image-1272" title="Screenshot-13" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-13.png" alt="" width="361" height="397" /></a></p>
<p>Click &#8220;Migrate&#8221;.</p>
<p>Getting back to LDAP Inspection page, click the unique button shown.</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-14.png"><img class="aligncenter size-full wp-image-1273" title="Screenshot-14" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-14.png" alt="" width="636" height="335" /></a></p>
<p>This time it&#8217;s to create a password for the user &#8216;admin&#8217; that will log into GOsa2 interface. Enter a password, here is &#8220;fogonacaixadagua&#8221; then click &#8220;Apply&#8221;</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-15.png"><img class="aligncenter size-full wp-image-1274" title="Screenshot-15" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-15.png" alt="" width="630" height="244" /></a></p>
<p>All nice and green, as I promised you.</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-16.png"><img class="aligncenter size-full wp-image-1276" title="Screenshot-16" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-16.png" alt="" width="645" height="648" /></a></p>
<p>Time to go to the last part. Click &#8220;Next&#8221;.</p>
<h4>9.10 Send a feedback</h4>
<p>You are on your own.</p>
<p>Finnished, click &#8220;Next&#8221;.</p>
<h3>9.11 Almost END</h3>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-17.png"><img class="aligncenter size-full wp-image-1277" title="Screenshot-17" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-17.png" alt="" width="644" height="323" /></a></p>
<p>Download the config file to your computer and then copy it to <tt>/etc/gosa</tt> on server side, apply the permissions as shown by installer.</p>
<pre class="brush: shell">scp ~/temp/gosa.conf root@192.168.11.13:/etc/gosa
</pre>
<p>After, on GOsa2 server</p>
<pre class="brush: shell">chown root:apache /etc/gosa/gosa.conf
chmod 640 /etc/gosa/gosa.conf
</pre>
<p>Click &#8220;Next&#8221; on final step to confirm that the config file is there.</p>
<p>You will be awarded with the login screen, use the &#8216;admin&#8217; user and the password defined in the install process to login.</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-18.png"><img class="aligncenter size-full wp-image-1278" title="Screenshot-18" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-18.png" alt="" width="809" height="510" /></a></p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-19.png"><img class="aligncenter size-full wp-image-1280" title="Screenshot-19" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-19.png" alt="" width="811" height="632" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/03/how-to-install-gosa2-on-redhat-centos-rpm-based/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Instalando o GOsa2 no RedHat / CentOS (rpm based)</title>
		<link>http://www.fogonacaixadagua.com.br/2010/03/instalando-o-gosa2-no-redhat-centos-rpm-based/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/03/instalando-o-gosa2-no-redhat-centos-rpm-based/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 19:38:12 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[GOsa2]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1243</guid>
		<description><![CDATA[Sobre esse artigo A idéia deste artigo é servir como base para instalação completa do GOsa2 que será utilizada por artigos futuros no que diz respeito a integração com outros serviços. O que GOsa2 quer dizer? GOsa2 é a forma compacta para GOnicus System Administration. Do site http://www.gosa-project.org/ A mighty System-/Config-management frontend using LDAP as [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/03/instalando-o-gosa2-no-redhat-centos-rpm-based/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><h2>Sobre esse artigo</h2>
<p>A idéia deste artigo é servir como base para instalação completa do GOsa2 que será utilizada por artigos futuros no que diz respeito a integração com outros serviços.</p>
<h2>O que GOsa2 quer dizer?</h2>
<p>GOsa2 é a forma compacta para GOnicus System Administration.</p>
<p>Do site <a title='Original Link: http://www.gosa-project.org/'  href="http://www.fogonacaixadagua.com.br/?D5DIP2Uj">http://www.gosa-project.org/</a></p>
<blockquote><p>A mighty System-/Config-management frontend using LDAP as a backend. It is able to manage POSIX, Samba, Mail, Kolab, FAX, Asterisk and many more services.</p>
</blockquote>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-1.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-1-300x197.png" alt="" title="Screenshot-1" width="300" height="197" class="aligncenter size-medium wp-image-1245" /></a></p>
<h2>Pré-requisitos</h2>
<ul>
<li><a href="http://www.fogonacaixadagua.com.br/2009/08/instalacao-minima-do-centos-e-redhat-5-3/">Instalação mínima do CentOS e RedHat 5.3</a> (Esse guia também aplica-se à versão 5.4 e superior)</li>
<li>Apache 2.2.x</li>
<li>PHP 5.2</li>
<li>OpenLDAP</li>
<li>Repositório yum EPEL</li>
</ul>
<h2>Instalando os pré-requisitos</h2>
<p>Como informado acima, estou partindo do princípio que você já possui um sistema CentOS ou RedHat instalado, portanto, estarei cobrindo aqui os requisitos do sistema, para ter o GOsa2 funcional.</p>
<h4>Instalando o repositório Yum EPEL</h4>
<ul>
<li><a href="http://www.fogonacaixadagua.com.br/2009/08/utilizando-o-repositorio-yum-epel/">Utilizando o repositório Yum EPEL</a></li>
</ul>
<pre class="brush: shell">
rpm -ivh http://virtualxp.org/downloads/epel-release-5-3.noarch.rpm
</pre>
<h4>Configurar o repositório do GOsa2</h4>
<p>Vá ao diretório <tt>/etc/yum.repos.d</tt> e crie o arquivo <tt>GOsa2.repo</tt> com seu editor de texto favorito.</p>
<p>Arquivo <tt>GOsa2.repo</tt></p>
<pre class="brush: text">
[GOsa]
name=GOsa Repository
baseurl=ftp://oss.gonicus.de/pub/gosa/redhat
enabled=1
gpgcheck=0
</pre>
<h4>Configurando repositório para PHP 5.2</h4>
<p>O PHP 5.2 não está no repositório oficial do CentOS / RedHat, para isso será necessário utilizarmos um repositório de terceiros, nesse guia utilizarei o repositório do <a title='Original Link: http://www.jasonlitka.com/yum-repository/'  href="http://www.fogonacaixadagua.com.br/?5DR0pKUz">Utter Ramblings</a>. É um repositório confiável e estável, pode utilizar sem maiores receios.</p>
<p>Vá ao diretório <tt>/etc/yum.repos.d</tt> e crie um novo arquivo com seu editor de textos favorito com o seguinte conteúdo:</p>
<p>Arquivo <tt>utterramblings.repo</tt></p>
<pre class="brush:text">
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
</pre>
<p>Esse repositório já tem também o Apache 2.2.x a ser utilizado.</p>
<h4>Instalando o servidor OpenLDAP</h4>
<p>Pode ser utilizado a versão oficial.</p>
<p>Para isso, executar o comando:</p>
<pre class="brush: shell">
yum install openldap openldap-clients openldap-servers
</pre>
<h2>Instalando o GOsa2 via yum</h2>
<p>Com os pré-requisitos satisfeitos, prossegue-se com a instalação definitiva do GOsa2.</p>
<p>Há uma série de plugins disponíveis para o GOsa2, fazendo uma busca no seu repositório, é possível ter uma idéia dos plugins e você pode instalar os que adequam ao seu ambiente:</p>
<pre class="brush: shell">
yum search gosa
</pre>
<p>WARNING: Evite instalar o pacote <tt>gosa-desktop</tt> pois virá o Gnome e o X com dependência.</p>
<p>Abaixo estão os pacotes que serão instalados para esse guia, como dito antes, adeque com o que lhe servir.</p>
<pre class="brush: shell">
yum install gosa-schema.noarch gosa-plugin-systems.noarch gosa-plugin-sudo.noarch gosa-plugin-squid.noarch gosa-plugin-samba.noarch gosa-plugin-rolemanagement.noarch gosa-plugin-pureftpd.noarch gosa-plugin-mail.noarch gosa-plugin-log.noarch gosa-plugin-ldapmanager.noarch gosa-plugin-dns.noarch gosa-plugin-dhcp.noarch gosa-plugin-connectivity.noarch gosa-plugin-addressbook.noarch gosa-help-en.noarch gosa.noarch
</pre>
<h4>Editar prâmetros do PHP (php.ini) para o GOsa2</h4>
<p>Para que o GOsa2 rode adequadamente, é necessário alterar 2 parâmetros no arquivo <tt>/etc/php.ini</tt>. Edite o arquivo e grave as alterações.</p>
<p>Antes:</p>
<ul>
<li>expose_php = On</li>
<li>magic_quotes_gpc = Off</li>
</ul>
<p>Depois:</p>
<ul>
<li>expose_php = Off</li>
<li>magic_quotes_gpc = On</li>
</ul>
<h4>Certificando-se que os serviços corretos iniciarão no boot</h4>
<p>Fazer com o Apache e o OpenLDAP iniciem no boot.</p>
<pre class="brush:shell">
chkconfig --levels 35 ldap on
chkconfig --levels 35 httpd on
</pre>
<h2>Configurando o OpenLDAP para ser utilizado com o GOsa2</h2>
<p>Temos todos os programas necessários instalados e tudo indo bem, agora é parte mais crítica, mas não complicada, do ambiente que estamos configurando.</p>
<p>Será necessário adequar o OpenLDAP para que o GOsa2 se entenda com ele, isso significa apresentar os <tt>schemas</tt> corretos ao OpenLDAP.</p>
<p>Crie um cópia de backup do arquivo de configuração atual, just in case :)</p>
<pre class="brush: shell">
cd /etc/openldap
cp slapd.conf slapd.conf.orig
</pre>
<p>Gerar uma senha para o <tt>cn=Manager</tt></p>
<pre class="brush: shell">
slappasswd -h {SSHA}
New password:
Re-enter new password:
{SSHA}Nag4FWwXLoGO/WpdpFJUlMVCBYwB94wt
</pre>
<p>O resultado foi um hash da senha informada, nesse caso utilizei a senha &#8220;fogonacaixadagua&#8221; e gerou esse hash, guarde esse hash por que ele será utilizado na sequencia.</p>
<p>Edite o arquivo <tt>/etc/openldap/slapd.conf</tt> e faça com fique parecido com o seguinte:</p>
<pre class="brush: text">
include         /etc/openldap/schema/corba.schema
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/dyngroup.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/java.schema
include         /etc/openldap/schema/misc.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/openldap.schema
include         /etc/openldap/schema/ppolicy.schema

include /etc/openldap/schema/gosa/samba3.schema
include /etc/openldap/schema/gosa/pureftpd.schema
include /etc/openldap/schema/gosa/gofon.schema
include /etc/openldap/schema/gosa/gosystem.schema
include /etc/openldap/schema/gosa/goto.schema
include /etc/openldap/schema/gosa/gosa-samba3.schema
include /etc/openldap/schema/gosa/gofax.schema
include /etc/openldap/schema/gosa/goserver.schema
include /etc/openldap/schema/gosa/goto-mime.schema
include /etc/openldap/schema/gosa/trust.schema
include /etc/openldap/schema/gosa/dnszone.schema
include /etc/openldap/schema/gosa/gosa_custom.schema

pidfile		/var/run/openldap/slapd.pid
argsfile	/var/run/openldap/slapd.args

database	bdb
suffix		"dc=FogoNaCaixadAgua"
rootdn		"cn=Manager,dc=FogoNaCaixadAgua"

# Senha gerada pelo comando slappasswd -h {SSHA}
rootpw		{SSHA}Nag4FWwXLoGO/WpdpFJUlMVCBYwB94wt

directory	/var/lib/ldap

index entryCSN,entryUUID eq
index uid,mail eq
index gosaMailAlternateAddress,gosaMailForwardingAddress eq
index cn,sn,givenName,ou pres,eq,sub
index objectClass pres,eq
index uidNumber,gidNumber,memberuid eq
index gosaSubtreeACL,gosaObject,gosaUser pres,eq
index sambaSID eq
index sambaPrimaryGroupSID eq
index sambaDomainName eq

cachesize 100000
</pre>
<p>Copiar alguns <tt>schemas</tt> que não estão no diretório certo:</p>
<pre class="brush: shell">
cp /usr/share/gosa/plugins/pureftpd/contrib/pureftpd.schema /etc/openldap/schema/gosa
cp /usr/share/gosa/plugins/dns/contrib/dnszone.schema /etc/openldap/schema/gosa
</pre>
<p>Criar o arquivo <tt>/etc/openldap/schema/gosa_custom.schema</tt> com o seguinte conteúdo:</p>
<p>Arquivo <tt>/etc/openldap/schema/gosa_custom.schema</tt></p>
<pre class="brush: plain">
#$Id: authldap.schema,v 1.8 2005/03/20 19:10:30 mrsam Exp $
#
# OID prefix: 1.3.6.1.4.1.25981
#
# Attributes: 1.3.6.1.4.1.25981.1.1
#
# Depends on: gosa.schema and cosine.schema

attributetype ( 1.3.6.1.4.1.25981.1.1.1 NAME 'gosaMailHome'
	DESC 'The absolute path to the mail message stor directory in a virtual mail setup.'
        EQUALITY caseExactIA5Match
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )

#
# Objects: 1.3.6.1.4.1.25981.1.2
#

objectclass ( 1.3.6.1.4.1.25981.1.2.1 NAME 'gosaVirtualMailAccount' SUP top AUXILIARY
	DESC 'Objectclass to mark Virtual MailAccounts for GOsa (v2.4)'
        MAY ( gosaMailHome ) )
</pre>
<h2>Iniciando o OpenLDAP</h2>
<p>Com o OpenLDAP server configurado e o schemas copiados, copie o arquivo DB_CONFIG.example para o diretório do LDAP:</p>
<pre class="brush: shell">
cd /etc/openldap
cp DB_CONFIG.example /var/lib/ldap/DB_CONFIG
</pre>
<p>Agora pode-se iniciar o OpenLDAP e verificar se tudo vai bem.</p>
<pre class="brush: shell">
service ldap start
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
</pre>
<h2>Iniciando o Apache</h2>
<p>O apache foi instalado e fará a interface para o GOsa2.</p>
<p>O próprio pacote do GOsa2 criou um arquivo de configuração para ele no apache, esse arquivo encontra-se em <tt>/etc/httpd/conf.d/gosa-apache.conf</tt></p>
<p>Seu conteúdo é o seguinte:</p>
<pre class="brush: plain">
# Include GOsa to your web service
Alias /gosa /usr/share/gosa/html

<ifmodule mod_php5.c>
<location /gosa>
    php_admin_flag engine on
    php_admin_flag register_globals off
    php_admin_flag allow_call_time_pass_reference off
    php_admin_flag expose_php off
    php_admin_flag zend.ze1_compatibility_mode off
    php_admin_flag register_long_arrays off
    php_admin_flag magic_quotes_gpc on
    php_admin_value upload_tmp_dir /var/spool/gosa/
    php_admin_value session.cookie_lifetime 0
    include /etc/gosa/gosa.secrets
</location>
</ifmodule>

<ifmodule mod_fcgid.c>
   PHP_Fix_Pathinfo_Enable 1
   <location /gosa>
     Options +ExecCGI
     AddHandler fcgid-script .php
     FCGIWrapper /var/www/php-fcgi/php-fcgi-starter .php
     include /etc/gosa/gosa.secrets
   </location>
</ifmodule>
</pre>
<p>Não é recomendado alterá-lo, a não ser que seja realmente necessário.</p>
<p>Pode-se iniciar o serviço do apache.</p>
<pre class="brush: shell">
service httpd start
Starting httpd:                                            [  OK  ]
</pre>
<h2>Configurando o GOsa2 pela interface Web</h2>
<p>Depois de iniciar o serviço do apache, acesse o IP do host que foi instalado o GOsa2, como por exemplo:</p>
<h4>Tela inicial da configuração do GOsa2</h4>
<pre>

http://192.168.11.13/gosa/
</pre>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-2.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-2.png" alt="" title="Screenshot-2" width="991" height="590" class="aligncenter size-full wp-image-1257" /></a></p>
<p>Note a parte destacada da imagem, é necessário executar esse comando para que o instalador do GOsa2 saiba que você tem poder sobre o servidor.</p>
<pre class="brush: shell">
echo -n 93esjraq6baopmpchl1qsksc84 > /tmp/gosa.auth
</pre>
<p>Após executado o comando, clique em &#8220;Next&#8221;.</p>
<h4>Seleção da linguagem</h4>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-3.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-3.png" alt="" title="Screenshot-3" width="791" height="630" class="aligncenter size-full wp-image-1260" /></a><br />
Escolha a linguagem e clique em &#8220;Next&#8221;.</p>
<h4>Verificação do ambiente</h4>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-4.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-4.png" alt="" title="Screenshot-4" width="774" height="680" class="aligncenter size-full wp-image-1262" /></a><br />
Se houver alguma falha nessa parte, volte para o início do documento e revise a sessão que diz: Editar prâmetros do PHP (php.ini) para o GOsa2.</p>
<p>Após todos os campos estarem com OK, clique em &#8220;Next&#8221;.</p>
<h4>Aceite do acordo</h4>
<p>Nessa tela faz-se o aceite do acordo da licença.<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-5.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-5.png" alt="" title="Screenshot-5" width="808" height="638" class="aligncenter size-full wp-image-1263" /></a><br />
Após marcar, conforme a a figura acima, clique em &#8220;Next&#8221;.</p>
<h4>Conexão com o LDAP</h4>
<p>Aqui configura-se a conectividade com o OpenLDAP que configuramos anteriormente.</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-6.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-6.png" alt="" title="Screenshot-6" width="808" height="645" class="aligncenter size-full wp-image-1265" /></a><br />
As partes que devem ser alteradas estão marcadas em 1 e 2, no caso:<br />
1. Informar o contexto para o usuário Manager, &#8220;cn=Manager,dc=FogoNaCaixadAgua&#8221;<br />
2. Colocar a senha que foi gerada no hash, &#8220;fogonacaixadagua&#8221;</p>
<p>Clicar em &#8220;Next&#8221;".</p>
<h4>Verificação dos schemas</h4>
<p>Sim!<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-7.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-7.png" alt="" title="Screenshot-7" width="808" height="621" class="aligncenter size-full wp-image-1266" /></a><br />
Clique em &#8220;Next&#8221;.</p>
<h4>Configuração do GOsa2 1/3</h4>
<p>Deixe as opções padrão e clique em &#8220;Next&#8221;.<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-8.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-8.png" alt="" title="Screenshot-8" width="808" height="719" class="aligncenter size-full wp-image-1267" /></a></p>
<h4>Configuração do GOsa2 2/3</h4>
<p>Mais algumas configurações pertinentes ao GOsa2.<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-9.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-9.png" alt="" title="Screenshot-9" width="791" height="756" class="aligncenter size-full wp-image-1268" /></a><br />
Abaixo, vou explicar as alterações feitas, baseada na numeração da figura acima, altere-as conforme mostrado na foto.<br />
1. É onde ficarão gravadas as informações das workstations de um domínio Windows<br />
2. Timezone para o GOsa2.<br />
3. Habilitar o &#8220;Copiar / Colar&#8221;, é uma função bastante interessante quando se quer mudar uma entrada de Unidade Organizacional, por exemplo.<br />
4. Habilitar snapshots, são úteis para reverter uma adição mal feita, por exemplo.<br />
5. Informar a senha do Manager, &#8220;fogonacaixadagua&#8221;.</p>
<p>Clicar em &#8220;Next&#8221; ao terminar.</p>
<h4>Configurações do GOsa2 3/3</h4>
<p>Última parte da configuração do GOsa2.<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-10.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-10.png" alt="" title="Screenshot-10" width="790" height="840" class="aligncenter size-full wp-image-1269" /></a><br />
1. Coloque a sua comunidade SNMP caso já exista alguma padrão na sua rede, ou coloque &#8216;public&#8217; apenas.<br />
2. Para habilitar as configurações do SUDO no LDAP.</p>
<p>Quando terminar, clicar em &#8220;Next&#8221;.</p>
<h4>Inspeção final do LDAP</h4>
<p>Nessa tela, haverá uma checagem para verificar se existe alguma árvore no LDAP, como começamos do zero, não tem nada, por isso vê-se uma sequencia de falhas. Não se preocupe, logo vai estar tudo verdinho!</p>
<p>Para criar o objeto root, clique no botão conforme destacado na imagem abaixo.<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-11.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-11.png" alt="" title="Screenshot-11" width="792" height="837" class="aligncenter size-full wp-image-1270" /></a></p>
<p>Após clicar no botão &#8220;Try to create a root object&#8221; veja que as coisas começar a melhorar ;) </p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-12.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-12.png" alt="" title="Screenshot-12" width="811" height="739" class="aligncenter size-full wp-image-1271" /></a></p>
<p>Clique primeiro no botão &#8220;Migrate&#8221; em &#8220;Inspecting object classes in root object&#8221; e você vai ser direcionado para a página abaixo:</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-13.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-13.png" alt="" title="Screenshot-13" width="361" height="397" class="aligncenter size-full wp-image-1272" /></a><br />
Clique em &#8220;Migrate&#8221;.</p>
<p>Voltando para a tela da inspeção do LDAP, clique no único botão que aparece:<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-14.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-14.png" alt="" title="Screenshot-14" width="636" height="335" class="aligncenter size-full wp-image-1273" /></a></p>
<p>Dessa vez, é para criar uma senha para o usuário &#8216;admin&#8217; que logará na interface Web do GOsa2, informe a senha para esse usuário, aqui foi definida &#8220;fogonacaixadagua&#8221; e clique em &#8220;Apply&#8221;.<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-15.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-15.png" alt="" title="Screenshot-15" width="630" height="244" class="aligncenter size-full wp-image-1274" /></a></p>
<p>Tudo bonito agora e verdinho, conforme o prometido!</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-16.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-16.png" alt="" title="Screenshot-16" width="645" height="648" class="aligncenter size-full wp-image-1276" /></a></p>
<p>Hora de prosseguir, para o final. Clique em &#8220;Next&#8221;.</p>
<h4>Enviar um feedback</h4>
<p>Aqui é por sua conta.</p>
<p>Terminando, clique em &#8220;Next&#8221;.</p>
<h3>FIM</h3>
<p>Chegamos.<br />
<a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-17.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-17.png" alt="" title="Screenshot-17" width="644" height="323" class="aligncenter size-full wp-image-1277" /></a><br />
Faça o download do arquivo de configuração para o seu computador e copie para o diretório <tt>/etc/gosa</tt> no servidor do GOsa2, altere as permissões do arquivo conforme a sugestão do instalador.</p>
<pre class="brush: shell">
scp ~/temp/gosa.conf root@192.168.11.13:/etc/gosa
</pre>
<p>E depois, no servidor</p>
<pre class="brush: shell">
chown root:apache /etc/gosa/gosa.conf
chmod 640 /etc/gosa/gosa.conf
</pre>
<p>Clique em &#8220;Next&#8221; na tela final do instalador para confirmar que o arquivo está lá.</p>
<p>Você então será agraciado com a tela de Login e utilize o usuário &#8216;admin&#8217; com a senha definida no processo de instalação.</p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-18.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-18.png" alt="" title="Screenshot-18" width="809" height="510" class="aligncenter size-full wp-image-1278" /></a></p>
<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-19.png"><img src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2010/03/Screenshot-19.png" alt="" title="Screenshot-19" width="811" height="632" class="aligncenter size-full wp-image-1280" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/03/instalando-o-gosa2-no-redhat-centos-rpm-based/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bash: Convertendo TABs para Espaço em arquivos</title>
		<link>http://www.fogonacaixadagua.com.br/2010/03/bash-convertendo-tabs-para-espaco-em-arquivos/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/03/bash-convertendo-tabs-para-espaco-em-arquivos/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 13:35:33 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1236</guid>
		<description><![CDATA[É possível utilizar várias ferramentas para essa finalidade, como por exemplo o sed e o awk. O comando expand coverte todos os TABs para espaços. Ele preserva os caracteres de backspace na saída; eles que fazem com os espaços sejam reduzidos na contagem para o cálculo dos TABs. expand arquivo.log > output.log expand dados.txt > [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/03/bash-convertendo-tabs-para-espaco-em-arquivos/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>É possível utilizar várias ferramentas para essa finalidade, como por exemplo o <tt>sed</tt> e o <tt>awk</tt>. O comando <tt>expand</tt> coverte todos os TABs para espaços.</p>
<p>Ele preserva os caracteres de backspace na saída; eles que fazem com os espaços sejam reduzidos na contagem para o cálculo dos TABs.</p>
<pre class="brush:shell">
expand arquivo.log > output.log
expand dados.txt > output.txt
expand -t 2 dados.txt > output.txt
</pre>
<p>A opção <tt>-t</tt> pode ser usada para gerar uma lista separada por vírgula (arquivo CSV).</p>
<p>Caso você queira fazer o contrário, ou seja, converter espaços para TABs, use o comando <tt>unexpand</tt>.</p>
<p>Veja as man pages para mais informações</p>
<pre class="brush:shell">
man expand
man unexpand
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/03/bash-convertendo-tabs-para-espaco-em-arquivos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Template para Script Resource no Red Hat Cluster Suite</title>
		<link>http://www.fogonacaixadagua.com.br/2010/01/template-para-script-resource-no-red-hat-cluster-suite/</link>
		<comments>http://www.fogonacaixadagua.com.br/2010/01/template-para-script-resource-no-red-hat-cluster-suite/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 20:34:12 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Red Hat Cluster Suite]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[RHCS]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1215</guid>
		<description><![CDATA[Existem alguns recursos já prontos no Red Hat Cluster Suite (RHCS) para serem adicionados como serviço. Mas também é possível acrescentar seu próprio script para que o RHCS realoque ou reinicie o serviço em questão. Basicamente o script tem que conter 3 chamadas: status, start e stop. Abaixo está um exemplo que inicia, pára e [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2010/01/template-para-script-resource-no-red-hat-cluster-suite/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Existem alguns recursos já prontos no Red Hat Cluster Suite (RHCS) para serem adicionados como serviço. Mas também é possível acrescentar seu próprio script para que o RHCS realoque ou reinicie o serviço em questão.</p>
<p>Basicamente o script tem que conter 3 chamadas: status, start e stop.</p>
<p>Abaixo está um exemplo que inicia, pára e verifica o status do Sun Glassfish, fique a vontade em adaptar a sua necessidade.</p>
<pre class="brush: bash">
#!/bin/sh

# Script Name: glassfish
# Script Path: /etc/init.d/glassfish
# Script Purpose: To provide glassfish management
# start/stop/status under Red Hat Cluster Cluster
# Script Author: Daniel K. Lima

BASEDIR=/opt/glassfish/bin

case $1 in
	'start')
		cd ${BASEDIR}
		./asadmin start-domain domain1
		exit 0
	;;

	'stop')
		z=$(ps -ef | grep "com.sun.aas" | grep -v "grep"| awk ' { print $2 } ')
		if [[ $? -eq 0 ]]
		then
			cd ${BASEDIR}
			./asadmin stop-domain domain1
			exit 0
		fi
	;;

	'restart')
	   	/etc/init.d/glassfish stop
   		sleep 2
  		echo Now starting......
  		/etc/init.d/glassfish start
    		echo "restarted"
    	;;

	'status')
		ps awx | grep -v "grep " | grep "com.sun.aas" 1>/dev/null
		if [[ $? = 0 ]]
		then
			echo "Glassfish is running..."
			exit 0
		else
			echo "Glassfish is stopped..."
			exit 1
		fi
	;;
esac
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2010/01/template-para-script-resource-no-red-hat-cluster-suite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fazendo com que o GRUB utilize um kernel específico uma vez ao dar boot</title>
		<link>http://www.fogonacaixadagua.com.br/2009/11/fazendo-com-que-o-grub-utilize-um-kernel-especifico-uma-vez-ao-dar-boot/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/11/fazendo-com-que-o-grub-utilize-um-kernel-especifico-uma-vez-ao-dar-boot/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 11:05:01 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CLI]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1187</guid>
		<description><![CDATA[Cenário Essa situação é interessante quando foi compilado um novo kernel e se está com acesso remoto ao servidor, ou seja, mandar um reboot remotamente com um novo kernel, muita coisa pode acontecer, e o mínimo é perder a conexão. Para essas situações tem como fazer com que o GRUB utilize um kernel em específico [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/11/fazendo-com-que-o-grub-utilize-um-kernel-especifico-uma-vez-ao-dar-boot/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><h2>Cenário</h2>
<p>Essa situação é interessante quando foi compilado um novo kernel e se está com acesso remoto ao servidor, ou seja, mandar um <tt>reboot</tt> remotamente com um novo kernel, muita coisa pode acontecer, e o mínimo é perder a conexão.</p>
<p>Para essas situações tem como fazer com que o GRUB utilize um kernel em específico apenas uma vez, e em caso de <tt>Kernel Panic</tt> o servidor será resetado e o kernel original será utilizado, voltando assim o acesso remoto para serem feitas as alterações necessárias.</p>
<h2>Preparando o ambiente</h2>
<p>É importante também definir os seguinte parâmetros de kernel:</p>
<pre class="brush: shell; gutter: false">
kernel.panic = 5
kernel.panic_on_oops = 1
</pre>
<p>A primeira linha significa que o computador será &#8220;resetado&#8221; após 5 segundo de Panic e a segunda linha informa que será gerado um <tt>Kernel Panic</tt> em qualquer evento de estouro de memória e afins.</p>
<p>Adicione as duas linhas anteriores no arquivo <tt>/etc/sysctl.conf</tt> e após isso, execute o comando</p>
<pre class="brush: shell; gutter: false"> sysctl -p</pre>
<h2>Lidando com o GRUB</h2>
<p>Como root execute</p>
<pre class="brush: shell; gutter: true">grub --batch</pre>
<pre class="brush: shell; gutter: true">
grub> savedefault --default=1 --once
grub> quit
</pre>
<p>Fará com que o GRUB ignore uma única vez os parâmetros &#8216;default&#8217; e &#8216;timeout&#8217; do grub.conf e nessa inicialização utilizará o kernel &#8217;1&#8242; do GRUB, no boot seguinte será utilizado o arquivo grub.conf normalmente. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/11/fazendo-com-que-o-grub-utilize-um-kernel-especifico-uma-vez-ao-dar-boot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux: Política que permite o Postfix &#8216;conversar&#8217; com o gnarwl</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/selinux-politica-que-permite-o-postfix-conversar-com-o-gnarwl/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/selinux-politica-que-permite-o-postfix-conversar-com-o-gnarwl/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 05:59:24 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Seguranca]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=1127</guid>
		<description><![CDATA[O gnarwl é de longe o melhor auto-reply disponível, bastante customizável e o melhor é que usa LDAP e é facilmente integrado com o Postifx. Lembrando que se você tem o plugin &#8216;vacation&#8217; no squirrelmail ele não vai ter incompatilidade, uma vez que setando a auto-resposta no squirrelmail vai sobrescrever os dados colocados originalmente no [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/10/selinux-politica-que-permite-o-postfix-conversar-com-o-gnarwl/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>O gnarwl é de longe o melhor auto-reply disponível, bastante customizável e o melhor é que usa LDAP e é facilmente integrado com o Postifx.</p>
<p>Lembrando que se você tem o plugin &#8216;vacation&#8217; no squirrelmail ele não vai ter incompatilidade, uma vez que setando a auto-resposta no squirrelmail vai sobrescrever os dados colocados originalmente no LDAP manualmente ou pelo phamm ou pelo GOsa2, ou seja, tranquilo :)</p>
<p>Não vou discutir aqui como instalar o gnarwl, pois para isso vou fazer outro post.</p>
<p>Esse post é específico em criar uma política que permita o Postfix &#8220;conversar&#8221; com o gnarwl, ou seja, vai permitir que o Postfix envie a mensagem, via BCC ao gnarwl e este verificará se o campo vacationActive está como TRUE.</p>
<h2>Criando o arquivo com as regras</h2>
<p>Primero, crie o arquivo que contém as regras para o gnarwl, chamando-o de <tt>gnarwl.te</tt> e com o seguinte conteúdo:</p>
<p><tt>Arquivo gnarwl.te</tt></p>
<pre class="brush: plain; gutter: true">module gnarwl 1.0;

require {
	type var_lib_t;
	type postfix_postdrop_t;
	type postfix_local_t;
	type sendmail_exec_t;
	class unix_stream_socket { read write getattr };
	class file { execute read lock create execute_no_trans write getattr };
	class dir { write search add_name };
}

#============= postfix_local_t ==============
allow postfix_local_t sendmail_exec_t:file { read execute execute_no_trans };
allow postfix_local_t var_lib_t:dir { write add_name };
allow postfix_local_t var_lib_t:file { read lock getattr write create };

#============= postfix_postdrop_t ==============
allow postfix_postdrop_t postfix_local_t:unix_stream_socket { read write getattr };
</pre>
<p>Vou explicar algumas linhas.</p>
<p>Linha 7 e 14: o postfix tem que ter permissão para executar o sendmail, pois quando o email é encaminhado para o usuário gnarwl (é um usuário local do Linux) ele auto-responde a mensagem para quem enviou, por isso essa regra é necessária.</p>
<p>Linhas 8 e 19: ao acessar o arquivo <tt>.forward</tt> do home do gnarwl, tem o comando que faz um pipe para o executável do gnarwl, essa linha é <tt>|/usr/bin/gnarwl</tt>, por isso o postfix precisa dessa permissão.</p>
<h2>Compilando as regras</h2>
<p>Com o arquivo criado, é necessário compilar as régras e instalar a nova política.</p>
<pre class="brush: shell">checkmodule -M -m -o gnarwl.mod gnarwl.te</pre>
<p>O resultado do comando será algo parecido com:</p>
<pre class="brush:shell; gutter: false">checkmodule:  loading policy configuration from gnarwl.te
checkmodule:  policy configuration loaded
checkmodule:  writing binary representation (version 6) to gnarwl.mod
</pre>
<pre class="brush: shell">semodule_package -o gnarwl.pp -m gnarwl.mod</pre>
<p>Se tudo for Ok, não haverá resultado de saída.</p>
<pre class="brush: shell">semodule -i gnarwl.pp</pre>
<p>Se tudo for Ok, não haverá resultado de saída.</p>
<h2>Verificando a instalação</h2>
<p>O comando <tt>semodule -l</tt> lista todos os módulos instalados, veja que o novo módulo gnarwl 1.0 está instalado.</p>
<pre class="brush: shell; gutter: false">semodule -l |grep gnarwl
gnarwl	1.0
</pre>
<p>Se algum problema ocorreu no processo, comente sua dúvida.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/selinux-politica-que-permite-o-postfix-conversar-com-o-gnarwl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Script shell com expect para atualização em massa para o horário de verão 2009/2010</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/script-shell-com-expect-para-atualizacao-em-massa-para-o-horario-de-verao-20092010/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/script-shell-com-expect-para-atualizacao-em-massa-para-o-horario-de-verao-20092010/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 00:47:21 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=967</guid>
		<description><![CDATA[Para quem trabalha com vários servidores Linux / FreeBSD atualizar todos os servidores para o horário e verão é uma tarefa cansativa e chata. Vou disponibilizar aqui um script para ser utilizado nessa tarefa, ou seja, um script que atualizará todos os servidores listados em um arquivo e os deixará prontos para a virada do [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/10/script-shell-com-expect-para-atualizacao-em-massa-para-o-horario-de-verao-20092010/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p><img class="aligncenter size-full wp-image-988" title="500px-Timezones2008_UTC-4" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/10/500px-Timezones2008_UTC-4.png" alt="500px-Timezones2008_UTC-4" width="500" height="268" />Para quem trabalha com vários servidores Linux / FreeBSD atualizar todos os servidores para o horário e verão é uma tarefa cansativa e chata.</p>
<p>Vou disponibilizar aqui um script para ser utilizado nessa tarefa, ou seja, um script que atualizará todos os servidores listados em um arquivo e os deixará prontos para a virada do horário.</p>
<p>O funcionamento do script é bem simples, é composto por 3 arquivos</p>
<ul>
<li>daylight.sh</li>
<li>daylight.exp</li>
<li>servidores.txt</li>
</ul>
<p>Vou explicar rapidamente o que é cada um desses arquivos e o que fazem.</p>
<h4>Pré-requisitos</h4>
<ul>
<li>expect</li>
<li>openssh</li>
</ul>
<h3>Posts relacionados</h3>
<ul>
<li><a href="http://www.fogonacaixadagua.com.br/2009/10/horario-de-verao-no-linux-e-freebsd-20092010/">Horario de verão no Linux e FreeBSD 2009/2010</a></li>
<li><a href="http://www.fogonacaixadagua.com.br/2009/08/horario-de-verao-20082009-no-linux-e-freebsd/">Horario de verão no Linux e FreeBSD</a></li>
</ul>
<h3>daylight.sh</h3>
<blockquote><p>É o script principal, responsável por ler os dados dos servidores do arquivo <tt>servidores.txt</tt> e repassar para o script expect que atuará nos servidores.</p>
</blockquote>
<h4>Arquivo <a href="http://www.virtualxp.org/downloads/scripts/Daylight/daylight.sh">daylight.sh</a></h4>
<pre class="brush: shell, gutter: true">#!/bin/bash

# Script para atualizacao em massa, via ssh, das regras de horario de verão
# nos servidores listados no arquivo
#
# - servidores.txt
#
# Autor: Daniel K Lima
# Data: 17/10/2009
########################

# VARIAVEIS para funcionamento do script
SERVIDORES="./servidores.txt"
DAYLIGHT="./daylight.exp"

# Testa se o arquivo servidores.txt existe
if [ ! -e ${SERVIDORES} ]
	then
	echo "Arquivo 'servidores.txt' não encontrado."
	exit 1
fi

# Ler o arquivo ${SERVIDORES} e processar cada linha que contém informações
# acerca da conexão
cat ${SERVIDORES} | while read LINHA
do
	# Joga os campos em variáveis
	HOST=$(echo ${LINHA} | cut -d',' -f1)
	USERNORMAL=$(echo ${LINHA} | cut -d',' -f2)
	USERPASSWD=$(echo ${LINHA} | cut -d',' -f3)
	ROOTPASSWD=$(echo ${LINHA} | cut -d',' -f4)

	# Teste sobre repasse das variáveis
	#echo ${HOST}
	#echo ${USERNORMAL}
	#echo ${USERPASSWD}
	#echo ${ROOTPASSWD}

	# Chama o arquivo expect com os parâmetros coletados
	# Testa se o expect existe
	if [ ! -e ${DAYLIGHT} ]
		then
		echo "Arquivo com script expect ${DAYLIGHT} não encontrado"
		exit 1
	else
		# Garantir que o arquivo tenha permissão de execução
		chmod 755 ${DAYLIGHT}

		# imprimir na tela o comando que esta sendo executado
		#echo "${DAYLIGHT} ${HOST} ${USERNORMAL} ${USERPASSWD} ${ROOTPASSWD}"

		# executar o script expect com os parametros
		${DAYLIGHT} ${HOST} ${USERNORMAL} ${USERPASSWD} ${ROOTPASSWD}
	fi

done</pre>
<div style="border: medium none ; margin: 1em 5em; padding: 0.2em; background-color: #bbffbb;">
<div style="float: left;"><img src="/images/Info.png" alt="" width="32" height="32" /></div>
<div style="margin-left: 36px;"><strong>Nota</strong><br />
 Recomendo <strong>fazer o download do script</strong> <tt><a href="http://www.virtualxp.org/downloads/scripts/Daylight/daylight.sh">daylight.sh</a></tt> ao invés de copiar o código, ao copiar e colar alguma coisa pode ser &#8220;truncada&#8221; e erros serão inevitáveis.</div>
</div>
<h3>daylight.exp</h3>
<blockquote><p>Contém o script expect que automatizará a conexão com os servidores baseado nos parâmetros que o script <tt>daylight.sh</tt> passar e criará os arquivos da nova timezone para o horário de verão.</p>
</blockquote>
<h4>Arquivo <a href="http://www.virtualxp.org/downloads/scripts/Daylight/daylight.exp">daylight.exp</a></h4>
<pre class="brush: shell; gutter: true">#!/usr/bin/expect -f
#
set force_conservative 0;
if {$force_conservative} {
	set send_slow {1 .1}
	proc send {ignore arg} {
		sleep .1
		exp_send -s -- $arg
	}
}

# argv 0 = host a ser conectado
# argv 1 = usuario para conexao SSH
# argv 2 = senha do usuario
# argv 3 = senha do root

set timeout -1
spawn $env(SHELL)
match_max 100000
send -- "ssh -l [lindex $argv 1] [lindex $argv 0]\r"
expect "word:"
send -- "[lindex $argv 2]\r"
expect "\$ "
send -- "su - root\r"
expect "word:"
send -- "[lindex $argv 3]\r"
expect "# "
send -- "cd /usr/share/zoneinfo/America\r"
expect "# "
send -- "cat &gt; Sao_Paulo.zic &lt;&lt; EOF\r"
expect "&gt; "
send -- "Rule Brazil 2009 only - Oct 18 00:00 1 S\rRule Brazil 2010 only - Feb 21 00:00 0 -\r\rZone Brazil/East -3:00 Brazil BR%sT"
send -- "\r"
expect "&gt; "
send -- "EOF\r"
expect "# "
send -- "zic Sao_Paulo.zic\r"
expect "# "
send -- "alias cp='cp'\r"
expect "# "
send -- "cp Sao_Paulo /etc/localtime\r"
expect "# "
send -- "date\r"
expect "# "
send -- "exit\r"
expect "\$ "
send -- "exit\r"
expect "$ "
send -- ""
expect eof</pre>
<div style="border: medium none ; margin: 1em 5em; padding: 0.2em; background-color: #bbffbb;">
<div style="float: left;"><img src="/images/Info.png" alt="" width="32" height="32" /></div>
<div style="margin-left: 36px;"><strong>Nota</strong><br />
 Recomendo <strong>fazer o download do script</strong> <tt><a href="http://www.virtualxp.org/downloads/scripts/Daylight/daylight.exp">daylight.exp</a></tt> ao invés de copiar o código, ao copiar e colar alguma coisa pode ser &#8220;truncada&#8221; e erros serão inevitáveis, como por exemplo o envio das teclas Ctrl+D que não aparece no código listado acima.</div>
</div>
<h3>servidores.txt</h3>
<blockquote><p>Contém a lista de servidores com usuário normal, senha do usuário normal e senha do root.</p>
</blockquote>
<p>O formato desse arquivo é bem simples:</p>
<pre class="brush=plain; gutter: false">host,usuario_normal,senha_usuario_normal,senha_root</pre>
<p>Note que os parâmetros são separados por vírgula.</p>
<p>Um exemplo desse arquivo ficaria assim:</p>
<pre class="brush: plain; gutter: true">192.168.32.20,master,xP57KLXu,89MX1sPSys3P
192.168.8.14,master,xP57KLXu,89MX1sPSys3P
192.168.32.42,master,xP57KLXu,89MX1sPSys3P
192.168.16.55,master,oz1XBUTK,89MX1sPSys3P
192.168.16.252,master,oz1XBUTK,89MX1sPSys3P
192.168.16.22,master,oz1XBUTK,sWr9MyYo
192.168.16.240,master,xP57KLXu,89MX1sPSys3P
192.168.16.18,master,xP57KLXu,sWr9MyYo
192.168.16.239,master,xP57KLXu,sWr9MyYo
192.168.8.26,master,xP57KLXu,89MX1sPSys3P
192.168.8.33,master,xP57KLXu,89MX1sPSys3P
192.168.32.132,master,xP57KLXu,sWr9MyYo
192.168.32.79,master,xP57KLXu,sWr9MyYo
192.168.32.21,master,oz1XBUTK,89MX1sPSys3P
192.168.32.22,master,oz1XBUTK,89MX1sPSys3P
192.168.32.55,master,oz1XBUTK,89MX1sPSys3P
192.168.32.44,master,xP57KLXu,sWr9MyYo
192.168.32.205,master,xP57KLXu,89MX1sPSys3P
192.168.32.204,master,oz1XBUTK,89MX1sPSys3P
192.168.32.60,master,xP57KLXu,sWr9MyYo
192.168.8.21,master,xP57KLXu,89MX1sPSys3P
192.168.32.111,master,xP57KLXu,89MX1sPSys3P</pre>
<p>Onde: <tt>master</tt> é o usuário comum, e a última coluna, é a senha do usuário <tt>root</tt></p>
<h3>Notas</h3>
<p>Algumas observações importantes acerca dos scripts, principalmente relacionado ao expect.</p>
<h4>Nota 1</h4>
<p>O script não sabe como lidar com verificação de certificado para servidores que ainda não estão na lista <tt>~/.ssh/known_hosts</tt>, portanto, para o script funcionar a contento, adicione essas duas linhas no arquivo <tt>~/.ssh/config</tt></p>
<h5>Arquivo ~/.ssh/config</h5>
<pre class="brush: plain; gutter: false">Host *
StrictHostKeyChecking no</pre>
<h4>Nota 2</h4>
<p>Em todos os hosts, o shell padrão do usuário comum e do root é o <tt>bash</tt> ou o <tt>sh</tt>.</p>
<p>Se você utiliza o <tt>csh</tt> deverá adaptar o arquivo <tt>daylight.exp</tt> na linha 23, onde ele espera o caracter <tt>$ </tt> que é do bash e do sh, e substituir por <tt>% </tt>.</p>
<p>O timeout do expect está em -1, ou seja, se algum erro acontecer o expect congelará e é possível sair do processo spawned com <tt>Ctrl+C</tt>, verifique onde o script parou e faça os ajustes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/script-shell-com-expect-para-atualizacao-em-massa-para-o-horario-de-verao-20092010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Find: mostrar apenas links simbólicos</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/find-mostrar-apenas-links-simbolicos/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/find-mostrar-apenas-links-simbolicos/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 14:26:38 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/2009/10/find-mostrar-apenas-links-simbolicos/</guid>
		<description><![CDATA[Se você quer saber quais arquivos no seu servidor são apenas links simbólicos, aqui está como fazer: find / -type l No exemplo mostrado ele vai procurar por todo o sistema, caso queira restringir a apenas um diretório em específico, substitua o &#8216;/&#8217; por &#8216;/diretorio&#8217;, sem os apóstrofos. Blogged with the Flock Browser]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-990 alignright" title="Questionmark" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/10/Questionmark-240x300.jpg" alt="Questionmark" width="240" height="300" />Se você quer saber quais arquivos no seu servidor são apenas links simbólicos, aqui está como fazer:</p>
<pre>find / -type l</pre>
<p>No exemplo mostrado ele vai procurar por todo o sistema, caso queira restringir a apenas um diretório em específico, substitua o &#8216;/&#8217; por &#8216;/diretorio&#8217;, sem os apóstrofos.</p>
<div class="flockcredit" style="text-align: right; color: #CCC; font-size: x-small;">Blogged with the <a style="color: #999; font-weight: bold;" title="Flock Browser" title='Original Link: http://www.flock.com/blogged-with-flock'  href="http://www.fogonacaixadagua.com.br/?99u2D93r" target="_new">Flock Browser</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/find-mostrar-apenas-links-simbolicos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como alterar a porta que o SSH &#8220;ouve&#8221;</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/como-alterar-a-porta-que-o-ssh-ouve/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/como-alterar-a-porta-que-o-ssh-ouve/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 16:35:05 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=925</guid>
		<description><![CDATA[. Este post serve para qualquer distribuição Linux ou qualquer BSD, pois por padrão os arquivos de configuração do OpenSSH estão em /etc/ssh Começe por editar o arquivo /etc/ssh/sshd_config e localizar a linha #Port 22 Por padrão ela vem comentada porque o SSH ouve na porta 22 por padrão mesmo, descomente essa linha e altere [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/10/quiet.jpg"><img class="size-full wp-image-1047 alignnone" title="quiet" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/10/quiet.jpg" alt="quiet" width="482" height="315" /></a>.</p>
<p>Este post serve para qualquer distribuição Linux ou qualquer BSD, pois por padrão os arquivos de configuração do OpenSSH estão em <tt>/etc/ssh</tt></p>
<p>Começe por editar o arquivo <tt>/etc/ssh/sshd_config</tt> e localizar a linha</p>
<pre class="brush: shell; gutter: false">#Port 22
</pre>
<p>Por padrão ela vem comentada porque o SSH ouve na porta 22 por padrão mesmo, descomente essa linha e altere para uma outra porta</p>
<pre class="brush: shell; gutter: false">Port 8222
</pre>
<p>É possível também adicionar várias linhas <tt>Port</tt> sendo que com isso, em cada porta especificada o OpenSSH irá responder nas portas listadas, mas tenha certeza que a porta especificada não esteja em uso no momento.</p>
<p>Bastando para isso agora reiniciar o serviço do OpenSSH.</p>
<p>No CentOS / Red Hat</p>
<pre class="brush: shell; gutter: true">service sshd restart</pre>
<p>No FreeBSD</p>
<pre class="brush: shell; gutter: true">/etc/rc.d/sshd restart</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/como-alterar-a-porta-que-o-ssh-ouve/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como saber qual versão do Red Hat / CentOS está instalada</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/como-saber-qual-versao-do-red-hat-centos-esta-instalada/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/como-saber-qual-versao-do-red-hat-centos-esta-instalada/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 16:23:59 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=922</guid>
		<description><![CDATA[Para saber qual versão do Red Hat / CentOS que está instalada é bem simples, execute o comando cat /etc/redhat-release e o resultado será algo como: Red Hat Enterprise Linux Server release 5.4 (Tikanga) Para Red Hat, ou no caso do CentOS CentOS release 5.3 (Final) Você saberá exatamente qual versão está instalada.]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/10/como-saber-qual-versao-do-red-hat-centos-esta-instalada/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Para saber qual versão do Red Hat / CentOS que está instalada é bem simples, execute o comando</p>
<pre class="brush: shell">cat /etc/redhat-release
</pre>
<p>e o resultado será algo como:</p>
<pre class="brush: shell; gutter: false">Red Hat Enterprise Linux Server release 5.4 (Tikanga)</pre>
<p>Para Red Hat, ou no caso do CentOS</p>
<pre class="brush: shell; gutter: false">CentOS release 5.3 (Final)</pre>
<p>Você saberá exatamente qual versão está instalada.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/como-saber-qual-versao-do-red-hat-centos-esta-instalada/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como reiniciar o Linux pela linha de comando</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/como-reiniciar-o-linux-pela-linha-de-comando/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/como-reiniciar-o-linux-pela-linha-de-comando/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 16:14:55 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[CLI]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=919</guid>
		<description><![CDATA[Para reiniciar o servidor Linux ou FreeBSD like, apenas execute o comando reboot ou shutdown -r now Como resultado você terá algo como: Broadcast message from root (pts/0) (Wed Apr 20 01:23:45 2009): The system is going down for reboot NOW!]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/10/como-reiniciar-o-linux-pela-linha-de-comando/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Para reiniciar o servidor Linux ou FreeBSD like, apenas execute o comando</p>
<pre class="brush: shell">reboot</pre>
<p>ou</p>
<pre class="brush: shell">shutdown -r now</pre>
<p>Como resultado você terá algo como:</p>
<pre class="brush: shell; gutter: false">Broadcast message from root (pts/0) (Wed Apr 20 01:23:45 2009):
The system is going down for reboot NOW!</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/como-reiniciar-o-linux-pela-linha-de-comando/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Horario de verão no Linux e FreeBSD 2009/2010</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/horario-de-verao-no-linux-e-freebsd-20092010/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/horario-de-verao-no-linux-e-freebsd-20092010/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 13:34:33 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[localtime]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/2009/10/horario-de-verao-no-linux-e-freebsd-20092010/</guid>
		<description><![CDATA[Na época de horário de verão sempre há um pânico extra. No Linux/FreeBSD e afins é possível se previnir, adicionar uma regra para mudar apartir de uma data específica. O exemplo desse post será configurado o horário de verão para 2009/2010. Nota: Linux É necessário estar no diretorio /usr/share/zoneinfo/America. Nota: FreeBSD É necessário estar no [...]]]></description>
			<content:encoded><![CDATA[<p>Na época de horário de verão sempre há um pânico extra.</p>
<p>No Linux/FreeBSD e afins é possível se previnir, adicionar uma regra para mudar apartir de uma data específica.</p>
<p><strong>O exemplo desse post será configurado o horário de verão para 2009/2010.</strong></p>
<div style="border: medium none ; margin: 1em 5em; padding: 0.2em; background-color: #bbffbb;">
<div style="float: left;"><img src="/images/Info.png" alt="" width="32" height="32" /></div>
<div style="margin-left: 36px;"><strong>Nota: Linux</strong><br />
 É necessário estar no diretorio <tt>/usr/share/zoneinfo/America</tt>.</div>
</div>
<div style="border: medium none ; margin: 1em 5em; padding: 0.2em; background-color: #bbffbb;">
<div style="float: left;"><img src="/images/Info.png" alt="" width="32" height="32" /></div>
<div style="margin-left: 36px;"><strong>Nota: FreeBSD</strong><br />
 É necessário estar no diretorio <tt>/usr/share/zoneinfo</tt>.</div>
</div>
<h3>Post relacionado</h3>
<ul>
<li><a href="http://www.fogonacaixadagua.com.br/2009/10/script-shell-com-expect-para-atualizacao-em-massa-para-o-horario-de-verao-20092010/">Script shell com expect para atualização em massa para o horário de verão 2009/2010</a></li>
</ul>
<h3>Criando o arquivo <tt>.zic</tt> com as regras de fuso</h3>
<p>Para isto ser possível, segue abaixo a forma de criar essa regra.</p>
<pre class="brush: shell; gutter: false">cd /usr/share/zoneinfo/America</pre>
<p>Primeiro, crie um arquivo <code>.zic</code> que conterá as regras.</p>
<p>Por exemplo, para alterar a regra para o fuso utilizando o horário de Brasília, crie o arquivo <tt>Sao_Paulo.zic</tt> e adicione o seguinte conteúdo:</p>
<pre class="brush: plain; gutter: false">Rule Brazil 2009 only - Oct 18 00:00 1 S
Rule Brazil 2010 only - Feb 21 00:00 0 -

Zone Brazil/East -3:00 Brazil BR%sT</pre>
<p>A primeira linha, é o início que a data entrará em vigor e o relógio do sistema irá adiantar em 1 hora nessa data.</p>
<p>A segunda linha é o final do horário de verão e o relógio irá atrasar 1 hora.</p>
<p>A terceira linha contém o fuso horário que o arquivo é baseado.</p>
<h3>Compilando o arquivo <tt>.zic</tt></h3>
<p>Isto feito, agora é só compilar o arquivo gerado para criar o novo localtime que utilizará magicamente da regra criada.</p>
<pre class="brush: bash">zic Sao_Paulo.zic</pre>
<p>Após a compilação, será gerado o arquivo Sao_Paulo que o sistema utilizará para configurar o fuso.</p>
<p>Isto feito, copiando para o /etc as regras já entrarão em vigor no mesmo momento.</p>
<pre class="brush: bash">cp Sao_Paulo /etc/localtime</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/horario-de-verao-no-linux-e-freebsd-20092010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Instalando VMware server 2.0.1 em Linux rpm based (Red Hat, Suse, CentOS, Fedora etc)</title>
		<link>http://www.fogonacaixadagua.com.br/2009/10/instalando-vmware-server-2-0-1-em-linux-rpm-based-red-hat-suse-centos-fedora-etc/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/10/instalando-vmware-server-2-0-1-em-linux-rpm-based-red-hat-suse-centos-fedora-etc/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 14:55:58 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualização]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=717</guid>
		<description><![CDATA[Para baixar o VMware, acesse o site http://www.vmware.com/download/server/ e faça o download do .rpm. Aviso Anote o número serial que será informado no momento do download. Instalando o .rpm rpm -ivh VMware-server-2.0.1-156745.x86_64.rpm Preparing... ########################################### [100%] 1:VMware-server ########################################### [100%] The installation of VMware Server 2.0.1 for Linux completed successfully. You can decide to remove this software [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/10/instalando-vmware-server-2-0-1-em-linux-rpm-based-red-hat-suse-centos-fedora-etc/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Para baixar o VMware, acesse o site <a title='Original Link: http://www.vmware.com/download/server'  href="http://www.fogonacaixadagua.com.br/?153T6SOo">http://www.vmware.com/download/server/</a> e faça o download do .rpm.</p>
<div style="border: 1px solid #ffcc00; margin: 1em 5em; padding: 0.2em; background-color: #f8e1d3;">
<div style="float: left;"><img style="border-width: 0px; color: #003399;" src="/images/Alerta2.png" alt="" width="32" height="32" /></div>
<div style="margin-left: 36px;"><strong>Aviso</strong><br />
 Anote o número serial que será informado no momento do download.</div>
</div>
<p><span id="more-717"></span></p>
<h3>Instalando o .rpm</h3>
<pre class="brush: plain">rpm -ivh VMware-server-2.0.1-156745.x86_64.rpm</pre>
<pre class="brush: shell; gutter: false">Preparing...                ########################################### [100%]
   1:VMware-server          ########################################### [100%]

The installation of VMware Server 2.0.1 for Linux completed successfully.
You can decide to remove this software from your system at any time by
invoking the following command: "rpm -e VMware-server".

Before running VMware Server for the first time, you need to
configure it for your running kernel by invoking the
following command: "/usr/bin/vmware-config.pl".

Enjoy,

    --the VMware team</pre>
<p>Após a instalação do RPM é necessário configurar o VMware Server.</p>
<p>Digite o comando abaixo como root para iniciar o processo</p>
<pre class="brush: plain; gutter: true">vmware-config.pl</pre>
<pre class="brush: plain; gutter: false">Making sure services for VMware Server are stopped.

Stopping VMware autostart virtual machines:
   Virtual machines                                                   failed
Stopping VMware management services:
   VMware Virtual Infrastructure Web Access
   VMware Server Host Agent                                           failed
Stopping VMware services:
   VMware Authentication Daemon                                        done
   Virtual machine monitor                                             done

You must read and accept the End User License Agreement to continue.
Press enter to display it.</pre>
<p>Pressione &lt;ENTER&gt; para ler o contrato de aceitação.</p>
<pre class="brush: plain; gutter: false">NOTICE:  BY DOWNLOADING AND INSTALLING, COPYING OR OTHERWISE USING THE
SOFTWARE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS VMWARE MASTER END
USER LICENSE AGREEMENT ("EULA").  IF YOU DO NOT AGREE TO THE TERMS OF
THIS EULA, YOU MAY NOT DOWNLOAD, INSTALL, COPY OR USE THE SOFTWARE, AND
YOU MAY RETURN THE UNUSED SOFTWARE TO THE VENDOR FROM WHICH YOU ACQUIRED
IT WITHIN THIRTY (30) DAYS AND REQUEST A REFUND OF THE LICENSE FEE, IF
ANY, ALREADY PAID UPON SHOWING PROOF OF PAYMENT.  "YOU" MEANS THE
NATURAL PERSON OR THE ENTITY THAT IS AGREEING TO BE BOUND BY THIS EULA,
THEIR EMPLOYEES AND THIRD PARTY CONTRACTORS THAT PROVIDE SERVICES TO
YOU.  YOU SHALL BE LIABLE FOR ANY FAILURE BY SUCH EMPLOYEES AND THIRD
PARTY CONTRACTORS TO COMPLY WITH THE TERMS OF THIS AGREEMENT.

1.	DEFINITIONS

1.1	"Designated Administrative Access" means that access to the
standard user interfaces of a given instance of the Software
(designated in this section) that you may grant to a designated
third party (a) for which you have provided advance written notice
to VMware that you are providing outsourced services and (b) for
whose dedicated benefit you have licensed such instance of the
Software.  Designated Administrative Access is applicable only
where you are 1) an IT outsourcing company that is providing
outsourced IT services to a client company and 2) applicable only
--More--</pre>
<p>Pressione &#8216;q&#8217; para sair ou aperte &lt;ESPAÇO&gt; para ler até o final.</p>
<pre class="brush: plain; gutter: false">Do you accept? (yes/no)</pre>
<p>Responda <tt>yes</tt></p>
<pre class="brush: plain; gutter: false">Thank you.

None of the pre-built vmmon modules for VMware Server is suitable for your
running kernel.  Do you want this program to try to build the vmmon module for
your system (you need to have a C compiler installed on your system)? [yes]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão [yes] ou digite <tt>yes</tt> para prosseguir com a compilação dos drivers do kernel.</p>
<pre class="brush: plain; gutter: false">Using compiler "/usr/bin/gcc". Use environment variable CC to override.

Your kernel was built with "gcc" version "4.3.2", while you are trying to use
"/usr/bin/gcc" version "4.3". This configuration is not recommended and VMware
Server may crash if you'll continue. Please try to use exactly same compiler as
one used for building your kernel. Do you want to go with compiler
"/usr/bin/gcc" version "4.3" anyway? [no]</pre>
<p>Responda <tt>yes</tt> para prosseguir com a compilação.</p>
<pre class="brush: plain; gutter: false">What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.27.29-0.1-default/build/include]</pre>
<p>Qual é o caminho para os sources do kernel, pressione &lt;ENTER&gt; para aceitar o sugerido.</p>
<pre class="brush: plain; gutter: false">Extracting the sources of the vmmon module.

Building the vmmon module.

Using 2.6.x kernel build system.
...
The vmmon module loads perfectly into the running kernel.</pre>
<p>Ao terminar a compilação dos módulos vmmon do VMware para o kernel, dará início à compilação do módulo vmci para o VMware.</p>
<pre class="brush: plain; gutter: false">None of the pre-built vmci modules for VMware Server is suitable for your
running kernel.  Do you want this program to try to build the vmci module for
your system (you need to have a C compiler installed on your system)? [yes]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão [yes] ou digite <tt>yes</tt> para prosseguir com a compilação dos drivers do kernel.</p>
<pre class="brush: plain; gutter: false">Extracting the sources of the vmci module.

Building the vmci module.
...
The vmci module loads perfectly into the running kernel.</pre>
<p>Ao terminar a compilação do módulo vmci para o VMware, dará início a compilação do módulo vsock.</p>
<pre class="brush: plain; gutter: false">None of the pre-built vsock modules for VMware Server is suitable for your
running kernel.  Do you want this program to try to build the vsock module for
your system (you need to have a C compiler installed on your system)? [yes]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão [yes] ou digite <tt>yes</tt> para prosseguir com a compilação dos drivers do kernel.</p>
<pre class="brush: plain; gutter: false">Extracting the sources of the vsock module.

Building the vsock module.</pre>
<h3>Configuração da rede</h3>
<pre class="brush: plain; gutter: false">Do you want networking for your virtual machines? (yes/no/help) [yes]</pre>
<p>Claro que rede é necessário :)</p>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão [yes] ou digite <tt>yes</tt> para prosseguir com a compilação dos drivers do kernel.</p>
<h4>Bridge</h4>
<pre class="brush: plain; gutter: false">Configuring a bridged network for vmnet0.

Please specify a name for this network.
[Bridged]</pre>
<p>O padrão sugerido é aceitável. Pressione &lt;ENTER&gt; ou escolha um outro nome.</p>
<p>Caso você tenha mais de 1 placa de rede no seu computador, aparecerá uma lista com as opções disponíveis.</p>
<p>Escolha a interface na qual você quer a bridge.</p>
<p>Caso desejar possuir em todas, repita o processo com todas as interfaces até terminar o processo.</p>
<pre class="brush: plain; gutter: false">Your computer has multiple ethernet network interfaces available: eth0, eth1,
pan0. Which one do you want to bridge to vmnet0? [eth0] eth1

The following bridged networks have been defined:

. vmnet0 is bridged to eth1</pre>
<pre class="brush: plain; gutter: false">Your computer has multiple ethernet network interfaces available: eth0, pan0.
Which one do you want to bridge to vmnet2? [eth0] 

The following bridged networks have been defined:

. vmnet0 is bridged to eth1
. vmnet2 is bridged to eth0</pre>
<p>Quando terminar, escreva <tt>no</tt> quando a opção de configuração de bridge aparecer novamente.</p>
<pre class="brush: plain; gutter: false">Do you wish to configure another bridged network? (yes/no) [no]</pre>
<p>Caso prefira que uma interface de rede seja configurada através de NAT, ou seja, terá um IP virtual de uma rede Virtual e sairá do host &#8220;NATeada&#8221;, com o IP do servidor.</p>
<h4>NAT</h4>
<pre class="brush: plain; gutter: false">Do you want to be able to use NAT networking in your virtual machines? (yes/no)
[yes]</pre>
<p>Caso queira esse tipo de configuração, pressione &lt;ENTER&gt;, caso negativo, escreva <tt>no</tt> e pressione &lt;ENTER&gt; para finalizar.</p>
<h4>Host-only</h4>
<pre class="brush: plain; gutter: false">Do you want to be able to use host-only networking in your virtual machines?
[no]</pre>
<p>Nesse caso é se você apenas quer que a máquina Host (onde está instalado o VMware) tenha acesso, e não será acessível por nenhuma outra na rede.</p>
<p>Hora de compilar os módulos vmnet para o kernel</p>
<pre class="brush: plain; gutter: false">None of the pre-built vmnet modules for VMware Server is suitable for your
running kernel.  Do you want this program to try to build the vmnet module for
your system (you need to have a C compiler installed on your system)? [yes]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão [yes] ou digite <tt>yes</tt> para prosseguir com a compilação dos drivers do kernel.</p>
<pre class="brush: plain; gutter: false">Extracting the sources of the vmnet module.

Building the vmnet module.
...
The vmnet module loads perfectly into the running kernel.</pre>
<pre class="brush: plain; gutter: false">Please specify a port for remote connections to use [902]</pre>
<p>A opção padrão é suficiente.</p>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão.</p>
<h4>Acesso web do gerenciador</h4>
<pre class="brush: plain; gutter: false">Please specify a port for standard http connections to use [8222]</pre>
<p>Qual porta o gerenciador Web estará ouvindo.</p>
<p>A opção padrão é suficiente.</p>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão.</p>
<pre class="brush: plain; gutter: false">Please specify a port for secure http (https) connections to use [8333]</pre>
<p>Qual porta o gerenciador Web (via https) estará ouvindo.</p>
<p>A opção padrão é suficiente.</p>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão.</p>
<h4>Usuário administrador do VMware Server</h4>
<pre class="brush: plain; gutter: false">The current administrative user for VMware Server  is ''.  Would you like to
specify a different administrator? [no]</pre>
<p>Especificar um usuário administrador para o VMware é bastante interessante. Nesse caso irei utilizar um usuário local na máquina <tt>daniel</tt> que terá poder de administrar as VMs criadas.</p>
<p>Escreva <tt>yes</tt> e pressione &lt;ENTER&gt; para digitar o nome do usuário.</p>
<pre class="brush: plain; gutter: false">Please specify the user whom you wish to be the VMware Server administrator
 daniel</pre>
<h4>Storage</h4>
<pre class="brush: plain; gutter: false">Using daniel as the VMware Server administrator.

insserv: script vmware-core: service VMware already provided!
insserv: script vmware-mgmt: service VMware already provided!
insserv: script vmware-autostart: service VMware already provided!
In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]</pre>
<p>Se você quiser utilizar o diretório padrão fornecido para gravar as novas VMs, pressione &lt;ENTER&gt;.</p>
<p>Se quiser outro diretório como storage das VMs, especifique o caminho completo aqui. No meu caso, tenho outro volume separado <tt>/VM</tt> e especificarei aqui</p>
<pre class="brush: plain; gutter: false">In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines] /VM</pre>
<h3>Número Serial</h3>
<p>No momento que você fez o download do VMware server foi sugerido que registrasse gratuitamente para receber o número Serial, deve estar em seu email.</p>
<p>Caso não possua o serial, o link para solicitar o número é <a title='Original Link: http://register.vmware.com/content/registration.html'  href="http://www.fogonacaixadagua.com.br/?2iGGLHkS">http://register.vmware.com/content/registration.html</a></p>
<pre class="brush: plain; gutter: false">Please enter your 20-character serial number.

Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel:</pre>
<p>Após digitar o número serial a saída será como a seguir</p>
<h3>Terminando a configuração</h3>
<pre class="brush: plain; gutter: false">Creating a new VMware VIX API installer database using the tar4 format.

Installing VMware VIX API.

In which directory do you want to install the VMware VIX API binary files?
[/usr/bin]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão.</p>
<pre class="brush: plain; gutter: false">In which directory do you want to install the VMware VIX API library files?
[/usr/lib/vmware-vix/lib]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão.</p>
<pre class="brush: plain; gutter: false">The path "/usr/lib/vmware-vix/lib" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão.</p>
<pre class="brush: plain; gutter: false">In which directory do you want to install the VMware VIX API document pages?
[/usr/share/doc/vmware-vix]</pre>
<p>Pressione &lt;ENTER&gt; para aceitar o padrão.</p>
<pre class="brush: plain; gutter: false">The path "/usr/share/doc/vmware-vix" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]</pre>
<p>Esse foi o último passo.</p>
<p>Se tudo correu bem, você verá no final</p>
<pre class="brush: plain; gutter: false">The installation of VMware VIX API 1.6.2 build-156745 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-vix.pl".

Enjoy,

--the VMware team

Starting VMware services:
   Virtual machine monitor                                             done
   Virtual machine communication interface                             done
   Virtual ethernet                                                    done
   Bridged networking on /dev/vmnet0                                   done
   Bridged networking on /dev/vmnet2                                   done
   VMware Server Authentication Daemon (background)                    done
   Shared Memory Available                                             done
Starting VMware management services:
   VMware Server Host Agent (background)                               done
   VMware Virtual Infrastructure Web Access
Starting VMware autostart virtual machines:
   Virtual machines                                                    done

The configuration of VMware Server 2.0.1 build-156745 for Linux for this
running kernel completed successfully.</pre>
<h3>Acessando a interface de gerenciamento Web</h3>
<p>Abra o navegador e aponte para http://localhost:8222</p>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/vmware/screenshot-3.png" title="" class="shutterset_singlepic41" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/41__640xfloat=_screenshot-3.png" alt="screenshot-3" title="screenshot-3" />
</a>

<p>Tela de login para a interface</p>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/vmware/screenshot.png" title="" class="shutterset_singlepic42" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/42__640xfloat=_screenshot.png" alt="screenshot" title="screenshot" />
</a>

<p>Após logar-se, essa é a interface de gerenciamento das VMs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/10/instalando-vmware-server-2-0-1-em-linux-rpm-based-red-hat-suse-centos-fedora-etc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Auto restart Apache quando o processo &#8220;morre&#8221;</title>
		<link>http://www.fogonacaixadagua.com.br/2009/09/auto-restart-apache-quando-o-processo-morre/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/09/auto-restart-apache-quando-o-processo-morre/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 02:50:03 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=774</guid>
		<description><![CDATA[Aqui está um shell script simples para ser usado no CentOS / Red Hat / Debian etc. Esse script funciona em outros sistemas operacionais com poucas modificações. Copie o código do script abaixo e cole num arquivo, podendo ser chamado /usr/local/bin/httpdcheck. Após isso, edite o crontab para rodar a cada 5 minutos */5 * * [...]]]></description>
			<content:encoded><![CDATA[<p>Aqui está um shell script simples para ser usado no CentOS / Red Hat / Debian etc. Esse script funciona em outros sistemas operacionais com poucas modificações.</p>
<p>Copie o código do script abaixo e cole num arquivo, podendo ser chamado <tt>/usr/local/bin/httpdcheck</tt>.</p>
<p>Após isso, edite o crontab para rodar a cada 5 minutos</p>
<pre class="brush: shell">*/5 * * * * /usr/local/bin/httpdcheck &gt;/dev/null 2&gt;&amp;1</pre>
<p>Abaixo está o script, após editá-lo no arquivo, não esqueça de dar permissão de execução para o arquivo com <tt>chmod 755 /usr/local/bin/httpdcheck</tt></p>
<pre class="brush: shell">#!/bin/bash

# Comente se está usando Debian
RESTART="/sbin/service httpd restart"

# Descomente se está usando Debian / Ubuntu Linux
#RESTART="/etc/init.d/apache2 restart"

#path do comando pgrep
PGREP="/usr/bin/pgrep"

# Nome do processo do Apache
# RHEL/CentOS/Fedora é httpd
# Debian 4.x é apache2
HTTPD="httpd"

# httpd pid
$PGREP ${HTTPD}

if [ $? -ne 0 ] # se o apache não está rodando
then
 # restart apache
 $RESTART
fi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/09/auto-restart-apache-quando-o-processo-morre/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Centralized LOG with rSyslog recording in MySQL DB and Web UI for queries</title>
		<link>http://www.fogonacaixadagua.com.br/2009/09/centralized-log-with-rsyslog-recording-in-mysql-db-and-web-ui-for-queries/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/09/centralized-log-with-rsyslog-recording-in-mysql-db-and-web-ui-for-queries/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 13:35:54 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Seguranca]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[syslog]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/2009/09/centralized-log-with-rsyslog-recording-in-mysql-db-and-web-ui-for-queries/</guid>
		<description><![CDATA[Having a centralized logging is a prerequisite if you want to have your logs intacts. But having the events recorded in plain files is virtually impossible for queries. Because of this, I will show you how to configure rsyslog to write events in MySQL DB and a web interface for queries with filters to facilitate [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/09/centralized-log-with-rsyslog-recording-in-mysql-db-and-web-ui-for-queries/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Having a centralized logging is a prerequisite if you want to have your logs intacts. But having the events recorded in plain files is virtually impossible for queries.</p>
<p>Because of this, I will show you how to configure rsyslog to write events in MySQL DB and a web interface for queries with filters to facilitate viewing of the logs without have to access the console for such task.</p>
<p>The focus of this post is on CentOS / Red Hat, but it can be used in other distributions with a few modifications in the process.</p>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/instalacao-rsyslog/screenshot_phplogcon01.png" title="" class="shutterset_singlepic39" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/39__320xfloat=_screenshot_phplogcon01.png" alt="screenshot_phplogcon01" title="screenshot_phplogcon01" />
</a>


<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/instalacao-rsyslog/screenshot-7.png" title="" class="shutterset_singlepic40" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/40__320xfloat=_screenshot-7.png" alt="screenshot-7" title="screenshot-7" />
</a>

<p><span id="more-830"></span></p>
<h3>Prerequisites</h3>
<ul>
<li><a title="Permanent Link to Instalação mínima do CentOS e RedHat 5.3" title='Original Link: ../2009/08/instalacao-minima-do-centos-e-redhat-5-3/'  href="http://www.fogonacaixadagua.com.br/?skrMlJVS"> Instalação mínima do CentOS e RedHat 5.3 </a></li>
</ul>
<p>It may be interesting for you to use a web-based repository for Yum for this follow the instructions in this post</p>
<ul>
<li><a title="Permanent Link to CentOS 5: Utilizando repositório Yum da internet" title='Original Link: ../2009/09/centos-5-utilizando-repositorio-yum-da-internet/'  href="http://www.fogonacaixadagua.com.br/?rWy0zLsK">CentOS 5: Utilizando repositório Yum da internet </a></li>
</ul>
<h3>Installing the necessary packages</h3>
<pre class="brush: shell">yum install rsyslog.i386 rsyslog-mysql.i386 mysql-server php php-mysql php-gd httpd mod_ssl</pre>
<p>Making sure that the services will start at boot</p>
<pre class="brush: shell">chkconfig --levels 35 rsyslog on
chkconfig --levels 35 httpd on
chkconfig --levels 35 mysqld on</pre>
<h3>Setting rSyslog</h3>
<p>As <tt>syslog</tt> comes by default with CentOS 5 / Red Hat 5, it is necessary to disable it because both of them uses the same port to listen for write request (UDP 514). rSyslog won&#8217;t start if <tt>syslog</tt> is active.</p>
<pre class="brush: shell">service syslog stop
chkconfig --del syslog</pre>
<div style="border-style: none; margin: 1em 5em; padding: 0.2em; background-color: #bbffbb;">
<div style="float: left;"><img style="border-width: 0px; color: #003399;" src="http://www.fogonacaixadagua.com.br/images/Info.png" alt="" width="32" height="32" /></div>
<div style="margin-left: 36px;"><strong>Note</strong></p>
<p><br class="spacer_" /></p>
<p>rSyslog uses the same syntax as <tt>syslog.conf</tt>. So, if you have a customized configuration you can copy <tt>syslog.conf</tt> over <tt>rsyslog.conf</tt>, just remember to rename the original <tt>rsyslog.conf</tt> to <tt>rsyslog.conf.orig</tt> just in case something goes wrong then you can rollback to the original one.</p>
</div>
</div>
<p>To rSyslog have access to MySQL it&#8217;s necessary to load the <tt>ommysql</tt> plugin, add this line at the begin of the <tt>/etc/rsyslog.conf</tt> file.</p>
<pre class="brush: plain">$ModLoad ommysql.so</pre>
<h4>Creating a MySQL database for rSyslog</h4>
<p>Before everything, it&#8217;s needed to start MySQL service</p>
<pre class="brush: shell">service mysqld start</pre>
<p>As <tt>root</tt>, lets create the access for the user from rSyslog to connect do database</p>
<pre class="brush: shell">mysql</pre>
<pre class="brush: sql">mysql> CREATE USER 'rsyslog'@'localhost' IDENTIFIED BY 'P45sword';
mysql> GRANT ALL PRIVILEGES ON Syslog.* TO 'rsyslog'@'localhost' WITH GRANT OPTION;</pre>
<p>Now, create the database that will be used by rSyslog</p>
<p>As root, run</p>
<pre class="brush: shell">mysql < /usr/share/doc/rsyslog-mysql-2.0.6/createDB.sql</pre>
<p>Back to the file, <tt>/etc/rsyslog.conf</tt> add this line before the rsyslog directives</p>
</pre>
<pre class="brush: plain">*.*    :ommysql:localhost,Syslog,rsyslog,P45sword</pre>
<p>This is the syntax:</p>
<pre class="brush: plain">   :ommysql:database-server,database-name,database-userid,database-password</pre>
<p>Where</p>
<ul>
<li> <strong>ommysql: </strong>is the plugin name</li>
<li> <strong>database-server: </strong>MySQL db server address (tipicaly localhost)</li>
<li> <strong>database-name: </strong>database</li>
<li> <strong>database-userid: </strong>the user allowed to connect to MySQL</li>
<li> <strong>database-password: </strong>user password</li>
</ul>
<p>At the end of this process, the file <tt>/etc/rsyslog.conf</tt> will look like</p>
<pre class="brush: plain">$ModLoad ommysql.so

*.*                      :ommysql:localhost,Syslog,rsyslog,P45sword

*.info;mail.none;authpriv.none;cron.none                /var/log/messages
authpriv.*                                              /var/log/secure
mail.*                                                  -/var/log/maillog
cron.*                                                  /var/log/cron
*.emerg                                                 *
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log</pre>
<h4>Allowing remote connections to rSyslog</h4>
<p>Edit the <tt>/etc/sysconfig/rsyslog</tt> file and add the parameter <tt>-r</tt> at line 6</p>
<pre class="brush: plain; gutter: false">SYSLOGD_OPTIONS="-r -m 0"</pre>
<p>It&#8217;s possible to start rsyslog right now, so you can see if everything gonna ok</p>
<pre class="brush: shell; gutter: false">service rsyslog start</pre>
<p>Watch the log <tt>/var/log/messages</tt>, if everything is ok, a message from rsyslog starting may look like this one, without error</p>
<pre class="brush: plain; gutter: true">Sep 22 18:42:23 master rsyslogd: [origin software="rsyslogd" swVersion="2.0.6" x -pid="2779" x-info="http://www.rsyslog.com"][x-configInfo udpReception="Yes" udp Port="514" tcpReception="No" tcpPort="0"] restart
Sep 22 18:42:23 master kernel: rklogd 2.0.6, log source = /proc/kmsg started.</pre>
<h3>Installing the Web UI client for rSyslog</h3>
<p>With the rsyslog service ok, comes the part where we configure the web interface to make de filters, queries etc.</p>
<p>Download the frontend phpLogCon to your server</p>
<pre class="brush: shell">wget http://www.virtualxp.org/downloads/phplogcon-2.6.4.tar.gz</pre>
<p>Extract to <tt>/usr/src</tt></p>
<pre class="brush: shell">tar zxvf phplogcon-2.6.4.tar.gz -C /usr/src</pre>
<p>Go to directory where you extracted it, in this case <tt>/usr/src/phplogcon-2.6.4</tt> and copy the directory <tt>src</tt> to <tt>/var/www/html</tt></p>
<pre class="brush: shell">cp -R src /var/www/html/syslog
cd /var/www/html/syslog
touch config.php
chown apache config.php</pre>
<p>If you haven&#8217;t started apache yet, you can do it now</p>
<pre class="brush: shell">service httpd start</pre>
<pre class="brush: shell">Starting httpd:                                            [  OK  ]</pre>
<p>Access your web browser pointing to server address <tt>http://172.20.32.205/syslog</tt>, replace the address with your server.</p>
<p><img class="aligncenter size-full wp-image-799" title="Screenshot" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot.png" alt="Screenshot" width="670" height="573" /></p>
<p>Note the error, it&#8217;s normal and awaited. Click in &#8220;here&#8221; to start  configuring phpLogCon.</p>
<p><img class="aligncenter size-full wp-image-800" title="Screenshot-1" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-1.png" alt="Screenshot-1" width="667" height="573" /></p>
<p>The installer will check the OS for the prerequisites to start the program. Click &#8220;Next&#8221;.</p>
<p><img class="aligncenter size-full wp-image-801" title="Screenshot-2" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-2.png" alt="Screenshot-2" width="666" height="575" /></p>
<p>The test was done on the phpLogCon has write access to config.php file that we created and defined the permission. Click &#8220;Next&#8221; to continue.</p>
<p><img class="aligncenter size-full wp-image-802" title="Screenshot-3" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-31.png" alt="Screenshot-3" width="668" height="692" /></p>
<p>On Basic Configuration, let the default options selected. Click &#8220;Next&#8221;.</p>
<p><img class="aligncenter size-full wp-image-803" title="Screenshot-4" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-4.png" alt="Screenshot-4" width="668" height="692" /></p>
<p>This is the most important part, it&#8217;s here that will be configured the data sources from Syslog.</p>
<p>Change the field &#8220;<strong>Source Type</strong>&#8221; to &#8220;MySQL&#8221; and fill the fields on block  &#8220;Database Type Options&#8221;, like the figure above.</p>
<p>Click Next.</p>
<p><img class="aligncenter size-full wp-image-806" title="Screenshot-5" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-5.png" alt="Screenshot-5" width="670" height="523" /></p>
<p>Ready! All okie dokie now!</p>
<p>Click &#8220;Finish!&#8221; and you will be redirected to the main screen for the phpLogCon.</p>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/instalacao-rsyslog/screenshot-6.png" title="" class="shutterset_singlepic38" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/38__640x_screenshot-6.png" alt="screenshot-6" title="screenshot-6" />
</a>

<h3>Setting clients to log on Syslog server</h3>
<p>On Linux clientes that you wanna log on a Syslog server, you must configure <tt>/etc/syslog.conf</tt> and add the following line:</p>
<pre class="brush: plain; gutter: false">*.*                   @syslog_server</pre>
<p>Where, &#8220;syslog_server&#8221; is the hostname or IP Address from syslog server.</p>
<p>With this done, you need to restart Syslog service on host client</p>
<pre class="brush: shell">service syslog restart</pre>
<p>Those procedures are for Red Hat / CentOS servers clients. You should adapt to you distribution.</p>
<p>Please, leave a comment showing the procedure for your client! It will be very helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/09/centralized-log-with-rsyslog-recording-in-mysql-db-and-web-ui-for-queries/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>How to compile a new kernel (2.6.30.5) in Linux CentOS 5.3 / Red Hat 5.3</title>
		<link>http://www.fogonacaixadagua.com.br/2009/09/how-to-compile-a-new-kernel-in-linux-centos-red-hat/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/09/how-to-compile-a-new-kernel-in-linux-centos-red-hat/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 00:29:43 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/2009/09/how-to-compile-a-new-kernel-2-6-30-5-in-linux-centos-5-3-red-hat-5-3/</guid>
		<description><![CDATA[You purchased a new hardware but the current kernel does not support it, or need to add functionality to the kernel that does not come from the factory. It is at those times that is necessary to compile a new kernel for the device to be recognized or a new functionality can be used by [...]]]></description>
			<content:encoded><![CDATA[<p>You purchased a new hardware but the current kernel does not support it, or need to add functionality to the kernel that does not come from the factory.</p>
<p>It is at those times that is necessary to compile a new kernel for the device to be recognized or a new functionality can be used by the software, for example.</p>
<p>I will show you how to compile a new kernel on CentOS / Red Hat Linux.</p>
<p><span id="more-811"></span></p>
<h3>Pre-requisite</h3>
<ul>
<li><a title='Original Link: ../2009/08/instalacao-minima-do-centos-e-redhat-5-3/'  href="http://www.fogonacaixadagua.com.br/?skrMlJVS">CentOS / RedHat 5.3 minimal installation</a> (Portuguese only)</li>
</ul>
<h3>Download latest kernel do Linux</h3>
<p>The latest version can be get straight from <a title='Original Link: http://www.kernel.org/pub/linux/kernel/v2.6/'  href="http://www.fogonacaixadagua.com.br/?z6hsEtqs" target="_blank">http://www.kernel.org/pub/linux/kernel/v2.6/</a></p>
<p>Downloading the kernel source (at this moment is 2.6.30.5)</p>
<pre class="brush: bash; gutter: true">wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.5.tar.bz2</pre>
<p>After you have done it, extract to <tt>/usr/src</tt></p>
<pre class="brush: bash; gutter: true">tar jxvf linux-2.6.30.5.tar.bz2 -C /usr/src</pre>
<pre class="brush: bash; gutter: true">...
linux-2.6.30.5/virt/
linux-2.6.30.5/virt/kvm/
linux-2.6.30.5/virt/kvm/coalesced_mmio.c
linux-2.6.30.5/virt/kvm/coalesced_mmio.h
linux-2.6.30.5/virt/kvm/ioapic.c
linux-2.6.30.5/virt/kvm/ioapic.h
linux-2.6.30.5/virt/kvm/iodev.h
linux-2.6.30.5/virt/kvm/iommu.c
linux-2.6.30.5/virt/kvm/irq_comm.c
linux-2.6.30.5/virt/kvm/kvm_main.c
linux-2.6.30.5/virt/kvm/kvm_trace.c</pre>
<p>To made things simple, go to  <tt>/usr/src</tt> and create a symlink to source code called <tt>linux</tt>, do this:</p>
<pre class="brush: shell; gutter true">cd /usr/src
ln -sf linux-2.6.30.5 linux</pre>
<p>Result:</p>
<pre class="brush: shell; gutter false">ls -al</pre>
<pre class="brush: bash; gutter: true">drwxr-xr-x  3 root root 4.0K Sep  2 06:18 .
drwxr-xr-x 13 root root 4.0K Aug 31 14:25 ..
lrwxrwxrwx  1 root root   14 Sep  2 06:18 linux -&gt; linux-2.6.30.5
drwxrwxr-x 22 root root 4.0K Aug 16 18:19 linux-2.6.30.5</pre>
<h3>Preparing the environment to compile Kernel</h3>
<p>To compile the Kernel on Linux, the OS need to be prepared, with gcc, ncurses etc.</p>
<p>If your CentOS or Red Hat installation is the minimal, the devel packages weren&#8217;t installed, it is needed to do it now, it&#8217;s simple with Yum that will resolve all dependencies.</p>
<pre class="brush: shell; gutter: false">yum install gcc make bison ncurses-devel rpm-build</pre>
<pre class="brush: bash; gutter: true">...
Installed: bison.i386 0:2.3-2.1 gcc.i386 0:4.1.2-44.el5 ncurses-devel.i386 0:5.5-24.20060715
Dependency Installed: cpp.i386 0:4.1.2-44.el5 glibc-devel.i386 0:2.5-34.el5_3.1 glibc-headers.i386 0:2.5-34.el5_3.1 kernel-headers.i386 0:2.6.18-128.7.1.el5 libgomp.i386 0:4.3.2-7.el5
Updated: glibc.i686 0:2.5-34.el5_3.1 glibc-common.i386 0:2.5-34.el5_3.1 nscd.i386 0:2.5-34.el5_3.1</pre>
<h3>Compiling the kernel to  CentOS or Red Hat</h3>
<p>Before starting the compilation, it is interesting to clean the garbage that should left behind.</p>
<pre class="brush: shell">make clean</pre>
<p>A good idea is to take the parameters of configuration that comes with the factory one, this file can be found at /boot dir, let&#8217;s copy it to the root of our kernel source and execute <tt>make menuconfig</tt>.</p>
<pre class="brush: shell">cd /usr/src/linux
cp /boot/config-`uname -r` .config</pre>
<p>Be sure to stay on <tt>/usr/src/linux</tt>.<br />
 Accessing the configuration menu is the easy way to configure it.</p>
<pre class="brush: shell">make menuconfig</pre>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/compilando-kernel-no-centos-redhat/kernel-01.png" title="" class="shutterset_singlepic30" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/30__320x240_kernel-01.png" alt="kernel-01" title="kernel-01" />
</a>

<p>As this is a custom compilation, I suggest you to add a custom tag that will identify the new kernel, to accomplish this, do that:</p>
<ul>
<li>On initial screen, go to  General setup  &#8212;&gt;</li>
</ul>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/compilando-kernel-no-centos-redhat/kernel-02.png" title="" class="shutterset_singlepic31" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/31__320x240_kernel-02.png" alt="kernel-02" title="kernel-02" />
</a>

<ul>
<li>Select Local version &#8211; append to kernel release</li>
</ul>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/compilando-kernel-no-centos-redhat/kernel-03.png" title="" class="shutterset_singlepic32" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/32__320x240_kernel-03.png" alt="kernel-03" title="kernel-03" />
</a>

<p>With this done, the resulting kernel.rpm will have the tag identifying it.</p>
<p>It is time to customize the kernel configuration to fit with your hardware.</p>
<p>After this task, it&#8217;s time to quit from menuconfig and start the compilation.</p>
<p>While you get out the configuration, you will be asked to save the changes. Answer Yes.</p>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/compilando-kernel-no-centos-redhat/kernel-04.png" title="" class="shutterset_singlepic34" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/34__320x240_kernel-04.png" alt="kernel-04" title="kernel-04" />
</a>

<p>The most awaited time&#8230; compiling!</p>
<p>Run <tt>make rpm</tt></p>
<pre class="brush: shell">make rpm</pre>
<pre class="brush: bash; gutter: false">...
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/x86/Kconfig
make clean
set -e; cd ..; ln -sf /usr/src/linux-2.6.30.5 kernel-2.6.30.5fogonacaixadagua
/bin/sh /usr/src/linux-2.6.30.5/scripts/setlocalversion &gt; /usr/src/linux-2.6.30.5/.scmversion
set -e; cd ..; tar -cz --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git -f kernel-2.6.30.5fogonacaixadagua.tar.gz kernel-2.6.30.5fogonacaixadagua/.
...</pre>
<p>The compilation will start, <strong>it will take a looong time</strong>.</p>
<p>At the end of process, without errors:</p>
<pre class="brush: shell">...
Wrote: /usr/src/redhat/SRPMS/kernel-2.6.30.5fogonacaixadagua-1.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/kernel-2.6.30.5fogonacaixadagua-1.i386.rpm
...</pre>
<p>The kernel was compiled and a .rpm was generated to be installed.</p>
<p>To confirm that the new kernel really exists in a rpm format, run:</p>
<pre class="brush: shell">ls -alh /usr/src/redhat/RPMS/i386/</pre>
<pre class="brush: bash; gutter: true">total 164M
drwxr-xr-x 2 root root 4.0K Sep  2 11:45 .
drwxr-xr-x 9 root root 4.0K Sep  2 10:39 ..
-rw-r--r-- 1 root root 164M Sep  2 11:45 kernel-2.6.30.5fogonacaixadagua-1.i386.rpm</pre>
<h3>RPM of the new kernel (32 bits)</h3>
<p>I&#8217;m putting the compiled kernel and packaged here, feel free to download it.</p>
<ul>
<li><a href="http://www.virtualxp.org/downloads/kernel-2.6.30.5/RPMS/i386/kernel-2.6.30.5fogonacaixadagua-1.i386.rpm"> kernel-2.6.30.5fogonacaixadagua-1.i386.rpm</a></li>
</ul>
<h3>Installing the new kernel</h3>
<p>How was generated a RPM of kernel, the installation becomes quite simple</p>
<pre class="brush: shell; gutter:false">rpm -ivh /usr/src/redhat/RPMS/i386/kernel-2.6.30.5fogonacaixadagua-1.i386.rpm</pre>
<pre class="brush: bash; gutter: false">Preparing...                ########################################### [100%]
   1:kernel                 ########################################### [100%]</pre>
<p>Confirming that the new kernel was installed.</p>
<pre class="brush: shell">ls /boot</pre>
<pre class="brush: shell; gutter: true">config-2.6.18-128.el5                 symvers-2.6.18-128.el5.gz
config-2.6.30.5-fogonacaixadagua      System.map-2.6.18-128.el5
grub                                  System.map-2.6.30.5-fogonacaixadagua
initrd-2.6.18-128.el5.img             vmlinux-2.6.30.5-fogonacaixadagua.bz2
initrd-2.6.30.5-fogonacaixadagua.img  vmlinuz-2.6.18-128.el5
lost+found                            vmlinuz-2.6.30.5-fogonacaixadagua</pre>
<h3>Creating the initrd for the new kernel</h3>
<p>To create the dependencies for the modules:</p>
<pre class="brush: shell">depmod 2.6.30.5-fogonacaixadagua</pre>
<p>You must create a new initrd so the OS can start and pre-load the modules necessary to your hardware.</p>
<pre class="brush: shell">mkinitrd -v /boot/initrd-2.6.30.5-fogonacaixadagua.img 2.6.30.5-fogonacaixadagua</pre>
<p>In case the following error occour:</p>
<pre class="brush: shell">No module dm-mem-cache found for kernel 2.6.30.5-fogonacaixadagua, aborting.</pre>
<div id="result_box" dir="ltr">To work around this, use the parameter<tt>--without-dmraid</tt> with <tt>mkinitrd</tt></div>
<pre class="brush: shell">mkinitrd --without-dmraid -v /boot/initrd-2.6.30.5-fogonacaixadagua.img 2.6.30.5-fogonacaixadagua</pre>
<h3>Editing grub</h3>
<p>Final phase, it remains only edit the grub.conf to use the new kernel.</p>
<p>With your favorite text editor, add the following lines:</p>
<pre class="brush: plain">title CentOS (2.6.30.5-fogonacaixadagua)
        root (hd0,0)
        kernel /vmlinuz-2.6.30.5-fogonacaixadagua ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.30.5-fogonacaixadagua.img</pre>
<p>The file <tt>/boot/grub/grub.conf</tt> will be like this:</p>
<pre class="brush: shell; highlight: [18,19,20,21]"># grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-128.el5)
	root (hd0,0)
	kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00
	initrd /initrd-2.6.18-128.el5.img
title CentOS (2.6.30.5-fogonacaixadagua)
        root (hd0,0)
        kernel /vmlinuz-2.6.30.5-fogonacaixadagua ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.30.5-fogonacaixadagua.img</pre>
<p>For the first boot, let the line <tt>default=0</tt> to test, if the new kernel boot with no trouble it will be ok to change the line to <tt>default=1</tt> to always boot with the new kernel.</p>
<h3>Testing a boot with the new kernel</h3>
<p>Reboot.</p>
<pre class="brush: shell">shutdown -r now</pre>
<ul>
<li>Press any key on boot screen to enter the selection kernel</li>
</ul>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/compilando-kernel-no-centos-redhat/kernel-05.png" title="" class="shutterset_singlepic35" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/35__320x240_kernel-05.png" alt="kernel-05" title="kernel-05" />
</a>

<ul>
<li>Select the new kernel configured into Grub</li>
</ul>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/compilando-kernel-no-centos-redhat/kernel-06.png" title="" class="shutterset_singlepic36" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/36__320x240_kernel-06.png" alt="kernel-06" title="kernel-06" />
</a>

<ul>
<li>At the end of the boot, it will be possible to see that the new one booted properly</li>
</ul>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/compilando-kernel-no-centos-redhat/kernel-07.png" title="" class="shutterset_singlepic37" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/37__320x240_kernel-07.png" alt="kernel-07" title="kernel-07" />
</a>

]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/09/how-to-compile-a-new-kernel-in-linux-centos-red-hat/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>LOG centralizado com rSyslog gravando em MySQL e interface web para consultas</title>
		<link>http://www.fogonacaixadagua.com.br/2009/09/rsyslog-gravando-no-mysql-e-com-interface-web-para-consultas/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/09/rsyslog-gravando-no-mysql-e-com-interface-web-para-consultas/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 23:39:25 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Seguranca]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[RedHat]]></category>
		<category><![CDATA[syslog]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=781</guid>
		<description><![CDATA[Ter um log centralizado é um pré-requisito se você quer ter seus logs íntegros. Mas ter os eventos registrados apenas em arquivos é praticamente inviável para consultas. Por conta disso, mostrarei aqui como configurar o rSyslog para gravar os eventos no MySQL e uma interface web para consultas, com filtros e tudo o mais para [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/09/rsyslog-gravando-no-mysql-e-com-interface-web-para-consultas/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Ter um log centralizado é um pré-requisito se você quer ter seus logs íntegros. Mas ter os eventos registrados apenas em arquivos é praticamente inviável para consultas.</p>
<p>Por conta disso, mostrarei aqui como configurar o rSyslog para gravar os eventos no MySQL e uma interface web para consultas, com filtros e tudo o mais para facilitar a visualização dos logs sem ser precisso acessar a console para tal atividade.</p>
<p><span id="more-781"></span></p>
<h3>Pré-requisitos</h3>
<ul>
<li><a title="Permanent Link to Instalação mínima do CentOS e RedHat 5.3" title='Original Link: ../2009/08/instalacao-minima-do-centos-e-redhat-5-3/'  href="http://www.fogonacaixadagua.com.br/?skrMlJVS"> Instalação mínima do CentOS e RedHat 5.3 </a></li>
</ul>
<p>Talvez seja interessante pra você utilizar um repositório Web para o Yum, para isso siga as instruções desse post</p>
<ul>
<li><a title="Permanent Link to CentOS 5: Utilizando repositório Yum da internet" title='Original Link: ../2009/09/centos-5-utilizando-repositorio-yum-da-internet/'  href="http://www.fogonacaixadagua.com.br/?rWy0zLsK">CentOS 5: Utilizando repositório Yum da internet </a></li>
</ul>
<h3>Instalando os pacotes necessários</h3>
<pre class="brush: shell">yum install rsyslog.i386 rsyslog-mysql.i386 mysql-server php php-mysql php-gd httpd mod_ssl</pre>
<p>Certificando que os serviços inicializarão no boot</p>
<pre class="brush: shell">chkconfig --levels 35 rsyslog on
chkconfig --levels 35 httpd on
chkconfig --levels 35 mysqld on</pre>
<h3>Configurando o rSyslog</h3>
<p>Como o <tt>syslog</tt> vem por padrão instalado no CentOS 5 / Red Hat 5, é necessário desabilitá-lo porque ambos utilizam a mesma porta para ouvir requisições de gravação remotas (UDP 514) e o rSyslog não vai iniciar se o <tt>syslog</tt> estiver ativo.</p>
<pre class="brush: shell">service syslog stop
chkconfig --del syslog</pre>
<div style="border-style: none; margin: 1em 5em; padding: 0.2em; background-color: #bbffbb;">
<div style="float: left;"><img style="border-width: 0px; color: #003399;" src="http://www.fogonacaixadagua.com.br/images/Info.png" alt="" width="32" height="32" /></div>
<div style="margin-left: 36px;"><strong>Nota</strong></p>
<p><br class="spacer_" /></p>
<p>O rSyslog entende a mesma sintaxe do <tt>syslog.conf</tt>. Então, se você tiver uma configuração específica para o syslog hoje pode copiar o arquivo <tt>syslog.conf</tt> para <tt>rsyslog.conf</tt>, lembrando de renomear o <tt>rsyslog.conf</tt> para <tt>rsyslog.conf.orig</tt>, assim caso alguma coisa aconteça de errado poderá voltar o arquivo original.</p>
</div>
</div>
<p>Para o rSyslog ter acesso ao MySQL é preciso carregar o plugin <tt>ommysql</tt>, acrescente essa linha no início do arquivo <tt>/etc/rsyslog.conf</tt></p>
<pre class="brush: plain">$ModLoad ommysql.so</pre>
<h4>Criando a base MySQL para o rSyslog</h4>
<p>Antes de tudo é preciso iniciar o serviço do MySQL</p>
<pre class="brush: shell">service mysqld start</pre>
<p>Como <tt>root</tt>, vamos criar o acesso para o usuário do banco que o rSyslog irá utilizar para conectar-se</p>
<pre class="brush: shell">mysql</pre>
<pre class="brush: sql">mysql> CREATE USER 'rsyslog'@'localhost' IDENTIFIED BY 'P45sword';
mysql> GRANT ALL PRIVILEGES ON Syslog.* TO 'rsyslog'@'localhost' WITH GRANT OPTION;</pre>
<p>E agora, criar o banco de dados que será utilizado pelo rSyslog.</p>
<p>Como root, execute o comando</p>
<pre class="brush: shell">mysql < /usr/share/doc/rsyslog-mysql-2.0.6/createDB.sql</pre>
<p>De volta ao arquivo <tt>/etc/rsyslog.conf</tt> acrescente essa linha, antes das diretivas do rSyslog</p>
</pre>
<pre class="brush: plain">*.*    :ommysql:localhost,Syslog,rsyslog,P45sword</pre>
<p>A sintaxe é essa:</p>
<pre class="brush: plain; gutter: true">:ommysql:database-server,database-name,database-userid,database-password</pre>
<p>Onde</p>
<ul>
<li> <strong>ommysql: </strong>é o nome do plugin</li>
<li> <strong>database-server: </strong>endereço do servidor do MySQL</li>
<li> <strong>database-name: </strong>nome da base</li>
<li> <strong>database-userid: </strong>usuário que conectar-se-á e tem permissão no MySQL</li>
<li> <strong>database-password: </strong>senha do usuário</li>
</ul>
<p>Ao final do processo o arquivo <tt>/etc/rsyslog.conf</tt> parecerá com o seguinte</p>
<pre class="brush: plain">$ModLoad ommysql.so

*.*                      :ommysql:localhost,Syslog,rsyslog,P45sword

*.info;mail.none;authpriv.none;cron.none                /var/log/messages
authpriv.*                                              /var/log/secure
mail.*                                                  -/var/log/maillog
cron.*                                                  /var/log/cron
*.emerg                                                 *
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log</pre>
<h4>Permitindo conexões remotas ao rSyslog</h4>
<p>Edite o arquivo <tt>/etc/sysconfig/rsyslog</tt> e acresente o parâmetro <tt>-r</tt> na linha 6</p>
<pre class="brush: plain; gutter: false">SYSLOGD_OPTIONS="-r -m 0"</pre>
<p>Já é possível iniciar o <tt>rsyslog</tt> para ver se tudo ocorreu bem.</p>
<pre class="brush: shell; gutter: false">service rsyslog start</pre>
<p>Verifique o log <tt>/var/log/messages</tt> e se tudo foi certo, a mensagem referente ao rsyslog iniciando deve ser como essa, sem erros</p>
<pre class="brush: plain; gutter: true">Sep 22 18:42:23 master rsyslogd: [origin software="rsyslogd" swVersion="2.0.6" x -pid="2779" x-info="http://www.rsyslog.com"][x-configInfo udpReception="Yes" udp Port="514" tcpReception="No" tcpPort="0"] restart
Sep 22 18:42:23 master kernel: rklogd 2.0.6, log source = /proc/kmsg started.</pre>
<h3>Instalando e configurando a interface Web para o rSyslog</h3>
<p>Com o serviço rsyslog configurado vem a parte necessária da interface Web para consultas e etc.</p>
<p>Baixe o frontend phpLogCon para o computador</p>
<pre class="brush: shell">wget http://www.virtualxp.org/downloads/phplogcon-2.6.4.tar.gz</pre>
<p>Descompacte o arquivo para <tt>/usr/src</tt></p>
<pre class="brush: shell">tar zxvf phplogcon-2.6.4.tar.gz -C /usr/src</pre>
<p>Vá ao diretório onde descompactou, no caso o <tt>/usr/src/phplogcon-2.6.4</tt> e copie o diretório <tt>src</tt> para <tt>/var/www/html</tt></p>
<pre class="brush: shell">cp -R src /var/www/html/syslog
cd /var/www/html/syslog
touch config.php
chown apache config.php</pre>
<p>Se você não iniciou o apache ainda, pode iniciar agora</p>
<pre class="brush: shell">service httpd start</pre>
<pre class="brush: shell">Starting httpd:                                            [  OK  ]</pre>
<p>Acesse agora, do navegador do seu computador o host <tt>http://172.20.32.205/syslog</tt>, substitua o endereço para o do seu servidor.</p>
<p><img class="aligncenter size-full wp-image-799" title="Screenshot" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot.png" alt="Screenshot" width="670" height="573" /></p>
<p>Note o erro, é normal e esperado. Clique em &#8220;here&#8221; para configurar o phpLogCon</p>
<p><img class="aligncenter size-full wp-image-800" title="Screenshot-1" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-1.png" alt="Screenshot-1" width="667" height="573" /></p>
<p>Agora o instalador verificará se o SO tem os pré-requisitos necessários para rodar o programa. Clique em &#8220;Next&#8221;.</p>
<p><img class="aligncenter size-full wp-image-801" title="Screenshot-2" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-2.png" alt="Screenshot-2" width="666" height="575" /></p>
<p>O teste feito foi referente se o phpLogCon tem acesso à escrita no arquivo config.php que criamos e definimos a permissão. Clique em &#8220;Next&#8221; para prosseguir.</p>
<p><img class="aligncenter size-full wp-image-802" title="Screenshot-3" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-31.png" alt="Screenshot-3" width="668" height="692" /></p>
<p>Nas configurações básicas, deixe as oções padrão marcadas e clique em &#8220;Next&#8221;.</p>
<p><img class="aligncenter size-full wp-image-803" title="Screenshot-4" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-4.png" alt="Screenshot-4" width="668" height="692" /></p>
<p>Essa é a tela de configuração mais importante. É nela que será configurado a origem dos dados dos eventos do Syslog.</p>
<p>Mude o campo &#8220;<strong>Source Type</strong>&#8221; para &#8220;MySQL&#8221; e preencha os campos da sessão &#8220;Database Type Options&#8221; como na figura acima.</p>
<p>Clique em Next.</p>
<p><img class="aligncenter size-full wp-image-806" title="Screenshot-5" src="http://www.fogonacaixadagua.com.br/wp-content/uploads/2009/09/Screenshot-5.png" alt="Screenshot-5" width="670" height="523" /></p>
<p>Pronto! Tudo okie dokie agora!</p>
<p>Clique em &#8220;Finish!&#8221; e você será direcionado para a tela principal do phpLogCon.</p>

<a href="http://www.fogonacaixadagua.com.br/wp-content/gallery/instalacao-rsyslog/screenshot-6.png" title="" class="shutterset_singlepic38" >
	<img class="ngg-singlepic" src="http://www.fogonacaixadagua.com.br/wp-content/gallery/cache/38__640x_screenshot-6.png" alt="screenshot-6" title="screenshot-6" />
</a>

<h3>Configurando clientes para logar no servidor rSyslog</h3>
<p>Nos clientes Linux / FreeBSD etc, que você quer que os logs sejam enviados ao servidor do rSyslog, você deve configurar o <tt>/etc/syslog.conf</tt> para essa finalidade. Adicione a seguinte linha:</p>
<pre class="brush: plain; gutter: false">*.*                   @syslog_server</pre>
<p>Onde, &#8220;syslog_server&#8221; é o hostname ou IP do servidor syslog.</p>
<p>Quando terminar, é necessário reiniciar o serviço do syslog no lado do cliente.</p>
<pre class="brush: shell">service syslog restart</pre>
<p>Esses procedimentos são para Red Hat / CentOS e clientes Linux em geral. Para outros sistemas, deve-se adaptar de acordo.</p>
<p>Deixe um comentário mostrando como foi feito para o seu cliente utilizar essa solução de log centralizado! Será de bastante valor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/09/rsyslog-gravando-no-mysql-e-com-interface-web-para-consultas/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Convertendo nomes de arquivos em letras MAIÚSCULAS para minúsculas</title>
		<link>http://www.fogonacaixadagua.com.br/2009/09/convertendo-nomes-de-arquivos-em-letras-maiusculas-para-minusculas/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/09/convertendo-nomes-de-arquivos-em-letras-maiusculas-para-minusculas/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 18:18:48 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=769</guid>
		<description><![CDATA[Script para converter nomes de arquivos de MAIÚSCULAS para minúsculas. #!/bin/bash file="$1" if [ $# -eq 0 ] then echo "$(basename $0)" exit 1 fi if [ ! $file ] then echo "$file não é um arquivo" exit 2 fi lowercase=$(echo $file &#124; tr '[A-Z]' '[a-z]']) if [ -f $lowercase ] then echo "Erro - [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/09/convertendo-nomes-de-arquivos-em-letras-maiusculas-para-minusculas/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Script para converter nomes de arquivos de MAIÚSCULAS para minúsculas.</p>
<pre class="brush: shell">#!/bin/bash

file="$1"
if [ $# -eq 0 ]
then
	echo "$(basename $0)"
	exit 1
fi

if [ ! $file ]
then
	echo "$file não é um arquivo"
	exit 2
fi

lowercase=$(echo $file | tr '[A-Z]' '[a-z]'])

if [ -f $lowercase ]
then
	echo "Erro - Arquivo já existe!"
	exit 3
fi

# troca o nome do arquivo
/bin/mv $file $lowercase
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/09/convertendo-nomes-de-arquivos-em-letras-maiusculas-para-minusculas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bloquear lista de IPs com iptables</title>
		<link>http://www.fogonacaixadagua.com.br/2009/09/bloquear-listas-de-ips-com-iptables/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/09/bloquear-listas-de-ips-com-iptables/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:45:51 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Seguranca]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[RedHat]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=765</guid>
		<description><![CDATA[Crie o arquivo /etc/iptables/blocked.ips com a lista de IPs ou redes a serem bloqueados. Como exemplo 192.168.0.0/24 200.122.53.11 74.67.1.213 E o script que será o responsável por carregar as regras. #!/bin/bash IPT=`which iptables` SPAMLIST="spamlist" SPAMDROPMSG="SPAM LIST DROP" BADIPS=$(egrep -v -E "^#&#124;^$" /etc/iptables/blocked.ips) # create a new iptables list $IPT -N $SPAMLIST for ipblock in $BADIPS [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/09/bloquear-listas-de-ips-com-iptables/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Crie o arquivo <tt>/etc/iptables/blocked.ips</tt> com a lista de IPs ou redes a serem bloqueados.</p>
<p>Como exemplo</p>
<pre class="brush: plain">192.168.0.0/24
200.122.53.11
74.67.1.213
</pre>
<p>E o script que será o responsável por carregar as regras.</p>
<pre class="brush: shell">#!/bin/bash

IPT=`which iptables`
SPAMLIST="spamlist"
SPAMDROPMSG="SPAM LIST DROP"
BADIPS=$(egrep -v -E "^#|^$" /etc/iptables/blocked.ips)

# create a new iptables list
$IPT -N $SPAMLIST

for ipblock in $BADIPS
do
   $IPT -A $SPAMLIST -s $ipblock -j LOG --log-prefix "$SPAMDROPMSG"
   $IPT -A $SPAMLIST -s $ipblock -j DROP
done

$IPT -I INPUT -j $SPAMLIST
$IPT -I OUTPUT -j $SPAMLIST
$IPT -I FORWARD -j $SPAMLIST
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/09/bloquear-listas-de-ips-com-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS 5: Utilizando repositório Yum da internet</title>
		<link>http://www.fogonacaixadagua.com.br/2009/09/centos-5-utilizando-repositorio-yum-da-internet/</link>
		<comments>http://www.fogonacaixadagua.com.br/2009/09/centos-5-utilizando-repositorio-yum-da-internet/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 23:53:35 +0000</pubDate>
		<dc:creator>Daniel Kühl Lima</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Yum]]></category>

		<guid isPermaLink="false">http://www.fogonacaixadagua.com.br/?p=710</guid>
		<description><![CDATA[Após a instalação do CentOS, você não quer mais depender da mídia de instalção e decide utilizar um repositório na Internet. A configuração abaixo do arquivo /etc/yum.repos.d/CentOS-Base.repo utiliza repositório da internet para atualização e para eventuais instalações de pacotes, livrando assim da dependência da mídia de instalação. [base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&#38;arch=$basearch&#38;repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-vertical"><script type="text/javascript">
			<!-- 
				tweetmeme_url = "http://www.fogonacaixadagua.com.br/2009/09/centos-5-utilizando-repositorio-yum-da-internet/";
				tweetmeme_source = "tweetmeme";
				tweetmeme_style = "normal";
				
			//-->
			</script>
                        <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div></div><p>Após a instalação do CentOS, você não quer mais depender da mídia de instalção e decide utilizar um repositório na Internet.</p>
<p>A configuração abaixo do arquivo <tt>/etc/yum.repos.d/CentOS-Base.repo</tt> utiliza repositório da internet para atualização e para eventuais instalações de pacotes, livrando assim da dependência da mídia de instalação.</p>
<pre class="brush: shell; gutter: true">[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
</pre>
<p>Os <tt>enabled=0</tt> significa que esse diretório dentro do repositório não será consultado. Se quiser habilitá-lo basta colocar um &#8220;1&#8243; no lugar do &#8220;0&#8243;.</p>
<p>Após feita essa configuração execute</p>
<pre class="brush: shell; gutter: true">yum update
</pre>
<p>para atualizar as informações do repositório.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fogonacaixadagua.com.br/2009/09/centos-5-utilizando-repositorio-yum-da-internet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

