Search code examples
ruby-on-railsherokusftp

Rails 6 net/sftp connection to ftp server results in a dh key too small error? On Heroku-20 Stack


My local rails server connects to the ftp server fine. Filezilla application connects fine. Cyberducky application connects fine. When the rails application is on Heroku, the ftp connection results in the error dh key too small.

I have access and control over the ftp server which is an Amazon Linux 2 box using vsftpd. Any thoughts here?


Solution

  • I ran into this same issue a while back and the problem is really obscure. I think it's directly related to the build on Heroku stack 20 because on Heroku stack 18 my background job that reached out to the same FTP server worked.

    Since you have control over the FTP server if you ssh into your server...

    follow below steps:

    Step 1: cd into the etc/vsftpd directory and then sudo nano/vim vsftpd.conf.

    Step 2: Once you have that file open it in the editor and add the line ssl_ciphers=HIGH

    Step 3: exit and save.

    The image attached is the setup that I have within that vsftpd.conf . Sample Vsftpd.conf