FTP Server

In this section:

iWay offers an FTP server that is designed to extend the processing capabilities of iWay Service Manager (iSM). Although this service can be configured to operate as a standard FTP server, the purpose of this service is transaction receipt and mailboxing. The FTP Server listener listens on the port that is specified in the FTP server settings. The listener begins processing messages when a file is sent through FTP to the iWay server. Therefore, it differs from general FTP servers in several ways:


Top of page

x
Configuring the FTP Server Listener

The FTP daemon service is configured in Service Manager as a listener of type FTP Server.



x
Procedure: How to Configure the FTP Server Listener

To configure the FTP Server listener:

  1. From the iWay Service Manager web console, click Registry and then Listeners.

    The Listeners pane opens.

  2. Click Add.

    The Listener Type pane opens.

  3. Select the FTPServer listener from the drop-down list, then click Next.

    The configuration parameters pane for the FTPServer listener opens.

  4. Provide the appropriate property values for the FTPServer listener, as defined in the following table. An asterisk indicates a required parameter.

    Parameter

    Definition

    Port*

    The TCP port for receipt of FTP requests. FTP standard is port 21.

    Local bind address

    The local bind address for multi-homed hosts. Usually leave empty.

    FTP Server Log

    A log of server commands received, and the results of each command.

    Server Root

    The base directory for this FTP Server. When user mailbox paths are relative, they are below this directory.

    Allow Anonymous

    If set to true, then anonymous login is permitted. Anonymous users inherit the default read and write security.

    Use Safestore

    The Safestore preserves store requests while the incoming document is passing through execution. It is not meaningful for direct writes of messages to the file system. Using safestore can reduce system performance.

    Users

    Authentication Realm

    Enter the name of the configured Authentication Realm provider. If left blank, then the user and their authentication credentials must be maintained in the FTP Server user repository.

    Repository Type

    This determines how the user repository is stored. The repository can be stored either as an XML file or as a JDBC database.

    Security File [URL] *

    The security file location. The security file describes users permitted to exchange messages with this server. It also describes their mailbox and security characteristics. This is a JDBC or a file URL depending upon the repository type.

    JDBC Provider

    The name of the iWay JDBC provider.

    JDBC Driver

    The JDBC driver to use for accessing repository. This is required if repository type is JDBC.

    JDBC User Name

    The password for accessing the JDBC repository. Required if repository type is JDBC.

    JDBC Password

    Select one of the following values from the drop-down list:

    • column
    • field
    • row

    Default Permissions

    Default Can READ

    If set to true, then users without specific security can read.

    Default Can WRITE

    If set to true, then users without specific security can write.

    Action on GET

    How should the server treat file retrieve type requests from the client.

    Action on PUT

    How should the server treat file store type requests from the client.

    SITE EXEC

    If set to true, clients can execute processes using the SITE EXEC command.

    Stream Encoding if ASCII

    Determines the type of encoding to be used for ASCII transfers carried in a stream document. This value must use valid ASCII encoding.

    Stream Encoding if EBCDIC

    Determines the type of encoding to be used for EBCDIC transfers carried in a stream document. This value must use valid EBCDIC encoding.

    Security

    Session Timeout *

    If a value greater than 0 is set, then that value is the maximum number of seconds between commands before the session automatically times out.

    Security Provider

    Enter the iWay keystore or SSL context security provider name. If this component is secure and no value is entered, then the default security provider is used.

    Security Protocol

    The minimal security protocol supported for FTPS.

    Use 128-bit Encryption

    This enforces the use of 128-bit encryption for all TLS channels.

    Require Secure Auth

    The login must be through a secure authorization channel. You will need to configure the Keystore under HTTPS section of the system properties if client authentication is required. Note, if keystore is configured in system properties make sure it has the CA certificate or the client certificate of the server you are connecting to. If keystore is not configured in system properties default truststore located under /lib/security/cacerts will be used.

    Require Secure Transfer

    The data transfers must be through a secured channel. You must configure the keystore under HTTPS section of the system properties if client authentication is required. Note, if keystore is configured in system properties make sure it has the CA certificate or the client certificate of the server you are connecting to. If keystore is not configured in system properties default truststore located under /lib/security/cacerts will be used.

    Other

    Whitespace Normalization

    This Specifies how the parser treats whitespaces in element content. Choose preserve (default) to disable all normalization as prescribed by the XML specification. Choose condense to remove extra whitespaces in pretty printed documents and for compatibility with earlier versions.

    Accepts non-XML (flat) only

    If set to true, the listener expects only flat (non-XML) files and the preparsers do not run.

    Optimize Favoring

    Select one of the following values from the drop-down list:

    • performance
    • memory

    Note: Selecting memory is recommended if you are expecting large input documents.

    Multithreading

    The number of documents that can be processed in parallel.

    Maximum threads

    The number of parallel threads that can grow automatically on demand.

    Execution Time Limit

    The time limit (in seconds) for a document to execute before it is terminated.

    Default Java File Encoding

    The default encoding if the incoming message is not self-declaring, for example, XML.

    Agent Precedence

    Changes order by which engine selects agents. Normally Document overrides listener. This is used to manage iWay documents.

    Always reply to listener default

    If set to true, the default reply definition is used in addition to the defined replies.

    Error Documents treated normally

    If set to true, the error documents are processed by any configured preemitters.

    Listener is Transaction Manager

    If set to true, the agents run within a local transaction managed by the listener.

    Record in Activity Log(s)

    If set to true, the activity on this channel will be recorded in the activity logs, else the activity will not be recorded.

    Note: The FTPServer listener supports streaming. Streaming is used for large documents or documents for which the application needs to split the input into sections under the same transaction. For more information on streaming and configuring streaming preparsers, see the iWay Service Manager Component and Functional Language Reference Guide.

  5. Click Next.

    The Name and Description pane opens.

  6. Provide a name and optionally, a description for the FTPServer listener, and click Finish.

    The newly created FTPServer listener is added to the list in the Listeners pane.



x
Action on GET

Client GET (and MGET) requests the return of information to the client by the server. A GET client for a file can be handled differently, depending on the current settings for the action. The default setting is configured for the listener but it can be overridden for any specific user in the security file.

  1. Use File System

    This is a standard FTP retrieval. Data is returned from the named file in the file system.

    For example:

    ftp> get test.xml
    200 PORT command successful.
    150 ASCII data connection for test.xml (172.30.246.86,4071) (42 bytes).
    226 ASCII transfer complete (42 bytes).
    ftp: 42 bytes received in 0.00Seconds 42000.00Kbytes/sec.

    Test.xml was retrieved from the FTPServer and sent to the FTP client.

  2. Execute as a Message

    A standardized XML ftpd request document is constructed containing the request. This document is passed to the system for execution. The result of the execution is returned to the client.

    For example, create a process flow that contains a MQEmit service object. Add the process flow to the FTPServer channel.

    ftp> get test.xml
    200 PORT command successful.
    150 ASCII data connection for /test.xml (172.30.246.86,4150) (0 bytes).
    226 ASCII transfer complete
    ftp: 1144 bytes received in 0.05Seconds 24.34Kbytes/sec.

    The following document is constructed and passed to the process flow.

    <ftpd user="user" type="get">
    <command>retr</command>
    <parm>/test.xml</parm>
    </ftpd>

    The process flow emits the above document to a MQ queue. The status document (shown below) is returned to the FTP client as test.xml.

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <emitstatus status="0">
    <protocol>MQ</protocol>
    <parms>
    <parm name="attribs">true</parm><parm name="ccsid"/>
    <parm name="channel">SYSTEM.DEF.SVRCONN</parm>
    <parm name="cipherspec">None</parm><parm name="correlid"/>
    <parm name="correlidtag"/><parm name="expiry"/>
    <parm name="format"/><parm name="host"/>
    <parm name="localtrans">true</parm>
    <parm name="manager">qm7</parm>
    <parm name="neverUseMaster">true</parm>
    <parm name="nopreemit">true</parm>
    <parm name="persist">queue</parm>
    <parm name="port">1414</parm>
    <parm name="priority"/>
    <parm name="queue">out</parm>
    <parm name="reportq"/>
    <parm name="reqcoa">false</parm>
    <parm name="reqcod">false</parm>
    <parm name="return">status</parm>
    <parm name="type">datagram</parm>
    <parm name="userregs">false</parm>
    <parm name="version">default</parm>
    <parm name="wanteos">false</parm>
    </parms>
    <timestamp>2010-11-29T21:25:51.800Z</timestamp>
    <status>0</status>
    <channel>ftpserver</channel>
    <nodename>com.ibi.agents.XDMQEmitAgent</nodename>
    <msgid>base64(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)</msgid>
    <native>0</native>
    <correlid>base64(QU1RIHFtNyAgICAgICAgIBIu7UwgPXwF)</correlid>
    </emitstatus>
  3. Deny Access to This Service

    The user may not execute a retrieval.

    For example:

    ftp> get test.xml
    200 PORT command successful.
    553 'test.xml': cannot read.
    Test.xml was not retrieved.
  4. Use File System Then Execute a Message

    The retrieval operates as a standard FTP retrieval. Data is returned from the named file in the file system. Then, a standardized XML ftpd request document is constructed containing the request. This document is passed to the system for execution. The result of the execution is sent to the configured emitter.

    For example, create a process flow that contains a MQEmit service object. Add the process flow to the FTPServer channel.

    ftp> get test.xml
    200 PORT command successful.
    150 ASCII data connection for /test.xml (172.30.246.86,4150) (0 bytes).
    226 ASCII transfer complete
    ftp: 1144 bytes received in 0.05Seconds 24.34Kbytes/sec.

    Test.xml was retrieved from the FTPServer and returned to the FTP client. In addition, the following document is constructed:

    <ftpd user="user" type="get">
    <command>retr</command>
    <parm>/test.xml</parm>
    </ftpd>

    The document is passed to the process flow. The process flow emits the above document to a MQ queue. The following status document is returned from the process flow and sent to any configured emitters:

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <emitstatus status="0">
    <protocol>MQ</protocol>
    <parms>
    <parm name="attribs">true</parm><parm name="ccsid"/>
    <parm name="channel">SYSTEM.DEF.SVRCONN</parm>
    <parm name="cipherspec">None</parm><parm name="correlid"/>
    <parm name="correlidtag"/><parm name="expiry"/>
    <parm name="format"/><parm name="host"/>
    <parm name="localtrans">true</parm>
    <parm name="manager">qm7</parm>
    <parm name="neverUseMaster">true</parm>
    <parm name="nopreemit">true</parm>
    <parm name="persist">queue</parm>
    <parm name="port">1414</parm>
    <parm name="priority"/>
    <parm name="queue">out</parm>
    <parm name="reportq"/>
    <parm name="reqcoa">false</parm>
    <parm name="reqcod">false</parm>
    <parm name="return">status</parm>
    <parm name="type">datagram</parm>
    <parm name="userregs">false</parm>
    <parm name="version">default</parm>
    <parm name="wanteos">false</parm>
    </parms>
    <timestamp>2010-11-29T21:25:51.800Z</timestamp>
    <status>0</status>
    <channel>ftpserver</channel>
    <nodename>com.ibi.agents.XDMQEmitAgent</nodename>
    <msgid>base64(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)</msgid>
    <native>0</native>
    <correlid>base64(QU1RIHFtNyAgICAgICAgIBIu7UwgPXwF)</correlid>
    </emitstatus>


x
Action on PUT

Client PUT (including append) cause the transfer of information from the client to the server. A client PUT request can be handled differently, depending upon the current setting for this action. The default setting is configured for the listener but it can be overridden for any specific user.

  1. Use File System

    The request operates as a standard FTP store command. Data is stored from the named file in the file system.

    For example:

    ftp> put test.xml
    200 PORT command successful.
    150 ASCII data connection for /test.xml (172.30.246.86,4242).
    226 ASCII /test.xml transfer complete (42 bytes)
    ftp: 42 bytes sent in 0.00Seconds 42000.00Kbytes/sec.

    Test.xml was sent to the FTPServer and saved in the server root directory.

  2. Execute as a Message

    The data is passed, as a document, into the system for execution. A standardized XML document is constructed containing the data. This document is passed to the system for execution.

    For example, create a process flow that contains a MQEmit service object. Add the process flow to the FTPServer channel.

    ftp> put test.xml
    200 PORT command successful.
    150 ASCII data connection for test.xml (172.30.246.86,4288).
    226 'STOR EXEC entered for test.xml': was successful.
    ftp: 42 bytes sent in 0.00Seconds 42000.00Kbytes/sec.

    Test.xml was sent to the FTPServer. It is then passed to the configured process flow which emits the document to an MQ queue.

    A 451 error code is returned to the FTP client when an error occurs in the process flow. For example:

    ftp> put test.xml
    200 PORT command successful.
    150 ASCII data connection for test.xml (172.30.246.86,1060).
    451 'STOR EXEC entered for test.xml': had an execution error!
    ftp: 1144 bytes sent in 0.00Seconds 1144000.00Kbytes/sec.

    An example of this type of error is when an MQEmit service object attempts to send a document to a queue that does not exist.

  3. Deny Access to This Service

    This user may not store a file.

    For example:

    ftp> put test.xml
    200 PORT command successful.
    553 'test.xml': cannot write. (DENY)

    Test.xml was not sent to the FTPServer.

  4. Use File System Then Execute a Message

    The retrieval operates as a standard FTP store command. Data is stored from the named file in the file system. Then, a standardized XML ftpd request document is constructed containing the request. This document is passed to the system for execution. The result of the execution is sent to the configured emitter.

    For example, create a process flow that contains a MQEmit service object. Add the process flow to the FTPServer channel.

    Test.xml was sent to the FTPServer and saved in the server root directory. In addition, the following document is constructed:

    <ftpd user="user" type="signal">
    <command>STOR</command>
    <parm>/test.xml</parm>
    <status>226 ASCII /test.xml transfer complete (42 bytes)</status>
    <path>c:\ftpserver\test.xml</path>
    <vpath>/test.xml</vpath>
    <transfersize>42</transfersize>
    </ftpd>

    The document is passed to the process flow. The process flow emits the above document to a MQ queue. The status document (shown below) is returned from the process flow and sent to the emitter (if one is configured).

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <emitstatus status="0">
    <protocol>MQ</protocol>
    <parms>
    <parm name="attribs">true</parm><parm name="ccsid"/>
    <parm name="channel">SYSTEM.DEF.SVRCONN</parm>
    <parm name="cipherspec">None</parm><parm name="correlid"/>
    <parm name="correlidtag"/><parm name="expiry"/>
    <parm name="format"/><parm name="host"/>
    <parm name="localtrans">true</parm>
    <parm name="manager">qm7</parm>
    <parm name="neverUseMaster">true</parm>
    <parm name="nopreemit">true</parm>
    <parm name="persist">queue</parm>
    <parm name="port">1414</parm>
    <parm name="priority"/>
    <parm name="queue">out</parm>
    <parm name="reportq"/>
    <parm name="reqcoa">false</parm>
    <parm name="reqcod">false</parm>
    <parm name="return">status</parm>
    <parm name="type">datagram</parm>
    <parm name="userregs">false</parm>
    <parm name="version">default</parm>
    <parm name="wanteos">false</parm>
    </parms>
    <timestamp>2010-11-29T21:25:51.800Z</timestamp>
    <status>0</status>
    <channel>ftpserver</channel>
    <nodename>com.ibi.agents.XDMQEmitAgent</nodename>
    <msgid>base64(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)</msgid>
    <native>0</native>
    <correlid>base64(QU1RIHFtNyAgICAgICAgIBIu7UwgPXwF)</correlid>
    </emitstatus>


x
The Security File

The security file (in XML format) is loaded when the listener is initialized. This XML file describes the users that are allowed and their attributes. The XML file contains one <user> element for each authorized user, and attributes of the <user> element are used to describe the user. Each user can be a member of one group, which applies the access group criteria that can then be modified on an individual basis. The format for the <access> element allows the specification of the use attribute. The name of the directory to which the access applies is entered as the value for the <access> element.

Any user can have controlled access. Permissions are applied to the specified subdirectory, which is below the document root of a user, and to all remaining directories below this subdirectory. If a permission is not specified, it is taken from the specification of a parent. Permissions are specified by the use attribute of the <access> child of the user. Possible access types are read ('r'), and write ('w'). Read permission permits the client to list directories and access files. Write permission permits file storage and the ability to manipulate directories. Either type can be preceded by a minus sign (-), which removes the permission. A plus sign (+) is implied if the minus is omitted.

To add read and write permissions, specify:

use='rw'

To accept the read permission of the parent and turn off write permission, specify:

use='-w'

The order of the characters is not significant.

The following diagram illustrates a sample FTP directory structure that is referred to in the XML security file example that is provided in this section.

The following is a sample XML file that represents the content of a security file:

<ftp>
	<users>
		<!-- u1 user has same permissions as g1 group, 
                 but set at user level 
            -->
		<user password="pw" init="/steve" use="rw">u1			
			<access use="rw-du">/steve/in</access>
			<access use="r-w-d">/steve/out</access>
			<access use="v-r-w">/common</access>
			<access use="r">/common/in</access>
			<access use="-r-w-v">/*</access>			
		</user>
		
		<!-- user john is exactly like u1 (except that he starts in /john directory) 
                 but permissions from group 
              -->
		<user password="pw" group="g1">john</user>
		
		<!-- user steve is exactly like john, with two exceptions (overriding group defaults) 
            -->
		<user password="pw" group="g1">steve
			<access use="rwd">/steve/in</access>
			<access use="rw">/common/in</access>
		</user>
		
		<!-- user u2 is like group g2, with specified home directory below docroot.  
                 Note that when home is used, 
		     init and permission paths are from the user (or group) home, NOT from docroot,
		     while home is from docroot. 
            -->
		<user password="pw" init="/steve1" home="/subroot" use="v-r-w-d">u2
			<access use="rw-du">/steve1/in</access>
			<access use="r-w-d">/steve1/out</access>
			<access use="v-r-w">/common1</access>
			<access use="r">/common1/in</access>
			<access use="-v-r-w">/*</access>	
		</user>	
		
		<!-- john1 has g2 permissions 
            -->
		<user password="pw" group="g2">john1</user>
		
		<!-- steve1 has g2 permissions with override.  keep in mind that g2 
                 specifies non-docroot home, so paths
		     are from home, not docroot. 
            -->
		<user password="pw" group="g2">steve1
			<access use="rwd">/steve1/in</access>
			<access use="rw">/common1/in</access>
		</user>
		
		<!-- u3 is similiar to u2, except starts in /subroot, no init pos. -->
		<user password="pw" home="/subroot" use="vw-d-ru">u3
			<access use="rwduv">/u3</access>
			<access use="-r-w-v">/*</access>	
		</user>		
		
		<user password="pw" group="g3">u4</user>
		
	</users>
	
	<groups>
		<!-- g1 group has same permissions as u1, 
                 generalized with $user pattern 
            -->
		<group init="/$user" use="v-r-w-d">g1
			<access use="rw-d">/$user/in</access>
			<access use="r-w-d">/$user/out</access>
			<access use="v-r-w">/common</access>
			<access use="r">/common/in</access>
			<access use="-r-w-v">/*</access>				
		</group>
		
		<!-- g2 group much like g1, but home dir is /subroot 
                 and all paths are beneath it 
            -->
		<group init="/$user" home="/subroot" use="v-r-w-d">g2
			<access use="rw-d">/$user/in</access>
			<access use="r-w-d">/$user/out</access>
			<access use="v-r-w">/common1</access>
			<access use="r">/common1/in</access>
			<access use="-v-r-w">/*</access>			
		</group>
		
		<!-- log into (virtual) root w/write, but not read permission. change to use subdirectory with full priv. except overwrite, but venture nowhere else -->
		<group home="/subroot" use="vw-d-ru">g3
			<access use="rwduv">/$user</access>
			<access use="-r-w-v">/*</access>				
		</group>	
	</groups>
</ftp>

This sample XML security file describes several different types of users, illustrating some common usage patterns.

For the users u1, steve, and john in the sample security file:

Users u1 and john differ only in that permissions of u1 are assigned to him directly, while john inherits them from the g1 group. User steve differs from john because he has access permissions for the /common/in and /steve/in directories that override the group g1 defaults.

For the users u2, steve1, and john1 in the sample security file:

For the users u3 and u4 in the sample security file:

The following table lists and describes the permission flags that are used in the sample security file:

Flag

Description

v

Signifies "visit and view" access. Without the v flag set on a directory, a user cannot change to that directory or list its contents. The v flag is set by default and must be revoked explicitly.

r

Signifies that a user can retrieve files from the specified directory.

w

Signifies that a user can store files in the specified directory.

d

When "d" is set on a directory, a user can delete files from that directory.

u

When a directory has the "u" flag set, a user cannot overwrite a file in that directory.

m

Signifies that the user can modify directories, by creating new directories and renaming existing ones. The -m flag is set by default and must be granted explicitly.

Access Tree Notes:



x
Procedure: How to Migrate User Configurations From XML to RDBMS

User configuration information can be stored in any relational database that is accessible through JDBC. To configure the user database:

  1. Create the database using any tool that can execute a DDL script. DDL scripts for MySQL, HSQLDB, and MSSQL are supplied and can be provided for other RDBMS as requested.
  2. From the iSM command line, run the MigrateFTPUsers tool.
  3. Type MigrateFTPUsers along with the command line arguments that are listed and described in the following table:

    Command

    Description

    userfile

    Path to the XML user configuration file you wish to migrate.

    op: operation

    Specify one of the following operations:

    • delete. Removes users, groups, and templates in the user file from the user database.
    • upsert. Inserts or update users, groups, and templates found in file.

    driver

    Name of JDBC driver class.

    url

    JDBC connection URL for the user database.

    u

    User ID that is used to connect to the user database. Must have insert/update/delete permission for user database tables.

    pwd

    Password that is used to connect to the user database.

  4. Alternatively, you can use the p switch to point to a standard Java properties file that sets properties driver, url, user, and password to be used in the connection to the database.

    For example:

    Enter command:>tool MigrateFTPUsers -userfile c:/working/ftptest/userfile.xml -driver com.mysql.jdbc.Driver -url
     jdbc:mysql:///iwftp -u root -pwd harrison -op upsert

    or:

    Enter command:>tool MigrateFTPUsers -p c:/working/mp.txt -userfile c:/working/ftptest/userfile.xml -op
     upsert

    The mp.txt file that is referred to in this example can have the following structure and format:

    driver=com.mysql.jdbc.Driver
    url= jdbc:mysql:///itm_db
    user=steve
    password=secret
  5. Perform the following steps to configure the FTPServer listener to use the user database for security information:
    1. Set the Repository Type property to "JDBC”.
    2. Set the Security File property to the JDBC connection URL for the user database.
    3. Set driver, user, and password properties appropriately.


x
RDBMS User Configuration Tables

User information can be stored in a small relational database consisting of four tables:

  • iwftp_owners
  • iwftp_permissions
  • iwftp_user_hosts
  • iwftp_templates

The iwftp_owners table defines users and groups that can access the server. The fields are listed and described in the following table:

Field

Type

Description

iw_ownername

varchar(45)

The identifier for the user or group.

iw_ownertype

char(1)

Specify G for group or U for user.

iw_password

varchar(45)

iw_isanon

integer

Specify 1 if this user definition should be used for anonymous logins, or 0 otherwise.

iw_fullname

varchar(45)

The long identifier for the user.

iw_partner

varchar(45)

The reference to a partner agreement defined in iWay Trading Manager.

iw_groupname

varchar(45)

For users, the group to which they belong. FK to iw_ownername.

iw_comment

varchar(45)

Documentation for this owner.

iw_home

varchar(45)

Home directory is root of virtual file system for this owner.

iw_initialposition

varchar(45)

Directory where owner should be positioned at login.

iw_getaction

integer

The action of the server on RETR command (0 is system default, 1 is exec, 2 is signal, and 3 is file).

iw_putaction

integer

The action of the server on STOR command. Uses the same constants as iw_getaction.

iw_canread

integer

Default read permission for this owner (0 for no, 1 for yes, and 2 for not set).

iw_canwrite

integer

Default write permission for this owner. Uses the same constants as iw_canread.

iw_candelete

integer

Default delete permission for this owner. Uses the same constants as iw_canread.

iw_canoverwrite

integer

Default overwrite permission for this owner. Uses the same constants as iw_canread.

iw_canvisit

integer

Default visit permission for this owner. Uses the same constants as iw_canread.

iw_canmod

integer

Default directory modify permission for this owner. Uses the same constants as iw_canread.

The iwftp_permissions table defines resources to which an owner has access and the specific constraints on that access. The fields are listed and described in the following table:

Field

Type

Description

iw_owner

varchar(45)

User or group to which this permission entry applies. FK for iwftp_owners.iw_ownername.

iw_ownertype

char(1)

Specify G for group or U for user. FK for iwftp_owners.iw_ownertype.

iw_resource

varchar(45)

Name of the directory for which access should be defined. Enter with an absolute path using the virtual file system of the owner.

iw_canread

integer

Default read permission for this owner (0 for no, 1 for yes, and 2 for not set).

iw_canwrite

integer

Default write permission for this owner. Uses the same constants as iw_canread.

iw_candelete

integer

Default delete permission for this owner. Uses the same constants as iw_canread.

iw_canoverwrite

integer

Default overwrite permission for this owner. Uses the same constants as iw_canread.

iw_canvisit

integer

Default visit permission for this owner. Uses the same constants as iw_canread.

iw_canmod

integer

Default directory modify permission for this owner. Uses the same constants as iw_canread.

The iwftp_user_hosts table defines host names or IP addresses from which a specific user can connect to the server. The fields are listed and described in the following table:

Field

Type

Description

iw_username

varchar(45)

User or group for which this host entry applies. FK for iwftp_owners.iw_ownername.

iw_hostname

varchar(45)

Host name or IP address from which this user can connect to the server.

The iwftp_templates table defines patterns that can be used as shorthand when configuring users or groups. The fields are listed and described in the following table:

Field

Type

Description

iw_templatename

varchar(45)

The identifier for this template.

iw_templatepattern

varchar(45)

The substitution string for this template.



x
Procedure: How to Configure the FTP Server for Anonymous Access

To configure for anonymous access:

  1. Set the Allow Anonymous property for the listener to true.
  2. Define a user with the permissions you wish to grant anonymous users.

    It is customary to name this user "anonymous". However, you may use any name you wish.

  3. Set the anonxx attribute for this user to true, as shown in the following example:
    <user anonxx="true" home="/common" use="v-r-w-d">anonymous</user>

    When the anonymous user logs in, he is prompted for a password. Any string containing the "@" character is accepted.



x
User Home Locations

If the path specified in the <home> element is absolute (for example, a physical location on a disk, such as d:/a/b), then the server root parameter on the listener is ignored and the user home is at and below the physical location specified. If the location is not absolute, then the home is below the server root (configured on the listener). In all cases, the user is restricted to the final home location. iWay recommends that only administrators receive physical home locations that permit access to data other than message data.



x
The Site Command

SITE is a server-specific command that can be called by clients to execute some site-specific function. The FTPServer supports SITE for the following purposes. The SITE verb itself may or may not be inserted by the specific client in use. The means by which such site-specific commands are requested differs for individual clients. The following table lists available SITE commands.

Command

Description

SITE MIME filename

Returns the MIME-type of the named file.

SITE EXEC [parameters]

The password for the user. Can be a function reference, such as LDAP().

SITE REGISTER [type] name value

Creates or loads the special register. The type must be set to USR, HDR, or DOC.

A client needs specific permission to use the SITE EXEC command. Overall permission is set using the listener configuration, and can be overridden for a specific user through the user for or TPA.



x
FTP Server Log

Each command executed by the server can be logged. This log takes the following format:

2006-01-29T16:20:12Z 1
USER joe : 331 Password required for joe (667c768105d92c18).
2006-01-29T16:20:14Z 1
PASS ---- : 230 User joe logged in.
2006-01-29T16:20:16Z 1
PORT 127,0,0,1,15,10 : 200 PORT command successful.
2006-01-29T16:20:16Z 1
LIST : 226 ASCII transfer complete.

Each line in the log represents one command, using the following format:



x
Special Registers

The server exposes several special registers, which are listed and described in the following table.

Name

Level

Type

Description

ftpd.command

Document

String

The name of the command.

ftpd.file

Document

String

The file name part of the command.

ftpd.mode

Document

String

The current transfer mode (ASCII or Binary).

ftpd.user

Document

String

The user id of the sender.

ip

Document

String

The IP address of the sender.

iwayconfig

System

String

The current active configuration name.

msgcount

Document

String

The number of messages executed.

msgsize

Document

Integer

The physical length of the message payload.

name

System

String

The assigned name of the master (listener).

pdm

Document

String

If this is a possible duplicate message, 1 is displayed.

protocol

System

String

The protocol on which message was received.

source

Document

String

The host name of the sender.

tid

Document

String

Unique transaction ID.



x
FTP Commands

The following table lists and describes the available FTP commands.

FTP Command

Description

ABOR

The ABOR command aborts the previous FTP service command and any associated transfer of data.

Server replies:

  • 226 ABOR command successful.

APPE

The APPE command appends data to the end of a file on the remote host. If the file does not already exist, it is created.

Server replies:

  • 556 Permission denied.
  • 226 Transfer complete.

AUTH

The AUTH command establishes an SSL encrypted session. Only the SSL type is supported.

Server replies:

  • 431 Service is unavailable.
  • 234 AUTH TLS request accepted.

CDUP

The CDUP command changes the parent directory.

Server replies:

  • 250 CWD command successful.
  • 550 Invalid Access.

CWD

The CWD command changes the working directory. If the directory name is not specified, the root directory (/) is assumed.

Server replies:

  • 250 CWD command successful.
  • 550 Invalid Access.

DELE

The DELE command deletes the file specified by the provided path.

Server replies:

  • 250 Command okay.
  • 550 Not a valid file.
  • 550 User has insufficient rights.

EPRT

The EPRT command allows for the specification of an extended address for the data connection. The extended address must consist of the network protocol, as well as the network and transport addresses. The format of EPRT is:

EPRT |<net-prt>|<net-addr>|<tcp-port>|

Server replies:

  • 200 EPRT command successful.

EPSV

The EPSV command requests that a server listen on a data port and wait for a connection.

Server replies:

  • 229 Entering passive mode (<message>).

FEAT

The FEAT command displays the feature list.

Server replies:

  • 211 iWay extended features:

HELP

The HELP command displays the HELP information.

Server replies:

  • 214 HELP information.

LIST

The LIST command causes a list to be sent from the server. If the path name specifies a directory or other group of files, the server should transfer a list of files in the specified directory. If the path name specifies a file, then the server should send current information on the file. A null argument implies that the user is currently working in that directory or it is a default directory.

Server replies:

  • 226 Transfer complete.

MDTM

The MDTM command returns the date and time of when a file was modified.

Server replies:

  • 553 File not found.
  • 213 <timestamp>.

MFMT

The MFMT command resets the remote files timestamp.

Server replies:

  • 213 ModifyTime=<timestamp>;/filename.

MKD

The MKD command causes the directory specified in the path name to be created as a directory (if the path name is absolute) or as a subdirectory of the current working directory (if the path name is relative).

Server replies:

  • 257 Directory Created.
  • 550 Already exists.
  • 550 No permission.

NLST

The NLST command causes a directory listing to be sent from the server to the user site. The path name should specify a directory or other system-specific file group descriptor. A null argument implies the current directory. The server will return a stream of file names and no other information.

Server replies:

  • 550 Connection refused: connect.
  • 226 Closing data connection.

NOOP

The NOOP command means there is no operation.

Server replies:

  • 200 NOOP command successful.

PASS

The PASS command is a Telnet string argument field specifying the user password. This command must be immediately preceded by the USER command.

Server replies:

  • 530 Login incorrect.
  • 230 User <username> logged in.

PASV

The PASV command requests the server to listen on a data port (which is not its default data port) and to wait for a connection rather than initiate one upon receipt of a transfer command. The response to this command includes the host and port address this server is listening on.

Server replies:

  • 227 Entering passive mode.

PBSZ

The PBSZ command represents the protection buffer size.

Server replies:

  • 431 Service unavailable.
  • 200 Command ok.

PORT

The PORT command is HOST-PORT specification argument for the data port to be used in data connection. There are defaults for both the user and server data ports, and under normal circumstances this command and its reply are not needed. If this command is used, the argument is the concatenation of a 32-bit internet host address and a 16-bit TCP port address. This address information is broken into 8-bit fields and the value of each field is transmitted as a decimal number (in character string representation). The fields are separated by commas. An example of a port command is:

PORT h1,h2,h3,h4,p1,p2

Server replies:

  • 200 PORT command successful.
  • 500 command not understood.

PROT

The PROT command returns a data channel protection level. The supported level values are C and P. P protects the connection, while C clears the connection.

Server replies:

  • 200 Command PROT ok.

PWD

The PWD command displays the name of the current working directory.

Server replies:

  • 257 “<current directory>.”

QUIT

The QUIT command closes the connection.

Server replies:

  • 221 Goodbye.

REST

The RESET command is an argument field that represents a server marker at which a file transfer is to be restarted. This command does not cause the file transfer but rather skips over the file to the specified data checkpoint. This command must be immediately followed by the appropriate FTP service command, which resumes the file transfer.

Server replies:

  • 350 Restarting at <position>. Send STOR or RETR to initiate transfer.
  • 501 not a number.

RETR

The RETR command causes the server to transfer a copy of the file, specified in the path name, to the server at the other end of the data connection. The status and contents of the file at the server site are unaffected.

Server replies:

  • 550 I/O Error: Connection refused: connect.
  • 226 Transfer complete.

RMD

The RMD command causes the directory specified in the path name to be removed as a directory (if the path name is absolute) or as a subdirectory of the current working directory (if the path name is relative).

Server replies:

  • 550 No permission.
  • 550 Not a valid directory.
  • 250 Directory removed.

RNFR

The RNFR command specifies the old path name of the file which is to be renamed. This command must be immediately followed by a RNTO command specifying the new file path name.

Server replies:

  • 350 File exists, ready for destination name.

RNTO

The RNTO command specifies the new path name of the designated file immediately preceding the RNFR command. Together the two commands cause a file to be renamed.

Server replies:

  • 250 RNTO command successful.
  • 550 <filename>: cannot rename.

SITE

The SITE command handles server-specific commands. For more information, see The Site Command.

SIZE

The SIZE command returns the size of the file in bytes.

Server replies:

  • 553 <filename>: cannot read.
  • 213 <size>

STOR

The STOR command causes the server to accept the data transferred through the data connection and to store the data as a file at the server site. If the file specified in the path name exists at the server site, then its contents are replaced by the data being transferred. A new file is created at the server site if the file specified in the path name does not already exist.

Server replies:

  • 553 <filename>: cannot write.
  • 226 Transfer complete.

STOU

The STOU command behaves like the STOR command except that the resultant file is to be created in the current directory under a name unique to that directory.

Server replies:

  • 553 <filename>: cannot write.
  • 226 Transfer complete.

SYST

The SYST command is used to find out the type of operating system on the server.

Server replies:

  • 215 UNIX Type: Server Version <version>.

TYPE

The TYPE command specifies the representation type. The allowed types are A and I.

Server replies:

  • 200 Type set to <value>.

USER

The USER command is a Telnet string argument field identifying the user. The user identification is required by the server to access the file system.

Server replies:

  • 230 Already logged-in.
  • 530 Invalid user name.


x
Security Considerations

The FTP server listener supports secure transfer using the FTP/S protocol as defined in RFC 2228 and RFC 4217. It supports the FEAT request from standard FTP clients and accepts requests to initiate operations on secure channels. Security control is done by the client. Configuration can be set to reject clients that do not request security operations. Secure control channels and data transfer channels are treated separately. For example, if listener configuration does not require that secure data transfer be done, then the listener will accept client requests to transfer files securely if appropriate key stores are defined, but will accept transfers on non-secure channels. If security configuration is not provided, the FEAT response to the client will not indicate support for TLS channels.

The server uses the key store of the system, which is defined in the system properties. If a key store is not defined, the server rejects the attempt of the client to establish a secure channel.

Minimum levels of security are configured for the listener, preventing socket negotiation below the specified levels.

The server implements data transfer port theft protection requiring that the data transfer socket be connected to the same IP address as the control socket.

Access permissions for directories can be configured on a per-user basis in the security file. Additionally, access from specific hosts can be specified on a per-user basis in the security file. This restricts the user to known client equipment. The client can be specified as a host name or as an IP address. The test is not case-sensitive. For more information, see The Security File.


Top of page

x
Using the Trading Partner Management Facility

The Trading Partner Management facility can hold the identity of a user authorized to submit or receive messages through the FTPD listener. This user is identified in the Protocol/FTPD section of the Partner Editor. For more information, see iWay Trading Manager User's Guide.

The following table lists and describes the fields you can specify in the agreement.

Field

Description

User Name

This is the login name of the user associated with this partner. If a simple name is used, this must be unique across the system, as the username will be used to locate the appropriate trading partner. If the user logs in using a user id of <partner>:user, then uniqueness is not required as the partner is identified by the value preceding the colon.

The partner identifier is formed by TPN(SREG('ftpd-user')).

Password

The password for the user. This can be a function reference, such as LDAP().

Mailbox

The mailbox assigned to this partner. This is a directory of the configured server root assigned to the listener. This is the users home location.

Require Secure Authentication

This partner requires that FTP control to and from this mailbox be done under secure authorization control as described in RFC 2228.

Require Secure Transfer

This partner requires that FTP transfers to/from this mailbox be done under secure channel conditions as described in RFC 2228.

The agreements are referenced at user login. Therefore, they can be changed while the system is operational. Note that when security requirements for a partner differ from that of the listener itself, the higher security takes precedence. Therefore, although a listener may not require that all transfers take place in a secure manner, an agreement with a specific partner may be required.


iWay Software