Re: Why are high ports used by SFTP server implementation?
Hum, that's not entirely clear to me. The first link says... 'A TCP/IPv4 connection consists of two endpoints, and each endpoint consists of an IP address and a port number. Therefore, when a client user connects to a server computer, an established connection can be thought of as the 4-tuple of (server IP, server port, client IP, client port). Usually three of the four are readily known -- client machine uses its own IP address and when connecting to a remote service, the server machine's IP address and service port number are required. What is not immediately evident is that when a connection is established that the client side of the connection uses a port number. Unless a client program explicitly requests a specific port number, the port number used is an *ephemeral* port number. Ephemeral ports are temporary ports assigned by a machine's IP stack, and are assigned from a designated range of ports for this purpose. In our case the server is configured to listen on port 22 and the client connects to port 22 so isn't that fixing the port on both sides at port 22? Are you saying that although port 22 is the logical port used on both systems, that in reality a different port is used on the client to connect to the server? We are using SSH only here I understand that only used port 22. Regarding the second link is that for FTP or also for SFTP? I know FTP uses passive ports and so does FTPS but we are only using SFTP, e.g. file transfer as part of SSH. Do those links really describe my situation? Or are those high ports created on the server so it can hand off work so it can listen on 22 again? E.g. is it using separate ports to communicate with clients instead of multiple threads on same port? Its not clear to me yet, trying to understand. -Dave On Tue, Feb 23, 2016 at 4:32 PM, Chad Beaulac <cabeau...@gmail.com> wrote: > Hey Dave, > > Listener servers hand off to ephemeral ports. > http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html > You need ephemeral ports so a server can start listening on port 22 again > while something else is happening. > > Look here for some configuration options. > https://mina.apache.org/ftpserver-project/configuration_passive_ports.html > > -Chad > > > On Tue, Feb 23, 2016 at 3:09 PM, David Hoffer <dhoff...@gmail.com> wrote: > > > We are using SSHD in an application to create an embedded SFTP server > which > > works fine. Our clients connect on port 22 and we don't have any issue > > with that. > > > > The problem/question is that our IA folks are complaining that our app > also > > listens on what appear to be random high ports. E.g. I see this in our > > logs. > > > > Session username@/127.0.0.1:58118 authenticated > > Server session created from /127.0.0.1:58132 > > Server session created from /127.0.0.1:58139 > > Server session created from /127.0.0.1:58157 > > > > I see these later log statements are coming from IoSession in > > ServerSessionImpl but I don't call this in my code so must be part of the > > SSHD/MINA framework. > > > > Why are these high ports being used and do we need them? If not needed > for > > SFTP server how can I disable? If they are needed, why and can I control > > the exact ports that are used? > > > > -Dave > > >
Why are high ports used by SFTP server implementation?
We are using SSHD in an application to create an embedded SFTP server which works fine. Our clients connect on port 22 and we don't have any issue with that. The problem/question is that our IA folks are complaining that our app also listens on what appear to be random high ports. E.g. I see this in our logs. Session username@/127.0.0.1:58118 authenticated Server session created from /127.0.0.1:58132 Server session created from /127.0.0.1:58139 Server session created from /127.0.0.1:58157 I see these later log statements are coming from IoSession in ServerSessionImpl but I don't call this in my code so must be part of the SSHD/MINA framework. Why are these high ports being used and do we need them? If not needed for SFTP server how can I disable? If they are needed, why and can I control the exact ports that are used? -Dave
Re: Apache FtpServer doubts
I'm interested in the VFS...I wasn't aware of that...can you point me to info on that? For an app I have I'd like an in memory file system. Thanks, -Dave On Sun, Sep 15, 2013 at 11:26 PM, Sam Mizanin sammyuglykid...@yahoo.comwrote: Salvador, The Apache Ftpserver is pretty robust and stable. Have been using it for sometime. Its easily embedded and can tweak the way you want it which includes the Authentication module and the FileSystemView. It works great with the normal file system as well as with the VFS. Cheers, Sam From: Niklas Gustavsson nik...@protocol7.com To: ftpserver-users@mina.apache.org Sent: Sunday, 15 September 2013, 14:48 Subject: Re: Apache FtpServer doubts On Thu, Sep 12, 2013 at 3:25 PM, Salvador Alcantara Cano salvador.alcant...@uab.cat wrote: I am starting to use Apache FtpServer. It seems a good ftp server, but I am not sure about the project activity. Is the Apache FtpServer an active project? How does Apache FtpServer compares with FileZilla? From ApacheFtpServer I like it a lot to have event hooks via Ftplets...something like this cannot be achieved with FileZilla. My concern is on robustness and stability. The FtpServer project is somewhat dormant but the code base is reasonably solid. The way I see it, the major value FtpServer adds is being embeddable and offering a flexible API for integrating it, like switching out the file system or integrating with some custom authentication. If you're looking for a more regular FTP server, serving files from a normal file system, I'd go with something else, FileZilla being a good option. /niklas
Re: Apache FtpServer doubts
Okay...I started down that path but found it was going to be a fairly involved task...I was wondering if maybe someone had an implementation in the public domain or possibly as part of FTPServer code base. -Dave On Mon, Sep 16, 2013 at 6:33 AM, John Hartnup john.hart...@gmail.comwrote: Write your own implementations of FtpFile, FileSystemView, FileSystemFactory. Inject the FileSystemFactory into your FtpServer object. That's it. On 16 September 2013 13:29, David Hoffer dhoff...@gmail.com wrote: I'm interested in the VFS...I wasn't aware of that...can you point me to info on that? For an app I have I'd like an in memory file system. Thanks, -Dave On Sun, Sep 15, 2013 at 11:26 PM, Sam Mizanin sammyuglykid...@yahoo.com wrote: Salvador, The Apache Ftpserver is pretty robust and stable. Have been using it for sometime. Its easily embedded and can tweak the way you want it which includes the Authentication module and the FileSystemView. It works great with the normal file system as well as with the VFS. Cheers, Sam From: Niklas Gustavsson nik...@protocol7.com To: ftpserver-users@mina.apache.org Sent: Sunday, 15 September 2013, 14:48 Subject: Re: Apache FtpServer doubts On Thu, Sep 12, 2013 at 3:25 PM, Salvador Alcantara Cano salvador.alcant...@uab.cat wrote: I am starting to use Apache FtpServer. It seems a good ftp server, but I am not sure about the project activity. Is the Apache FtpServer an active project? How does Apache FtpServer compares with FileZilla? From ApacheFtpServer I like it a lot to have event hooks via Ftplets...something like this cannot be achieved with FileZilla. My concern is on robustness and stability. The FtpServer project is somewhat dormant but the code base is reasonably solid. The way I see it, the major value FtpServer adds is being embeddable and offering a flexible API for integrating it, like switching out the file system or integrating with some custom authentication. If you're looking for a more regular FTP server, serving files from a normal file system, I'd go with something else, FileZilla being a good option. /niklas -- There is no way to peace; peace is the way
Re: Apache FtpServer doubts
In my case I wanted a virtual file system that was event based, e.g. when file was received it would fire event with data (name plus byte array). I got the events/notification working fine...just didn't have time to implement the VFS. For now I just read the byes from the native file system and then delete the file. I hope to get back to that...but got directed to a different project for the moment. IMHO, it seems a VFS would have enough general interest...it would be great to be part of the FTPServer project...either in the mainline code...or in an example project. -Dave On Mon, Sep 16, 2013 at 6:59 AM, John Hartnup john.hart...@gmail.comwrote: Well, NativeFilesystem etc. are one implementation that's in the FTPServer code base. It's not a particularly involved task. There are lots of methods, but most of them will have very short implementations (isReadable(), isWritable() etc.) What goes into the implementation depends on what you want for the backend. On 16 September 2013 13:37, David Hoffer dhoff...@gmail.com wrote: Okay...I started down that path but found it was going to be a fairly involved task...I was wondering if maybe someone had an implementation in the public domain or possibly as part of FTPServer code base. -Dave On Mon, Sep 16, 2013 at 6:33 AM, John Hartnup john.hart...@gmail.com wrote: Write your own implementations of FtpFile, FileSystemView, FileSystemFactory. Inject the FileSystemFactory into your FtpServer object. That's it. On 16 September 2013 13:29, David Hoffer dhoff...@gmail.com wrote: I'm interested in the VFS...I wasn't aware of that...can you point me to info on that? For an app I have I'd like an in memory file system. Thanks, -Dave On Sun, Sep 15, 2013 at 11:26 PM, Sam Mizanin sammyuglykid...@yahoo.com wrote: Salvador, The Apache Ftpserver is pretty robust and stable. Have been using it for sometime. Its easily embedded and can tweak the way you want it which includes the Authentication module and the FileSystemView. It works great with the normal file system as well as with the VFS. Cheers, Sam From: Niklas Gustavsson nik...@protocol7.com To: ftpserver-users@mina.apache.org Sent: Sunday, 15 September 2013, 14:48 Subject: Re: Apache FtpServer doubts On Thu, Sep 12, 2013 at 3:25 PM, Salvador Alcantara Cano salvador.alcant...@uab.cat wrote: I am starting to use Apache FtpServer. It seems a good ftp server, but I am not sure about the project activity. Is the Apache FtpServer an active project? How does Apache FtpServer compares with FileZilla? From ApacheFtpServer I like it a lot to have event hooks via Ftplets...something like this cannot be achieved with FileZilla. My concern is on robustness and stability. The FtpServer project is somewhat dormant but the code base is reasonably solid. The way I see it, the major value FtpServer adds is being embeddable and offering a flexible API for integrating it, like switching out the file system or integrating with some custom authentication. If you're looking for a more regular FTP server, serving files from a normal file system, I'd go with something else, FileZilla being a good option. /niklas -- There is no way to peace; peace is the way -- There is no way to peace; peace is the way
Re: Apache FtpServer doubts
Frank, thanks for the heads-up...I'll definitely have a look at that. -Dave On Mon, Sep 16, 2013 at 7:53 AM, Frank van der Kleij kl...@hotmail.comwrote: I did this VFS integration for Apache FTP server a while ago but I haven't looked at it for almost two years now: http://vfs-utils.sourceforge.net/ftpserver/index.html Perhaps it can help - at least to get started! Frank Date: Mon, 16 Sep 2013 06:37:16 -0600 Subject: Re: Apache FtpServer doubts From: dhoff...@gmail.com To: ftpserver-users@mina.apache.org Okay...I started down that path but found it was going to be a fairly involved task...I was wondering if maybe someone had an implementation in the public domain or possibly as part of FTPServer code base. -Dave On Mon, Sep 16, 2013 at 6:33 AM, John Hartnup john.hart...@gmail.com wrote: Write your own implementations of FtpFile, FileSystemView, FileSystemFactory. Inject the FileSystemFactory into your FtpServer object. That's it. On 16 September 2013 13:29, David Hoffer dhoff...@gmail.com wrote: I'm interested in the VFS...I wasn't aware of that...can you point me to info on that? For an app I have I'd like an in memory file system. Thanks, -Dave On Sun, Sep 15, 2013 at 11:26 PM, Sam Mizanin sammyuglykid...@yahoo.com wrote: Salvador, The Apache Ftpserver is pretty robust and stable. Have been using it for sometime. Its easily embedded and can tweak the way you want it which includes the Authentication module and the FileSystemView. It works great with the normal file system as well as with the VFS. Cheers, Sam From: Niklas Gustavsson nik...@protocol7.com To: ftpserver-users@mina.apache.org Sent: Sunday, 15 September 2013, 14:48 Subject: Re: Apache FtpServer doubts On Thu, Sep 12, 2013 at 3:25 PM, Salvador Alcantara Cano salvador.alcant...@uab.cat wrote: I am starting to use Apache FtpServer. It seems a good ftp server, but I am not sure about the project activity. Is the Apache FtpServer an active project? How does Apache FtpServer compares with FileZilla? From ApacheFtpServer I like it a lot to have event hooks via Ftplets...something like this cannot be achieved with FileZilla. My concern is on robustness and stability. The FtpServer project is somewhat dormant but the code base is reasonably solid. The way I see it, the major value FtpServer adds is being embeddable and offering a flexible API for integrating it, like switching out the file system or integrating with some custom authentication. If you're looking for a more regular FTP server, serving files from a normal file system, I'd go with something else, FileZilla being a good option. /niklas -- There is no way to peace; peace is the way
Re: How to truly embed FTPServer in application?
Yeah I was thinking I might need to do some thing like that. As an interm solution I might stay with the native implementation (to prove my app concept) and replace that later, how can I 'know' that a new file has arrived and get the full file path so I can retrieve it from the native file system? I'm not clear how to use the Ftplet to accomplish this as Thomaz suggested. -Dave On Fri, Jul 19, 2013 at 2:47 AM, John Hartnup john.hart...@gmail.comwrote: To do something different instead of writing native files, you need to write your own implementations of FtpFilesystemFactory, FtpFile and FilesystemView. Use NativeFtpFile etc. as guides. Then, when wiring up your embedded server, server.setFilesystemFactory(myFilesystemFactory); ftplets may also be useful to you. They're there as hooks to do something at certain moments in a session. On 18 July 2013 21:55, David Hoffer dhoff...@gmail.com wrote: Not sure how to do that... Do you mean extend DefaultFtpletContainer and override afterCommand()? Then it it do something like... String command = request.getCommand().toUpperCase(); if (STOR.equals(command)) { // data transfer is complete, get the data. How? } How can I get the data/file that was just transferred? I don't see data methods on the Ftplet. I've not used this component before, any examples or pointers are greatly appreciated. -Dave On Thu, Jul 18, 2013 at 2:16 PM, Thomaz Luiz Santos thomaz.san...@gmail.com wrote: use the Ftplet and capture the command STOR ( Transfer complete ). On Thu, Jul 18, 2013 at 4:58 PM, David Hoffer dhoff...@gmail.com wrote: I'd like to use FTPServer in an embedded application. The instructions show how to do this but the example is not quite as embedded as I'd like. In my use case I want to receive FTPS files but I don't really want the file to be stored on disk, rather I want to be notified of the new message event in Java code and then I want to get and consume the message data directly by my application. I.e. I don't want to have to poll the disk looking for new data/etc. Ideally it would all be stream based as the files can be large but I'd be satisfied to start with getting the data in any form...but I need to be notified when it has arrived and have a way to get the data...even if just a byte []. How can I do this? Thanks, -Dave -- -- Thomaz Luiz Santos Linux User: #359356 http://thomaz.santos.googlepages.com/ -- There is no way to peace; peace is the way
Re: How to truly embed FTPServer in application?
Hi Thomaz, It looks like your attachment didn't get attached. Any chance you could paste that in plaintext? Or possibly use public file share? -Dave On Fri, Jul 19, 2013 at 7:05 AM, Thomaz Luiz Santos thomaz.san...@gmail.com wrote: David, following attached example, of the Ftplet. On Fri, Jul 19, 2013 at 9:41 AM, David Hoffer dhoff...@gmail.com wrote: Yeah I was thinking I might need to do some thing like that. As an interm solution I might stay with the native implementation (to prove my app concept) and replace that later, how can I 'know' that a new file has arrived and get the full file path so I can retrieve it from the native file system? I'm not clear how to use the Ftplet to accomplish this as Thomaz suggested. -Dave On Fri, Jul 19, 2013 at 2:47 AM, John Hartnup john.hart...@gmail.com wrote: To do something different instead of writing native files, you need to write your own implementations of FtpFilesystemFactory, FtpFile and FilesystemView. Use NativeFtpFile etc. as guides. Then, when wiring up your embedded server, server.setFilesystemFactory(myFilesystemFactory); ftplets may also be useful to you. They're there as hooks to do something at certain moments in a session. On 18 July 2013 21:55, David Hoffer dhoff...@gmail.com wrote: Not sure how to do that... Do you mean extend DefaultFtpletContainer and override afterCommand()? Then it it do something like... String command = request.getCommand().toUpperCase(); if (STOR.equals(command)) { // data transfer is complete, get the data. How? } How can I get the data/file that was just transferred? I don't see data methods on the Ftplet. I've not used this component before, any examples or pointers are greatly appreciated. -Dave On Thu, Jul 18, 2013 at 2:16 PM, Thomaz Luiz Santos thomaz.san...@gmail.com wrote: use the Ftplet and capture the command STOR ( Transfer complete ). On Thu, Jul 18, 2013 at 4:58 PM, David Hoffer dhoff...@gmail.com wrote: I'd like to use FTPServer in an embedded application. The instructions show how to do this but the example is not quite as embedded as I'd like. In my use case I want to receive FTPS files but I don't really want the file to be stored on disk, rather I want to be notified of the new message event in Java code and then I want to get and consume the message data directly by my application. I.e. I don't want to have to poll the disk looking for new data/etc. Ideally it would all be stream based as the files can be large but I'd be satisfied to start with getting the data in any form...but I need to be notified when it has arrived and have a way to get the data...even if just a byte []. How can I do this? Thanks, -Dave -- -- Thomaz Luiz Santos Linux User: #359356 http://thomaz.santos.googlepages.com/ -- There is no way to peace; peace is the way -- -- Thomaz Luiz Santos Linux User: #359356 http://thomaz.santos.googlepages.com/
How to truly embed FTPServer in application?
I'd like to use FTPServer in an embedded application. The instructions show how to do this but the example is not quite as embedded as I'd like. In my use case I want to receive FTPS files but I don't really want the file to be stored on disk, rather I want to be notified of the new message event in Java code and then I want to get and consume the message data directly by my application. I.e. I don't want to have to poll the disk looking for new data/etc. Ideally it would all be stream based as the files can be large but I'd be satisfied to start with getting the data in any form...but I need to be notified when it has arrived and have a way to get the data...even if just a byte []. How can I do this? Thanks, -Dave
Re: How to truly embed FTPServer in application?
Not sure how to do that... Do you mean extend DefaultFtpletContainer and override afterCommand()? Then it it do something like... String command = request.getCommand().toUpperCase(); if (STOR.equals(command)) { // data transfer is complete, get the data. How? } How can I get the data/file that was just transferred? I don't see data methods on the Ftplet. I've not used this component before, any examples or pointers are greatly appreciated. -Dave On Thu, Jul 18, 2013 at 2:16 PM, Thomaz Luiz Santos thomaz.san...@gmail.com wrote: use the Ftplet and capture the command STOR ( Transfer complete ). On Thu, Jul 18, 2013 at 4:58 PM, David Hoffer dhoff...@gmail.com wrote: I'd like to use FTPServer in an embedded application. The instructions show how to do this but the example is not quite as embedded as I'd like. In my use case I want to receive FTPS files but I don't really want the file to be stored on disk, rather I want to be notified of the new message event in Java code and then I want to get and consume the message data directly by my application. I.e. I don't want to have to poll the disk looking for new data/etc. Ideally it would all be stream based as the files can be large but I'd be satisfied to start with getting the data in any form...but I need to be notified when it has arrived and have a way to get the data...even if just a byte []. How can I do this? Thanks, -Dave -- -- Thomaz Luiz Santos Linux User: #359356 http://thomaz.santos.googlepages.com/