quarta-feira, 21 de setembro de 2011

Milky Twilight - O que significa isso?!



Se você já traduziu a música "Kiss Me" da banda "Sixpence None The Richer" e não conseguiu entender o que é o tal do "crepúsculo leitoso" (milky twilight) que diz na letra, não se aflinja, aqui está a solução:

Milky Twilight, trata-se de um cenário esbranquiçado, brumoso, seja por uma neblina ou nuvens ao anoitecer.
Alguns sites traduzem como Via Lactea, talvez pelo fato de um céu muito estrelado ser esbranquiçado, mas essa tradução não é correta, além do mais, via láctea é milky way.
Veja a figura abaixo, "beneath the milky twilight" seria embaixo desse céu esbranquiçado ao anoitecer.

sexta-feira, 29 de julho de 2011

How to enable https / ssl on tomcat certificate and private key already existing





I have the following scenary:

I bought 1 certificate + 1 private key of ICP Brasil. I need to add them to tomcat to my sites inside it work with ssl (https). How to do?

== Creating keystore ==
To enable ssl in tomcat, before, must be created the "keystore", that is a encrypted file where tomcat stores all the certificates and keys in a secure way. To create it and manipulate it, use the command "keytool". When you import a certificate in a first time, the keystore is created.

#importing the ICPBrasil root certificates
# that certificates were downloaded from http://acraiz.icpbrasil.gov.br/ICP-Brasil.crt
keytool -import -trustcacerts -alias icpbrasil1 -file /etc/tomcat6/certificados/icpbrasil1.pem -keystore /usr/share/tomcat6/.keystore

keytool -import -trustcacerts -alias icpbrasil2 -file /etc/tomcat6/certificados/icpbrasil2.pem -keystore /usr/share/tomcat6/.keystore

keytool -import -trustcacerts -alias icpbrasil3 -file /etc/tomcat6/certificados/icpbrasil3.pem -keystore /usr/share/tomcat6/.keystore

== Converting certificate + private key to DER format ==
To add the certificate + private key that I bought, it's necessary to convert them to DER format.
openssl pkcs8 -topk8 -nocrypt -in key.pem -inform PEM -out key.der -outform DER
openssl pkcs8 -topk8 -nocrypt -in cert.pem -inform PEM -out cert.der -outform DER

== Adding the pair certificate + private key to keystore ==
Unfortunately tomcat has a "kludge" to add the private key to keystore: it's necessary to use a class called ImportKey to import the pair to tomcat. To download, compile and use the class, follow the following commands:

wget http://www.startux.de/images/phocadownload/importkey.java
mv importkey.java ImportKey.java #the file name must be equal the class name
javac ImportKey.java
java ImportKey key.der cert.der ANY_ALIAS /usr/share/tomcat6/.keystore KEYSTORE_PASSWORD #java ImportKey keyfile certfile [alias] [keystore] [keystore_passphrase]


== Configuring server.xml ==
In "/etc/tomcat6/server.xml" add the following lines to enable the usage of the keystore and https:
maxThreads="1024" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystorePass="KEYSTORE_PASSWORD" />

Restart tomcat
/etc/init.d/tomcat6 restart

SORRY MY ENGLISH, I'M LEARNING YET!

Como habilitar https ssl no tomcat com certificado e chave privada já existentes





Possuo o seguinte cenário:

Comprei 1 certificado + 1 chave privada da ICP Brasil. Preciso adiciona-los ao tomcat para que meus sites contidos nele trabalhem com ssl (https). Como fazer?

== Criando keystore ==
Para ativar o ssl no tomcat, antes deve ser criado o chamado "keystore", que é um arquivo criptografado onde o tomcat guarda todos os certificados de forma segura. Para cria-lo e manipula-lo o comando "keytool" deve ser usado. Ao importar um certificado pela primeira vez, o keystore é criado.

#importando certificados raiz da ICPBrasil
# esses certificados foram baixados de http://acraiz.icpbrasil.gov.br/ICP-Brasil.crt
keytool -import -trustcacerts -alias icpbrasil1 -file /etc/tomcat6/certificados/icpbrasil1.pem -keystore /usr/share/tomcat6/.keystore #quando executado pela primeira vez, cria o keystore

keytool -import -trustcacerts -alias icpbrasil2 -file /etc/tomcat6/certificados/icpbrasil2.pem -keystore /usr/share/tomcat6/.keystore #adicionando certificado em keystore ja existente

keytool -import -trustcacerts -alias icpbrasil3 -file /etc/tomcat6/certificados/icpbrasil3.pem -keystore /usr/share/tomcat6/.keystore #adicionando certificado em keystore ja existente

== Convertendo certificado + chave privada para formato DER ==
Para adicionar o certificado + chave privada que comprei, é necessário converte-los para o formato DER.
#convertendo certificado e chave do formato pem para der
openssl pkcs8 -topk8 -nocrypt -in chave.pem -inform PEM -out chave.der -outform DER #convertendo chave pem para der
openssl pkcs8 -topk8 -nocrypt -in certificado.pem -inform PEM -out certificado.der -outform DER # convertendo certificado pem para der

== Adicionando a dupla certificado + chave privada ao keystore ==
Infelizmente o tomcat possui uma "gambiarra" para adicionar a chave privada ao keystore: é necessário utilizar uma classe chamada ImportKey para importar a dupla para o tomcat. Para baixar, compilar e usar a classe, siga os comandos abaixo:

wget http://www.startux.de/images/phocadownload/importkey.java

mv importkey.java ImportKey.java #o nome do arquivo tem que ser igual ao nome da classe

javac ImportKey.java #compilando

java ImportKey chave.der certificado.der ALIAS_QUALQUER /usr/share/tomcat6/.keystore SENHA_DO_KEYSTORE #java ImportKey keyfile certfile [alias] [keystore] [keystore_passphrase]


== Configurando server.xml ==
Em "/etc/tomcat6/server.xml" adicione as seguintes linhas para habilitar o uso do keystore e do HTTPs:
maxThreads="1024" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystorePass="SENHA_DO_KEYSTORE" />

Reinicie o tomcat
/etc/init.d/tomcat6 restart

segunda-feira, 30 de maio de 2011

glassfish + como instalar no centos com yum





O glassfish é um software semelhante ao tomcat. Porém, a grande vantagem do glassfish é que todas as aplicações que rodam no tomcat, também rodam no glassfish. O contrário não é verdadeiro.

Para realizar a instalação no centos5, realize os passos abaixo:

==Pré-requisitos==
- Sistema Operacional centos5
- Java5


==Crie o repositório:==
Na sua máquina crie o arquivo/repositório "/etc/yum.repos.d/gfa-puma.repo" com o seguinte conteúdo:
[gfa-puma]
name=GFA PUMA
baseurl=http://linux.web.psi.ch/dist/scientific/51/gfa/puma/
enabled=1


==Atualize o yum:==
yum update --skip-broken


==Instale o glassfish:==
yum install glassfish-v3 --nogpgcheck


==Configure o glassfish para iniciar automaticamente:==
chkconfig glassfish-v3 on


==Inicie o serviço:==
/etc/init.d/glassfish-v3 start


==Acesse a área administrativa:==
Acesse em um browser
http://nome_do_servidor_glassfish:4848

glassfish + how to install in centos with yum





Glassfish is a similar software to tomcat. However, the biggest advantage of glassfish is the all applications that run in tomcat also run in glassfish. The opposite is not true.

To do the instalation in centos5, do the following steps:

==Prerequisites==
- centos5 OS
- Java5


==Create the repository:==
In your machine create the file/repository "/etc/yum.repos.d/gfa-puma.repo" with the following content:
[gfa-puma]
name=GFA PUMA
baseurl=http://linux.web.psi.ch/dist/scientific/51/gfa/puma/
enabled=1


==Update the yum:==
yum update --skip-broken


==Install the glassfish:==
yum install glassfish-v3 --nogpgcheck


==Configure the glassfish to auto start:==
chkconfig glassfish-v3 on


==Start the service:==
/etc/init.d/glassfish-v3 start


==Access the administrative area:==
Access by a browser
http://address_of_glassfish_server:4848


SORRY MY ENGLISH, I'M LEARNING YET!

segunda-feira, 28 de março de 2011

How to disable centos net-snmp log





The centos snmp client logs all the snmp requisitions that the system receives.
Many times this is incovenient because that dirty the /var/log/messages with these kind of logs:
Mar 28 12:44:57 server1 snmpd[16808]: Connection from UDP: [172.25.3.53]:47306
Mar 28 12:44:57 server1 snmpd[16808]: Received SNMP packet(s) from UDP: [172.25.3.53]:47306
Mar 28 12:44:57 server1 snmpd[16808]: Connection from UDP: [172.25.3.53]:47306

To disable it, edit the "/etc/sysconfig/snmpd.options" file and add the following line:
.
.
.
OPTIONS="-Lf /dev/null -p /var/run/snmpd.pid -a"
.
.
.

Note: this file can already have the line 'OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"', note that the -Lsd option must be removed because it is what enables the log.

Restart the snmpd service:
/etc/init.d/snmpd restart


SORRY MY ENGLISH, I'M LEARNING YET!

Destivar log do net-snmp do centos





O cliente snmp do centos loga todas as requisições de snmp que recebe.
Muitas vezes isso é incoveniente pois suja o /var/log/messages com logs do seguinte tipo:

Mar 28 12:44:57 server1 snmpd[16808]: Connection from UDP: [172.25.3.53]:47306
Mar 28 12:44:57 server1 snmpd[16808]: Received SNMP packet(s) from UDP: [172.25.3.53]:47306
Mar 28 12:44:57 server1 snmpd[16808]: Connection from UDP: [172.25.3.53]:47306

Para desativa-lo, edite o arquivo "/etc/sysconfig/snmpd.options" e adicione a linha abaixo:
.
.
.
OPTIONS="-Lf /dev/null -p /var/run/snmpd.pid -a"
.
.
.

Nota: nesse aquivo pode já existir a linha 'OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"', note que a opção -Lsd deve ser retirada, pois é ela que habilita o log.

Reinicie o serviço snmpd:
/etc/init.d/snmpd restart