cancel
Showing results for 
Search instead for 
Did you mean: 

SOLVED: Ubuntu Lucid Alfresco 3.3g IMAP and authbind woes

cloudcontrol
Champ in-the-making
Champ in-the-making
Everything seems to be in place for authbind to work, but Alfresco 3.3g IMAP fails to bind to port 143. Binding to unprivileged ports works fine.  Anyone have success binding to  privileged ports with Alfresco 3.3g?

/etc/default/tomcat6 line 60: AUTHBIND=yes
/etc/authbind/byuid/107 (tomcat UID)= 0.0.0.0/32:1,1023 (also tried removing this file and creating /etc/authbind/byport owned by tomcat6 user

In alfresco-global.properties:
#
# IMAP
#————-
imap.server.enabled=true
imap.server.port=143
imap.server.host=(hostname which resolves to local IP address)

web.application.context.url=http://FQDN:8080/alfresco
imap.server.web.application.context.url=http://FQDN:8080/alfresco

tomcat6 init script excerpt:

catalina_sh() {
   # Escape any double quotes in the value of JAVA_OPTS
   JAVA_OPTS="$(echo $JAVA_OPTS | sed 's/\"/\\\"/g')"

   AUTHBIND_COMMAND=""
   if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then
      JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
      AUTHBIND_COMMAND="/usr/bin/authbind –deep /bin/bash -c "
   fi

   # Define the command to run Tomcat's catalina.sh as a daemon
   # set -a tells sh to export assigned variables to spawned shells.
   TOMCAT_SH="set -a; JAVA_HOME=\"$JAVA_HOME\"; source \"$DEFAULT\"; \
      CATALINA_HOME=\"$CATALINA_HOME\"; \
      CATALINA_BASE=\"$CATALINA_BASE\"; \
      JAVA_OPTS=\"$JAVA_OPTS\"; \
      CATALINA_PID=\"$CATALINA_PID\"; \
      CATALINA_TMPDIR=\"$CATALINA_TMPDIR\"; \
      LANG=\"$LANG\"; JSSE_HOME=\"$JSSE_HOME\"; \
      cd \"$CATALINA_BASE\"; \
      \"$CATALINA_SH\" $@"

   if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then
      TOMCAT_SH="'$TOMCAT_SH'"
   fi


- alfresco.log output:

14:07:20,121 INFO  [org.alfresco.repo.imap.AlfrescoImapServer] IMAP service started on hostSmiley Tongueort FQDN:143.
14:07:20,123 INFO  [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] Startup of 'imap' subsystem, ID: [imap, default] complete

~# netstat -an –tcp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:39872           0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:8100          0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50500           0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:8005          0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50501           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50502           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50503           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50504           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50505           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50506           0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:587           0.0.0.0:*               LISTEN    
tcp        0      0 0.0.0.0:50508           0.0.0.0:*               LISTEN    
tcp        0      0 10.160.226.81:22        76.233.236.102:54119    ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:57169         ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:57171         ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:57170         ESTABLISHED
tcp        0      0 127.0.0.1:57167         127.0.0.1:3306          ESTABLISHED
tcp        0      0 127.0.0.1:57168         127.0.0.1:3306          ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:57167         ESTABLISHED
tcp        0      0 127.0.0.1:57171         127.0.0.1:3306          ESTABLISHED
tcp        0      0 10.160.226.81:22        76.233.236.102:52785    ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:57168         ESTABLISHED
tcp        0      0 127.0.0.1:57170         127.0.0.1:3306          ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:57172         ESTABLISHED
tcp        0      0 127.0.0.1:57169         127.0.0.1:3306          ESTABLISHED
tcp        0      0 127.0.0.1:50720         127.0.0.1:8100          ESTABLISHED
tcp        0      0 127.0.0.1:57172         127.0.0.1:3306          ESTABLISHED
tcp        0      0 10.160.226.81:22        76.233.236.102:55409    ESTABLISHED
tcp        0      0 127.0.0.1:8100          127.0.0.1:50720         ESTABLISHED
tcp6       0      0 :::22                   :::*                    LISTEN
1 REPLY 1

cloudcontrol
Champ in-the-making
Champ in-the-making
Failure to bind is not logged in alfresco.log, but /var/log/tomcat6/catalina.out and error is:
Exception in thread "Thread-29" java.lang.RuntimeException: java.net.SocketException: No such file or directory
        at com.icegreen.greenmail.imap.ImapServer.run(ImapServer.java:53)
Caused by: java.net.SocketException: No such file or directory
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:336)
        at java.net.ServerSocket.bind(ServerSocket.java:336)
        at java.net.ServerSocket.<init>(ServerSocket.java:202)
        at com.icegreen.greenmail.AbstractServer.openServerSocket(AbstractServer.java:48)
        at com.icegreen.greenmail.imap.ImapServer.run(ImapServer.java:51)

By Default, the file /etc/authbind/byuid/107 contained:

0.0.0.0/32:1,1023

The fix is changing this to:

x.x.x.x/32:1,1023

where x.x.x.x is your local IP address which resolves to your systems hostname.