Browse Source

update docs for v2

pull/270/head
butlerx 4 years ago
parent
commit
555f44f87d
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. 33
      README.md
  2. 6
      docs/flags.md
  3. 6
      docs/https.md
  4. 2
      docs/nginx.md
  5. 4
      docs/service.md
  6. 4
      src/main.ts
  7. 3
      src/server.ts

33
README.md

@ -35,7 +35,30 @@ yarn global add wetty
## Usage
```sh
wetty [-h] [--port PORT] [--base BASE] [--sshhost SSH_HOST] [--sshport SSH_PORT] [--sshuser SSH_USER] [--host HOST] [--command COMMAND] [--forcessh] [--bypasshelmet] [--title TITLE] [--sslkey SSL_KEY_PATH] [--sslcert SSL_CERT_PATH]
$ wetty --help
Options:
--help, -h Print help message [boolean]
--version Show version number [boolean]
--conf config file to load config from [string]
--ssl-key path to SSL key [string]
--ssl-cert path to SSL certificate [string]
--ssh-host ssh server host [string]
--ssh-port ssh server port [number]
--ssh-user ssh user [string]
--title window title [string]
--ssh-auth defaults to "password", you can use "publickey,password"
instead [string]
--ssh-pass ssh password [string]
--ssh-key path to an optional client private key (connection will be
password-less and insecure!) [string]
--force-ssh Connecting through ssh even if running as root [boolean]
--known-hosts path to known hosts file [string]
--base, -b base path to wetty [string]
--port, -p wetty listen port [number]
--host wetty listen host [string]
--command, -c command to run in shell [string]
--bypass-helmet disable helmet from placing security restrictions [boolean]
```
Open your browser on `http://yourserver:3000/wetty` and you will prompted to
@ -44,11 +67,11 @@ user before hand.
If you run it as root it will launch `/bin/login` (where you can specify the
user name), else it will launch `ssh` and connect by default to `localhost`. The
SSH connection can be forced using the `--forcessh` option.
SSH connection can be forced using the `--force-ssh` option.
If instead you wish to connect to a remote host you can specify the `--sshhost`
option, the SSH port using the `--sshport` option and the SSH user using the
`--sshuser` option.
If instead you wish to connect to a remote host you can specify the `--ssh-host`
option, the SSH port using the `--ssh-port` option and the SSH user using the
`--ssh-user` option.
Check out the
[Flags docs](https://github.com/butlerx/wetty/blob/master/docs/flags.md) for a

6
docs/flags.md

@ -14,12 +14,12 @@ the `login` binary rather than ssh. If no host is specified it will use
`localhost` as the ssh host.
If instead you wish to connect to a remote host you can specify the host with
the `--sshhost` flag and pass the IP or DNS address of the host you want to
the `--ssh-host` flag and pass the IP or DNS address of the host you want to
connect to.
## Default User
You can specify the default user used to ssh to a host using the `--sshuser`.
You can specify the default user used to ssh to a host using the `--ssh-user`.
This user can overwritten by going to
`http://yourserver:3000/wetty/ssh/<username>`. If this is left blank a user will
be prompted to enter their username when they connect.
@ -27,7 +27,7 @@ be prompted to enter their username when they connect.
## SSH Port
By default WeTTy will try to ssh to port `22`, if your host uses an alternative
ssh port this can be specified with the flag `--sshport`.
ssh port this can be specified with the flag `--ssh-port`.
## WeTTy URL

6
docs/https.md

@ -6,11 +6,11 @@ either using WeTTy behind a proxy or directly.
See docs for [NGinX](./nginx.md) and [Apache](./apache.md) for running behind a
proxy.
To run WeTTy directly with SSL use both the `--sslkey` and `--sslcert` flags and
pass them the path too your cert and key as follows:
To run WeTTy directly with SSL use both the `--ssl-key` and `--ssl-cert` flags
and pass them the path too your cert and key as follows:
```bash
wetty --sslkey key.pem --sslcert cert.pem
wetty --ssl-key key.pem --ssl-cert cert.pem
```
If you don't have SSL certificates from a CA you can create a self signed

2
docs/nginx.md

@ -19,7 +19,7 @@ Put the following configuration in your nginx conf:
```nginx
location ^~ /wetty {
proxy_pass http://127.0.0.1:3000/WeTTy;
proxy_pass http://127.0.0.1:3000/wetty;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

4
docs/service.md

@ -7,7 +7,7 @@ bundled with the npm package to make this easier.
```bash
$ yarn global add wetty
$ sudo cp ~/.config/yarn/global/node_modules/wetty/bin/wetty.conf /etc/init
$ sudo cp ~/.config/yarn/global/node_modules/wetty/conf/wetty.conf /etc/init
$ sudo start wetty
```
@ -15,7 +15,7 @@ $ sudo start wetty
```bash
$ yarn global add wetty
$ cp ~/.config/yarn/global/node_modules/wetty/bin/wetty.service ~/.config/systemd/user/
$ cp ~/.config/yarn/global/node_modules/wetty/conf/wetty.service ~/.config/systemd/user/
$ systemctl --user enable wetty
$ systemctl --user start wetty
```

4
src/main.ts

@ -4,7 +4,7 @@
*/
import yargs from 'yargs';
import { logger } from './shared/logger.js';
import { startServer } from './server.js';
import { start } from './server.js';
import { loadConfigFile, mergeCliConf } from './shared/config.js';
const opts = yargs
@ -94,7 +94,7 @@ if (!opts.help) {
loadConfigFile(opts.conf)
.then(config => mergeCliConf(opts, config))
.then(conf =>
startServer(conf.ssh, conf.server, conf.command, conf.forceSSH, conf.ssl),
start(conf.ssh, conf.server, conf.command, conf.forceSSH, conf.ssl),
)
.catch((err: Error) => {
logger.error(err);

3
src/server.ts

@ -2,6 +2,7 @@
* Create WeTTY server
* @module WeTTy
*/
import type SocketIO from 'socket.io';
import type { SSH, SSL, Server } from './shared/interfaces.js';
import { getCommand } from './server/command.js';
import { logger } from './shared/logger.js';
@ -20,7 +21,7 @@ import {
* @name startServer
* @returns Promise that resolves SocketIO server
*/
export async function startServer(
export async function start(
ssh: SSH = sshDefault,
serverConf: Server = serverDefault,
command: string = defaultCommand,

Loading…
Cancel
Save