You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Mohit Anchlia <mo...@gmail.com> on 2009/02/03 00:43:37 UTC
How to set timeout?
I looked at the various manuals but nothing is clearly document about
how to set the idle timeout. I have couple of questions?
1. On linux can I set idle-timeout on EmbeddedFtpServer outside of JVM
but either logging in ftp server or by any other means?
2. I have below code (that I haven't written) that I need to modify to
add idle-timeout. But when I add
"config.listeners.default.data-connection.idle-timeout" I get
org.apache.ftpserver.FtpServerConfigurationException: Unknown property
"idle-timeout" on class
org.apache.ftpserver.DefaultDataConnectionConfig exception.
How do I add idle-timeout?
public static FtpServer createFtpServer(int port, String username,
String password, String homeDir) throws Exception {
ConfigurableFtpServerContext context = new
ConfigurableFtpServerContext(new
PropertiesConfiguration(getFtpProperties(port)));
PropertiesUserManager userManager =
(PropertiesUserManager)context.getUserManager();
addUser(userManager, username, password, homeDir);
FtpServer ftpServer = new FtpServer(context);
return ftpServer;
}
public static Properties getFtpsProperties(int port, String
keystoreLoc) throws IOException {
Properties p = new Properties();
if (keystoreLoc == null) keystoreLoc = "./dist/ftp/.keystore";
// Enable FTPS (SSL)
p.put("config.listeners.default.implicit-ssl", "false");
p.put("config.listeners.default.port", Integer.toString(port));
p.put("config.listeners.default.ssl.class",
"org.apache.ftpserver.ssl.DefaultSsl");
p.put("config.listeners.default.ssl.keystore-file", keystoreLoc);
p.put("config.listeners.default.ssl.keystore-password", "password");
p.put("config.listeners.default.ssl.keystore-type", "JKS");
p.put("config.listeners.default.ssl.keystore-algorithm", "SunX509");
p.put("config.listeners.default.ssl.ssl-protocol", "TLS");
p.put("config.listeners.default.ssl.client-authentication", "false");
p.put("config.listeners.default.ssl.key-password", "password");
// Enable encrypted data channel
p.put("config.listeners.default.data-connection.class",
"org.apache.ftpserver.DefaultDataConnectionConfig");
p.put("config.listeners.default.data-connection.ssl.class",
"org.apache.ftpserver.ssl.DefaultSsl");
log.info("SETTING IDLE TIMEOUT");
p.put("config.listeners.default.data-connection.idle-timeout", "300");
log.info("DONE SETTING IDLE TIMEOUT");
// p.put("config.listeners.default.data-connection.passive.address",
"localhost");
p.put("config.listeners.default.data-connection.passive.ports",
"5000-5010");
p.put("config.listeners.default.data-connection.ssl.keystore-file",
keystoreLoc);
p.put("config.listeners.default.data-connection.ssl.keystore-password",
"password");
p.put("config.listeners.default.data-connection.ssl.keystore-type",
"JKS");
p.put("config.listeners.default.data-connection.ssl.keystore-algorithm",
"SunX509");
p.put("config.listeners.default.data-connection.ssl.ssl-protocol",
"TLS");
p.put("config.listeners.default.data-connection.ssl.client-authentication",
"false");
p.put("config.connection-manager.max-connection", 100); // No Limit
p.put("config.connection-manager.max-login", 100); // No Limit
// User Manager
p.put("config.file-system-manager.create-home", "true");
// p.put("config.user-manager.class",
"org.apache.ftpserver.usermanager.PropertiesUserManager");
// p.put("config.user-manager.admin", "efe");
// p.put("config.user-mananger.prop-file", userfile);
// p.put("config.user.manager.prop-password-encrypt", "false");
//
// System.out.println("UserFile = " + userfile);
return p;
}
Re: How to set timeout?
Posted by Mohit Anchlia <mo...@gmail.com>.
Timeout neve occurred. I set both default timeout and
timeout-poll-interval to 300 secs. I connected as a client and left
the session open, but that session never timedout
On Wed, Feb 4, 2009 at 12:38 AM, David Latorre <dv...@gmail.com> wrote:
> 2009/2/3 Mohit Anchlia <mo...@gmail.com>
>
>> Thanks ..so I made the change to set default-idle-time to 300 secs.
>> And then logged in as a client, ftp server didn't timeout even after 5
>> mts of inactivity
>>
>
> What did you set the timeout-poll-inverval to? When dit the timeout occur?
>
>
>
>>
>> On Tue, Feb 3, 2009 at 3:12 AM, David Latorre <dv...@gmail.com> wrote:
>> > 2009/2/3 Ashish <pa...@gmail.com>
>> >
>> >> On Tue, Feb 3, 2009 at 2:38 PM, David Latorre <dv...@gmail.com> wrote:
>> >> > Hello Mohit,
>> >> > My advice is to update to the latest version of FtpServer. A lot of
>> >> > improvements and bugfixes have been added since your version was
>> >> released.
>> >> > From and old config file of mine i see this:
>> >> >
>> >> > config.connection-manager.default-idle-time=1000
>> >> > config.connection-manager.timeout-poll-inverval=60
>> >>
>> >> David, could you point me to the class where this handling is done.
>> >> Is it in NioListener.java ?
>> >>
>> >> acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
>> >> getIdleTimeout());
>> >>
>> >
>> > In our current code base, yes (He's using an older version). Although you
>> > can set an idle-timeout in the user manager too.
>> >
>> >
>> >
>> >>
>> >> Have you ever tried to set timeout greater than 60 sec (60000)
>> >> assuming the settings are in
>> >> ms? So far the way I have experimented with MINA, couldn't make this
>> >> work for longer timeout,
>> >> without a workaround.
>> >>
>> >
>> > From Mina javadoc: Sets idle time for the specified type of idleness in
>> > seconds.
>> > I haven't really tested this though - and Im not very familiar with Mina
>> > itself. I should do some research on this.
>> >
>> >
>> >
>> >>
>> >> Let me know your thoughts.
>> >>
>> >> thanks
>> >> ashish
>> >>
>> >
>>
>
Re: How to set timeout?
Posted by David Latorre <dv...@gmail.com>.
2009/2/3 Mohit Anchlia <mo...@gmail.com>
> Thanks ..so I made the change to set default-idle-time to 300 secs.
> And then logged in as a client, ftp server didn't timeout even after 5
> mts of inactivity
>
What did you set the timeout-poll-inverval to? When dit the timeout occur?
>
> On Tue, Feb 3, 2009 at 3:12 AM, David Latorre <dv...@gmail.com> wrote:
> > 2009/2/3 Ashish <pa...@gmail.com>
> >
> >> On Tue, Feb 3, 2009 at 2:38 PM, David Latorre <dv...@gmail.com> wrote:
> >> > Hello Mohit,
> >> > My advice is to update to the latest version of FtpServer. A lot of
> >> > improvements and bugfixes have been added since your version was
> >> released.
> >> > From and old config file of mine i see this:
> >> >
> >> > config.connection-manager.default-idle-time=1000
> >> > config.connection-manager.timeout-poll-inverval=60
> >>
> >> David, could you point me to the class where this handling is done.
> >> Is it in NioListener.java ?
> >>
> >> acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
> >> getIdleTimeout());
> >>
> >
> > In our current code base, yes (He's using an older version). Although you
> > can set an idle-timeout in the user manager too.
> >
> >
> >
> >>
> >> Have you ever tried to set timeout greater than 60 sec (60000)
> >> assuming the settings are in
> >> ms? So far the way I have experimented with MINA, couldn't make this
> >> work for longer timeout,
> >> without a workaround.
> >>
> >
> > From Mina javadoc: Sets idle time for the specified type of idleness in
> > seconds.
> > I haven't really tested this though - and Im not very familiar with Mina
> > itself. I should do some research on this.
> >
> >
> >
> >>
> >> Let me know your thoughts.
> >>
> >> thanks
> >> ashish
> >>
> >
>
Re: How to set timeout?
Posted by Mohit Anchlia <mo...@gmail.com>.
Thanks ..so I made the change to set default-idle-time to 300 secs.
And then logged in as a client, ftp server didn't timeout even after 5
mts of inactivity
On Tue, Feb 3, 2009 at 3:12 AM, David Latorre <dv...@gmail.com> wrote:
> 2009/2/3 Ashish <pa...@gmail.com>
>
>> On Tue, Feb 3, 2009 at 2:38 PM, David Latorre <dv...@gmail.com> wrote:
>> > Hello Mohit,
>> > My advice is to update to the latest version of FtpServer. A lot of
>> > improvements and bugfixes have been added since your version was
>> released.
>> > From and old config file of mine i see this:
>> >
>> > config.connection-manager.default-idle-time=1000
>> > config.connection-manager.timeout-poll-inverval=60
>>
>> David, could you point me to the class where this handling is done.
>> Is it in NioListener.java ?
>>
>> acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
>> getIdleTimeout());
>>
>
> In our current code base, yes (He's using an older version). Although you
> can set an idle-timeout in the user manager too.
>
>
>
>>
>> Have you ever tried to set timeout greater than 60 sec (60000)
>> assuming the settings are in
>> ms? So far the way I have experimented with MINA, couldn't make this
>> work for longer timeout,
>> without a workaround.
>>
>
> From Mina javadoc: Sets idle time for the specified type of idleness in
> seconds.
> I haven't really tested this though - and Im not very familiar with Mina
> itself. I should do some research on this.
>
>
>
>>
>> Let me know your thoughts.
>>
>> thanks
>> ashish
>>
>
Re: How to set timeout?
Posted by David Latorre <dv...@gmail.com>.
2009/2/3 Ashish <pa...@gmail.com>
> On Tue, Feb 3, 2009 at 2:38 PM, David Latorre <dv...@gmail.com> wrote:
> > Hello Mohit,
> > My advice is to update to the latest version of FtpServer. A lot of
> > improvements and bugfixes have been added since your version was
> released.
> > From and old config file of mine i see this:
> >
> > config.connection-manager.default-idle-time=1000
> > config.connection-manager.timeout-poll-inverval=60
>
> David, could you point me to the class where this handling is done.
> Is it in NioListener.java ?
>
> acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
> getIdleTimeout());
>
In our current code base, yes (He's using an older version). Although you
can set an idle-timeout in the user manager too.
>
> Have you ever tried to set timeout greater than 60 sec (60000)
> assuming the settings are in
> ms? So far the way I have experimented with MINA, couldn't make this
> work for longer timeout,
> without a workaround.
>
From Mina javadoc: Sets idle time for the specified type of idleness in
seconds.
I haven't really tested this though - and Im not very familiar with Mina
itself. I should do some research on this.
>
> Let me know your thoughts.
>
> thanks
> ashish
>
Re: How to set timeout?
Posted by Ashish <pa...@gmail.com>.
On Tue, Feb 3, 2009 at 2:38 PM, David Latorre <dv...@gmail.com> wrote:
> Hello Mohit,
> My advice is to update to the latest version of FtpServer. A lot of
> improvements and bugfixes have been added since your version was released.
> From and old config file of mine i see this:
>
> config.connection-manager.default-idle-time=1000
> config.connection-manager.timeout-poll-inverval=60
David, could you point me to the class where this handling is done.
Is it in NioListener.java ?
acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
getIdleTimeout());
Have you ever tried to set timeout greater than 60 sec (60000)
assuming the settings are in
ms? So far the way I have experimented with MINA, couldn't make this
work for longer timeout,
without a workaround.
Let me know your thoughts.
thanks
ashish
Re: How to set timeout?
Posted by David Latorre <dv...@gmail.com>.
Hello Mohit,
My advice is to update to the latest version of FtpServer. A lot of
improvements and bugfixes have been added since your version was released.
>From and old config file of mine i see this:
config.connection-manager.default-idle-time=1000
config.connection-manager.timeout-poll-inverval=60
2009/2/3 Mohit Anchlia <mo...@gmail.com>
> I looked at the various manuals but nothing is clearly document about
> how to set the idle timeout. I have couple of questions?
>
> 1. On linux can I set idle-timeout on EmbeddedFtpServer outside of JVM
> but either logging in ftp server or by any other means?
> 2. I have below code (that I haven't written) that I need to modify to
> add idle-timeout. But when I add
> "config.listeners.default.data-connection.idle-timeout" I get
> org.apache.ftpserver.FtpServerConfigurationException: Unknown property
> "idle-timeout" on class
> org.apache.ftpserver.DefaultDataConnectionConfig exception.
> How do I add idle-timeout?
>
> public static FtpServer createFtpServer(int port, String username,
> String password, String homeDir) throws Exception {
> ConfigurableFtpServerContext context = new
> ConfigurableFtpServerContext(new
> PropertiesConfiguration(getFtpProperties(port)));
> PropertiesUserManager userManager =
> (PropertiesUserManager)context.getUserManager();
> addUser(userManager, username, password, homeDir);
>
> FtpServer ftpServer = new FtpServer(context);
> return ftpServer;
> }
>
> public static Properties getFtpsProperties(int port, String
> keystoreLoc) throws IOException {
> Properties p = new Properties();
> if (keystoreLoc == null) keystoreLoc = "./dist/ftp/.keystore";
> // Enable FTPS (SSL)
> p.put("config.listeners.default.implicit-ssl", "false");
> p.put("config.listeners.default.port", Integer.toString(port));
> p.put("config.listeners.default.ssl.class",
> "org.apache.ftpserver.ssl.DefaultSsl");
> p.put("config.listeners.default.ssl.keystore-file", keystoreLoc);
> p.put("config.listeners.default.ssl.keystore-password", "password");
> p.put("config.listeners.default.ssl.keystore-type", "JKS");
> p.put("config.listeners.default.ssl.keystore-algorithm", "SunX509");
> p.put("config.listeners.default.ssl.ssl-protocol", "TLS");
> p.put("config.listeners.default.ssl.client-authentication",
> "false");
> p.put("config.listeners.default.ssl.key-password", "password");
>
> // Enable encrypted data channel
> p.put("config.listeners.default.data-connection.class",
> "org.apache.ftpserver.DefaultDataConnectionConfig");
> p.put("config.listeners.default.data-connection.ssl.class",
> "org.apache.ftpserver.ssl.DefaultSsl");
> log.info("SETTING IDLE TIMEOUT");
> p.put("config.listeners.default.data-connection.idle-timeout",
> "300");
> log.info("DONE SETTING IDLE TIMEOUT");
> // p.put("config.listeners.default.data-connection.passive.address",
> "localhost");
> p.put("config.listeners.default.data-connection.passive.ports",
> "5000-5010");
> p.put("config.listeners.default.data-connection.ssl.keystore-file",
> keystoreLoc);
>
> p.put("config.listeners.default.data-connection.ssl.keystore-password",
> "password");
> p.put("config.listeners.default.data-connection.ssl.keystore-type",
> "JKS");
>
> p.put("config.listeners.default.data-connection.ssl.keystore-algorithm",
> "SunX509");
> p.put("config.listeners.default.data-connection.ssl.ssl-protocol",
> "TLS");
>
> p.put("config.listeners.default.data-connection.ssl.client-authentication",
> "false");
>
> p.put("config.connection-manager.max-connection", 100); // No Limit
> p.put("config.connection-manager.max-login", 100); // No Limit
>
> // User Manager
> p.put("config.file-system-manager.create-home", "true");
> // p.put("config.user-manager.class",
> "org.apache.ftpserver.usermanager.PropertiesUserManager");
> // p.put("config.user-manager.admin", "efe");
> // p.put("config.user-mananger.prop-file", userfile);
> // p.put("config.user.manager.prop-password-encrypt", "false");
> //
> // System.out.println("UserFile = " + userfile);
> return p;
> }
>