[jira] [Work logged] (SSHD-1042) Command Limiting Policy SSH_FXP_READDIR closing connection

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/SSHD-1042?focusedWorklogId=464126=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-464126
 ]

ASF GitHub Bot logged work on SSHD-1042:


Author: ASF GitHub Bot
Created on: 29/Jul/20 17:38
Start Date: 29/Jul/20 17:38
Worklog Time Spent: 10m 
  Work Description: tomaswolf closed pull request #151:
URL: https://github.com/apache/mina-sshd/pull/151


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 464126)
Time Spent: 40m  (was: 0.5h)

> Command Limiting Policy SSH_FXP_READDIR closing connection
> --
>
> Key: SSHD-1042
> URL: https://issues.apache.org/jira/browse/SSHD-1042
> Project: MINA SSHD
>  Issue Type: New Feature
>Reporter: Shahbaz
>Assignee: Lyor Goldstein
>Priority: Major
> Fix For: 2.6.0
>
> Attachments: apache rmdir.PNG, maverick filesystem.PNG
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> *This are the below commands which prevent the execution of process for the 
> user at instance level relating to permission of open, read, write, opendir, 
> readdir, remove, rename, makedir, removedir respectively.*
> *SSH_FXP_OPEN*
>  *SSH_FXP_READ*
>  *SSH_FXP_WRITE*
>  *SSH_FXP_OPENDIR*
>  *SSH_FXP_READDIR*
>  *SSH_FXP_REMOVE*
>  *SSH_FXP_RENAME*
>  *SSH_FXP_MKDIR*
>  *SSH_FXP_RMDIR*
> *But the command for* *SSH_FXP_READDIR is not executed as it directly closes 
> the connection. This connection is closed because while throwing the 
> exception it directly calls destroy method from filesystem. Is there any 
> workaround to inhibit its execution when we extend sftpsubsytem class where 
> exception is thrown.***
> *While reading the directory when SH_FXP_READDIR is applied, the operation is 
> interrupted, as it evokes the destroy function to close the connection 
> directly when an IOException is thrown. The issue is how can we make sure the 
> destroy function is not called, when exception is thrown in a class which 
> extends SFTPSubsystem.*
>  
> *Exact working scenarios of the above issue:* 
> We have our implementation of Command Limiting Policy to prevent specific IP 
> addresses or users from executing 
>  certain commands on an SFTP server.  
>  After validation of the policy, we don't want user to perform the operation 
> based on the command which is applied on the policy. 
>  For example: When the SSH_FXP_OPENDIR is invoked, the user is restricted 
> from open directory operation. 
>  Our issue is related to command SSH_FXP_READDIR command.
>  Expected Behaviour : Prevent user from reading the directory when sftp ls 
> command is executed, by giving the message like "Unable to read the 
> directory". 
>  But we see that, though we throw AcessDeniedException on validating the 
> policy, the connection is getting closed, and we get an error as "Connection 
> closed". 
>  We have the same implementation for validating the policy and we throw 
> AcessDeniedException in case of all the sftp commands(if we need to prevent 
> the user/ip)
>  We find that all the sftp commands work as expected, except SSH_FXP_READDIR. 
> The difference we find is that destroy() method in SFTP Subsystem is getting 
> invoked after our policy validation in SSH_FXP_READDIR. In case of all other 
> commands, we dont see destro() getting invoked.
>  
> Is there any specific thing that needs to be handled in our implementation to 
> prevent destroy() from getting invoked and connection getting closed. We are 
> unable to find why destroy() is invoked in case of SSH_FXP_READDIR command, 
> even though AcessDeniedException is thrown from our implementation.
>  
>  
>  
> *Below attached are the images which shows how destroy is invoked in both 
> maverick and apache case.* 
>  
>  
>  
>  



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

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



[jira] [Work logged] (SSHD-1042) Command Limiting Policy SSH_FXP_READDIR closing connection

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/SSHD-1042?focusedWorklogId=463681=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463681
 ]

ASF GitHub Bot logged work on SSHD-1042:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:21
Start Date: 29/Jul/20 07:21
Worklog Time Spent: 10m 
  Work Description: tomaswolf commented on a change in pull request #151:
URL: https://github.com/apache/mina-sshd/pull/151#discussion_r461132590



##
File path: 
sshd-sftp/src/main/java/org/apache/sshd/sftp/server/SftpEventListener.java
##
@@ -35,6 +36,32 @@
  * @author mailto:dev@mina.apache.org;>Apache MINA SSHD Project
  */
 public interface SftpEventListener extends SshdEventListener {
+
+/**
+ * Called when a SFTP request has been received before it is processed.
+ *
+ * @param  session The {@link ServerSession} through which the request 
was received
+ * @param  typeThe request type; one of the {@code SSH_FXP_*} 
constants from {@link SftpConstants}
+ * @param  id  The id received with the request
+ * @throws IOException If the request shall generate an error response. 
Throwing an exception for
+ * {@code type = }{@link SftpConstants#SSH_FXP_INIT} 
closes the session.
+ */
+default void received(ServerSession session, int type, int id) throws 
IOException {
+// empty
+}
+
+/**
+ * Called when a SFTP extension request {@link 
SftpConstants#SSH_FXP_EXTENDED} has been received before it is processed.
+ *
+ * @param  session The {@link ServerSession} through which the request 
was received
+ * @param  extension   The extension request received; one of the {@code 
SSH_EXT_*} constants from {@link SftpConstants}
+ * @param  id  The id received with the request
+ * @throws IOException If the request shall generate an error response.
+ */
+default void receivedExtension(ServerSession session, String extension, 
int id) throws IOException {
+// empty
+}
+

Review comment:
   These callbacks would enable the SB2Bi team to implement their "Command 
Limiting Policy" via an SftpEventListener.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463681)
Time Spent: 20m  (was: 10m)

> Command Limiting Policy SSH_FXP_READDIR closing connection
> --
>
> Key: SSHD-1042
> URL: https://issues.apache.org/jira/browse/SSHD-1042
> Project: MINA SSHD
>  Issue Type: New Feature
>Reporter: Shahbaz
>Assignee: Lyor Goldstein
>Priority: Major
> Fix For: 2.6.0
>
> Attachments: apache rmdir.PNG, maverick filesystem.PNG
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> *This are the below commands which prevent the execution of process for the 
> user at instance level relating to permission of open, read, write, opendir, 
> readdir, remove, rename, makedir, removedir respectively.*
> *SSH_FXP_OPEN*
>  *SSH_FXP_READ*
>  *SSH_FXP_WRITE*
>  *SSH_FXP_OPENDIR*
>  *SSH_FXP_READDIR*
>  *SSH_FXP_REMOVE*
>  *SSH_FXP_RENAME*
>  *SSH_FXP_MKDIR*
>  *SSH_FXP_RMDIR*
> *But the command for* *SSH_FXP_READDIR is not executed as it directly closes 
> the connection. This connection is closed because while throwing the 
> exception it directly calls destroy method from filesystem. Is there any 
> workaround to inhibit its execution when we extend sftpsubsytem class where 
> exception is thrown.***
> *While reading the directory when SH_FXP_READDIR is applied, the operation is 
> interrupted, as it evokes the destroy function to close the connection 
> directly when an IOException is thrown. The issue is how can we make sure the 
> destroy function is not called, when exception is thrown in a class which 
> extends SFTPSubsystem.*
>  
> *Exact working scenarios of the above issue:* 
> We have our implementation of Command Limiting Policy to prevent specific IP 
> addresses or users from executing 
>  certain commands on an SFTP server.  
>  After validation of the policy, we don't want user to perform the operation 
> based on the command which is applied on the policy. 
>  For example: When the SSH_FXP_OPENDIR is invoked, the user is restricted 
> from open directory operation. 
>  Our issue is related to command SSH_FXP_READDIR command.
>  Expected Behaviour : Prevent user from reading the directory when sftp ls 
> command is executed, by giving the message like "Unable to read 

[jira] [Work logged] (SSHD-1042) Command Limiting Policy SSH_FXP_READDIR closing connection

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/SSHD-1042?focusedWorklogId=463732=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463732
 ]

ASF GitHub Bot logged work on SSHD-1042:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:27
Start Date: 29/Jul/20 07:27
Worklog Time Spent: 10m 
  Work Description: lgoldstein commented on pull request #151:
URL: https://github.com/apache/mina-sshd/pull/151#issuecomment-665071196


   Merged - split into 2 commits [`DirectoryHandle` related 
one](https://github.com/apache/mina-sshd/commit/50391abbd285d331a33f4ce9f300afeb99b078ed)
 and [`SftpEventListener` 
one](https://github.com/apache/mina-sshd/commit/20c2392d2b5f933c43ac60d530e6f95d44c08509).
   
   Added also a [specific 
`readingEntries`](https://github.com/apache/mina-sshd/commit/192ad6acdf24b7b7c8714b8d5fe4c95cc7d8de4d)
 API that would enable implementing the policy referenced in the issue more 
easily
   
   Please close the PR - many thanks.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463732)
Time Spent: 0.5h  (was: 20m)

> Command Limiting Policy SSH_FXP_READDIR closing connection
> --
>
> Key: SSHD-1042
> URL: https://issues.apache.org/jira/browse/SSHD-1042
> Project: MINA SSHD
>  Issue Type: New Feature
>Reporter: Shahbaz
>Assignee: Lyor Goldstein
>Priority: Major
> Fix For: 2.6.0
>
> Attachments: apache rmdir.PNG, maverick filesystem.PNG
>
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> *This are the below commands which prevent the execution of process for the 
> user at instance level relating to permission of open, read, write, opendir, 
> readdir, remove, rename, makedir, removedir respectively.*
> *SSH_FXP_OPEN*
>  *SSH_FXP_READ*
>  *SSH_FXP_WRITE*
>  *SSH_FXP_OPENDIR*
>  *SSH_FXP_READDIR*
>  *SSH_FXP_REMOVE*
>  *SSH_FXP_RENAME*
>  *SSH_FXP_MKDIR*
>  *SSH_FXP_RMDIR*
> *But the command for* *SSH_FXP_READDIR is not executed as it directly closes 
> the connection. This connection is closed because while throwing the 
> exception it directly calls destroy method from filesystem. Is there any 
> workaround to inhibit its execution when we extend sftpsubsytem class where 
> exception is thrown.***
> *While reading the directory when SH_FXP_READDIR is applied, the operation is 
> interrupted, as it evokes the destroy function to close the connection 
> directly when an IOException is thrown. The issue is how can we make sure the 
> destroy function is not called, when exception is thrown in a class which 
> extends SFTPSubsystem.*
>  
> *Exact working scenarios of the above issue:* 
> We have our implementation of Command Limiting Policy to prevent specific IP 
> addresses or users from executing 
>  certain commands on an SFTP server.  
>  After validation of the policy, we don't want user to perform the operation 
> based on the command which is applied on the policy. 
>  For example: When the SSH_FXP_OPENDIR is invoked, the user is restricted 
> from open directory operation. 
>  Our issue is related to command SSH_FXP_READDIR command.
>  Expected Behaviour : Prevent user from reading the directory when sftp ls 
> command is executed, by giving the message like "Unable to read the 
> directory". 
>  But we see that, though we throw AcessDeniedException on validating the 
> policy, the connection is getting closed, and we get an error as "Connection 
> closed". 
>  We have the same implementation for validating the policy and we throw 
> AcessDeniedException in case of all the sftp commands(if we need to prevent 
> the user/ip)
>  We find that all the sftp commands work as expected, except SSH_FXP_READDIR. 
> The difference we find is that destroy() method in SFTP Subsystem is getting 
> invoked after our policy validation in SSH_FXP_READDIR. In case of all other 
> commands, we dont see destro() getting invoked.
>  
> Is there any specific thing that needs to be handled in our implementation to 
> prevent destroy() from getting invoked and connection getting closed. We are 
> unable to find why destroy() is invoked in case of SSH_FXP_READDIR command, 
> even though AcessDeniedException is thrown from our implementation.
>  
>  
>  
> *Below attached are the images which shows how destroy is invoked in both 
> maverick and apache case.* 
>  
>  
>  
>  



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


[jira] [Work logged] (SSHD-1042) Command Limiting Policy SSH_FXP_READDIR closing connection

2020-07-29 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/SSHD-1042?focusedWorklogId=463613=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-463613
 ]

ASF GitHub Bot logged work on SSHD-1042:


Author: ASF GitHub Bot
Created on: 29/Jul/20 07:15
Start Date: 29/Jul/20 07:15
Worklog Time Spent: 10m 
  Work Description: tomaswolf opened a new pull request #151:
URL: https://github.com/apache/mina-sshd/pull/151


   * Call opening() for DirectoryHandle
   * Add received() and receivedExtension() called just after a
 command has been received.



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 463613)
Remaining Estimate: 0h
Time Spent: 10m

> Command Limiting Policy SSH_FXP_READDIR closing connection
> --
>
> Key: SSHD-1042
> URL: https://issues.apache.org/jira/browse/SSHD-1042
> Project: MINA SSHD
>  Issue Type: New Feature
>Reporter: Shahbaz
>Assignee: Lyor Goldstein
>Priority: Major
> Fix For: 2.6.0
>
> Attachments: apache rmdir.PNG, maverick filesystem.PNG
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> *This are the below commands which prevent the execution of process for the 
> user at instance level relating to permission of open, read, write, opendir, 
> readdir, remove, rename, makedir, removedir respectively.*
> *SSH_FXP_OPEN*
>  *SSH_FXP_READ*
>  *SSH_FXP_WRITE*
>  *SSH_FXP_OPENDIR*
>  *SSH_FXP_READDIR*
>  *SSH_FXP_REMOVE*
>  *SSH_FXP_RENAME*
>  *SSH_FXP_MKDIR*
>  *SSH_FXP_RMDIR*
> *But the command for* *SSH_FXP_READDIR is not executed as it directly closes 
> the connection. This connection is closed because while throwing the 
> exception it directly calls destroy method from filesystem. Is there any 
> workaround to inhibit its execution when we extend sftpsubsytem class where 
> exception is thrown.***
> *While reading the directory when SH_FXP_READDIR is applied, the operation is 
> interrupted, as it evokes the destroy function to close the connection 
> directly when an IOException is thrown. The issue is how can we make sure the 
> destroy function is not called, when exception is thrown in a class which 
> extends SFTPSubsystem.*
>  
> *Exact working scenarios of the above issue:* 
> We have our implementation of Command Limiting Policy to prevent specific IP 
> addresses or users from executing 
>  certain commands on an SFTP server.  
>  After validation of the policy, we don't want user to perform the operation 
> based on the command which is applied on the policy. 
>  For example: When the SSH_FXP_OPENDIR is invoked, the user is restricted 
> from open directory operation. 
>  Our issue is related to command SSH_FXP_READDIR command.
>  Expected Behaviour : Prevent user from reading the directory when sftp ls 
> command is executed, by giving the message like "Unable to read the 
> directory". 
>  But we see that, though we throw AcessDeniedException on validating the 
> policy, the connection is getting closed, and we get an error as "Connection 
> closed". 
>  We have the same implementation for validating the policy and we throw 
> AcessDeniedException in case of all the sftp commands(if we need to prevent 
> the user/ip)
>  We find that all the sftp commands work as expected, except SSH_FXP_READDIR. 
> The difference we find is that destroy() method in SFTP Subsystem is getting 
> invoked after our policy validation in SSH_FXP_READDIR. In case of all other 
> commands, we dont see destro() getting invoked.
>  
> Is there any specific thing that needs to be handled in our implementation to 
> prevent destroy() from getting invoked and connection getting closed. We are 
> unable to find why destroy() is invoked in case of SSH_FXP_READDIR command, 
> even though AcessDeniedException is thrown from our implementation.
>  
>  
>  
> *Below attached are the images which shows how destroy is invoked in both 
> maverick and apache case.* 
>  
>  
>  
>  



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

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