cancel
Showing results for 
Search instead for 
Did you mean: 

RMI ports and firewalls

ugocei
Champ in-the-making
Champ in-the-making
Hello, I'm experimenting with the ASR deployment mode in WCM 2.1.1.

I have the firewall on the destination server set to open port 50500 for incoming RMI connections. With this configuration deployment fails. Looking at the firewall logs I noticed incoming connections on port 49880 also. By opening also this port I could deploy successfully.

What is this port? Does it always need to be opened through the firewall? Is there any documentation available about this?

Thanks,

  Ugo
7 REPLIES 7

ugocei
Champ in-the-making
Champ in-the-making
Replying to myself…

I discovered that port 50500 is the RMI Registry port. The other port is the actual AVM service port and is not always 49880 but is randomly chosen. This makes connecting to a remote AVM server through a firewall even harder, since we cannot just ask the firewall admin to open any random port.

I know that RMI allows to specify a fixed port for a service by passing a port agrument in the service constructor. Is this a configurable parameter in Alfresco?

britt
Champ in-the-making
Champ in-the-making
Indeed, normally the actual connection port is chosen randomly.  One can set up an RMI service to use a custom socket factory that can use a specified port for connections.  I'll change that as soon as I figure out some Spring issues.

ugocei
Champ in-the-making
Champ in-the-making
In the meantime I've worked around it by putting a file named custom-remote-services-context.xml in my extension folder, with the following content:


<beans>

        <bean id="avmRemoteService" class="org.springframework.remoting.rmi.RmiServiceExporter">
          <property name="service">
                  <ref bean="avmRemoteTransport"/>
        </property>
          <property name="serviceInterface">
                  <value>org.alfresco.service.cmr.remote.AVMRemoteTransport</value>
        </property>
          <property name="serviceName">
                  <value>avm</value>
        </property>
          <property name="registryPort">
                <value>${avm.remote.port}</value>
          </property>
          <property name="servicePort">
                <value>50501</value>
          </property>
  </bean>

</beans>

The "servicePort" parameter is the one that does the trick and there's no need for custom socket factories.

tommorris
Champ in-the-making
Champ in-the-making
Thanks for the contribution ugocei!

Does this configuration change need to happen on both the destination and the source machine?

Also, does anyone know if the File System Receiver has the same issues? And if so, where the configuration takes place?

Tom.

sandyseptian
Champ in-the-making
Champ in-the-making
Hi,
I am using alfresco community 2.9B, and having difficulty when try to eliminate random port caused by avm service port. I have try to define service port, using your code. i set service port to 50111, but still alfresco generate random port for avm service. see netstat status: port 33546 is the random port generated by alfresco, and port  50111 is what i define at remote-service-context.xml.
is this code only work for alfresco 2.0 -2.1? is there some setting that i miss??
thanks in advance.

this code i used:

<bean id="avmRemoteService" class="org.springframework.remoting.rmi.RmiServiceExporter">
          <property name="service">
                  <ref bean="avmRemoteTransport"/>
        </property>
          <property name="serviceInterface">
                  <value>org.alfresco.service.cmr.remote.AVMRemoteTransport</value>
        </property>
          <property name="serviceName">
                  <value>avm</value>
        </property>
          <property name="registryPort">
                <value>${alfresco.rmi.services.port}</value>
          </property>
          <property name="servicePort">
                <value>50111</value>
          </property>
  </bean>

netstat result :

tcp        0      0 :::50500                    :::*                        LISTEN      14240/java
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      14240/java
tcp        0      0 :::389                      :::*                        LISTEN      2216/slapd
tcp        0      0 :::33546                    :::*                        LISTEN      14240/java
tcp        0      0 :::139                      :::*                        LISTEN      14240/java
tcp        0      0 :::8080                     :::*                        LISTEN      14240/java
tcp        0      0 :::21                       :::*                        LISTEN      14240/java
tcp        0      0 :::22                       :::*                        LISTEN      2327/sshd
tcp        0      0 :::445                      :::*                        LISTEN      14240/java
tcp        0      0 :::50111                    :::*                        LISTEN      14240/java

tommorris
Champ in-the-making
Champ in-the-making
Actually, I couldn't get this to work with version 2.1.2.
I have it on pretty good authority that it will always attempt to use a random port.

dschmalz
Champ in-the-making
Champ in-the-making
Hi,

Using the Alfresco Enterprise 2.2.0 WCM and the 2.2.1 Alfresco File Receivers, I (finally) got it to work. Part of the solution is found above - but you also need to modify the File Receiver configuration.

In Alfresco WCM add, as indicated above, a custom context file at $ALFRESCO_HOME/tomcat/shared/classes/alfresco/extension/custom-remote-services-context.xml, with the following content:


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="avmRemoteService" class="org.springframework.remoting.rmi.RmiServiceExporter">
                <property name="service">
                        <ref bean="avmRemoteTransport"/>
                </property>
                <property name="serviceInterface">
                        <value>org.alfresco.service.cmr.remote.AVMRemoteTransport</value>
                </property>
                <property name="serviceName">
                        <value>avm</value>
                </property>
                <property name="registryPort">
                        <value>${alfresco.rmi.services.port}</value>
                </property>
                <property name="servicePort">
                        <value>44100</value>
                </property>
        </bean>
</beans>

Replace the value for servicePort with the port that you have opened on your firewall.

Then, on the File Receiver side, update the deployment.properties file, adding also the specific port for the exported RMI service:


dep.datadir=depdata
dep.logdir=deplog
dep.metadatadir=depmetadata
dep.rmi.port=44100
dep.rmi.service.port=44100

(Note that the dep.rmi.service.port has to match the one set in the custom-remote-services-context.xml).

Finallly, on the File Receiver side, update the deploymentReceiverTransportRMI bean in the application-context.xml:


        <bean id="deploymentReceiverTransportRMI" class="org.springframework.remoting.rmi.RmiServiceExporter">
                <property name="service">
                        <ref bean="deploymentReceiverTransport"/>
                </property>
                <property name="serviceInterface">
                        <value>org.alfresco.deployment.DeploymentReceiverTransport</value>
                </property>
                <property name="serviceName">
                        <value>deployment</value>
                </property>
                <property name="registryPort">
                        <value>${dep.rmi.port}</value>
                </property>
                <property name="servicePort">
                        <value>${dep.rmi.service.port}</value>
                </property>
        </bean>

Then, in your Web Project, simply keep the default values for ports (i.e. leave empty) when configuring the file receiver and it should deploy nicely.

I guess that for making it work also with Alfresco Runtime Servers, you would instead need to create a second custom-remote-services-context.xml in your Alfresco Runtime extension directory and set properly the servicePort property.

Hope this helps,
David