webssh2_client 0.2.23 → 0.2.25
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 +84 -209
- package/client/public/client.htm +11 -1
- package/client/public/webssh2.bundle.js +1 -1
- package/client/public/webssh2.css +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
# WebSSH2 Client
|
|
1
|
+
# WebSSH2 Client - Web SSH Client
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
|
-
WebSSH2 Client is
|
|
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.
|
|
6
|
+
|
|
7
|
+

|
|
6
8
|
|
|
7
9
|
# EXPERIMENTAL
|
|
8
10
|
The current status is experimental, and this first version is a refactor of webssh2 v0.2.x to be compatible with a refactor of the same version of webssh2 as a stand-alone server-side component running Node.js v6.9.1.
|
|
@@ -11,29 +13,31 @@ The intention is to harmonize the latest release of webssh2 by splitting out the
|
|
|
11
13
|
|
|
12
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.
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## Table of Contents
|
|
15
17
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
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)
|
|
22
29
|
|
|
23
|
-
##
|
|
30
|
+
## Requirements
|
|
24
31
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- Xterm.js for terminal emulation
|
|
28
|
-
- Webpack for bundling
|
|
29
|
-
- ES6+ JavaScript
|
|
32
|
+
- Modern web browser with JavaScript enabled
|
|
33
|
+
- WebSSH2 server (see server README for setup instructions)
|
|
30
34
|
|
|
31
35
|
## Installation
|
|
32
36
|
|
|
33
37
|
1. Clone the repository:
|
|
34
38
|
```
|
|
35
|
-
git clone https://github.com/billchurch/
|
|
36
|
-
cd
|
|
39
|
+
git clone https://github.com/billchurch/webssh2_client.git
|
|
40
|
+
cd webssh2_client
|
|
37
41
|
```
|
|
38
42
|
|
|
39
43
|
2. Install dependencies:
|
|
@@ -46,11 +50,67 @@ The main idea behind bifurcating the client/server is to make it easier to custo
|
|
|
46
50
|
npm run build
|
|
47
51
|
```
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
4. The built client files will be in the `client/public` directory.
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
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.
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
The client can be configured using URL parameters or through the config file on the server. Some configurable options include:
|
|
50
69
|
|
|
51
|
-
|
|
70
|
+
- `port` - SSH server port (default: 22)
|
|
71
|
+
- `header` - Optional header text
|
|
72
|
+
- `headerBackground` - Optional header background color
|
|
73
|
+
- `sshterm` - Terminal type for pty (default: xterm-color)
|
|
74
|
+
|
|
75
|
+
For a full list of configuration options, refer to the server README.
|
|
76
|
+
|
|
77
|
+
## Features
|
|
52
78
|
|
|
53
|
-
|
|
79
|
+
- Web-based SSH client with xterm.js terminal emulation
|
|
80
|
+
- Supports various SSH authentication methods (password and keyboard-interactive)
|
|
81
|
+
- Customizable terminal settings (font size, font family, colors, etc.)
|
|
82
|
+
- Session logging with download option
|
|
83
|
+
- Support for reauthentication and credential replay
|
|
84
|
+
- Responsive design for various screen sizes
|
|
85
|
+
- Keyboard shortcuts support
|
|
86
|
+
- Terminal Mouse support
|
|
87
|
+
- Copy and paste functionality
|
|
88
|
+
- Multi-factor authentication support
|
|
89
|
+
- CORS support for flexible server setups
|
|
90
|
+
|
|
91
|
+
## Routes
|
|
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`
|
|
101
|
+
|
|
102
|
+
- Quick connections to specific hosts
|
|
103
|
+
- Optional `port` parameter (e.g., `?port=2222`)
|
|
104
|
+
- HTTP Basic Authentication for credentials
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
- To add custom JavaScript, modify `./src/client.htm`, `./src/index.js`, or add your file to `webpack.*.js`.
|
|
109
|
+
- For security, use HTTPS when transmitting credentials via HTTP Basic Auth.
|
|
110
|
+
- Terminal settings can be customized after login via `Menu | Settings` and persist across sessions.
|
|
111
|
+
- Debug mode can be enabled by setting the `DEBUG` environment variable.
|
|
112
|
+
|
|
113
|
+
## Advanced Configuration
|
|
54
114
|
|
|
55
115
|
In the client HTML file, you'll find this script tag:
|
|
56
116
|
|
|
@@ -145,197 +205,12 @@ When `autoConnect` is not used, ensure your server is configured to prompt for o
|
|
|
145
205
|
|
|
146
206
|
By leveraging these configuration options, you can customize the WebSSH2 client to suit your needs or integrate it seamlessly into your existing systems. Remember that the server handles authentication, providing flexibility in managing and securing credentials.
|
|
147
207
|
|
|
148
|
-
##
|
|
149
|
-
|
|
150
|
-
### Development
|
|
151
|
-
|
|
152
|
-
To start the development server:
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
npm start
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
This will run the application using `node index.js`.
|
|
159
|
-
|
|
160
|
-
To build the development version:
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
npm run builddev
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
This will use Webpack to build the development version of the application.
|
|
167
|
-
|
|
168
|
-
To watch for changes and rebuild automatically:
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
npm run watch
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
This will start the server and watch for file changes, rebuilding as necessary.
|
|
175
|
-
|
|
176
|
-
### Production Build
|
|
177
|
-
|
|
178
|
-
To create a production build:
|
|
179
|
-
|
|
180
|
-
```
|
|
181
|
-
npm run build
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
This will generate optimized files for production using Webpack.
|
|
185
|
-
|
|
186
|
-
### Analyze Bundle
|
|
187
|
-
|
|
188
|
-
To analyze the bundle size:
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
npm run analyze
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
This will generate a JSON report of the bundle and analyze its size.
|
|
195
|
-
|
|
196
|
-
### Publishing
|
|
197
|
-
|
|
198
|
-
Before publishing, the package will automatically run the build script:
|
|
199
|
-
|
|
200
|
-
```
|
|
201
|
-
npm publish
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
This ensures that the latest production build is included in the published package.
|
|
205
|
-
|
|
206
|
-
## Scripts
|
|
207
|
-
|
|
208
|
-
- `start`: Runs the application using Node.js
|
|
209
|
-
- `build`: Creates a production build using Webpack
|
|
210
|
-
- `builddev`: Creates a development build using Webpack
|
|
211
|
-
- `analyze`: Analyzes the bundle size
|
|
212
|
-
- `watch`: Runs the application and watches for changes, rebuilding as necessary
|
|
213
|
-
- `watch:build`: Watches for changes and rebuilds using Webpack (development config)
|
|
214
|
-
- `prepublishOnly`: Runs before publishing to ensure the latest build is included
|
|
215
|
-
|
|
216
|
-
## URL Parameters
|
|
217
|
-
|
|
218
|
-
The WebSSH2 client supports various URL parameters to customize the SSH connection and terminal behavior. These parameters can be added to the URL when accessing the client.
|
|
219
|
-
|
|
220
|
-
### SSH Connection Parameters
|
|
221
|
-
|
|
222
|
-
- `host`: The hostname or IP address of the SSH server to which to connect.
|
|
223
|
-
- Example: `?host=192.168.1.1`
|
|
224
|
-
|
|
225
|
-
- `port`: The port number of the SSH server (default is 22).
|
|
226
|
-
- Example: `?port=2222`
|
|
227
|
-
|
|
228
|
-
- `username`: The username to use for SSH authentication.
|
|
229
|
-
- Example: `?username=admin`
|
|
230
|
-
|
|
231
|
-
- `password`: The password for SSH authentication (not recommended for production use).
|
|
232
|
-
- Example: `?password=secretpassword`
|
|
233
|
-
|
|
234
|
-
### UI Customization
|
|
235
|
-
|
|
236
|
-
- `header`: Custom text to display in the header.
|
|
237
|
-
- Example: `?header=My%20SSH%20Session`
|
|
238
|
-
|
|
239
|
-
- `headerbackground`: Background color for the header.
|
|
240
|
-
- Example: `?headerbackground=red`
|
|
241
|
-
|
|
242
|
-
### Usage Example
|
|
243
|
-
|
|
244
|
-
A full URL with multiple parameters might look like this:
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
http://localhost:2222/ssh/host/192.168.1.100?port=2222&header=Production%20Server&headerbackground=red&fontSize=14&bellStyle=none
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
This URL would connect to a SSH server at 192.168.1.100 on port 2222, with a red header displaying "Production Server", using a 14px font size and turning off the audible bell.
|
|
251
|
-
|
|
252
|
-
Note: Be cautious about including sensitive information like passwords in URL parameters, especially in production environments.
|
|
253
|
-
|
|
254
|
-
## Terminal Configuration
|
|
255
|
-
|
|
256
|
-
WebSSH2 Client allows users to customize their terminal experience through a set of configurable options. These settings are stored in the browser's localStorage under the key `webssh2.settings.global`, ensuring your preferences persist across sessions.
|
|
257
|
-
|
|
258
|
-
### Accessing Terminal Settings
|
|
259
|
-
|
|
260
|
-
You can access the terminal configuration in two ways:
|
|
261
|
-
|
|
262
|
-
1. **From an Active Session:**
|
|
263
|
-
- Click on the menu icon (☰) in the bottom-left corner of the terminal.
|
|
264
|
-
- Select "Settings" from the dropdown menu.
|
|
265
|
-
|
|
266
|
-
2. **During Login:**
|
|
267
|
-
- In the login dialog, click on the gear icon (⚙️) next to the "Connect" button.
|
|
268
|
-
|
|
269
|
-
### Available Settings
|
|
270
|
-
|
|
271
|
-
The terminal settings dialog offers the following customization options:
|
|
272
|
-
|
|
273
|
-
1. **Font Size**
|
|
274
|
-
- Range: 8-72 pixels
|
|
275
|
-
- Adjusts the size of the text in the terminal.
|
|
276
|
-
|
|
277
|
-
2. **Font Family**
|
|
278
|
-
- Specifies the font used in the terminal.
|
|
279
|
-
- Example: "Courier New, monospace"
|
|
280
|
-
|
|
281
|
-
3. **Cursor Blink**
|
|
282
|
-
- Options: On / Off
|
|
283
|
-
- Determines whether the cursor blinks in the terminal.
|
|
284
|
-
|
|
285
|
-
4. **Scrollback**
|
|
286
|
-
- Range: 1-200000 lines
|
|
287
|
-
- Sets the number of lines kept in the terminal's scrollback buffer.
|
|
288
|
-
|
|
289
|
-
5. **Tab Stop Width**
|
|
290
|
-
- Range: 1-100 spaces
|
|
291
|
-
- Defines the width of tab stops in the terminal.
|
|
292
|
-
|
|
293
|
-
6. **Bell Style**
|
|
294
|
-
- Options: Sound / None
|
|
295
|
-
- Configures the audible bell behavior in the terminal.
|
|
296
|
-
|
|
297
|
-
### Applying Settings
|
|
298
|
-
|
|
299
|
-
After adjusting your preferences:
|
|
300
|
-
|
|
301
|
-
1. Click "Save" to apply the new settings.
|
|
302
|
-
2. The changes will take effect immediately for the current session and all future sessions.
|
|
303
|
-
3. Click "Cancel" to close the dialog without saving changes.
|
|
304
|
-
|
|
305
|
-
### Resetting to Defaults
|
|
306
|
-
|
|
307
|
-
To reset all settings to their default values:
|
|
308
|
-
|
|
309
|
-
1. Clear your browser's localStorage for the WebSSH2 Client site.
|
|
310
|
-
2. Refresh the page.
|
|
311
|
-
|
|
312
|
-
### Note on Persistence
|
|
313
|
-
|
|
314
|
-
These settings are stored locally in your browser. If you use WebSSH2 Client on a different device or browser, you'll need to reconfigure your preferences.
|
|
315
|
-
|
|
316
|
-
## Debugging
|
|
317
|
-
|
|
318
|
-
This project uses the `debug` module for logging. To enable debugging in the browser:
|
|
319
|
-
|
|
320
|
-
1. Open the browser's console.
|
|
321
|
-
2. Enter: `localStorage.debug = 'webssh2-client*'`
|
|
322
|
-
3. Refresh the page.
|
|
323
|
-
|
|
324
|
-
To turn off debugging, enter: `localStorage.debug = ''`
|
|
325
|
-
|
|
326
|
-
## Contributing
|
|
327
|
-
|
|
328
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
208
|
+
## Support
|
|
329
209
|
|
|
330
|
-
|
|
331
|
-
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
332
|
-
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
333
|
-
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
334
|
-
5. Open a Pull Request
|
|
210
|
+
If you find this project helpful, you can support the developer:
|
|
335
211
|
|
|
336
|
-
|
|
212
|
+
[](https://www.buymeacoffee.com/billchurch)
|
|
337
213
|
|
|
338
|
-
This project follows the Airbnb JavaScript Style Guide. Please ensure your contributions adhere to this style.
|
|
339
214
|
|
|
340
215
|
## License
|
|
341
216
|
|
package/client/public/client.htm
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Version Version 0.2.
|
|
1
|
+
<!-- Version Version 0.2.25 - 2024-08-22T17:16:39.057Z - 3bb6482 -->
|
|
2
2
|
<!-- webssh2-client -->
|
|
3
3
|
<!-- /client/src/client.htm -->
|
|
4
4
|
<!DOCTYPE html>
|
|
@@ -38,6 +38,16 @@
|
|
|
38
38
|
<p id="errorMessage"></p>
|
|
39
39
|
</div>
|
|
40
40
|
</dialog>
|
|
41
|
+
<dialog id="promptDialog" class="modal">
|
|
42
|
+
<div class="modal-content prompt-modal">
|
|
43
|
+
<button autofocus class="close-button">×</button>
|
|
44
|
+
<h2 id="promptMessage"></h2>
|
|
45
|
+
<form>
|
|
46
|
+
<div id="promptInputContainer"></div>
|
|
47
|
+
<button type="submit" class="pure-button pure-button-primary">Submit</button>
|
|
48
|
+
</form>
|
|
49
|
+
</div>
|
|
50
|
+
</dialog>
|
|
41
51
|
<dialog id="terminalSettingsDialog" class="modal">
|
|
42
52
|
<div class="modal-content">
|
|
43
53
|
<h2>Terminal Settings</h2>
|