Skip to content

Commit 0bd2821

Browse files
authored
refactor: use tailscale api for user checking instead of tsnet (#978)
1 parent 364175a commit 0bd2821

15 files changed

Lines changed: 266 additions & 480 deletions

File tree

.env.example

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,18 @@ TINYAUTH_LDAP_AUTHKEY=
221221
# Cache duration for LDAP group membership in seconds.
222222
TINYAUTH_LDAP_GROUPCACHETTL=900
223223

224-
# experimental config
224+
# tailscale config
225225

226226
# Enable Tailscale integration.
227-
TINYAUTH_EXPERIMENTAL_TAILSCALE_ENABLED=false
228-
# Tailscale state directory.
229-
TINYAUTH_EXPERIMENTAL_TAILSCALE_DIR="./tailscale_state"
230-
# Tailscale hostname.
231-
TINYAUTH_EXPERIMENTAL_TAILSCALE_HOSTNAME=
232-
# Tailscale auth key.
233-
TINYAUTH_EXPERIMENTAL_TAILSCALE_AUTHKEY=
234-
# Use ephemeral Tailscale node.
235-
TINYAUTH_EXPERIMENTAL_TAILSCALE_EPHEMERAL=false
236-
# Enable Tailscale Funnel.
237-
TINYAUTH_EXPERIMENTAL_TAILSCALE_FUNNEL=false
238-
# Listen on the Tailscale address instead of standard address.
239-
TINYAUTH_EXPERIMENTAL_TAILSCALE_LISTEN=false
227+
TINYAUTH_TAILSCALE_ENABLED=false
228+
# Tailscale API token.
229+
TINYAUTH_TAILSCALE_APITOKEN=
230+
# Path to the file containing the Tailscale API token.
231+
TINYAUTH_TAILSCALE_APITOKENFILE=
232+
# Tailnet name.
233+
TINYAUTH_TAILSCALE_TAILNET=
234+
# Cache duration for Tailscale device and user lists in seconds.
235+
TINYAUTH_TAILSCALE_CACHEDURATION=300
240236
# Label provider to use for ACLs (auto, docker, kubernetes or none to disable). auto detects the environment.
241237
TINYAUTH_LABELPROVIDER="auto"
242238

.github/workflows/nightly.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,14 @@ jobs:
4242
with:
4343
ref: nightly
4444

45-
- name: Install go
46-
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
47-
with:
48-
go-version: "^1.26.4"
49-
5045
- name: Generate metadata
5146
id: metadata
5247
run: |
5348
echo "VERSION=nightly" >> "$GITHUB_OUTPUT"
5449
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
5550
echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_OUTPUT"
56-
export TAILSCALE_BUILD_TAGS=$(go run tailscale.com/cmd/featuretags@v1.100.0 -min -add acme,serve,netstack)
5751
export GIN_BUILD_TAGS=nomsgpack
58-
echo "BUILD_TAGS=$TAILSCALE_BUILD_TAGS,$GIN_BUILD_TAGS" >> "$GITHUB_OUTPUT"
52+
echo "BUILD_TAGS=$GIN_BUILD_TAGS" >> "$GITHUB_OUTPUT"
5953
6054
binary-build:
6155
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ jobs:
2121
- name: Checkout
2222
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2323

24-
- name: Install go
25-
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
26-
with:
27-
go-version: "^1.26.4"
28-
2924
- name: Generate metadata
3025
id: metadata
3126
env:
@@ -34,9 +29,8 @@ jobs:
3429
echo "VERSION=$REF_NAME" >> "$GITHUB_OUTPUT"
3530
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
3631
echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_OUTPUT"
37-
export TAILSCALE_BUILD_TAGS=$(go run tailscale.com/cmd/featuretags@v1.100.0 -min -add acme,serve,netstack)
3832
export GIN_BUILD_TAGS=nomsgpack
39-
echo "BUILD_TAGS=$TAILSCALE_BUILD_TAGS,$GIN_BUILD_TAGS" >> "$GITHUB_OUTPUT"
33+
echo "BUILD_TAGS=$GIN_BUILD_TAGS" >> "$GITHUB_OUTPUT"
4034
4135
binary-build:
4236
runs-on: ubuntu-latest

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ COMMIT_HASH := $(shell git rev-parse HEAD)
99
BUILD_TIMESTAMP := $(shell date '+%Y-%m-%dT%H:%M:%S')
1010
BIN_NAME := tinyauth-$(GOARCH)
1111
LDFLAGS := -s -w
12-
# We don't want all of the tailscale feature-set
13-
TAILSCALE_BUILD_TAGS = $(shell go run tailscale.com/cmd/featuretags@v1.100.0 -min -add acme,serve,netstack)
1412
# Whatever 6MB serialization lib Gin is using
1513
GIN_BUILD_TAGS := nomsgpack
16-
BUILD_TAGS = $(GIN_BUILD_TAGS),$(TAILSCALE_BUILD_TAGS)
14+
BUILD_TAGS = $(GIN_BUILD_TAGS)
1715

1816
# Development vars
1917
DEV_COMPOSE := $(shell test -f "docker-compose.test.yml" && echo "docker-compose.test.yml" || echo "docker-compose.dev.yml" )

go.mod

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,18 @@ require (
3030
k8s.io/apimachinery v0.36.2
3131
k8s.io/client-go v0.36.2
3232
modernc.org/sqlite v1.53.0
33-
tailscale.com v1.100.0
3433
)
3534

3635
require (
3736
charm.land/bubbles/v2 v2.0.0 // indirect
3837
charm.land/bubbletea/v2 v2.0.2 // indirect
3938
dario.cat/mergo v1.0.1 // indirect
40-
filippo.io/edwards25519 v1.2.0 // indirect
4139
github.com/Azure/go-ntlmssp v0.1.1 // indirect
4240
github.com/BurntSushi/toml v1.6.0 // indirect
4341
github.com/Masterminds/goutils v1.1.1 // indirect
4442
github.com/Masterminds/semver/v3 v3.4.0 // indirect
4543
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
4644
github.com/Microsoft/go-winio v0.6.2 // indirect
47-
github.com/akutz/memconn v0.1.0 // indirect
48-
github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e // indirect
4945
github.com/atotto/clipboard v0.1.4 // indirect
5046
github.com/boombuler/barcode v1.0.2 // indirect
5147
github.com/bytedance/gopkg v0.1.3 // indirect
@@ -64,59 +60,46 @@ require (
6460
github.com/clipperhouse/displaywidth v0.11.0 // indirect
6561
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
6662
github.com/cloudwego/base64x v0.1.6 // indirect
67-
github.com/coder/websocket v1.8.12 // indirect
6863
github.com/containerd/errdefs v1.0.0 // indirect
6964
github.com/containerd/errdefs/pkg v0.3.0 // indirect
70-
github.com/creachadair/msync v0.7.1 // indirect
65+
github.com/containerd/log v0.1.0 // indirect
7166
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
72-
github.com/dblohm7/wingoes v0.0.0-20240119213807-a09d6be7affa // indirect
7367
github.com/distribution/reference v0.6.0 // indirect
7468
github.com/docker/go-connections v0.6.0 // indirect
7569
github.com/docker/go-units v0.5.0 // indirect
7670
github.com/dustin/go-humanize v1.0.1 // indirect
7771
github.com/felixge/httpsnoop v1.0.4 // indirect
7872
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
7973
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
80-
github.com/gaissmai/bart v0.26.1 // indirect
8174
github.com/gin-contrib/sse v1.1.0 // indirect
8275
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect
83-
github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 // indirect
8476
github.com/go-logr/logr v1.4.3 // indirect
8577
github.com/go-logr/stdr v1.2.2 // indirect
78+
github.com/go-openapi/jsonreference v0.20.4 // indirect
8679
github.com/go-playground/locales v0.14.1 // indirect
8780
github.com/go-playground/universal-translator v0.18.1 // indirect
8881
github.com/go-playground/validator/v10 v10.30.1 // indirect
8982
github.com/goccy/go-json v0.10.5 // indirect
9083
github.com/goccy/go-yaml v1.19.2 // indirect
91-
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 // indirect
92-
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
93-
github.com/google/btree v1.1.3 // indirect
94-
github.com/google/go-cmp v0.7.0 // indirect
95-
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
9684
github.com/huandu/xstrings v1.5.0 // indirect
97-
github.com/huin/goupnp v1.3.0 // indirect
9885
github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect
9986
github.com/jackc/pgpassfile v1.0.0 // indirect
10087
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
10188
github.com/jackc/puddle/v2 v2.2.2 // indirect
102-
github.com/jsimonetti/rtnetlink v1.4.0 // indirect
10389
github.com/json-iterator/go v1.1.12 // indirect
104-
github.com/klauspost/compress v1.18.5 // indirect
10590
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
10691
github.com/leodido/go-urn v1.4.0 // indirect
10792
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
10893
github.com/mattn/go-colorable v0.1.14 // indirect
10994
github.com/mattn/go-isatty v0.0.20 // indirect
11095
github.com/mattn/go-runewidth v0.0.20 // indirect
11196
github.com/mattn/go-sqlite3 v1.14.32 // indirect
112-
github.com/mdlayher/netlink v1.7.3-0.20250113171957-fbb4dce95f42 // indirect
113-
github.com/mdlayher/socket v0.5.0 // indirect
11497
github.com/mitchellh/copystructure v1.2.0 // indirect
115-
github.com/mitchellh/go-ps v1.0.0 // indirect
11698
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
11799
github.com/mitchellh/reflectwalk v1.0.2 // indirect
118100
github.com/moby/docker-image-spec v1.3.1 // indirect
119101
github.com/moby/sys/atomicwriter v0.1.0 // indirect
102+
github.com/moby/term v0.5.2 // indirect
120103
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
121104
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
122105
github.com/muesli/cancelreader v0.2.2 // indirect
@@ -125,22 +108,16 @@ require (
125108
github.com/opencontainers/go-digest v1.0.0 // indirect
126109
github.com/opencontainers/image-spec v1.1.1 // indirect
127110
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
128-
github.com/pires/go-proxyproto v0.8.1 // indirect
129111
github.com/pkg/errors v0.9.1 // indirect
130112
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
131113
github.com/quic-go/qpack v0.6.0 // indirect
132114
github.com/quic-go/quic-go v0.59.1 // indirect
133115
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
134116
github.com/rivo/uniseg v0.4.7 // indirect
135-
github.com/safchain/ethtool v0.3.0 // indirect
136117
github.com/shopspring/decimal v1.4.0 // indirect
118+
github.com/sirupsen/logrus v1.9.4 // indirect
137119
github.com/spf13/cast v1.10.0 // indirect
138-
github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d // indirect
139-
github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 // indirect
140-
github.com/tailscale/hujson v0.0.0-20260302212456-ecc657c15afd // indirect
141-
github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc // indirect
142-
github.com/tailscale/web-client-prebuilt v0.0.0-20250124233751-d4cd19a26976 // indirect
143-
github.com/tailscale/wireguard-go v0.0.0-20260527010701-b48af7099cad // indirect
120+
github.com/spf13/pflag v1.0.10 // indirect
144121
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
145122
github.com/ugorji/go/codec v1.3.1 // indirect
146123
github.com/x448/float16 v0.8.4 // indirect
@@ -155,8 +132,6 @@ require (
155132
go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
156133
go.opentelemetry.io/otel/trace v1.43.0 // indirect
157134
go.yaml.in/yaml/v2 v2.4.3 // indirect
158-
go4.org/mem v0.0.0-20240501181205-ae6ca9944745 // indirect
159-
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
160135
golang.org/x/arch v0.22.0 // indirect
161136
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
162137
golang.org/x/mod v0.37.0 // indirect
@@ -166,12 +141,9 @@ require (
166141
golang.org/x/term v0.44.0 // indirect
167142
golang.org/x/text v0.38.0 // indirect
168143
golang.org/x/time v0.14.0 // indirect
169-
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
170-
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
171144
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect
172145
gopkg.in/inf.v0 v0.9.1 // indirect
173146
gotest.tools/v3 v3.5.2 // indirect
174-
gvisor.dev/gvisor v0.0.0-20260224225140-573d5e7127a8 // indirect
175147
k8s.io/klog/v2 v2.140.0 // indirect
176148
k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect
177149
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 // indirect

0 commit comments

Comments
 (0)