Conta de mail na Vodafone PT (Portugal) e Thunderbird

Associado a um número de telemóvel da Vodafone Portugal (e provavelmente noutros países), pode-se ter uma conta de email associada gratuitamente a esse número de telemóvel.

O facto em si (no meu caso) não é importante, mas sendo cliente Vodafone ADSL/Fibra, a única forma de poder enviar mails a partir do meu NAS (Synology) para outras contas de correio sem ser considerado SPAM devido ao meu IP ADSL é fazer relay pelo servidor SMTP da Vodafone.

No entanto para isso é necessário que a conexão SMTP seja autenticada.

A questão é que a ajuda on-line da Vodafone só exemplifica para os produtos Microsoft nomeadamente o Outlook e Outlook express, o que definitivamente não é o meu caso. Tanto o NAS Synology como o Thunderbird permitem o uso de vários tipos de autenticação, e por isso devem ser configurados da seguinte forma:

SMTP:

Description: Vodafone
Server Name: smtp.vodafone.pt
Port: 25 (O default SMTP)
Connection Security: STARTTLS
Authentication Method: Normal password
User Name: minhaconta@vodafone.pt

Note-se que no user name é obrigatório colocar o email completo. Por exemplo minhaconta por si só não funciona.

IMAP:

Server Name: imap.vodafone.pt
Port: 993
User Name: minhaconta@vodafone.pt (Mais uma vez aqui o email completo)
Connection Security: SSL/TLS
Authentication Method: Normal password

E pronto, com estas configurações é possível configurar tanto o thunderbird, como o KDE, e claro o aviso de email do Synology Nas

JBoss and JAAS debug

I’m having a lot of problems debugging an application that is supposedly to be able to run on JBoss…

One of the main issues is the authentication process between the Web Container and the EJB container. For authentication the Java JAAS architecture is used. Jboss has different configuration files than BEA or WebSphere, namely the configuration file login-config.xml. In this file an application policy is defined, namely how users are validated: if they use a file with user/password, database or LDAP. In this file an application policy used by the EJB and WEB cointaner must be defined (it can be the same).

On the Web container/application side, the jboss-web.xml file on the WEB-INF folder of the Web application has the Authentication domain used for login that, of course, must match the other configuration files, in this case the login-config.xml file and the web.xml file. The web.xml file must also protect the resources that access the EJB container. This means that users must pass container authentication so a JAAS instantiation is built.

So the quick tip is:

1) Make sure that everything connects: login-config.xml<-> jboss-web.xml <-> web.xml

Content of jboss-web.xml file on the Web application WEB-INF directory:

<jboss-web><security-domain>java:/jaas/APPLICATION_DOMAIN</security-domain></jboss-web>

2) Make sure that on your web.xml file the <realm-name> on the <login-config> section matches the name on the security domain, in this case APPLICATION_DOMAIN.

3) On Jboss login-config.xml file a there should be also an <application-policy name=”APPLICATION_DOMAIN”> with the configuration that you need (Database module, LDAP module.

But this might be not enough, so if you need to debug the JAAS, you can add to the log4j.xml file the following:

On the log4j.xml file add the following sections:

<category name="org.jboss.security">
    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
    <appender-ref ref="SECURITY_F"/>
</category> <appender name="SECURITY_F"
    class='org.jboss.logging.appender.DailyRollingFileAppender'>
    <param name="Append" value="true"/>
    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
    <param name="File"
    value="${jboss.server.home.dir}/log/jboss.security.log"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern"
            value="%d{ABSOLUTE} %-5p [%c] %m%n"/>
    </layout>
</appender>

This is more or les in the middle of the file, just where the <category-name> section begins.

With this configuration a new log file named jboss.security.log will be created with the JAAS information, so you can see what’s going on.