webssh2_client 0.2.25 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -150
- package/client/public/client.htm +38 -14
- package/client/public/webssh2.bundle.js +1 -1
- package/client/public/webssh2.css +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,35 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
WebSSH2 Client is an HTML5 web-based terminal emulator and SSH client. It uses WebSockets to communicate with a WebSSH2 server, which in turn uses SSH2 to connect to SSH servers.
|
|
5
|
+
WebSSH2 Client is an HTML5 web-based terminal emulator and SSH client component. It uses WebSockets to communicate with a WebSSH2 server, which in turn uses SSH2 to connect to SSH servers.
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
#
|
|
10
|
-
|
|
9
|
+
# Important Notice
|
|
10
|
+
This package contains only the browser-side client component of WebSSH2. It requires a compatible WebSSH2 server to function. The server component is available at [webssh2 server](https://github.com/billchurch/webssh2/tree/bigip-server). This package is intended for advanced users who want to customize or integrate the client component independently.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
The main idea behind bifurcating the client/server is to make it easier to customize the client to work in other frameworks and use cases.
|
|
15
|
-
|
|
16
|
-
## Table of Contents
|
|
17
|
-
|
|
18
|
-
- [Requirements](#requirements)
|
|
19
|
-
- [Installation](#installation)
|
|
20
|
-
- [Usage](#usage)
|
|
21
|
-
- [Configuration](#configuration)
|
|
22
|
-
- [Features](#features)
|
|
23
|
-
- [Routes](#routes)
|
|
24
|
-
- [Development](#development)
|
|
25
|
-
- [Advanced Configuration](#advanced-configuration)
|
|
26
|
-
- [Support](#support)
|
|
27
|
-
- [License](#license)
|
|
28
|
-
- [Acknowledgments](#acknowledgments)
|
|
12
|
+
# Status
|
|
13
|
+
This is an experimental refactor of the WebSSH2 v0.2.x client to function as a standalone component. It has been separated from the server-side code to facilitate customization and integration with different frameworks.
|
|
29
14
|
|
|
30
15
|
## Requirements
|
|
31
16
|
|
|
32
17
|
- Modern web browser with JavaScript enabled
|
|
33
|
-
- WebSSH2 server (
|
|
18
|
+
- Compatible WebSSH2 server instance (v0.2.x or compatible)
|
|
19
|
+
- Socket.IO v2.2.0 compatibility (due to server requirements)
|
|
34
20
|
|
|
35
21
|
## Installation
|
|
36
22
|
|
|
@@ -52,172 +38,91 @@ The main idea behind bifurcating the client/server is to make it easier to custo
|
|
|
52
38
|
|
|
53
39
|
4. The built client files will be in the `client/public` directory.
|
|
54
40
|
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
1. Set up and start the WebSSH2 server (see server README for instructions).
|
|
58
|
-
|
|
59
|
-
2. Access the web client by navigating to the server's URL, typically:
|
|
60
|
-
```
|
|
61
|
-
http://localhost:2222/ssh
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
3. You'll be prompted for host details and SSH credentials.
|
|
41
|
+
## Server Requirements
|
|
65
42
|
|
|
66
|
-
|
|
43
|
+
The WebSSH2 client requires a compatible server that provides:
|
|
67
44
|
|
|
68
|
-
|
|
45
|
+
- WebSocket endpoint for SSH communication
|
|
46
|
+
- Authentication handling
|
|
47
|
+
- SSH connection management
|
|
48
|
+
- Socket.IO v2.2.0 compatibility
|
|
69
49
|
|
|
70
|
-
|
|
71
|
-
- `header` - Optional header text
|
|
72
|
-
- `headerBackground` - Optional header background color
|
|
73
|
-
- `sshterm` - Terminal type for pty (default: xterm-color)
|
|
50
|
+
For server setup instructions, refer to the [WebSSH2 server documentation](https://github.com/billchurch/webssh2/tree/bigip-server).
|
|
74
51
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## Features
|
|
52
|
+
## Client Features
|
|
78
53
|
|
|
79
54
|
- Web-based SSH client with xterm.js terminal emulation
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
- Terminal Mouse support
|
|
55
|
+
- Customizable terminal settings:
|
|
56
|
+
- Font size and family
|
|
57
|
+
- Color schemes
|
|
58
|
+
- Cursor behavior
|
|
59
|
+
- Scrollback buffer size
|
|
60
|
+
- Session logging with download capability
|
|
87
61
|
- Copy and paste functionality
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
The WebSSH2 Server (not provided by this package) provides two main routes:
|
|
94
|
-
|
|
95
|
-
### 1. `/ssh`
|
|
96
|
-
|
|
97
|
-
- Interactive login form
|
|
98
|
-
- Terminal configuration options
|
|
99
|
-
|
|
100
|
-
### 2. `/ssh/host/:host`
|
|
62
|
+
- Terminal mouse support
|
|
63
|
+
- Keyboard shortcuts
|
|
64
|
+
- Responsive design
|
|
65
|
+
- Multi-factor authentication support (when supported by server)
|
|
66
|
+
- Support for credential replay and reauthentication
|
|
101
67
|
|
|
102
|
-
|
|
103
|
-
- Optional `port` parameter (e.g., `?port=2222`)
|
|
104
|
-
- HTTP Basic Authentication for credentials
|
|
68
|
+
## Configuration
|
|
105
69
|
|
|
106
|
-
|
|
70
|
+
The client can be configured through:
|
|
107
71
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
- Debug mode can be enabled by setting the `DEBUG` environment variable.
|
|
72
|
+
1. URL parameters
|
|
73
|
+
2. Configuration object
|
|
74
|
+
3. User interface settings
|
|
112
75
|
|
|
113
|
-
|
|
76
|
+
### URL Parameters
|
|
114
77
|
|
|
115
|
-
|
|
78
|
+
Supported URL parameters include:
|
|
116
79
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
The WebSSH2 server replaces this null value with a configuration object. However, you can also set this manually to override server-provided settings or to configure the client when using it standalone.
|
|
80
|
+
- `host` - SSH server hostname
|
|
81
|
+
- `port` - SSH server port (default: 22)
|
|
82
|
+
- `header` - Optional header text
|
|
83
|
+
- `headerBackground` - Optional header background color
|
|
84
|
+
- `sshterm` - Terminal type (default: xterm-color)
|
|
124
85
|
|
|
125
|
-
### Configuration
|
|
86
|
+
### Configuration Object
|
|
126
87
|
|
|
127
|
-
|
|
88
|
+
You can configure the client by setting `window.webssh2Config`:
|
|
128
89
|
|
|
129
90
|
```javascript
|
|
130
91
|
window.webssh2Config = {
|
|
131
92
|
socket: {
|
|
132
|
-
url: null, // WebSocket URL
|
|
133
|
-
path: '/ssh/socket.io'
|
|
93
|
+
url: null, // WebSocket URL (auto-detected if null)
|
|
94
|
+
path: '/ssh/socket.io' // Socket.IO path
|
|
134
95
|
},
|
|
135
96
|
ssh: {
|
|
136
|
-
host: null, // SSH server hostname
|
|
137
|
-
port: 22,
|
|
138
|
-
username: null,
|
|
139
|
-
|
|
140
|
-
sshterm: 'xterm-color', // Terminal type
|
|
141
|
-
readyTimeout: 20000, // SSH connection timeout (ms)
|
|
97
|
+
host: null, // SSH server hostname
|
|
98
|
+
port: 22, // SSH server port
|
|
99
|
+
username: null,
|
|
100
|
+
sshterm: 'xterm-color'
|
|
142
101
|
},
|
|
143
102
|
header: {
|
|
144
|
-
text: null,
|
|
145
|
-
background: 'green'
|
|
146
|
-
},
|
|
147
|
-
autoConnect: false // Whether to connect automatically
|
|
148
|
-
};
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Auto-Connect Functionality
|
|
152
|
-
|
|
153
|
-
The `autoConnect` option is used to create pre-configured connections:
|
|
154
|
-
|
|
155
|
-
- When set to `true`, the client will attempt to connect immediately using the provided SSH configuration, bypassing the login form.
|
|
156
|
-
- For `autoConnect` to work, you must provide at least the `host` in the SSH configuration.
|
|
157
|
-
- `autoConnect` requires a username and password. If these are not provided, the server may use other methods (like basic auth or session data) to authenticate the connection.
|
|
158
|
-
- If the host is missing when `autoConnect` is `true,` the login form will be shown instead.
|
|
159
|
-
|
|
160
|
-
Example usage:
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
window.webssh2Config = {
|
|
164
|
-
ssh: {
|
|
165
|
-
host: 'example.com',
|
|
166
|
-
port: 22,
|
|
167
|
-
username: 'user', // Optional
|
|
168
|
-
password: 'password' // Optional
|
|
103
|
+
text: null,
|
|
104
|
+
background: 'green'
|
|
169
105
|
},
|
|
170
|
-
autoConnect:
|
|
106
|
+
autoConnect: false
|
|
171
107
|
};
|
|
172
108
|
```
|
|
173
109
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
### Security Considerations
|
|
177
|
-
|
|
178
|
-
The `autoConnect` feature only requires the host to be specified. The server handles authentication, which may use various methods, including basic auth or session data.
|
|
179
|
-
- If you do include a username and password in the client-side configuration, be cautious, as this may pose security risks, especially in production environments.
|
|
180
|
-
- For production use, consider using secure server-side authentication methods rather than including credentials in the client-side configuration.
|
|
181
|
-
When `autoConnect` is not used, ensure your server is configured to prompt for or securely handle credentials as needed.
|
|
182
|
-
|
|
183
|
-
### Customization Examples
|
|
184
|
-
|
|
185
|
-
1. Setting a custom header:
|
|
186
|
-
```javascript
|
|
187
|
-
window.webssh2Config = {
|
|
188
|
-
header: {
|
|
189
|
-
text: 'My Custom SSH Client',
|
|
190
|
-
background: '#007acc'
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
2. Configuring for a specific SSH server with auto-connect:
|
|
196
|
-
```javascript
|
|
197
|
-
window.webssh2Config = {
|
|
198
|
-
ssh: {
|
|
199
|
-
host: 'myserver.example.com',
|
|
200
|
-
port: 2222
|
|
201
|
-
},
|
|
202
|
-
autoConnect: true
|
|
203
|
-
};
|
|
204
|
-
```
|
|
110
|
+
## Development
|
|
205
111
|
|
|
206
|
-
|
|
112
|
+
- For development information see [DEVELOPMENT.md](./DEVELOPMENT.md).
|
|
207
113
|
|
|
208
114
|
## Support
|
|
209
115
|
|
|
210
|
-
If you find this project helpful,
|
|
116
|
+
If you find this project helpful, consider supporting the developer:
|
|
211
117
|
|
|
212
118
|
[](https://www.buymeacoffee.com/billchurch)
|
|
213
119
|
|
|
214
|
-
|
|
215
120
|
## License
|
|
216
121
|
|
|
217
122
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
|
|
218
123
|
|
|
219
124
|
## Acknowledgments
|
|
220
125
|
|
|
221
|
-
- [Xterm.js](https://xtermjs.org/) for
|
|
222
|
-
- [Socket.IO](https://socket.io/) for
|
|
223
|
-
- [Webpack](https://webpack.js.org/) for module bundling
|
|
126
|
+
- [Xterm.js](https://xtermjs.org/) for terminal emulation
|
|
127
|
+
- [Socket.IO](https://socket.io/) for WebSocket communication
|
|
128
|
+
- [Webpack](https://webpack.js.org/) for module bundling
|
package/client/public/client.htm
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Version Version 0.2.
|
|
1
|
+
<!-- Version Version 0.2.27 - 2024-12-02T21:03:28.371Z - 1989d45 -->
|
|
2
2
|
<!-- webssh2-client -->
|
|
3
3
|
<!-- /client/src/client.htm -->
|
|
4
4
|
<!DOCTYPE html>
|
|
@@ -14,20 +14,44 @@
|
|
|
14
14
|
<dialog id="loginDialog" class="modal">
|
|
15
15
|
<div class="modal-content">
|
|
16
16
|
<h2>WebSSH2 Login</h2>
|
|
17
|
-
<form id="loginForm" class="pure-form
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
<form id="loginForm" class="pure-form">
|
|
18
|
+
<input type="text" id="hostInput" name="host" placeholder="Host" required>
|
|
19
|
+
<input type="text" id="portInput" name="port" placeholder="Port" value="22">
|
|
20
|
+
<input type="text" id="usernameInput" name="username" placeholder="Username" required>
|
|
21
|
+
|
|
22
|
+
<!-- Password section - always visible -->
|
|
23
|
+
<div class="password-wrapper">
|
|
24
|
+
<input type="password" id="passwordInput" name="password" placeholder="Password">
|
|
25
|
+
<span id="capsLockIcon">⇪</span>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- Private key toggle button -->
|
|
29
|
+
<div class="private-key-toggle">
|
|
30
|
+
<button type="button" id="privateKeyToggle" class="pure-button">
|
|
31
|
+
<i class="fa fa-key"></i> Add SSH Key
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- Private key section (initially hidden) -->
|
|
36
|
+
<div id="privateKeySection" class="hidden">
|
|
37
|
+
<div class="private-key-input">
|
|
38
|
+
<textarea id="privateKeyText" name="privateKey"
|
|
39
|
+
placeholder="Paste your private key here" rows="3"></textarea>
|
|
40
|
+
<div class="file-upload">
|
|
41
|
+
<input type="file" id="privateKeyFile" accept=".pem,.key">
|
|
42
|
+
<label for="privateKeyFile" class="pure-button">
|
|
43
|
+
<i class="fa fa-upload"></i> Upload Key File
|
|
44
|
+
</label>
|
|
45
|
+
</div>
|
|
46
|
+
<input type="password" id="passphraseInput" name="passphrase"
|
|
47
|
+
placeholder="Key password (if encrypted)" class="optional">
|
|
29
48
|
</div>
|
|
30
|
-
</
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="login-buttons">
|
|
52
|
+
<button type="submit" class="pure-button pure-button-primary">Connect</button>
|
|
53
|
+
<button type="button" id="loginSettingsBtn" class="pure-button">⚙️</button>
|
|
54
|
+
</div>
|
|
31
55
|
</form>
|
|
32
56
|
</div>
|
|
33
57
|
</dialog>
|