Skip to content

Commit 56816e6

Browse files
Updated go deps and general package work (antoniomika#279)
* Updated go deps and general package work * Update used go version to 1.21 * feat: wildcard support * Fixed lint * feat: auto redirect to https * Use proper hostname in redirect * Add wildcards to sni proxy * Ensure wildcard isn't too greedy and fix sni on https port * Code cleanup --------- Co-authored-by: Son Nguyen <[email protected]>
1 parent 62dec83 commit 56816e6

17 files changed

+337
-83
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set up Go
3131
uses: actions/setup-go@v3
3232
with:
33-
go-version: 1.19
33+
go-version: 1.21
3434
- name: Checkout repo
3535
uses: actions/checkout@v3
3636
- name: Lint the codebase

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v2
1616
with:
17-
go-version: 1.19
17+
go-version: 1.21
1818
- name: Run GoReleaser
1919
uses: goreleaser/goreleaser-action@v2
2020
with:

.vscode/launch.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
"--http-load-balancer=true",
3939
"--tcp-load-balancer=true",
4040
"--alias-load-balancer=true",
41-
"--sni-load-balancer=true"
41+
"--sni-load-balancer=true",
42+
"--force-https",
43+
"--bind-wildcards"
4244
]
4345
}
4446
]

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=$BUILDPLATFORM golang:1.19-alpine as builder
1+
FROM --platform=$BUILDPLATFORM golang:1.21-alpine as builder
22
LABEL maintainer="Antonio Mika <[email protected]>"
33

44
ENV CGO_ENABLED 0

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ Flags:
342342
--bind-random-subdomains Force bound HTTP tunnels to use random subdomains instead of user provided ones (default true)
343343
--bind-random-subdomains-length int The length of the random subdomain to generate if a subdomain is unavailable or if random subdomains are enforced (default 3)
344344
--bind-root-domain Allow binding the root domain when accepting an HTTP listener
345+
--bind-wildcards Allow binding wildcards when accepting an HTTP listener
345346
--cleanup-unauthed Cleanup unauthed SSH connections after a set timeout (default true)
346347
--cleanup-unauthed-timeout duration Duration to wait before cleaning up an unauthed connection (default 5s)
347348
--cleanup-unbound Cleanup unbound (unforwarded) SSH connections after a set timeout
@@ -350,6 +351,8 @@ Flags:
350351
--debug Enable debugging information
351352
--debug-interval duration Duration to wait between each debug loop output if debug is true (default 2s)
352353
-d, --domain string The root domain for HTTP(S) multiplexing that will be appended to subdomains (default "ssi.sh")
354+
--force-all-https Redirect all requests to the https server
355+
--force-https Allow indiviual binds to request for https to be enforced
353356
--force-requested-aliases Force the aliases used to be the one that is requested. Will fail the bind if it exists already
354357
--force-requested-ports Force the ports used to be the one that is requested. Will fail the bind if it exists already
355358
--force-requested-subdomains Force the subdomains used to be the one that is requested. Will fail the bind if it exists already

cmd/sish.go

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ func init() {
9898
rootCmd.PersistentFlags().BoolP("proxy-protocol-use-timeout", "", false, "Use a timeout for the proxy-protocol read")
9999
rootCmd.PersistentFlags().BoolP("proxy-protocol-listener", "", false, "Use the proxy-protocol to resolve ip addresses from user connections")
100100
rootCmd.PersistentFlags().BoolP("https", "", false, "Listen for HTTPS connections. Requires a correct --https-certificate-directory")
101+
rootCmd.PersistentFlags().BoolP("force-all-https", "", false, "Redirect all requests to the https server")
102+
rootCmd.PersistentFlags().BoolP("force-https", "", false, "Allow indiviual binds to request for https to be enforced")
101103
rootCmd.PersistentFlags().BoolP("redirect-root", "", true, "Redirect the root domain to the location defined in --redirect-root-location")
102104
rootCmd.PersistentFlags().BoolP("admin-console", "", false, "Enable the admin console accessible at http(s)://domain/_sish/console?x-authorization=admin-console-token")
103105
rootCmd.PersistentFlags().BoolP("service-console", "", false, "Enable the service console for each service and send the info to connected clients")
@@ -121,6 +123,7 @@ func init() {
121123
rootCmd.PersistentFlags().BoolP("strip-http-path", "", true, "Strip the http path from the forward")
122124
rootCmd.PersistentFlags().BoolP("bind-any-host", "", false, "Allow binding any host when accepting an HTTP listener")
123125
rootCmd.PersistentFlags().BoolP("bind-root-domain", "", false, "Allow binding the root domain when accepting an HTTP listener")
126+
rootCmd.PersistentFlags().BoolP("bind-wildcards", "", false, "Allow binding wildcards when accepting an HTTP listener")
124127
rootCmd.PersistentFlags().BoolP("load-templates", "", true, "Load HTML templates. This is required for admin/service consoles")
125128
rootCmd.PersistentFlags().BoolP("rewrite-host-header", "", true, "Force rewrite the host header if the user provides host-header=host.com")
126129

config.example.yml

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ bind-random-ports: true
2323
bind-random-subdomains: true
2424
bind-random-subdomains-length: 3
2525
bind-root-domain: false
26+
bind-wildcards: false
2627
cleanup-unauthed: true
2728
cleanup-unauthed-timeout: 5s
2829
cleanup-unbound: false
@@ -31,6 +32,8 @@ config: config.yml
3132
debug: false
3233
debug-interval: 2s
3334
domain: ssi.sh
35+
force-all-https: false
36+
force-https: false
3437
force-requested-aliases: false
3538
force-requested-ports: false
3639
force-requested-subdomains: false

go.mod

+45-34
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,80 @@
11
module github.com/antoniomika/sish
22

3-
go 1.19
3+
go 1.21
44

55
require (
66
github.com/ScaleFT/sshkeys v1.2.0
77
github.com/antoniomika/syncmap v1.0.0
8-
github.com/caddyserver/certmagic v0.17.2
8+
github.com/caddyserver/certmagic v0.19.2
99
github.com/fsnotify/fsnotify v1.6.0
10-
github.com/gin-gonic/gin v1.8.1
10+
github.com/gin-gonic/gin v1.9.1
1111
github.com/gorilla/websocket v1.5.0
12-
github.com/jpillora/ipfilter v1.2.8
12+
github.com/jpillora/ipfilter v1.2.9
1313
github.com/logrusorgru/aurora v2.0.3+incompatible
1414
github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a
15-
github.com/pires/go-proxyproto v0.6.2
15+
github.com/pires/go-proxyproto v0.7.0
1616
github.com/radovskyb/watcher v1.0.7
17-
github.com/sirupsen/logrus v1.9.0
18-
github.com/spf13/cobra v1.6.1
19-
github.com/spf13/viper v1.14.0
17+
github.com/sirupsen/logrus v1.9.3
18+
github.com/spf13/cobra v1.7.0
19+
github.com/spf13/viper v1.17.0
2020
github.com/vulcand/oxy v1.4.2
21-
golang.org/x/crypto v0.4.0
22-
gopkg.in/natefinch/lumberjack.v2 v2.0.0
21+
golang.org/x/crypto v0.14.0
22+
gopkg.in/natefinch/lumberjack.v2 v2.2.1
2323
)
2424

2525
require (
2626
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
27+
github.com/bytedance/sonic v1.10.1 // indirect
28+
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
29+
github.com/chenzhuoyu/iasm v0.9.0 // indirect
2730
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect
31+
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
2832
github.com/gin-contrib/sse v0.1.0 // indirect
29-
github.com/go-playground/locales v0.14.0 // indirect
30-
github.com/go-playground/universal-translator v0.18.0 // indirect
31-
github.com/go-playground/validator/v10 v10.11.1 // indirect
32-
github.com/goccy/go-json v0.10.0 // indirect
33+
github.com/go-playground/locales v0.14.1 // indirect
34+
github.com/go-playground/universal-translator v0.18.1 // indirect
35+
github.com/go-playground/validator/v10 v10.15.5 // indirect
36+
github.com/goccy/go-json v0.10.2 // indirect
3337
github.com/hashicorp/hcl v1.0.0 // indirect
3438
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3539
github.com/json-iterator/go v1.1.12 // indirect
36-
github.com/klauspost/cpuid/v2 v2.2.2 // indirect
37-
github.com/leodido/go-urn v1.2.1 // indirect
40+
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
41+
github.com/leodido/go-urn v1.2.4 // indirect
3842
github.com/libdns/libdns v0.2.1 // indirect
3943
github.com/magiconair/properties v1.8.7 // indirect
4044
github.com/mailgun/timetools v0.0.0-20170619190023-f3a7b8ffff47 // indirect
41-
github.com/mattn/go-isatty v0.0.16 // indirect
42-
github.com/mholt/acmez v1.0.4 // indirect
43-
github.com/miekg/dns v1.1.50 // indirect
45+
github.com/mattn/go-isatty v0.0.19 // indirect
46+
github.com/mholt/acmez v1.2.0 // indirect
47+
github.com/miekg/dns v1.1.56 // indirect
4448
github.com/mitchellh/mapstructure v1.5.0 // indirect
4549
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4650
github.com/modern-go/reflect2 v1.0.2 // indirect
4751
github.com/pelletier/go-toml v1.9.5 // indirect
48-
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
49-
github.com/phuslu/iploc v1.0.20221130 // indirect
52+
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
53+
github.com/phuslu/iploc v1.0.20230929 // indirect
54+
github.com/sagikazarmark/locafero v0.3.0 // indirect
55+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
5056
github.com/segmentio/fasthash v1.0.3 // indirect
51-
github.com/spf13/afero v1.9.3 // indirect
52-
github.com/spf13/cast v1.5.0 // indirect
57+
github.com/sourcegraph/conc v0.3.0 // indirect
58+
github.com/spf13/afero v1.10.0 // indirect
59+
github.com/spf13/cast v1.5.1 // indirect
5360
github.com/spf13/jwalterweatherman v1.1.0 // indirect
5461
github.com/spf13/pflag v1.0.5 // indirect
55-
github.com/subosito/gotenv v1.4.1 // indirect
62+
github.com/subosito/gotenv v1.6.0 // indirect
5663
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
57-
github.com/ugorji/go/codec v1.2.7 // indirect
58-
go.uber.org/atomic v1.10.0 // indirect
59-
go.uber.org/multierr v1.8.0 // indirect
60-
go.uber.org/zap v1.24.0 // indirect
61-
golang.org/x/mod v0.7.0 // indirect
62-
golang.org/x/net v0.4.0 // indirect
63-
golang.org/x/sys v0.3.0 // indirect
64-
golang.org/x/text v0.5.0 // indirect
65-
golang.org/x/tools v0.4.0 // indirect
66-
google.golang.org/protobuf v1.28.1 // indirect
64+
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
65+
github.com/ugorji/go/codec v1.2.11 // indirect
66+
github.com/zeebo/blake3 v0.2.3 // indirect
67+
go.uber.org/atomic v1.11.0 // indirect
68+
go.uber.org/multierr v1.11.0 // indirect
69+
go.uber.org/zap v1.26.0 // indirect
70+
golang.org/x/arch v0.5.0 // indirect
71+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
72+
golang.org/x/mod v0.13.0 // indirect
73+
golang.org/x/net v0.16.0 // indirect
74+
golang.org/x/sys v0.13.0 // indirect
75+
golang.org/x/text v0.13.0 // indirect
76+
golang.org/x/tools v0.14.0 // indirect
77+
google.golang.org/protobuf v1.31.0 // indirect
6778
gopkg.in/ini.v1 v1.67.0 // indirect
6879
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
6980
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)