Configuring SFTP Publishing

Configuring SFTP Publishing

SFTP  Publishing in Rhythmyx:

In Rhythmyx SFTP file transfer can be used for File transfer during publishing. This delivery type uses SFTP protocol for file transfer.  Following configurations needs to be in place for sftp publishing.

Registering a Delivery Type for SFTP Publishing

Delivery Types are added in the 'Delivery Types' section of the 'Publishing Design' user interface in Rhythmyx.  If the sftp delivery type is not already listed in the Delivery Types section of the Publishing Design configuration, we need to register the sftp delivery type to use this delivery type for publishing. 

Steps to Register the Delivery Type

1. Login into Rhythmyx using the browser.
2. Click the tab for 'Publishing Design'.
3. On the left menu, choose 'Delivery Type'.
4. Then on the center of the page, choose Action > Create Delivery Type.
5. Provide a name for this Delivery Type, for eg: sftp
6. For the 'Spring Bean Name' field provide the value - sys_sftpDeliveryHandler
7. Click Save.
8. Make the required changes in the site registration and content list(s) for publishing using the sftp delivery type.

Configuring the Delivery Type Definition

Delivery Types are configured by modifying the sys_sftpDeliveryHandler bean config in publisher-beans.xml file in the Rhythmyx server.  This file can be found in the following locations:

Jetty

<Rhythmyx>/jetty/base/webapps/Rhythmyx/WEB-INF/config/user/spring/publisher-beans.xml

JBOSS

<Rhythmyx>/AppServer/server/rx/deploy/rxapp.ear/rxapp.war/WEB-INF/config/user/spring/publisher-beans.xml

 

SFTP Bean Definition

Add the following bean definition to enable the SFTP delivery type.

<bean id="sys_sftpDeliveryHandler" class="com.percussion.rx.delivery.impl.PSSFtpDeliveryHandler">
</bean>

Available Properties

1. timeout

(defaults to -1 as not defined.
It is the socket timeout in milliseconds for the underlying provider)

example:

<property name="timeout" value="60"/>

2. umask

(defaults to null as not defined
It is a 3-character string of octal digits if defined. If the umask is not defined, then the permissions of the created files and directories are controlled by the configuration of the login user ID of the SSH server. If the umask is defined, then the permissions of the created filed  and directories will be modified according to the specified umask.

example:

<property name="umask" value="022"/>

3. transactional


Defaults to true.  Determines if the content will be published in a transaction where
all the content items are created and written to temporary files before they are written to the target. If false each item is written to the target as it is created.

example:

<property name="transactional" value="true"/>

4.privateKeyFilePath

(defaults to null. path to a private key file name - used for SFTP with
key exchange)
To generate the keys use ssh-keygen tool. The tool will generate two key files public and private. The public file (usually /home/user/.ssh/id_dsa.pub) should be installed on remote SFTP site by the site admin (usually as a new line in home/remote_user/.ssh/authorized_keys file).  The private file name (usually /home/user/.ssh/id_dsa) is the
one referred by this setting.

example:
<property name="privateKeyFilePath" value="/home/user/.ssh/id_dsa"/>

SSH Config File

When running SFTP publishing the system will load SSH options from the <InstallDir>/rxconfig/ssh-keys/config file.  NOTE: The Site configuration set in the Publishing definition will override certain overlapping configuration options (like User or SFTP Key).

The SFTP publisher recognizes the following standard SSH configuration settings:

  • Host
  • User
  • Hostname
  • Port
  • PreferredAuthentications
  • IdentityFile
  • NumberOfPasswordPrompts
  • ConnectTimeout
  • HostKeyAlias
  • UserKnownHostsFile
  • KexAlgorithms
  • HostKeyAlgorithms
  • Ciphers
  • Macs
  • Compression
  • CompressionLevel
  • ForwardAgent
  • RequestTTY
  • ServerAliveInterval
  • LocalForward
  • RemoteForward
  • ClearAllForwardings

This file does not exist by default, and will be ignored if it is not present or has syntax errors.  More information on the configuration options can be found in the OpenSSH documentation.

OpenSSH Configuration Example 1:  Enabling Compression & ServerAliveInterval defaults for all SFTP publishing targets

  1. Create the file <installDir>/rxconfig/ssh-keys/config
  2. Add the following configuration to the file:
Host *

ServerAliveInterval 60
ServerAliveCountMax 10
Compression yes

After saving this file, the above config will be applied to all future SFTP publishes.  A restart should not be required when making changes to this configuration file.

The setting ServerAliveInterval tells the SSH engine to send a NULL packet after every 60 seconds of idleness from the server to keep the connection alive, the ServerAliveCountMax tells the SSH Engine to do that a maximum of 10 times in a row with no response before shutting down the connection.  The Compression yes option, tells the engine to compress data streamed over the connection.  These settings can help with SFTP connections during long running publishes, and should improve performance of the publishing job during the Commiting stage when files are transfered to the destination SFTP server. 

NOTE:

As a System Administrator it is a common practice to backup a configuration file when making changes to it.  Normally this is a good practice.  When working with files in the WEB-INF/config/folder structure like the config/user/beans/publisher-beans.xml file, it is important to make sure that you do not save a backup of the file in this folder tree.  We recommend either using XML comments <!-- commented stuff --> in the files, or to save the backup to a different location.  The product processes all files that exist in this special config folder tree as active configuration files to support 3rd party or customer created Java extensions.  If a backup file is located in these directories, it will be processed as a valid and active configuration, and may overwrite your intended production config.  To avoid troubleshooting headaches, either use XML comments, or backup to a different location.