Skip to content

Commit

Permalink
Initial Fork
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanHood committed Apr 6, 2022
0 parents commit beeea34
Show file tree
Hide file tree
Showing 9 changed files with 634 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: checks

on:
push:
branches: ['main']
pull_request:
branches: ['*']

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: WillAbides/setup-go-faster@v1.7.0
with:
go-version: 1.17
- run: go install mvdan.cc/gofumpt@latest
- run: test -z $(gofumpt -l .)
- run: go vet ./...
- run: go build ./...
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: release

on:
push:
tags: ['v*']

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: WillAbides/setup-go-faster@v1.7.0
with:
go-version: 1.17
- uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tsstate/
dist/
20 changes: 20 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
before:
hooks:
- go mod tidy -compat=1.17
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# tailscale-netcat

This tool is designed to immitate netcat for the purposes of SSH's ProxyCommand. It may work for other uses of netcat within a Tailscale network but I wouldn't trust it.

## Usage

On first run you will need to login, a link is provided for ease of use. Auth keys are also supported, see below for use
```
sean@laptop:~$ ssh -o 'ProxyCommand tailscale-netcat -host %h -port %p' myserver
2022/04/02 15:54:42 NeedsLogin: https://login.tailscale.com/a/12345678
kex_exchange_identification: Connection closed by remote host
```

On second login, you'll be in:
```
sean@laptop:~$ ssh -o 'ProxyCommand tailscale-netcat -host %h -port %p' myserver
sean@myserver:~$
```

Optional Env Vars:

`TS_AUTHKEY` is now enabled for this project. You can provide this variable with a key, consult the tailscale documentation to determine the appropriate key to use.

`TS_STATEDIR` is the location where the persistent data for the sidecar will be stored. This is used to not need to re-authorise the instance. In a container setup, you'll want to have this persisted. The default is `./tsstate`, which will result in Tailscale using `home/nonroot/tsstate` in the Docker container.


## Credits
* https://github.com/markpash/tailscale-sidecar
* https://github.com/vfedoroff/go-netcat
50 changes: 50 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module github.com/seanhood/tailscale-netcat

go 1.17

require tailscale.com v1.22.2

require (
github.com/akutz/memconn v0.1.0 // indirect
github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 // indirect
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/coreos/go-iptables v0.6.0 // indirect
github.com/creack/pty v1.1.17 // indirect
github.com/gliderlabs/ssh v0.3.3 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/godbus/dbus/v5 v5.0.6 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/insomniacslk/dhcp v0.0.0-20211026125128-ad197bcd36fd // indirect
github.com/josharian/native v1.0.0 // indirect
github.com/jsimonetti/rtnetlink v0.0.0-20211203074127-fd9a11f42291 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/mdlayher/netlink v1.6.0 // indirect
github.com/mdlayher/sdnotify v0.0.0-20210228150836-ea3ec207d697 // indirect
github.com/mdlayher/socket v0.1.1 // indirect
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/tailscale/certstore v0.0.0-20210528134328-066c94b793d3 // indirect
github.com/tailscale/goupnp v1.0.1-0.20210804011211-c64d0f06ea05 // indirect
github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85 // indirect
github.com/tcnksm/go-httpstat v0.2.0 // indirect
github.com/u-root/uio v0.0.0-20210528114334-82958018845c // indirect
github.com/vishvananda/netlink v1.1.1-0.20211101163509-b10eb8fe5cf6 // indirect
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/mem v0.0.0-20210711025021-927187094b94 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20211027215541-db492cf91b37 // indirect
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 // indirect
golang.zx2c4.com/wireguard v0.0.0-20211116201604-de7c702ace45 // indirect
golang.zx2c4.com/wireguard/windows v0.4.10 // indirect
gvisor.dev/gvisor v0.0.0-20220126021142-d8aa030b2591 // indirect
inet.af/netaddr v0.0.0-20211027220019-c74959edd3b6 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
Loading

0 comments on commit beeea34

Please sign in to comment.