1

We run a system that automatically sends a swift message at the end of a process. But this messages are sent using FTP. We feel the FTP process is too prone to MITMA and wish to change the sending medium to SFTP. How can this be achieved? Remember we want it to be automatic. No interactive session. It would be more like;

if XXXX conditions are met

echo "BBBB"

then

(message sends over to the swift sever, THROUGH SFTP)

tlng05
  • 10,244
  • 1
  • 33
  • 36

2 Answers2

2

SSH File Transfer Protocol(SFTP) uses the Secure CoPy(SCP) command to only allow file transfer to a remote server over an Secure SHell(SSH) like connection. This is good because it's fully encrypted end to end.

If you prefer the ease of FTP though and you want encryption you can use File Transfer Protocol Secure(FTPS) to use FTP over an encrypted connection to the server. If you validate the SSL certificate or use a pinned one this becomes just as secure, if not more so, than SFTP with the added benefit of not opening up your SSH port.

So in reality you have two options:

  • SFTP is great if you're in complete control of everything
    This opens your SSH to the clients. You need to be certain you're in control of that. If it's remote and under someone else's control it's actually better to not use this method.
  • FTPS is great if you don't want to open your SSH connections and would prefer it handled on a different service through TLS.
Robert Mennell
  • 6,968
  • 1
  • 13
  • 38
1

essentially SFTP is the same thing as SSH except its limited to file transfers. It has very little to do with FTP (You should assume anything sent over FTP to be fully pubic to everyone).

If you want to copy data to a server using SFTP/SSH. You could copy the file containing the data using scp:

scp /path/to/file username@ipaddress:/path/to/destination

Then, you can do whatever it is the server should do from the same script:

ssh username@ipaddress

Now you're in a remote shell on the server. All following commands in the script are executed remotely. until you use exit

Also note that the server will request a password when using scp/ssh so it may be useful to setup public key authentication instead. Otherwise you'll have to include the password in your script (DON'T).

EKZ12U
  • 11
  • 1