Skip to content

Commit 69093be

Browse files
jpilloracmenginnz
andauthored
Bump to Go 1.21 (jpillora#440)
Co-authored-by: cmeng <[email protected]>
1 parent ce307e5 commit 69093be

File tree

11 files changed

+298
-88
lines changed

11 files changed

+298
-88
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Test
1111
strategy:
1212
matrix:
13-
go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x]
13+
go-version: [1.21.x]
1414
platform: [ubuntu-latest, macos-latest, windows-latest]
1515
runs-on: ${{ matrix.platform }}
1616
steps:

README.md

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,23 @@ $ chisel server --help
119119
--port, -p, Defines the HTTP listening port (defaults to the environment
120120
variable PORT and fallsback to port 8080).
121121
122-
--key, An optional string to seed the generation of a ECDSA public
122+
--key, (deprecated use --keygen and --keyfile instead)
123+
An optional string to seed the generation of a ECDSA public
123124
and private key pair. All communications will be secured using this
124125
key pair. Share the subsequent fingerprint with clients to enable detection
125126
of man-in-the-middle attacks (defaults to the CHISEL_KEY environment
126127
variable, otherwise a new key is generate each run).
127128
129+
--keygen, A path to write a newly generated PEM-encoded SSH private key file.
130+
If users depend on your --key fingerprint, you may also include your --key to
131+
output your existing key. Use - (dash) to output the generated key to stdout.
132+
133+
--keyfile, An optional path to a PEM-encoded SSH private key. When
134+
this flag is set, the --key option is ignored, and the provided private key
135+
is used to secure all communications. (defaults to the CHISEL_KEY_FILE
136+
environment variable). Since ECDSA keys are short, you may also set keyfile
137+
to an inline base64 private key (e.g. chisel server --keygen - | base64).
138+
128139
--authfile, An optional path to a users.json file. This file should
129140
be an object with users defined like:
130141
{
@@ -300,6 +311,9 @@ $ chisel client --help
300311
--hostname, Optionally set the 'Host' header (defaults to the host
301312
found in the server url).
302313
314+
--sni, Override the ServerName when using TLS (defaults to the
315+
hostname).
316+
303317
--tls-ca, An optional root certificate bundle used to verify the
304318
chisel server. Only valid when connecting to the server with
305319
"https" or "wss". By default, the operating system CAs will be used.
@@ -341,38 +355,42 @@ $ chisel client --help
341355

342356
### Security
343357

344-
Encryption is always enabled. When you start up a chisel server, it will generate an in-memory ECDSA public/private key pair. The public key fingerprint (base64 encoded SHA256) will be displayed as the server starts. Instead of generating a random key, the server may optionally specify a key seed, using the `--key` option, which will be used to seed the key generation. When clients connect, they will also display the server's public key fingerprint. The client can force a particular fingerprint using the `--fingerprint` option. See the `--help` above for more information.
358+
Encryption is always enabled. When you start up a chisel server, it will generate an in-memory ECDSA public/private key pair. The public key fingerprint (base64 encoded SHA256) will be displayed as the server starts. Instead of generating a random key, the server may optionally specify a key file, using the `--keyfile` option. When clients connect, they will also display the server's public key fingerprint. The client can force a particular fingerprint using the `--fingerprint` option. See the `--help` above for more information.
345359

346360
### Authentication
347361

348362
Using the `--authfile` option, the server may optionally provide a `user.json` configuration file to create a list of accepted users. The client then authenticates using the `--auth` option. See [users.json](example/users.json) for an example authentication configuration file. See the `--help` above for more information.
349363

350364
Internally, this is done using the _Password_ authentication method provided by SSH. Learn more about `crypto/ssh` here http://blog.gopheracademy.com/go-and-ssh/.
351365

352-
### SOCKS5 Guide
366+
### SOCKS5 Guide with Docker
367+
368+
1. Print a new private key to the terminal
369+
370+
```sh
371+
chisel server --keygen -
372+
# or save it to disk --keygen /path/to/mykey
373+
```
353374

354375
1. Start your chisel server
355376

356-
```sh
357-
docker run \
358-
--name chisel -p 9312:9312 \
359-
-d --restart always \
360-
jpillora/chisel server -p 9312 --socks5 --key supersecret
361-
```
377+
```sh
378+
jpillora/chisel server --keyfile '<ck-base64 string or file path>' -p 9312 --socks5
379+
```
362380

363-
2. Connect your chisel client (using server's fingerprint)
381+
1. Connect your chisel client (using server's fingerprint)
364382
365-
```sh
366-
chisel client --fingerprint 'rHb55mcxf6vSckL2AezFV09rLs7pfPpavVu++MF7AhQ=' <server-address>:9312 socks
367-
```
383+
```sh
384+
chisel client --fingerprint '<see server output>' <server-address>:9312 socks
385+
```
368386
369-
3. Point your SOCKS5 clients (e.g. OS/Browser) to:
387+
1. Point your SOCKS5 clients (e.g. OS/Browser) to:
370388
371-
```
372-
<client-address>:1080
373-
```
389+
```
390+
<client-address>:1080
391+
```
374392
375-
4. Now you have an encrypted, authenticated SOCKS5 connection over HTTP
393+
1. Now you have an encrypted, authenticated SOCKS5 connection over HTTP
376394
377395
378396
#### Caveats
@@ -403,6 +421,8 @@ Since WebSockets support is required:
403421
- `1.5` - Added reverse SOCKS support (by @aus)
404422
- `1.6` - Added client stdio support (by @BoleynSu)
405423
- `1.7` - Added UDP support
424+
- `1.8` - Move to a `scratch`Docker image
425+
- `1.9` - Switch from `--key` seed to P256 key strings with `--key{gen,file}` + bump to Go 1.21 (by @cmenginnz)
406426
407427
## License
408428

client/client.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"golang.org/x/sync/errgroup"
3030
)
3131

32-
//Config represents a client configuration
32+
// Config represents a client configuration
3333
type Config struct {
3434
Fingerprint string
3535
Auth string
@@ -45,7 +45,7 @@ type Config struct {
4545
Verbose bool
4646
}
4747

48-
//TLSConfig for a Client
48+
// TLSConfig for a Client
4949
type TLSConfig struct {
5050
SkipVerify bool
5151
CA string
@@ -54,7 +54,7 @@ type TLSConfig struct {
5454
ServerName string
5555
}
5656

57-
//Client represents a client instance
57+
// Client represents a client instance
5858
type Client struct {
5959
*cio.Logger
6060
config *Config
@@ -69,7 +69,7 @@ type Client struct {
6969
tunnel *tunnel.Tunnel
7070
}
7171

72-
//NewClient creates a new client instance
72+
// NewClient creates a new client instance
7373
func NewClient(c *Config) (*Client, error) {
7474
//apply default scheme
7575
if !strings.HasPrefix(c.Server, "http") {
@@ -105,7 +105,7 @@ func NewClient(c *Config) (*Client, error) {
105105
tlsConfig: nil,
106106
}
107107
//set default log level
108-
client.Logger.Info = c.Verbose
108+
client.Logger.Info = true
109109
//configure tls
110110
if u.Scheme == "wss" {
111111
tc := &tls.Config{}
@@ -190,7 +190,7 @@ func NewClient(c *Config) (*Client, error) {
190190
return client, nil
191191
}
192192

193-
//Run starts client and blocks while connected
193+
// Run starts client and blocks while connected
194194
func (c *Client) Run() error {
195195
ctx, cancel := context.WithCancel(context.Background())
196196
defer cancel()
@@ -221,7 +221,7 @@ func (c *Client) verifyServer(hostname string, remote net.Addr, key ssh.PublicKe
221221
return nil
222222
}
223223

224-
//verifyLegacyFingerprint calculates and compares legacy MD5 fingerprints
224+
// verifyLegacyFingerprint calculates and compares legacy MD5 fingerprints
225225
func (c *Client) verifyLegacyFingerprint(key ssh.PublicKey) error {
226226
bytes := md5.Sum(key.Marshal())
227227
strbytes := make([]string, len(bytes))
@@ -236,7 +236,7 @@ func (c *Client) verifyLegacyFingerprint(key ssh.PublicKey) error {
236236
return nil
237237
}
238238

239-
//Start client and does not block
239+
// Start client and does not block
240240
func (c *Client) Start(ctx context.Context) error {
241241
ctx, cancel := context.WithCancel(ctx)
242242
c.stop = cancel
@@ -293,12 +293,12 @@ func (c *Client) setProxy(u *url.URL, d *websocket.Dialer) error {
293293
return nil
294294
}
295295

296-
//Wait blocks while the client is running.
296+
// Wait blocks while the client is running.
297297
func (c *Client) Wait() error {
298298
return c.eg.Wait()
299299
}
300300

301-
//Close manually stops the client
301+
// Close manually stops the client
302302
func (c *Client) Close() error {
303303
if c.stop != nil {
304304
c.stop()

client/client_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package chclient
22

33
import (
4-
"crypto/ecdsa"
54
"crypto/elliptic"
65
"log"
76
"net/http"
@@ -54,7 +53,7 @@ func TestFallbackLegacyFingerprint(t *testing.T) {
5453
t.Fatal(err)
5554
}
5655
r := ccrypto.NewDetermRand([]byte("test123"))
57-
priv, err := ecdsa.GenerateKey(elliptic.P256(), r)
56+
priv, err := ccrypto.GenerateKeyGo119(elliptic.P256(), r)
5857
if err != nil {
5958
t.Fatal(err)
6059
}
@@ -77,7 +76,7 @@ func TestVerifyLegacyFingerprint(t *testing.T) {
7776
t.Fatal(err)
7877
}
7978
r := ccrypto.NewDetermRand([]byte("test123"))
80-
priv, err := ecdsa.GenerateKey(elliptic.P256(), r)
79+
priv, err := ccrypto.GenerateKeyGo119(elliptic.P256(), r)
8180
if err != nil {
8281
t.Fatal(err)
8382
}
@@ -100,7 +99,7 @@ func TestVerifyFingerprint(t *testing.T) {
10099
t.Fatal(err)
101100
}
102101
r := ccrypto.NewDetermRand([]byte("test123"))
103-
priv, err := ecdsa.GenerateKey(elliptic.P256(), r)
102+
priv, err := ccrypto.GenerateKeyGo119(elliptic.P256(), r)
104103
if err != nil {
105104
t.Fatal(err)
106105
}

go.mod

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
module github.com/jpillora/chisel
22

3-
go 1.13
3+
go 1.21
44

55
require (
6-
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect
76
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
87
github.com/fsnotify/fsnotify v1.6.0
9-
github.com/gorilla/websocket v1.4.2
10-
github.com/jpillora/ansi v1.0.2 // indirect
8+
github.com/gorilla/websocket v1.5.0
119
github.com/jpillora/backoff v1.0.0
1210
github.com/jpillora/requestlog v1.0.0
1311
github.com/jpillora/sizestr v1.0.0
12+
golang.org/x/crypto v0.12.0
13+
golang.org/x/net v0.14.0
14+
golang.org/x/sync v0.3.0
15+
)
16+
17+
require (
18+
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect
19+
github.com/jpillora/ansi v1.0.3 // indirect
1420
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
15-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
16-
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
17-
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
18-
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
21+
golang.org/x/sys v0.11.0 // indirect
22+
golang.org/x/text v0.12.0 // indirect
1923
)

go.sum

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
44
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
55
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
66
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
7-
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
8-
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
9-
github.com/jpillora/ansi v1.0.2 h1:+Ei5HCAH0xsrQRCT2PDr4mq9r4Gm4tg+arNdXRkB22s=
10-
github.com/jpillora/ansi v1.0.2/go.mod h1:D2tT+6uzJvN1nBVQILYWkIdq7zG+b5gcFN5WI/VyjMY=
7+
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
8+
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
9+
github.com/jpillora/ansi v1.0.3 h1:nn4Jzti0EmRfDxm7JtEs5LzCbNwd5sv+0aE+LdS9/ZQ=
10+
github.com/jpillora/ansi v1.0.3/go.mod h1:D2tT+6uzJvN1nBVQILYWkIdq7zG+b5gcFN5WI/VyjMY=
1111
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
1212
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
1313
github.com/jpillora/requestlog v1.0.0 h1:bg++eJ74T7DYL3DlIpiwknrtfdUA9oP/M4fL+PpqnyA=
@@ -16,22 +16,16 @@ github.com/jpillora/sizestr v1.0.0 h1:4tr0FLxs1Mtq3TnsLDV+GYUWG7Q26a6s+tV5Zfw2yg
1616
github.com/jpillora/sizestr v1.0.0/go.mod h1:bUhLv4ctkknatr6gR42qPxirmd5+ds1u7mzD+MZ33f0=
1717
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce h1:fb190+cK2Xz/dvi9Hv8eCYJYvIGUTN2/KLq1pT6CjEc=
1818
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4=
19-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI=
20-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
21-
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
22-
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
23-
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
24-
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
25-
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
26-
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
27-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
28-
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
29-
golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY=
19+
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
20+
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
21+
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
22+
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
23+
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
24+
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
3025
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
31-
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
32-
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE=
33-
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
34-
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
35-
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
36-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
37-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
26+
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
27+
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
28+
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
29+
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
30+
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
31+
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=

main.go

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import (
1515
chclient "github.com/jpillora/chisel/client"
1616
chserver "github.com/jpillora/chisel/server"
1717
chshare "github.com/jpillora/chisel/share"
18+
"github.com/jpillora/chisel/share/ccrypto"
1819
"github.com/jpillora/chisel/share/cos"
20+
"github.com/jpillora/chisel/share/settings"
1921
)
2022

2123
var help = `
@@ -103,12 +105,23 @@ var serverHelp = `
103105
--port, -p, Defines the HTTP listening port (defaults to the environment
104106
variable PORT and fallsback to port 8080).
105107
106-
--key, An optional string to seed the generation of a ECDSA public
108+
--key, (deprecated use --keygen and --keyfile instead)
109+
An optional string to seed the generation of a ECDSA public
107110
and private key pair. All communications will be secured using this
108111
key pair. Share the subsequent fingerprint with clients to enable detection
109112
of man-in-the-middle attacks (defaults to the CHISEL_KEY environment
110113
variable, otherwise a new key is generate each run).
111114
115+
--keygen, A path to write a newly generated PEM-encoded SSH private key file.
116+
If users depend on your --key fingerprint, you may also include your --key to
117+
output your existing key. Use - (dash) to output the generated key to stdout.
118+
119+
--keyfile, An optional path to a PEM-encoded SSH private key. When
120+
this flag is set, the --key option is ignored, and the provided private key
121+
is used to secure all communications. (defaults to the CHISEL_KEY_FILE
122+
environment variable). Since ECDSA keys are short, you may also set keyfile
123+
to an inline base64 private key (e.g. chisel server --keygen - | base64).
124+
112125
--authfile, An optional path to a users.json file. This file should
113126
be an object with users defined like:
114127
{
@@ -170,6 +183,7 @@ func server(args []string) {
170183

171184
config := &chserver.Config{}
172185
flags.StringVar(&config.KeySeed, "key", "", "")
186+
flags.StringVar(&config.KeyFile, "keyfile", "", "")
173187
flags.StringVar(&config.AuthFile, "authfile", "", "")
174188
flags.StringVar(&config.Auth, "auth", "", "")
175189
flags.DurationVar(&config.KeepAlive, "keepalive", 25*time.Second, "")
@@ -187,13 +201,26 @@ func server(args []string) {
187201
port := flags.String("port", "", "")
188202
pid := flags.Bool("pid", false, "")
189203
verbose := flags.Bool("v", false, "")
204+
keyGen := flags.String("keygen", "", "")
190205

191206
flags.Usage = func() {
192207
fmt.Print(serverHelp)
193208
os.Exit(0)
194209
}
195210
flags.Parse(args)
196211

212+
if *keyGen != "" {
213+
if err := ccrypto.GenerateKeyFile(*keyGen, config.KeySeed); err != nil {
214+
log.Fatal(err)
215+
}
216+
return
217+
}
218+
219+
if config.KeySeed != "" {
220+
log.Print("Option `--key` is deprecated and will be removed in a future version of chisel.")
221+
log.Print("Please use `chisel server --keygen /file/path`, followed by `chisel server --keyfile /file/path` to specify the SSH private key")
222+
}
223+
197224
if *host == "" {
198225
*host = os.Getenv("HOST")
199226
}
@@ -209,8 +236,10 @@ func server(args []string) {
209236
if *port == "" {
210237
*port = "8080"
211238
}
212-
if config.KeySeed == "" {
213-
config.KeySeed = os.Getenv("CHISEL_KEY")
239+
if config.KeyFile == "" {
240+
config.KeyFile = settings.Env("KEY_FILE")
241+
} else if config.KeySeed == "" {
242+
config.KeySeed = settings.Env("KEY")
214243
}
215244
s, err := chserver.NewServer(config)
216245
if err != nil {

0 commit comments

Comments
 (0)