This file was never truly necessary and has never actually been used in the history of Tailscale's open source releases. A Brief History of AUTHORS files --- The AUTHORS file was a pattern developed at Google, originally for Chromium, then adopted by Go and a bunch of other projects. The problem was that Chromium originally had a copyright line only recognizing Google as the copyright holder. Because Google (and most open source projects) do not require copyright assignemnt for contributions, each contributor maintains their copyright. Some large corporate contributors then tried to add their own name to the copyright line in the LICENSE file or in file headers. This quickly becomes unwieldy, and puts a tremendous burden on anyone building on top of Chromium, since the license requires that they keep all copyright lines intact. The compromise was to create an AUTHORS file that would list all of the copyright holders. The LICENSE file and source file headers would then include that list by reference, listing the copyright holder as "The Chromium Authors". This also become cumbersome to simply keep the file up to date with a high rate of new contributors. Plus it's not always obvious who the copyright holder is. Sometimes it is the individual making the contribution, but many times it may be their employer. There is no way for the proejct maintainer to know. Eventually, Google changed their policy to no longer recommend trying to keep the AUTHORS file up to date proactively, and instead to only add to it when requested: https://opensource.google/docs/releasing/authors. They are also clear that: > Adding contributors to the AUTHORS file is entirely within the > project's discretion and has no implications for copyright ownership. It was primarily added to appease a small number of large contributors that insisted that they be recognized as copyright holders (which was entirely their right to do). But it's not truly necessary, and not even the most accurate way of identifying contributors and/or copyright holders. In practice, we've never added anyone to our AUTHORS file. It only lists Tailscale, so it's not really serving any purpose. It also causes confusion because Tailscalars put the "Tailscale Inc & AUTHORS" header in other open source repos which don't actually have an AUTHORS file, so it's ambiguous what that means. Instead, we just acknowledge that the contributors to Tailscale (whoever they are) are copyright holders for their individual contributions. We also have the benefit of using the DCO (developercertificate.org) which provides some additional certification of their right to make the contribution. The source file changes were purely mechanical with: git ls-files | xargs sed -i -e 's/\(Tailscale Inc &\) AUTHORS/\1 contributors/g' Updates #cleanup Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d Signed-off-by: Will Norris <will@tailscale.com>
nginx-auth
This is a tool that allows users to use Tailscale Whois authentication with NGINX as a reverse proxy. This allows users that already have a bunch of services hosted on an internal NGINX server to point those domains to the Tailscale IP of the NGINX server and then seamlessly use Tailscale for authentication.
Many thanks to @zrail on Twitter for introducing the basic idea and offering some sample code. This program is based on that sample code with security enhancements. Namely:
- This listens over a UNIX socket instead of a TCP socket, to prevent leakage to the network
- This uses systemd socket activation so that systemd owns the socket and can then lock down the service to the bare minimum required to do its job without having to worry about dropping permissions
- This provides additional information in HTTP response headers that can be useful for integrating with various services
Configuration
In order to protect a service with this tool, do the following in the respective
server block:
Create an authentication location with the internal flag set:
location /auth {
internal;
proxy_pass http://unix:/run/tailscale.nginx-auth.sock;
proxy_pass_request_body off;
proxy_set_header Host $http_host;
proxy_set_header Remote-Addr $remote_addr;
proxy_set_header Remote-Port $remote_port;
proxy_set_header Original-URI $request_uri;
}
Then add the following to the location / block:
auth_request /auth;
auth_request_set $auth_user $upstream_http_tailscale_user;
auth_request_set $auth_name $upstream_http_tailscale_name;
auth_request_set $auth_login $upstream_http_tailscale_login;
auth_request_set $auth_tailnet $upstream_http_tailscale_tailnet;
auth_request_set $auth_profile_picture $upstream_http_tailscale_profile_picture;
proxy_set_header X-Webauth-User "$auth_user";
proxy_set_header X-Webauth-Name "$auth_name";
proxy_set_header X-Webauth-Login "$auth_login";
proxy_set_header X-Webauth-Tailnet "$auth_tailnet";
proxy_set_header X-Webauth-Profile-Picture "$auth_profile_picture";
When this configuration is used with a Go HTTP handler such as this:
http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
e := json.NewEncoder(w)
e.SetIndent("", " ")
e.Encode(r.Header)
})
You will get output like this:
{
"Accept": [
"*/*"
],
"Connection": [
"upgrade"
],
"User-Agent": [
"curl/7.82.0"
],
"X-Webauth-Login": [
"Xe"
],
"X-Webauth-Name": [
"Xe Iaso"
],
"X-Webauth-Profile-Picture": [
"https://avatars.githubusercontent.com/u/529003?v=4"
],
"X-Webauth-Tailnet": [
"cetacean.org.github"
]
"X-Webauth-User": [
"Xe@github"
]
}
Headers
The authentication service provides the following headers to decorate your proxied requests:
| Header | Example Value | Description |
|---|---|---|
Tailscale-User |
azurediamond@hunter2.net |
The Tailscale username the remote machine is logged in as in user@host form |
Tailscale-Login |
azurediamond |
The user portion of the Tailscale username the remote machine is logged in as |
Tailscale-Name |
Azure Diamond |
The "real name" of the Tailscale user the machine is logged in as |
Tailscale-Profile-Picture |
https://i.kym-cdn.com/photos/images/newsfeed/001/065/963/ae0.png |
The profile picture provided by the Identity Provider your tailnet uses |
Tailscale-Tailnet |
hunter2.net |
The tailnet name |
Most of the time you can set X-Webauth-User to the contents of the
Tailscale-User header, but some services may not accept a username with an @
symbol in it. If this is the case, set X-Webauth-User to the Tailscale-Login
header.
The Tailscale-Tailnet header can help you identify which tailnet the session
is coming from. If you are using node sharing, this can help you make sure that
you aren't giving administrative access to people outside your tailnet.
Allow Requests From Only One Tailnet
If you want to prevent node sharing from allowing users to access a service, add
the Expected-Tailnet header to your auth request:
location /auth {
# ...
proxy_set_header Expected-Tailnet "tailnet012345.ts.net";
}
If a user from a different tailnet tries to use that service, this will return a generic "forbidden" error page:
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
You can get the tailnet name from the admin panel.
Building
Install cmd/mkpkg:
cd .. && go install ./mkpkg
Then run ./mkdeb.sh. It will emit a .deb and .rpm package for amd64
machines (Linux uname flag: x86_64). You can add these to your deployment
methods as you see fit.