Thursday 11 December 2014

FTP Adapter Configuration for SFTP Communication in SOA using public key authentication process

Target : To establish SFTP communication between the SOA server and the SFTP server and configure FTP Adapter using public key authentication process.

Solution :

1. Login to the SOA server
cd ~ ( This will navigate to the home location of the user )
cd .ssh

2. Execute the below command. This will generate the public and private key
ssh-keygen

3. After entering the above command, you would be asked the file where the keys would be saved. Accept the default values and enter. Now, the identification will be saved at the below location
Private key location : /<home location of the user>/.ssh/id_rsa
Public Key Location : /<home location of the user>/.ssh/id_rsa.pub

4. Copy the public key of the SOA host ( /<home location of the user>/.ssh/id_rsa.pub ) to the known_hosts/authorized keys of the SFTP server. This can be done by copying the content of the pub key file into the authorized_keys file. ( If not sure how to perform this, please contact the system admin )

5. On the SFTP server, make sure you have the required privileges on the authoroized_keys

6. Now test the SFTP communication. This can be done by the following steps on the SOA server
sftp <sftp_user>@SFTPHOST

Alternatively, You can use the below command if the SFTP is running on a different port apart from the default one :
sftp -vvv -oPort=<port number> <user>@<SFTP HOST>

7. When you do this for the first time, you will be prompted for confirmation. Type "yes"

8. This completes the SFTP communication between the SOA server and the SFTP host.

9. Once the communication is established, now configure the adapter : Update the FTP adapter connection pool which you are using with the below parameters :
o Authentication type : publickey
o Host : <SFTP Host Name>
o Port : <SFTP Port>
o Private key file : /<user's home>/.ssh/ id_rsa
The above is the private key path which has been created in the 1s step.
o Username : <SFTP User>
o useSFTP : true

10. Save and activate the changes. Update the deployment FTP Adapter.