God you're fast. I made my own attempts and attached diff files to the JIRA
issue you created. I also added a couple of comments/suggestions to the
issue.

In short I believe that it is probably easier for the user/developer if it
is enough to specify whether a secure data channel should be used or not
(the default should be true). Adding more detailed options, like you did, is
of course just a benefit as long as it is possible to also configure it the
easy way (like I described).

I haven't tested your changes yet - will do. I have done some limited
testing with my own version, but only in passive mode. If you use a secure
data channel in active mode one must first create a public/private key pair
for the ftps client to use and I haven't gotten around to testing that yet.

/Bengt

2010/6/4 Claus Ibsen <claus.ib...@gmail.com>

> Hi
>
> On Fri, Jun 4, 2010 at 3:42 PM, Bengt Rodehav <be...@rodehav.com> wrote:
> > OK, will try to do that sometime this weekend.
> >
> > Will be in touch,
> >
>
> I was one step ahead of you. I created the ticket and took a stab at
> resolving it.
> https://issues.apache.org/activemq/browse/CAMEL-2790
>
> Can you try with the latest source code? And maybe if there is still
> some issue then work on a patch from there.
> Would be lovely with an unit test, but the test ftp server we use
> cannot understand the secure data transfer.
>
> Anyway would be awesome if you could test it on your real systems.
>
>
>
> > /Bengt
> >
> > 2010/6/4 Claus Ibsen <claus.ib...@gmail.com>
> >
> >> Hi
> >>
> >> Well spotted. Do you mind creating a JIRA ticket and link to this post
> >> using nabble etc.
> >> And you may even want to contribute a patch :)
> >>
> >>
> >> On Fri, Jun 4, 2010 at 11:34 AM, Bengt Rodehav <be...@rodehav.com>
> wrote:
> >> > I'm using camel-ftp for secure ftps communication. I need to be able
> to
> >> > connect to a wide range of ftps servers in both explicit and implicit
> >> mode.
> >> > I have encountered problems using camel-ftp for ftps communication in
> >> > implicit mode.
> >> >
> >> > Some ftps servers require that the file transfer is encrypted (not
> just
> >> the
> >> > commands). This is of course very natural and is the reason why ftps
> is
> >> > chosen in the first place. However, commons-net (which camel-ftp uses)
> >> does
> >> > (for some reason) not by default setup a secure channel for file
> >> transfers.
> >> > It has to be requested by code similar to the following:
> >> >
> >> >  ftpsClient.execPBSZ(0);
> >> >  ftpsClient.execPROT("P");
> >> >
> >> > I suggest to add an option to camel-ftp, regarding ftps, to make it
> >> possible
> >> > to specify whether the data channel will be encrypted or not.
> Encrypted
> >> > should be default.
> >> >
> >> > When looking at the code in camel-ftp it seems like there is no
> special
> >> > handling during connect for ftps compared to ftp. Thus there is no
> >> natural
> >> > place to put the above code. One way is to add something like the
> >> following
> >> > at the end of the method "connect" in the class "FtpOperations":
> >> >
> >> >  if(client instanceof FTPSClient) {
> >> >    FTPSClient ftpsClient = (FTPSClient)client;
> >> >    try {
> >> >      if (useSecureDataChannel) { // useSecureDataChannel should be
> >> > initialized from the configuration somehow
> >> >        ftpsClient.execPBSZ(0);
> >> >        ftpsClient.execPROT("P");
> >> >      }
> >> >    } catch (SSLException e) {
> >> >      throw new
> GenericFileOperationFailedException(client.getReplyCode(),
> >> > client.getReplyString(), e.getMessage(), e);
> >> >    } catch (IOException e) {
> >> >      throw new
> GenericFileOperationFailedException(client.getReplyCode(),
> >> > client.getReplyString(), e.getMessage(), e);
> >> >    }
> >> >  }
> >> >
> >> > Am I the only one having problems with this? Maybe there is a
> workaround
> >> > that I haven't figured out.
> >> >
> >> > /Bengt
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> Apache Camel Committer
> >>
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >> Open Source Integration: http://fusesource.com
> >> Blog: http://davsclaus.blogspot.com/
> >> Twitter: http://twitter.com/davsclaus
> >>
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Reply via email to