4 Replies Latest reply on Nov 18, 2013 5:59 AM by henrikdeluxe

    how to configure jboss 7 mail for NTLM authentication?

    henrikdeluxe

      Hello,

       

      i'm migrating from EAP 5.1 to EAP 6.1 and encountered a new problem: sending mails via smtp and NTLM authentication

       

      my mail configuration in eap 6.1 looks like this:

      <subsystem xmlns="urn:jboss:domain:mail:1.1">
          <mail-session jndi-name="java:jboss/mail/myMail" from="service@mydomain.org" debug="true">
              <smtp-server ssl="false" outbound-socket-binding-ref="mail-smtp">
                  <login name="service" password="mypass"/>
              </smtp-server>
          </mail-session>
      </subsystem>
      
      <!-- [...] -->
      
      <outbound-socket-binding name="mail-smtp">
          <remote-destination host="192.168.0.1" port="25"/>
      </outbound-socket-binding>
      
      
      

       

       

      with this i'm getting following ERROR:

      javax.mail.AuthenticationFailedException: 535 5.7.3 Authentication unsuccessful

       

               at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:823)

               at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:756)

               at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673)

               at javax.mail.Service.connect(Service.java:317)

               at javax.mail.Service.connect(Service.java:176)

               at javax.mail.Service.connect(Service.java:125)

               at javax.mail.Transport.send0(Transport.java:194)

               at javax.mail.Transport.send(Transport.java:124)

               at org.mycode.server.MailerBean.sendMessage(MailerBean.java:170)

               at org.mycode.server.MailerBean.sendEmail(MailerBean.java:102)

               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

               at java.lang.reflect.Method.invoke(Method.java:606)

               at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

               at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)

               at org.mycode.server.LoggingInterceptor.invoke(LoggingInterceptor.java:106)

               at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)

               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

               at java.lang.reflect.Method.invoke(Method.java:606)

               at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:123)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

               at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

               at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:226)

               at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:317)

               at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:214)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

               at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

               at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)

               at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

               at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

               at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)

               at org.mycode.server.IMailerLocal$$$view288.sendEmail(Unknown Source)

               at org.mycode.server.MyBean.sendMail(MyBean.java:113)

               ... 164 more

       

       

       

      my old (working) mail-service.xml in eap 5.1 looks like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- $Id: mail-service.xml 62350 2007-04-15 16:50:12Z dimitris@jboss.org $ -->
      <server>
      
        <!-- ==================================================================== -->
        <!-- Mail Connection Factory                                              -->
        <!-- ==================================================================== -->
      
        <mbean code="org.jboss.mail.MailService"
               name="jboss:service=Mail">
          <attribute name="JNDIName">java:/Mail</attribute>
          <attribute name="User">service</attribute>
          <attribute name="Password">mypass</attribute>
          <attribute name="Configuration">
            <!-- A test configuration -->
            <configuration>
              <!-- Change to your mail server prototocol -->
              <property name="mail.store.protocol" value="imap"/>
              <property name="mail.transport.protocol" value="smtp"/>
      
              <!-- Change to the user who will receive mail  -->
              <property name="mail.user" value="service"/>
      
              <!-- Change to the mail server  -->
              <property name="mail.imap.host" value="192.168.0.1"/>
      
              <!-- Change to the SMTP gateway server -->
              <property name="mail.smtp.host" value="192.168.0.1"/>
              <property name="mail.smtp.auth" value="true"></property>
            
              <!-- The mail server port -->
              <property name="mail.smtp.port" value="25"/>
              <property name="mail.smtp.ssl.enable" value="false"></property>
            
              <!-- Change to the address mail will be from  -->
              <property name="mail.from" value="service@mydomain.org"/>
          <property name="mail.smtp.auth.ntlm.domain" value="mylm" />
          <property name="mail.smtp.auth.mechanisms" value="NTLM" />
          <property name="mail.smtp.auth.ntlm.disable" value="false" />
      
              <!-- Enable debugging output from the javamail classes -->
              <property name="mail.debug" value="true"/>
                       </configuration>
          </attribute>
          <depends>jboss:service=Naming</depends>
        </mbean>
      
      </server>
      
      
      
      

       

       

       

       

      my suggest is, that the NTLM properties are missing

       

      does anyone may solved this or could anyone help please?

      thank you in advance

        • 1. Re: how to configure jboss 7 mail for NTLM authentication?
          ctomc

          hey,

           

          you would need to configure mail subsystem bit differently to allow usage of custom properties you need.

           

          <subsystem xmlns="urn:jboss:domain:mail:1.1">  
              <mail-session jndi-name="java:jboss/mail/myMail" from="service@mydomain.org" debug="true">  
                 <custom-server name="smtp" outbound-socket-binding-ref="mail-smtp">
                    <login name="service" password="mypass"/>  
                    <property name="auth.ntlm.domain" value="mylm" />  
                    <property name="auth.mechanisms" value="NTLM" />  
                    <property name="auth.ntlm.disable" value="false" />  
                  </custom-server>
              </mail-session>  
          </subsystem>  
          

           

          let me know if that works for you.

           

           

          --

          tomaz

          • 2. Re: how to configure jboss 7 mail for NTLM authentication?
            henrikdeluxe

            got it working with:

             

            1. <subsystem xmlns="urn:jboss:domain:mail:1.1"> 
            2. <mail-session jndi-name="java:jboss/mail/myMail" from="service@mydomain.org" debug="true"> 
            3. <smtp-server outbound-socket-binding-ref="mail-smtp"/>
            4. </mail-session> 
            5. </subsystem>



            very strange

            • 3. Re: how to configure jboss 7 mail for NTLM authentication?
              ctomc

              So it works for you if you don't provide any credentials at all?

               

              that would mean it is using you machine credentials and not your provided ones.

              to be fair, i am bit guessing here as I never saw behavior as such but could be possible.

              • 4. Re: how to configure jboss 7 mail for NTLM authentication?
                henrikdeluxe

                yes it work if do not provide any credentials

                 

                I got this migration project and did not know how the mailserver was configured. everythin i had was this mail-service.xml

                To get rid of this problem i tried to connect with credentials over telnet, but this also did not work. Then i tried to connect without credentials over telnet and surprisingly it worked

                 

                I don't know why it worked in eap 5 with configured authentication and credentials.