You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switch to slog for structured logging with appropriate log levels for
activity within the app.
- log all token api errors at WARN level
- move tsnet.Server logging to new flag: -debug-tsnet
- move request/response logging to new flag: -debug-all-requests
- unify API error handling logic to writeHTTPError
- switch funnel error to http.StatusUnauthorized
- update docker image to use new logging flags
- update README.md with new flags and env vars
Signed-off-by: Benson Wong <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+93-69Lines changed: 93 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,38 +18,49 @@
18
18
19
19
### (Recommended) Using the pre-built image
20
20
21
-
To be updated.
21
+
Docker images are automatically published on when releases are tagged.
22
22
23
-
### Other ways to build & run tsidp
23
+
```bash
24
+
# to use the latest image
25
+
$ docker pull ghcr.io/tailscale/tsidp:latest
24
26
25
-
<details>
26
-
<summary>Building your own container</summary>
27
+
# to use a specific release version
28
+
$ docker pull ghcr.io/tailscale/tsidp:v0.0.2
29
+
```
27
30
28
-
Replace `YOUR_TAILSCALE_AUTHKEY` with your Tailscale authentication key in the following commands:
31
+
Running a tsidp container:
29
32
30
-
1. Use an existing auth key or create a new auth key in the [Tailscale dashboard](https://login.tailscale.com/admin/settings/keys). Ensure you select an existing [tag](https://tailscale.com/kb/1068/tags) or create a new one.
33
+
> [!TIP]
34
+
> Replace `YOUR_TAILSCALE_AUTHKEY` with your Tailscale authentication key in the following commands:
35
+
>
36
+
> Use an existing auth key or create a new auth key in the [Tailscale dashboard](https://login.tailscale.com/admin/settings/keys). Ensure you select an existing [tag](https://tailscale.com/kb/1068/tags) or create a new one.
31
37
32
38
```bash
33
-
# Build the container using the included Dockerfile
34
-
docker build -t tsidp .
35
-
36
39
# Run tsidp with a persistent volume to store state
37
40
docker run -d \
38
41
--name tsidp \
39
42
-p 443:443 \
40
43
-v tsidp-data:/data \
41
-
-e TS_STATE_DIR=/data \
42
-
-e TS_AUTHKEY=YOUR_TAILSCALE_AUTHKEY \
43
-
-e TSNET_FORCE_LOGIN=1 \
44
44
-e TAILSCALE_USE_WIP_CODE=1 \
45
-
-e TSIDP_ENABLE_STS=1 \
45
+
-e TS_STATE_DIR=/data \
46
46
-e TS_HOSTNAME=idp \
47
-
tsidp
47
+
-e TSIDP_ENABLE_STS=1 \
48
+
ghcr.io/tailscale/tsidp:latest
48
49
```
49
50
50
51
Visit `https://idp.yourtailnet.ts.net` to confirm the service is running.
51
52
52
-
_If you're running tsidp for the first time, you may not be able to access it initially even though it is running. It takes a few minutes for the TLS certificate to generate._
53
+
> [!NOTE]
54
+
> If you're running tsidp for the first time it may take a few minutes for the TLS certificate to generate. You may not be able to access the service until the certificate is ready.
55
+
56
+
### Other Ways to Build and Run
57
+
58
+
<details>
59
+
<summary>Building your own container</summary>
60
+
61
+
```bash
62
+
$ make docker-image
63
+
```
53
64
54
65
</details>
55
66
@@ -60,26 +71,23 @@ If you'd like to build tsidp and / or run it directly you can do the following:
60
71
61
72
```bash
62
73
# Clone the Tailscale repository
63
-
git clone https://github.com/tailscale/tsidp.git
64
-
cd tsidp
65
-
```
66
-
67
-
Replace `YOUR_TAILSCALE_AUTHKEY` with your Tailscale authentication key in the following commands:
68
-
69
-
1. Use an existing auth key or create a new auth key in the [Tailscale dashboard](https://login.tailscale.com/admin/settings/keys). Ensure you select an existing [tag](https://tailscale.com/kb/1068/tags) or create a new one.
70
-
2. Run `TS_AUTH_KEY=YOUR_TAILSCALE_AUTHKEY TAILSCALE_USE_WIP_CODE=1 TSNET_FORCE_LOGIN=1 go run .`
71
-
72
-
Visit `https://idp.yourtailnet.ts.net` to confirm the service is running.
_If you're running tsidp for the first time, you may not be able to access it initially even though it is running. It takes a few minutes for the TLS certificate to generate._
77
+
# run with default values for flags
78
+
$ TAILSCALE_USE_WIP_CODE=1 TS_AUTHKEY={YOUR_TAILSCALE_AUTHKEY} TSNET_FORCE_LOGIN=1 go run .
79
+
```
75
80
76
81
</details>
77
82
78
83
## Setting an Application Capability Grant
79
84
80
-
tsidp requires an [Application capability grant](https://tailscale.com/kb/1537/grants-app-capabilities) to allow access to the admin UI and dynamic client registration endpoints.
85
+
> [!IMPORTANT]
86
+
> Access to the admin UI and dynamic client registration endpoints are **denied** by default.
87
+
88
+
To access the admin UI and dynamic client registration endpoints an [Application capability grant](https://tailscale.com/kb/1537/grants-app-capabilities) must be set in the the [Tailscale console](https://login.tailscale.com/admin).
81
89
82
-
This is a permissive grant that is suitable only for testing purposes:
90
+
This is a permissive grant that is suitable for testing purposes:
83
91
84
92
```json
85
93
"grants": [
@@ -89,23 +97,75 @@ This is a permissive grant that is suitable only for testing purposes:
89
97
"app": {
90
98
"tailscale.com/cap/tsidp": [
91
99
{
92
-
// STS controls
93
-
"users": ["*"],
94
-
"resources": ["*"],
95
-
96
100
// allow access to UI
97
101
"allow_admin_ui": true,
98
102
99
103
// allow dynamic client registration
100
104
"allow_dcr": true,
105
+
106
+
// Secure Token Service (STS) controls
107
+
"users": ["*"],
108
+
"resources": ["*"],
101
109
},
102
110
],
103
111
},
104
112
},
105
113
],
106
114
```
107
115
108
-
## Application Configuration Guides
116
+
## tsidp Configuration Options
117
+
118
+
The `tsidp-server` is configured by several command-line flags:
|`-log <level>`| Set logging level: `debug`, `info`, `warn`, `error`|`info`|
130
+
|`-debug-all-requests`| For development. Prints all requests and responses | disabled |
131
+
|`-debug-tsnet`| For development. Enables debug level logging with tsnet connection | disabled |
132
+
133
+
### CLI Environment Variables
134
+
135
+
The `tsidp-server` binary is configured through the CLI flags above. However, there are several environment variables that configure the libraries `tsidp-server` uses to connect to the Tailnet.
136
+
137
+
#### Required
138
+
139
+
-`TAILSCALE_USE_WIP_CODE=1`: required while tsidp is in development (<v1.0.0).
140
+
141
+
#### Optional
142
+
143
+
These environment variables are used when tsidp does not have any state information set in `-dir <path>`.
144
+
145
+
-`TS_AUTHKEY=<key>`: Key for registering a tsidp as a new node on your tailnet. If omitted a link will be printed to manually register.
146
+
-`TSNET_FORCE_LOGIN=1`: Force re-login of the node. Useful during development.
147
+
148
+
### Docker Environment Variables
149
+
150
+
The Docker image exposes the CLI flags through environment variables. If omitted the default values for the CLI flags will be used.
151
+
152
+
> [!NOTE] > `TS_STATE_DIR` and `TS_HOSTNAME` are legacy names. These will be replaced by `TSIDP_STATE_DIR` and `TSIDP_HOSTNAME` in the future.
All environment variables are optional. When omitted the default value for the command-line flag will be used.
164
-
165
189
## Support
166
190
167
191
This is an experimental, work in progress, [community project](https://tailscale.com/kb/1531/community-projects). For issues or questions, file issues on the [GitHub repository](https://github.com/tailscale/tsidp).
0 commit comments