Back to product page
- Introduction
- Overview
- License agreement
- Getting Started
- Objects
- Enumerations
- wodSSHD
- Methods
- Properties
- Events
- Connecting
- CryptoInformation
- Disconnected
- LoginGSSAPI
- LoginPassword
- LoginPubkey
- PortBindRequest
- PortForwardConnect
- PortForwardDisconnect
- PortForwardRequest
- Received
- ServiceRequest
- ServiceStart
- SftpDeleteFile
- SftpDownloadFile
- SftpFileTransferData
- SftpListDir
- SftpListDirData
- SftpMakeDir
- SftpProgress
- SftpRemoveDir
- SftpRename
- SftpTransferComplete
- SftpUploadFile
- StateChanged
- IwodSSHDNotify
- Methods
- Connecting
- CryptoInformation
- Disconnected
- LoginGSSAPI
- LoginPassword
- LoginPubkey
- PortBindRequest
- PortForwardConnect
- PortForwardDisconnect
- PortForwardRequest
- Received
- ServiceRequest
- ServiceStart
- SftpDeleteFile
- SftpDownloadFile
- SftpFileTransferData
- SftpListDir
- SftpListDirData
- SftpMakeDir
- SftpProgress
- SftpRemoveDir
- SftpRename
- SftpTransferComplete
- SftpUploadFile
- StateChanged
- Methods
- SSHKeyPair
- SSHUser
- SSHUsers
- How to get support
- Technical information
- Fast notifications
- Error list
ServiceRequest event
Fires when user requests some service from the server.
Syntax
- Basic
Private Sub object_ServiceRequest(User, ServiceIndex, ServiceType, ServicePath, Action)
The ServiceRequest(object,User,ServiceIndex,ServiceType,Action) syntax has these parts:
The ServiceRequest(object,User,ServiceIndex,ServiceType,Action) syntax has these parts:
object | A wodSSHD object. Reference to user who is requesting new service. |
User | A SSHUser object. |
ServiceIndex | An Integer value. Index of new service, starts from 0. |
ServiceType | A SSHServiceTypes enumeration, as described in settings. Type of the service. |
Action | A SSHActions enumeration, as described in settings. Determines if user is allowed to use a service, or not |
Remarks
The settings for ServiceType are:
Constant | Value | Description |
---|---|---|
stNone | 0 | No service |
stShell | 1 | Command prompt. |
stExecute | 2 | Execute program. |
stSubsystem | 3 | External subsystem. |
stPortForwarding | 4 | Port forwarding. |
stSCP | 5 | Secure file copy. |
The settings for Action are:
Constant | Value | Description |
---|---|---|
Deny | 0 | Deny execution of the action. |
Allow | 1 | Allow to execute action. |
ServiceRequest is fired after successful authentication of the user with your server. At this point (but also it is possible later to occur) user will request some service, such as to execute shell or some program on your system, or to start SFTP server (implemented internally by wodSSHD). Most important thing you should do is to decide whether you will allow the user to use requested service, or not. If you allow such request, set Action variable to Allow, otherwise set it to Deny.
You should make your choices based mostly on ServiceType argument, so make sure to check its value. It will never contain stNone constant, because such service is not known by the client (client cannot request 'no new service'). However, it is possible that you change it to stNone if client requests, for example, stShell. You may do is if you don't want client to see shell command prompt, but rather to see some dialog your prepared for him.
It is also possible to redirect shShell requests to stExecute. For example, user requests the shell, but you set ServiceType to stExecute, and point ServicePath to some program and the client will never know the difference. This is very practical when you want clients to use some restricted environments, such as BBS (bulletin board systems) or similar.
It makes no sense to change ServiceType if, for example, SFTP subsystem was requested. You can change it to something else, like stNone, but since the client is not prepared to accept data in different format than requested, it will most probably disconnect after first received (unknown) packet.
ServicePath variable will hold information about actual EXE file that will be executed for this service. For stShell it will point to your CMD.EXE file (on Windows 9x this will be COMMAND.COM), and for stExecute it will point to file user requested. Be sure to check this value so you don't allow user to execute just anything.
Since version 1.1.1 you can change any of requested services to stPortForwarding - to force redirection of the service to external system. For example, you might want to redirect stShell requests to some other UNIX system's TELNET protocol service, etc. When you do this, wodSSHServer will fire PortForwardRequest event with RemoteHost="" and RemotePort=0 arguments, where you must change them to redirect to the service you want.
Since version 1.2.4. SCP transfers can be used also. When client tries to SCP (secure copy) file to/from wodSSHServer, ServiceRequest will contain stSCP value in ServiceType argument. After you accept it, SftpDownloadFile or SftpUploadFile events will be fired providing you with information about file that is to be downloaded/uploaded.