You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Sampo Savolainen <sa...@spatineo.com> on 2014/09/04 10:53:31 UTC

SSHD and error messages to clients

Hi,

I asked this on the users mailing list last week, but got no reply. As this
list seems to be more active, I thought I'd see if anyone here could answer
my question.

I'm using the org.apache.sshd to run a custom sftp server that receives
files from users. The server imposes some restrictions on what kinds of
files it will accept. The problem is that though these restrictions are
documented, the users sometimes get confused by the server not accepting a
file. Does the sftp protocol allow for the server to send a custom string
to the user which (hopefully) the client software will present to the user?
If so, how can I get SSHD to send such messages to the clients?


  Sampo

-- 
Sampo Savolainen
R&D Director, Spatineo Oy
sampo.savolainen@spatineo.com
+358-407555649
Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
www.spatineo.com, twitter.com/#!/spatineo
www.linkedin.com/company/spatineo-inc

This message may contain privileged and/or confidential information. If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate, or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.

Re: SSHD and error messages to clients

Posted by Sampo Savolainen <sa...@spatineo.com>.
Hi,

Thanks. I see that SSHD is passing the exception messages to the
SSH_FX_FAILURE messages as you said.

For some reason it seems clients ignore these messages though. I tried
adding all possible verbose logging options in the openssh sftp client and
still couldn't get it to show the messages. Such a shame!

It seems I need to figure out another way of passing the error messages to
clients. Thanks for the help.


  Sampo


On Fri, Sep 5, 2014 at 9:42 AM, Guillaume Nodet <gn...@apache.org> wrote:

> If you have overriden the FileSystemView, throwing any kind of IOException
> will usually result in a SSH_FX_FAILURE status to be sent.
> For example, when opening a file, instead of returning false in
> isWritable(), try throwing an IOException there.
>
>
> 2014-09-05 8:29 GMT+02:00 Sampo Savolainen <sampo.savolainen@spatineo.com
> >:
>
> > Hi Guillaume,
> >
> > Thanks! This sounds promising. I do realize that it's up to the client to
> > show the error, so this is not a foolproof mechanism by any measure.
> >
> > Is there an exception that I can throw from which the exception message
> is
> > automatically inserted to the SSH_FX_FAILURE status? Or do I have to
> modify
> > the SftpSubsystem?
> >
> >
> >  Sampo
> >
> >
> > On Thu, Sep 4, 2014 at 12:07 PM, Guillaume Nodet <gn...@apache.org>
> > wrote:
> >
> > > When an exception occurs in the SftpSubsystem, a SSH_FX_FAILURE status
> > will
> > > be sent back to the user with the exception message.  This could be a
> way
> > > for you to send a custom message.
> > > As to whether it will be displayed by the client or not, i've no idea,
> > and
> > > I suppose it depends on the client...
> > >
> > >
> > > 2014-09-04 10:53 GMT+02:00 Sampo Savolainen <
> > sampo.savolainen@spatineo.com
> > > >:
> > >
> > > > Hi,
> > > >
> > > > I asked this on the users mailing list last week, but got no reply.
> As
> > > this
> > > > list seems to be more active, I thought I'd see if anyone here could
> > > answer
> > > > my question.
> > > >
> > > > I'm using the org.apache.sshd to run a custom sftp server that
> receives
> > > > files from users. The server imposes some restrictions on what kinds
> of
> > > > files it will accept. The problem is that though these restrictions
> are
> > > > documented, the users sometimes get confused by the server not
> > accepting
> > > a
> > > > file. Does the sftp protocol allow for the server to send a custom
> > string
> > > > to the user which (hopefully) the client software will present to the
> > > user?
> > > > If so, how can I get SSHD to send such messages to the clients?
> > > >
> > > >
> > > >   Sampo
> > > >
> > > > --
> > > > Sampo Savolainen
> > > > R&D Director, Spatineo Oy
> > > > sampo.savolainen@spatineo.com
> > > > +358-407555649
> > > > Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
> > > > www.spatineo.com, twitter.com/#!/spatineo
> > > > www.linkedin.com/company/spatineo-inc
> > > >
> > > > This message may contain privileged and/or confidential information.
> If
> > > you
> > > > have received this e-mail in error or are not the intended recipient,
> > you
> > > > may not use, copy, disseminate, or distribute it; do not open any
> > > > attachments, delete it immediately from your system and notify the
> > sender
> > > > promptly by e-mail that you have done so.
> > > >
> > >
> >
> >
> >
> > --
> > Sampo Savolainen
> > R&D Director, Spatineo Oy
> > sampo.savolainen@spatineo.com
> > +358-407555649
> > Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
> > www.spatineo.com, twitter.com/#!/spatineo
> > www.linkedin.com/company/spatineo-inc
> >
> > This message may contain privileged and/or confidential information. If
> you
> > have received this e-mail in error or are not the intended recipient, you
> > may not use, copy, disseminate, or distribute it; do not open any
> > attachments, delete it immediately from your system and notify the sender
> > promptly by e-mail that you have done so.
> >
>



-- 
Sampo Savolainen
R&D Director, Spatineo Oy
sampo.savolainen@spatineo.com
+358-407555649
Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
www.spatineo.com, twitter.com/#!/spatineo
www.linkedin.com/company/spatineo-inc

This message may contain privileged and/or confidential information. If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate, or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.

Re: SSHD and error messages to clients

Posted by Guillaume Nodet <gn...@apache.org>.
If you have overriden the FileSystemView, throwing any kind of IOException
will usually result in a SSH_FX_FAILURE status to be sent.
For example, when opening a file, instead of returning false in
isWritable(), try throwing an IOException there.


2014-09-05 8:29 GMT+02:00 Sampo Savolainen <sa...@spatineo.com>:

> Hi Guillaume,
>
> Thanks! This sounds promising. I do realize that it's up to the client to
> show the error, so this is not a foolproof mechanism by any measure.
>
> Is there an exception that I can throw from which the exception message is
> automatically inserted to the SSH_FX_FAILURE status? Or do I have to modify
> the SftpSubsystem?
>
>
>  Sampo
>
>
> On Thu, Sep 4, 2014 at 12:07 PM, Guillaume Nodet <gn...@apache.org>
> wrote:
>
> > When an exception occurs in the SftpSubsystem, a SSH_FX_FAILURE status
> will
> > be sent back to the user with the exception message.  This could be a way
> > for you to send a custom message.
> > As to whether it will be displayed by the client or not, i've no idea,
> and
> > I suppose it depends on the client...
> >
> >
> > 2014-09-04 10:53 GMT+02:00 Sampo Savolainen <
> sampo.savolainen@spatineo.com
> > >:
> >
> > > Hi,
> > >
> > > I asked this on the users mailing list last week, but got no reply. As
> > this
> > > list seems to be more active, I thought I'd see if anyone here could
> > answer
> > > my question.
> > >
> > > I'm using the org.apache.sshd to run a custom sftp server that receives
> > > files from users. The server imposes some restrictions on what kinds of
> > > files it will accept. The problem is that though these restrictions are
> > > documented, the users sometimes get confused by the server not
> accepting
> > a
> > > file. Does the sftp protocol allow for the server to send a custom
> string
> > > to the user which (hopefully) the client software will present to the
> > user?
> > > If so, how can I get SSHD to send such messages to the clients?
> > >
> > >
> > >   Sampo
> > >
> > > --
> > > Sampo Savolainen
> > > R&D Director, Spatineo Oy
> > > sampo.savolainen@spatineo.com
> > > +358-407555649
> > > Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
> > > www.spatineo.com, twitter.com/#!/spatineo
> > > www.linkedin.com/company/spatineo-inc
> > >
> > > This message may contain privileged and/or confidential information. If
> > you
> > > have received this e-mail in error or are not the intended recipient,
> you
> > > may not use, copy, disseminate, or distribute it; do not open any
> > > attachments, delete it immediately from your system and notify the
> sender
> > > promptly by e-mail that you have done so.
> > >
> >
>
>
>
> --
> Sampo Savolainen
> R&D Director, Spatineo Oy
> sampo.savolainen@spatineo.com
> +358-407555649
> Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
> www.spatineo.com, twitter.com/#!/spatineo
> www.linkedin.com/company/spatineo-inc
>
> This message may contain privileged and/or confidential information. If you
> have received this e-mail in error or are not the intended recipient, you
> may not use, copy, disseminate, or distribute it; do not open any
> attachments, delete it immediately from your system and notify the sender
> promptly by e-mail that you have done so.
>

Re: SSHD and error messages to clients

Posted by Sampo Savolainen <sa...@spatineo.com>.
Hi Guillaume,

Thanks! This sounds promising. I do realize that it's up to the client to
show the error, so this is not a foolproof mechanism by any measure.

Is there an exception that I can throw from which the exception message is
automatically inserted to the SSH_FX_FAILURE status? Or do I have to modify
the SftpSubsystem?


 Sampo


On Thu, Sep 4, 2014 at 12:07 PM, Guillaume Nodet <gn...@apache.org> wrote:

> When an exception occurs in the SftpSubsystem, a SSH_FX_FAILURE status will
> be sent back to the user with the exception message.  This could be a way
> for you to send a custom message.
> As to whether it will be displayed by the client or not, i've no idea, and
> I suppose it depends on the client...
>
>
> 2014-09-04 10:53 GMT+02:00 Sampo Savolainen <sampo.savolainen@spatineo.com
> >:
>
> > Hi,
> >
> > I asked this on the users mailing list last week, but got no reply. As
> this
> > list seems to be more active, I thought I'd see if anyone here could
> answer
> > my question.
> >
> > I'm using the org.apache.sshd to run a custom sftp server that receives
> > files from users. The server imposes some restrictions on what kinds of
> > files it will accept. The problem is that though these restrictions are
> > documented, the users sometimes get confused by the server not accepting
> a
> > file. Does the sftp protocol allow for the server to send a custom string
> > to the user which (hopefully) the client software will present to the
> user?
> > If so, how can I get SSHD to send such messages to the clients?
> >
> >
> >   Sampo
> >
> > --
> > Sampo Savolainen
> > R&D Director, Spatineo Oy
> > sampo.savolainen@spatineo.com
> > +358-407555649
> > Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
> > www.spatineo.com, twitter.com/#!/spatineo
> > www.linkedin.com/company/spatineo-inc
> >
> > This message may contain privileged and/or confidential information. If
> you
> > have received this e-mail in error or are not the intended recipient, you
> > may not use, copy, disseminate, or distribute it; do not open any
> > attachments, delete it immediately from your system and notify the sender
> > promptly by e-mail that you have done so.
> >
>



-- 
Sampo Savolainen
R&D Director, Spatineo Oy
sampo.savolainen@spatineo.com
+358-407555649
Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
www.spatineo.com, twitter.com/#!/spatineo
www.linkedin.com/company/spatineo-inc

This message may contain privileged and/or confidential information. If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate, or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.

Re: SSHD and error messages to clients

Posted by Guillaume Nodet <gn...@apache.org>.
When an exception occurs in the SftpSubsystem, a SSH_FX_FAILURE status will
be sent back to the user with the exception message.  This could be a way
for you to send a custom message.
As to whether it will be displayed by the client or not, i've no idea, and
I suppose it depends on the client...


2014-09-04 10:53 GMT+02:00 Sampo Savolainen <sa...@spatineo.com>:

> Hi,
>
> I asked this on the users mailing list last week, but got no reply. As this
> list seems to be more active, I thought I'd see if anyone here could answer
> my question.
>
> I'm using the org.apache.sshd to run a custom sftp server that receives
> files from users. The server imposes some restrictions on what kinds of
> files it will accept. The problem is that though these restrictions are
> documented, the users sometimes get confused by the server not accepting a
> file. Does the sftp protocol allow for the server to send a custom string
> to the user which (hopefully) the client software will present to the user?
> If so, how can I get SSHD to send such messages to the clients?
>
>
>   Sampo
>
> --
> Sampo Savolainen
> R&D Director, Spatineo Oy
> sampo.savolainen@spatineo.com
> +358-407555649
> Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
> www.spatineo.com, twitter.com/#!/spatineo
> www.linkedin.com/company/spatineo-inc
>
> This message may contain privileged and/or confidential information. If you
> have received this e-mail in error or are not the intended recipient, you
> may not use, copy, disseminate, or distribute it; do not open any
> attachments, delete it immediately from your system and notify the sender
> promptly by e-mail that you have done so.
>