Skip to content

Commit 9135f14

Browse files
committed
Describe how SSHWIFTY_PRESETS should be configured
1 parent a63c90a commit 9135f14

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,22 @@ SSHWIFTY_ONLYALLOWPRESETREMOTES
431431

432432
These options are correspond to their counterparts in the configuration file.
433433

434+
`SSHWIFTY_PRESETS` is a bit special because it should contain valid JSON
435+
encoded Preset data. An sample of it's format is demonstrated in the
436+
[`preset.example.json`] file and can be loaded via `cat` command. For example:
437+
438+
SSHWIFTY_PRESETS=$(cat preset.example.json) ./sshwifty
439+
440+
Of course, you can also directly setup `SSHWIFTY_PRESETS` with a string. But in
441+
such case, you might need to escape the JSON characters. To do that, one option
442+
is to use `jq`:
443+
444+
cat preset.example.json | jq -c | jq -Rs
445+
446+
Which should give you one line of escaped JSON string, safe for use in scripts.
447+
448+
[`preset.example.json`]: preset.example.json
449+
434450
Notice: When you're using environment variables to configure Sshwifty, only one
435451
Sshwifty HTTP server is then allowed. There is no way to setup multiple servers
436452
under this method of configuration. If you need to serve on multiple ports, use

preset.example.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
11
[
22
{
3-
"Title": "Testing telnet server",
3+
"Title": "SDF.org Unix Shell",
4+
"Type": "SSH",
5+
"Host": "sdf.org:22",
6+
"TabColor": "112233",
7+
"Meta": {
8+
"Encoding": "utf-8",
9+
"Authentication": "Password"
10+
}
11+
},
12+
{
13+
"Title": "My own super secure server",
14+
"Type": "SSH",
15+
"Host": "localhost",
16+
"Meta": {
17+
"User": "root",
18+
"Encoding": "utf-8",
19+
"Private Key": "-----BEGIN RSA !!!Will be sent to client in plain-text!!! -END RSA PRI...\n",
20+
"Authentication": "Private Key",
21+
"Fingerprint": "SHA256:bgO...."
22+
}
23+
},
24+
{
25+
"Title": "My own super expensive router",
426
"Type": "Telnet",
5-
"Host": "sshwifty-telnet-test:5555",
6-
"Meta": {}
27+
"Host": "localhost",
28+
"Meta": {
29+
"Encoding": "ibm866"
30+
}
731
}
832
]

sshwifty.conf.example.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"Meta": {
4343
"User": "root",
4444
"Encoding": "utf-8",
45-
"Private Key": "-----BEGIN RSA Will be sent to client-END RSA PRI...\n",
45+
"Private Key": "-----BEGIN RSA !!!Will be sent to client in plain-text!!! -END RSA PRI...\n",
4646
"Authentication": "Private Key",
4747
"Fingerprint": "SHA256:bgO...."
4848
}

0 commit comments

Comments
 (0)