Secure file transfer from Ionic to (AWS EC2) server


#1

I’m trying to transfer a file from an Ionic iOS app to an AWS EC2 server running CentOS. I want this to be a secure file transfer. Will this plugin https://ionicframework.com/docs/native/ftp/ create a secure connection? I would assume not, since FTP isn’t secure. But if the server uses https would that make the FTP upload secure? If not, is there a way to securely transfer a file from an ionic app to a server?


#2

For secure FTP navigation you will need to use an SFTP connection, I found this plugin it can help you with SFTP connection, but I think you will need to change your FTP server to accept secure connections and your ftp url will turn into sftp://server:port


#3

Thanks! Unfortunately it looks like it only supports Android. I found a plugin that not related to ionic or cordova, so it might be a little harder to integrate into my project, but hopefully it will work: https://github.com/jyu213/ssh2-sftp-client. Ionic is pretty awesome so thank you to everyone who is working on it! Hopefully a SFTP plugin is added to Ionic soon!


#4

@AndrewGolf

Were you able to get that ssh2 sftp plugin working?? I really need this functionality for a project and would love to know if/how you got it working! Thanks so much.


#5

Yep! I will post some info about it tonight. I ended up using a different library than the one I posted.


#6

I found a plugin but I had trouble installing it, so I had to package it myself, then install it (link at bottom). The first part of the readme tells you how to install it. The second part is the original readme for the plugin which contains documentation for the methods. One thing to note is that it doesn’t support public key auth, so you have to use a username and password for a user on the server in order to run it. Note that I kinda dug this plugin up from nowhere and dusted it off in order to use it, so I’m not sure how secure it actually is. Its definitely no longer maintained, so you’ll have to judge for yourself if its suitable for your needs.

After you create a user on the server, you may have to do one more thing to allow username/password auth to the server. I was connecting to an Amazon EC2 server so this part might be slightly different on other servers.

  1. Open up the file /etc/ssh/sshd_config (probably need to open with sudo)
  2. Find the PasswordAuthentication line and make sure it says PasswordAuthentication yes
  3. Find the ChallengeResponseAuthentication line and make sure it says ChallengeResponseAuthentication=yes
  4. Save that file
  5. Run sudo service sshd restart

Then you should be good to go!

The plugin is here: https://github.com/AndrewERAU/com.tlantic.plugins.ssh