You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Lyor Goldstein (Jira)" <ji...@apache.org> on 2021/04/20 17:12:00 UTC

[jira] [Comment Edited] (SSHD-1127) SFTP/SCP SftpErrorStatusDataHandler is not propagating back proper custom messages to the client

    [ https://issues.apache.org/jira/browse/SSHD-1127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17325968#comment-17325968 ] 

Lyor Goldstein edited comment on SSHD-1127 at 4/20/21, 5:11 PM:
----------------------------------------------------------------

See [Sending custom data via STDERR channel data to the client|https://github.com/apache/mina-sshd/blob/master/docs/sftp.md#sending-custom-data-via-stderr-channel-data-to-the-client] and [Intercepting data sent via STDERR channel data from the client|https://github.com/apache/mina-sshd/blob/master/docs/sftp.md#intercepting-data-sent-via-stderr-channel-data-from-the-client]. Note that this deals only with +server+ handling custom error messages - we currently do not have support for client consuming these messages


was (Author: lgoldstein):
See [Sending custom data via STDERR channel data to the client|https://github.com/apache/mina-sshd/blob/master/docs/sftp.md#sending-custom-data-via-stderr-channel-data-to-the-client]. Note that this deals only with +server+ sending error messages - we currently do not have support for client consuming these messages

> SFTP/SCP SftpErrorStatusDataHandler is not propagating back proper custom messages to the client
> ------------------------------------------------------------------------------------------------
>
>                 Key: SSHD-1127
>                 URL: https://issues.apache.org/jira/browse/SSHD-1127
>             Project: MINA SSHD
>          Issue Type: Improvement
>            Reporter: Susmit Sarkar
>            Assignee: Lyor Goldstein
>            Priority: Minor
>
> Hi Team,
> *SftpErrorStatusDataHandler* is not propagating back proper custom messages to the client. Although it works fine with clients like FileZilla and WinSCP, we don't get a proper message for Unix-based SFTP command-line client.
> We can say that there is no issue with the implementation as it's working for clients like FileZilla and WinScp, so the code is fine. I agree with you on that.
> But commercial sftp server libraries are able to successfully propagate messages to all clients FileZilla, WinScp, Putty, Terminal.
> As for example, Maverick based SFTP server uses this API:
> {code:java}
> // code placeholder
> import com.maverick.sshd.SessionChannel;
> SessionChannel.sendStderrData("Too many concurrent logins. Please try again later.\n".getBytes("US-ASCII"));{code}
> [http://maverick-legacy-server-javadocs.s3-website-eu-west-1.amazonaws.com/com/maverick/sshd/SessionChannel.html#sendStderrData-byte:A-]
> I think a similar implementation should be introduced in the MINA library for future release.
> While reading the doc I came across this: ([https://github.com/apache/mina-sshd/blob/ac45b617272303058193db193650e7f2db3d1872/docs/sftp.md])
> If the registered handler implements {{ChannelSessionAware}} then it will also be informed of the registered {{ChannelSession}} when it is provided to the {{SftpSubsystem}} itself. This can be used to register an extended data writer that can handle data sent via the STDERR channel. *Note:* this feature is allowed according to [SFTP version 4 - section 3.1|https://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-3.1]:
> Packets are sent and received on stdout and stdin. Data sent on stderr by the server SHOULD be considered debug or supplemental error information, and MAY be displayed to the user.
> *however, the current code provides no built-in support for this feature.*
> sftp> PUT docker-compose.yml
>  debug3: Looking up docker-compose.yml
>  Uploading docker-compose.yml to /dmicons/docker-compose.yml
>  debug3: Sent message SSH2_FXP_OPEN I:8 P:/dmicons/docker-compose.yml
>  remote open("/dmicons/docker-compose.yml"): Failure
> *---------------------------------------------------------------*
> Same operation in WinScp loggers are coming as:
> 2021-02-17 18:42:44.322 - Uploading a file to a full filesystem (HDD).
>  * 2021-02-17 18:42:44.322 - Exceeding a user disk quota.
>  . 2021-02-17 18:42:44.322 Asking user:
>  . 2021-02-17 18:42:44.322 Cannot create remote file '/dmicons/IBM_UserTest.log'. ("General failure (server should provide error description).
>  . 2021-02-17 18:42:44.322 Error code: 4
>  . 2021-02-17 18:42:44.322 *Error message from server: User admin is not allowed to execute this SFTP command because of policy SFTP20*
> Thanks,
> Susmit 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org