Skip to content

Commit 2803f27

Browse files
bmartins-unitip-rwdependabot[bot]Rajpratik71jpillora
authored
RDNET-798 update chisel from upstream (#5)
* Set ServerName (SNI) to *hostname. Useful for spoofing our way through restrictive gateways. * Bump actions/checkout from 2 to 3.1.0 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.1.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v2...v3.1.0) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Added --sni switch to control the ServerName when connecting with TLS. Makes 'domain fronting' possible. * feat: dependabot workflow automation for updating dependency Signed-off-by: Pratik Raj <[email protected]> * Bump github.com/fsnotify/fsnotify from 1.4.9 to 1.6.0 (jpillora#389) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * UDP buffer size override with CHISEL_UDP_MAX_SIZE environment variable (jpillora#367) * Add locking around the connection count to fix a data race. (jpillora#342) Co-authored-by: andres-portainer <[email protected]> * fix: small typo error in main.go (jpillora#334) * Respond to /health and /version by request path rather than by the whole url string (jpillora#328) Co-authored-by: bar <[email protected]> * Update version.go (jpillora#288) * Providing chisel's client with a logger level (jpillora#281) Co-authored-by: Barak Sharoni <[email protected]> Co-authored-by: barak-sharoni-velocity <[email protected]> * add EnvBool * Fix jpillora#390: Use code to generate certificates for client & server (jpillora#400) * docker alpine->google-distroless * docker to use scratch * Fix missing NetDialContext: c.config.DialContext (jpillora#398) * actions: setup go v3 * switch to scratch image * update dependabot * move chisel to flyio * update from upstream --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Pratik Raj <[email protected]> Co-authored-by: ip-rw <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pratik Raj <[email protected]> Co-authored-by: Jaime Pillora <[email protected]> Co-authored-by: fsiegmund <[email protected]> Co-authored-by: andres-portainer <[email protected]> Co-authored-by: andres-portainer <[email protected]> Co-authored-by: 0xflotus <[email protected]> Co-authored-by: BigSully <[email protected]> Co-authored-by: bar <[email protected]> Co-authored-by: invist <[email protected]> Co-authored-by: zuzgon <[email protected]> Co-authored-by: Barak Sharoni <[email protected]> Co-authored-by: barak-sharoni-velocity <[email protected]> Co-authored-by: Jaime Pillora <[email protected]> Co-authored-by: Guillaume SMAHA <[email protected]>
1 parent 63278dc commit 2803f27

28 files changed

+417
-212
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ updates:
44
- package-ecosystem: "github-actions"
55
directory: "/"
66
schedule:
7-
interval: "daily"
7+
interval: "monthly"
8+
9+
# Dependencies listed in go.mod
10+
- package-ecosystem: "gomod"
11+
directory: "/" # Location of package manifests
12+
schedule:
13+
interval: "monthly"

.github/gocompare.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/goreleaser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ archives:
3535
files:
3636
- none*
3737
release:
38+
draft: true
3839
prerelease: auto
3940
changelog:
4041
sort: asc

.github/workflows/ci.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,69 +10,69 @@ jobs:
1010
name: Test
1111
strategy:
1212
matrix:
13-
go-version: [1.13.x, 1.14.x, 1.15.x]
13+
go-version: [1.18.x, 1.19.x]
1414
platform: [ubuntu-latest, macos-latest, windows-latest]
1515
runs-on: ${{ matrix.platform }}
1616
steps:
1717
- name: Install Go
18-
uses: actions/setup-go@v1
18+
uses: actions/setup-go@v3
1919
with:
2020
go-version: ${{ matrix.go-version }}
2121
- name: Checkout code
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323
- name: Build
24-
run: go build -v .
24+
run: go build -v -o /dev/null .
2525
- name: Test
2626
run: go test -v ./...
27-
env:
28-
GODEBUG: x509ignoreCN=0
2927
# ================
30-
# RELEASE JOB
28+
# RELEASE JOBS
3129
# runs after a success test
3230
# only runs on push "v*" tag
3331
# ================
34-
release:
35-
name: Release
32+
release_binaries:
33+
name: Release Binaries
3634
needs: test
3735
if: startsWith(github.ref, 'refs/tags/v')
3836
runs-on: ubuntu-latest
3937
steps:
4038
- name: Check out code
41-
uses: actions/checkout@v2
39+
uses: actions/checkout@v3
4240
- name: goreleaser
4341
if: success()
4442
uses: docker://goreleaser/goreleaser:latest
4543
env:
4644
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4745
with:
4846
args: release --config .github/goreleaser.yml
47+
release_docker:
48+
name: Release Docker Images
49+
needs: test
50+
if: startsWith(github.ref, 'refs/tags/v')
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Check out code
54+
uses: actions/checkout@v3
4955
- name: Set up QEMU
5056
uses: docker/setup-qemu-action@v1
5157
- name: Set up Docker Buildx
5258
id: buildx
5359
uses: docker/setup-buildx-action@v1
5460
- name: Login to DockerHub
55-
uses: docker/login-action@v1
61+
uses: docker/login-action@v2
5662
with:
57-
username: ${{ secrets.DOCKERHUB_USERNAME }}
63+
username: jpillora
5864
password: ${{ secrets.DOCKERHUB_TOKEN }}
5965
- name: Docker meta
6066
id: docker_meta
61-
uses: crazy-max/ghaction-docker-meta@v1
67+
uses: docker/metadata-action@v4
6268
with:
6369
images: jpillora/chisel
64-
tag-latest: true
65-
# Outputs:
66-
# jpillora/chisel:1.2.3
67-
# jpillora/chisel:1.2
68-
# jpillora/chisel:1
69-
# jpillora/chisel:latest
70-
tag-semver: |
71-
{{version}}
72-
{{major}}.{{minor}}
73-
{{major}}
70+
tags: |
71+
type=semver,pattern={{version}}
72+
type=semver,pattern={{major}}.{{minor}}
73+
type=semver,pattern={{major}}
7474
- name: Build and push
75-
uses: docker/build-push-action@v2
75+
uses: docker/build-push-action@v3
7676
with:
7777
context: .
7878
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6

Dockerfile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# build stage
2-
FROM golang:alpine AS build-env
3-
LABEL maintainer="[email protected]"
4-
RUN apk update
5-
RUN apk add git
6-
ENV CGO_ENABLED 0
2+
FROM golang:alpine AS build
3+
RUN apk update && apk add git
74
ADD . /src
85
WORKDIR /src
6+
ENV CGO_ENABLED 0
97
RUN go build \
108
-ldflags "-X github.com/jpillora/chisel/share.BuildVersion=$(git describe --abbrev=0 --tags)" \
11-
-o chisel
12-
# container stage
13-
FROM alpine
14-
RUN apk update && apk add --no-cache ca-certificates
9+
-o /tmp/bin
10+
# run stage
11+
FROM scratch
12+
LABEL maintainer="[email protected]"
13+
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
1514
WORKDIR /app
16-
COPY --from=build-env /src/chisel /app/chisel
17-
ENTRYPOINT ["/app/chisel"]
15+
COPY --from=build /tmp/bin /app/bin
16+
ENTRYPOINT ["/app/bin"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ $ chisel server --help
167167
and you cannot set --tls-domain.
168168
169169
--tls-domain, Enables TLS and automatically acquires a TLS key and
170-
certificate using LetsEncypt. Setting --tls-domain requires port 443.
170+
certificate using LetsEncrypt. Setting --tls-domain requires port 443.
171171
You may specify multiple --tls-domain flags to serve multiple domains.
172172
The resulting files are cached in the "$HOME/.cache/chisel" directory.
173173
You can modify this path by setting the CHISEL_LE_CACHE variable,

client/client.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type Config struct {
4242
Headers http.Header
4343
TLS TLSConfig
4444
DialContext func(ctx context.Context, network, addr string) (net.Conn, error)
45+
Verbose bool
4546
}
4647

4748
//TLSConfig for a Client
@@ -50,6 +51,7 @@ type TLSConfig struct {
5051
CA string
5152
Cert string
5253
Key string
54+
ServerName string
5355
}
5456

5557
//Client represents a client instance
@@ -103,10 +105,13 @@ func NewClient(c *Config) (*Client, error) {
103105
tlsConfig: nil,
104106
}
105107
//set default log level
106-
client.Logger.Info = true
108+
client.Logger.Info = c.Verbose
107109
//configure tls
108110
if u.Scheme == "wss" {
109111
tc := &tls.Config{}
112+
if c.TLS.ServerName != "" {
113+
tc.ServerName = c.TLS.ServerName
114+
}
110115
//certificate verification config
111116
if c.TLS.SkipVerify {
112117
client.Infof("TLS verification disabled")

client/client_connect.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (c *Client) connectionLoop(ctx context.Context) error {
3939
if attempt > 0 {
4040
maxAttemptVal := fmt.Sprint(maxAttempt)
4141
if maxAttempt < 0 {
42-
maxAttemptVal = "unlimited";
42+
maxAttemptVal = "unlimited"
4343
}
4444
msg += fmt.Sprintf(" (Attempt: %d/%s)", attempt, maxAttemptVal)
4545
}
@@ -64,7 +64,7 @@ func (c *Client) connectionLoop(ctx context.Context) error {
6464
return nil
6565
}
6666

67-
//connectionOnce connects to the chisel server and blocks
67+
// connectionOnce connects to the chisel server and blocks
6868
func (c *Client) connectionOnce(ctx context.Context) (connected bool, err error) {
6969
//already closed?
7070
select {
@@ -82,6 +82,7 @@ func (c *Client) connectionOnce(ctx context.Context) (connected bool, err error)
8282
TLSClientConfig: c.tlsConfig,
8383
ReadBufferSize: settings.EnvInt("WS_BUFF_SIZE", 0),
8484
WriteBufferSize: settings.EnvInt("WS_BUFF_SIZE", 0),
85+
NetDialContext: c.config.DialContext,
8586
}
8687
//optional proxy
8788
if p := c.proxyURL; p != nil {

example/Flyfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM jpillora/chisel
2+
ENTRYPOINT ["/app/bin", "server", "--port", "443", "--tls-domain", "chisel.jpillora.com"]

example/fly.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
app = "jp-chisel"
2+
kill_signal = "SIGINT"
3+
kill_timeout = 5
4+
processes = []
5+
6+
[build]
7+
dockerfile = "Flyfile"
8+
9+
[[services]]
10+
internal_port = 443
11+
protocol = "tcp"
12+
[[services.ports]]
13+
port = "443"

0 commit comments

Comments
 (0)