Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FTP over TLS

77 views
Skip to first unread message

Mike Griffiths

unread,
May 14, 2023, 4:30:18 PM5/14/23
to
Hi all,

Does anyone have any experience of doing FTP over TLS in TCL? I was naively hoping, when I saw no mention of it in the ftp package docs or wiki page, that it may be as easy as just changing [socket] calls in the ftp package code for ::tls::socket but (with verbose and debug options in the ftp package set) I'm just getting error messages:

error error | Service not available!
error error | Not connected!

after very long timeouts. Anyone have any advice/experience doing this?

(Mike) 39 % package require Tcl
8.6.9
(Mike) 40 % package require ftp
2.4.13
(Mike) 41 % package require tls
1.7.16

Many thanks,

Mike

Andreas Leitgeb

unread,
May 15, 2023, 6:16:10 AM5/15/23
to
Mike Griffiths <mi...@keyboardzombie.com> wrote:
> Does anyone have any experience of doing FTP over TLS in TCL?

ftp is a rather "complicated" protocol, involving separate connections
for transfer of directory listings or files.

There exist some approaches to wrap that with tls channels, but I must
admit I'm not very experienced with those. My feeling is, that at
very least, you need to make sure to switch "passive" mode off (or was
it on, anyway, be sure to try both ways!)

The "wrong" one of these "passive" settings would require the ftp-server
to open a connection back to you, which pretty surely wouldn't work.

Most likely it would be best to find some other alternative like
"sftp", which is based on ssh and entirely different.


> I was naively hoping, when I saw no mention of it in the ftp package docs
> or wiki page, that it may be as easy as just changing [socket] calls in the
> ftp package code for ::tls::socket but (with verbose and debug options in
> the ftp package set) I'm just getting error messages:

Also, be sure that also the secondary connection (which for correct
passive-mode setting would originate from the client) also gets
tls-wrapped.

Mike Griffiths

unread,
May 15, 2023, 7:00:24 AM5/15/23
to
Hi Andreas,

Thanks for your reply. For the time being I've gone with using a portable (no install) ftp client with command line behaviour that I can ship with my Tcl code to do the transfers, though if anyone's made a pure-Tcl approach this would still be great to see.

I did try changing all the sockets to tls::socket variants, and a (very light) bit of research before I switched to the ftp.exe approach suggested there may actually be 2 ports in play for implicit ftps so I tried that too, as well as using both passive and active modes, but nothing proved successful, alas...

Kind regards,

Mike

greg

unread,
May 15, 2023, 3:08:36 PM5/15/23
to
TclCurl
https://wiki.tcl-lang.org/page/TclCurl

Tcl binding for libcurl, a library for accessing internet resources of various types. Supports FTP, FTPS, , SFTP etc..




Mike Griffiths

unread,
May 15, 2023, 3:41:59 PM5/15/23
to
Hi Greg,

Thanks for your reply. I did have a quick look at this and I know I've used it in years gone by, but struggled to find any Win32 binaries for this; it seems to only be source available now; while it's possibly the best Tcl-only approach this unfortunately made it more of a time investment for me to figure out than using an external tool for this project...

Kind regards,

Mike
0 new messages