0

Is it possible to do a ColdFusion FTP connection using Explicit TLS?

I have searched on Google but to no avail.

Timothy Ruhle
  • 7,387
  • 10
  • 41
  • 67
  • 2
    Did you try? If so and it did not work, what error did you get? Are you asking about using the `cfftp` tag? What version of ColdFusion are you running? On what operating system? We need some more information to help you but I would say the first step is to just try it and see what happens. If it fails then post back with what you tried and how it failed. [Here are the docs for cfftp and secure connections](http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-72fa.html). – Miguel-F May 16 '13 at 13:08

2 Answers2

3

The Apache Commons has an FTPSClient class as well, and I think it is already available in the later versions of Coldfusion.

Just adding an example. It uses a test server that I found available. I am using CF 9.0.2, and did not have to download any additional jars.

ftpsClient = CreateObject("java","org.apache.commons.net.ftp.FTPSClient").init(JavaCast("boolean",true));
ftpsClient.connect(JavaCast("string","ftp.secureftp-test.com"),990);
connected = ftpsClient.isConnected();

WriteOutput("Is Connected:" &  connected & '<br/>');

login = ftpsClient.login('test','test');
WriteOutput("Is Logged in:" &  login & '<br/>');


ftpsClient.logout();
ftpsClient.disconnect();
connected = ftpsClient.isConnected();

WriteOutput("Is Connected:" &  connected & '<br/>');
abbottmw
  • 752
  • 1
  • 5
  • 19
  • The test server I am using in this code is no longer available, but I setup my own local server for testing – abbottmw Jun 23 '14 at 12:25
1

Unless something changed in CF10, CFFTP supports secure FTP but not SFTP or FTPS. You may need to use a java library like FTP4J as mentioned in this blog.

From the FTP4J documentation:

FTPS/FTPES secured connection

The ftp4j library supports both FTPS (FTP over implicit TLS/SSL) and FTPES (FTP over explicit TLS/SSL).

The setSecurity() method can be used to turn on the feature:

client.setSecurity(FTPClient.SECURITY_FTPS); // enables FTPS client.setSecurity(FTPClient.SECURITY_FTPES); // enables FTPES

as Miguel-F pointed out, if you switch the comment on these two lines it should enable FTPES.

//FTPClient.setSecurity(FTPClient.SECURITY_FTPES); // enables FTPES
FTPClient.setSecurity(FTPClient.SECURITY_FTPS); // enables FTPS
genericHCU
  • 4,394
  • 2
  • 22
  • 34
  • Since we gave the same answer, even referencing the same blog post, and you beat me by a few seconds I have deleted mine and up-voted yours. Touche my friend... ;) – Miguel-F May 16 '13 at 13:26
  • nah, keep yours up, you reference the line of code you need to enable the ftpes. I'll vote yours up too. – genericHCU May 16 '13 at 13:27
  • 1
    No biggie, just add the reference to yours. Thanks tho. – Miguel-F May 16 '13 at 13:28