FTPAdapter using SFTP

FTP Adapter Configuration for SFTP

Introduction

At my current project incoming data files, located at a third party FTP server, have to be read using SFTP.
Despite of several blog posts and the FTP Adapter documentation of Oracle, it took us a full day to get a working SFTP configuration. I use this blogpost to document this for myself in case I have to do it again, and for others who need to do (about) the same.

Prerequisite

First of all start with ensuring that no firewall is blocking traffic from the weblogic server to the FTP server using the specified SFTP port (default this is 22). On a linux (or unix) server you can verify this by opening a command prompt on the weblogic server (eg. with Putty) and use command “ssh “.

SFTP Configuration

Two configuration steps are required now:
A. Create a private and public key file
B. Add a FTP Adapter Outbound Configuration for SFTP

A. Create a private and public key file (linux/unix):

  1. Log in with a command prompt as the oracle user (the user under which weblogic runs) on the weblogic server
  2. Navigate to the .ssh directory under the user home directory:
  3. Generate a public and private key with ssh-keygen (and accept defaults): (4 x Enter).
    Two files are created: id_rsa and id_rsa.pub
  4. Add the public key to the ‘autorized keys’:

In a production environment these files should be write protected (even for the oracle account itself).

B. Add a FTP Adapter Outbound Configuration for SFTP:

  1. Log in with admin privileges on the weblogic console
  2. Click on “Deployments” (second item in menu on left side of page)
  3. Search in the list of deployments for the “FtpAdapter” (you may have to navigate to the next page with “Next”) and click on its name (it’s a link):        (hint: Customize this table -> Number of rows 100 -> Apply)
    Deployments-FtpAdapter
  4. Select tab “Configuration” and its subtab “Outbound Connection Pools”
  5. Expand “javax.resource.cci.ConnectionFactory” by clicking on the + icon :
    FtpAdapter Outbound Configurations
  6. We’re going the make configuration changes, so create a session with button “Lock & Edit” (upper top left of screen)
  7. De button “New” is enabled. Click on it.
  8. Select the only option “javax.resource.cci.ConnectionFactory” and click “Next”
  9. Enter a descent JNDI name, e.g. eis/Ftp/TimeCardsSftp (Be precise! This name is used in the software to connect)
  10. Click on “Finish”
  11. Expand “javax.resource.cci.ConnectionFactory” again
  12. Click on the outbound connection you’ve just created, e.g. on eis/Ftp/TimeCardsSftp.
    We’re going the change some properties.
    Attention! The UI is a little awkward. Be sure to use the ENTER button after changing a property otherwise the change will not be saved! Unfortunately this causes the UI to navigate back to the first property page 🙁
    Property adjustments (different from default values):
    <host name or ip address of ftp server>
    <password of ftp account>
    <path to private key file> e.g.
    <username of ftp account>

    (below this post you can find screenprints of all the properties)
  13. Now press button “Save” to store these settings in the deployment plan of the FtpAdapter.
    (The first you’re asked in which file these settings has to be saved. My advise is to rename Plan.xml to a more descriptive name, e.g. FtpAdapterPlan.xml)
  14. The FtpAdapter has to be redeployed with these new settings. Go back to the list of “Deployments”.
    (second item in menu on left side or use the ‘breadcrumbs’ in top of page)
  15. Do NOT click on the FtpAdapter, but select it!
    Select FtpAdapter
  16. Click on button “Update” (on top or button of list)
  17. Accept the already chosen option “Redeploy this application using the following deployment files” and click on button “Finish”
  18. Finally you have to activate these changes by clicking on button “Release Configuration” (upper left top of page)

Resources

Screenprints of all properties set

(values for host, username and password have been made unreadable)
WeblogicFtpAdapterOutboundConnectionSFTP1
WeblogicFtpAdapterOutboundConnectionSFTP2
WeblogicFtpAdapterOutboundConnectionSFTP3
WeblogicFtpAdapterOutboundConnectionSFTP4
WeblogicFtpAdapterOutboundConnectionSFTP5
WeblogicFtpAdapterOutboundConnectionSFTP6

4 Comments

  1. Yousra February 25, 2019
  2. San February 17, 2017
  3. Deb December 8, 2016
  4. Bas August 1, 2016