Is it possible to do a ColdFusion FTP connection using Explicit TLS?
I have searched on Google but to no avail.
Is it possible to do a ColdFusion FTP connection using Explicit TLS?
I have searched on Google but to no avail.
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/>');
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