Skip to content

Commit a8d8b87

Browse files
author
Earl Lee
committed
Move Linux client & common packages into a public repo.
1 parent c955043 commit a8d8b87

File tree

156 files changed

+17113
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+17113
-0
lines changed

AUTHORS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This is the official list of Tailscale
2+
# authors for copyright purposes.
3+
#
4+
# Names should be added to this file as one of
5+
# Organization's name
6+
# Individual's name <submission email address>
7+
# Individual's name <submission email address> <email2> <emailN>
8+
#
9+
# Please keep the list sorted.
10+
#
11+
# You do not need to add entries to this list, and we don't actively
12+
# populate this list. If you do want to be acknowledged explicitly as
13+
# a copyright holder, though, then please send a PR referencing your
14+
# earlier contributions and clarifying whether it's you or your
15+
# company that owns the rights to your contribution.
16+
17+
Tailscale Inc.

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2020 Tailscale & AUTHORS. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
* Neither the name of Tailscale Inc. nor the names of its
14+
contributors may be used to endorse or promote products derived from
15+
this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PATENTS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Additional IP Rights Grant (Patents)
2+
3+
"This implementation" means the copyrightable works distributed by
4+
Tailscale Inc. as part of the Tailscale project.
5+
6+
Tailscale Inc. hereby grants to You a perpetual, worldwide,
7+
non-exclusive, no-charge, royalty-free, irrevocable (except as stated
8+
in this section) patent license to make, have made, use, offer to
9+
sell, sell, import, transfer and otherwise run, modify and propagate
10+
the contents of this implementation of Tailscale, where such license
11+
applies only to those patent claims, both currently owned or
12+
controlled by Tailscale Inc. and acquired in the future, licensable
13+
by Tailscale Inc. that are necessarily infringed by this
14+
implementation of Tailscale. This grant does not include claims that
15+
would be infringed only as a consequence of further modification of
16+
this implementation. If you or your agent or exclusive licensee
17+
institute or order or agree to the institution of patent litigation
18+
against any entity (including a cross-claim or counterclaim in a
19+
lawsuit) alleging that this implementation of Tailscale or any code
20+
incorporated within this implementation of Tailscale constitutes
21+
direct or contributory patent infringement, or inducement of patent
22+
infringement, then any patent rights granted to you under this License
23+
for this implementation of Tailscale shall terminate as of the date
24+
such litigation is filed.

atomicfile/atomicfile.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2019 Tailscale & AUTHORS. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// Package atomicfile contains code related to writing to filesystems
6+
// atomically.
7+
//
8+
// This package should be considered internal; its API is not stable.
9+
package atomicfile // import "tailscale.com/atomicfile"
10+
11+
import (
12+
"fmt"
13+
"io/ioutil"
14+
"os"
15+
)
16+
17+
// WriteFile writes data to filename+some suffix, then renames it
18+
// into filename.
19+
func WriteFile(filename string, data []byte, perm os.FileMode) error {
20+
tmpname := filename + ".new.tmp"
21+
if err := ioutil.WriteFile(tmpname, data, perm); err != nil {
22+
return fmt.Errorf("%#v: %v", tmpname, err)
23+
}
24+
if err := os.Rename(tmpname, filename); err != nil {
25+
return fmt.Errorf("%#v->%#v: %v", tmpname, filename, err)
26+
}
27+
return nil
28+
}

cmd/relaynode/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*.tar.gz
2+
/*.deb
3+
/*.rpm
4+
/*.spec
5+
/pkgver
6+
debian/changelog
7+
debian/debhelper-build-stamp
8+
debian/files
9+
debian/*.log
10+
debian/*.substvars
11+
debian/*.debhelper
12+
debian/tailscale-relay
13+
/tailscale-relay/
14+
/tailscale-relay-*

cmd/relaynode/acl.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
// Declare static groups of users beyond those in the identity service
3+
"Groups": {
4+
5+
},
6+
7+
// Declare convenient hostname aliases to use in place of IP addresses
8+
"Hosts": {
9+
"h222": "100.2.2.2"
10+
},
11+
12+
// Access control list
13+
"ACLs": [
14+
{
15+
"Action": "accept",
16+
// Match any of several users
17+
18+
// Match any port on h222, and port 22 of 10.1.2.3
19+
"Ports": ["h222:*", "10.1.2.3:22"]
20+
},
21+
{
22+
"Action": "accept",
23+
// Match any user at all
24+
"Users": ["*"],
25+
// Match port 80 on one machine, ports 53 and 5353 on a second one,
26+
// and ports 8000 through 8080 (a port range) on a third one.
27+
"Ports": ["h222:80", "10.8.8.8:53,5353", "10.2.3.4:8000-8080"]
28+
},
29+
{
30+
"Action": "accept",
31+
// Match all users in the "Admin" role (network administrators)
32+
"Users": ["role:Admin", "group:eng"],
33+
// Allow access to port 22 on all servers
34+
"Ports": ["*:22"]
35+
},
36+
{
37+
"Action": "accept",
38+
"Users": ["role:User"],
39+
// Match only windows and linux workstations (not implemented yet)
40+
"OS": ["windows", "linux"],
41+
// Only desktop machines are allowed to access this server
42+
"Ports": ["10.1.1.1:443"]
43+
},
44+
{
45+
"Action": "accept",
46+
"Users": ["*"],
47+
// Match machines which have never been authorized, or which expired.
48+
// (not implemented yet)
49+
"MachineAuth": ["unauthorized", "expired"],
50+
// Logged-in users on unauthorized machines can access the email server.
51+
// Open the TLS ports for SMTP, IMAP, and HTTP.
52+
"Ports": ["10.1.2.3:465", "10.1.2.3:993", "10.1.2.3:443"]
53+
},
54+
55+
// Match absolutely everything. Comment out this section if you want
56+
// the above ACLs to apply.
57+
{ "Action": "accept", "Users": ["*"], "Ports": ["*:*"] },
58+
59+
// Leave this line here so that every rule can end in a comma.
60+
// It has no effect since it has no matching rules.
61+
{"Action": "accept"}
62+
]
63+
}

cmd/relaynode/clean.do

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm -f debian/changelog *~ debian/*~

cmd/relaynode/clean.od

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
exec >&2
2+
read -r package <package
3+
rm -f *~ .*~ \
4+
debian/*~ debian/changelog debian/debhelper-build-stamp \
5+
debian/*.log debian/files debian/*.substvars debian/*.debhelper \
6+
*.tar.gz *.deb *.rpm *.spec pkgver relaynode *.exe
7+
[ -n "$package" ] && rm -rf "debian/$package"
8+
for d in */.stamp; do
9+
if [ -e "$d" ]; then
10+
dir=$(dirname "$d")
11+
rm -rf "$dir"
12+
fi
13+
done

cmd/relaynode/deb.od

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
exec >&2
2+
dir=${1%/*}
3+
redo-ifchange "$S/$dir/package" "$S/oss/version/short.txt"
4+
read -r package <"$S/$dir/package"
5+
read -r version <"$S/oss/version/short.txt"
6+
arch=$(dpkg --print-architecture)
7+
8+
redo-ifchange "$dir/${package}_$arch.deb"
9+
rm -f "$dir/${package}"_*_"$arch.deb"
10+
ln -sf "${package}_$arch.deb" "$dir/${package}_${version}_$arch.deb"

cmd/relaynode/debian/README.Debian

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tailscale IPN relay daemon.

cmd/relaynode/debian/changelog.do

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
redo-ifchange ../../../version/short.txt gen-changelog
2+
(
3+
cd ..
4+
debian/gen-changelog
5+
) >$3

cmd/relaynode/debian/clean

Whitespace-only changes.

cmd/relaynode/debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

cmd/relaynode/debian/control

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Source: tailscale-relay
2+
Section: net
3+
Priority: extra
4+
Maintainer: Avery Pennarun <[email protected]>
5+
Build-Depends: debhelper (>= 10.2.5), dh-systemd (>= 1.5)
6+
Standards-Version: 3.9.2
7+
Homepage: https://tailscale.com/
8+
Vcs-Git: https://github.com/tailscale/tailscale
9+
Vcs-Browser: https://github.com/tailscale/tailscale
10+
11+
Package: tailscale-relay
12+
Architecture: any
13+
Depends: ${shlibs:Depends}, ${misc:Depends}
14+
Description: Traffic relay node for Tailscale IPN

cmd/relaynode/debian/copyright

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=173
2+
Upstream-Name: tailscale-relay
3+
Upstream-Contact: Avery Pennarun <[email protected]>
4+
Source: https://github.com/tailscale/tailscale/
5+
6+
Files: *
7+
Copyright: © 2019 Tailscale Inc. <[email protected]>
8+
License: Proprietary
9+
*
10+
* Copyright 2019 Tailscale Inc. All rights reserved.
11+
*

cmd/relaynode/debian/gen-changelog

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
read junk pkgname <debian/control
3+
read shortver <../../version/short.txt
4+
git log --pretty='format:'"$pkgname"' (SHA:%H) unstable; urgency=low
5+
6+
* %s
7+
8+
-- %aN <%aE> %aD
9+
' . |
10+
python -Sc '
11+
import os, re, subprocess, sys
12+
13+
first = True
14+
def Describe(g):
15+
global first
16+
if first:
17+
s = sys.argv[1]
18+
first = False
19+
else:
20+
sha = g.group(1)
21+
s = subprocess.check_output(["git", "describe", "--", sha]).strip().decode("utf-8")
22+
return re.sub(r"^\D*", "", s)
23+
24+
print(re.sub(r"SHA:([0-9a-f]+)", Describe, sys.stdin.read()))
25+
' "$shortver"

cmd/relaynode/debian/install

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
relaynode /usr/sbin
2+
tailscale-login /usr/sbin
3+
taillogin /usr/sbin
4+
acl.json /etc/tailscale

cmd/relaynode/debian/postinst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#DEBHELPER#
2+
3+
f=/var/lib/tailscale/relay.conf
4+
if ! [ -e "$f" ]; then
5+
echo
6+
echo "Note: Run tailscale-login to configure $f." >&2
7+
echo
8+
fi

cmd/relaynode/debian/rules

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/make -f
2+
DESTDIR=debian/tailscale-relay
3+
4+
override_dh_auto_test:
5+
override_dh_auto_install:
6+
mkdir -p "${DESTDIR}/etc/default"
7+
cp tailscale-relay.defaults "${DESTDIR}/etc/default/tailscale-relay"
8+
9+
%:
10+
dh $@ --with=systemd
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Traffic relay node for Tailscale IPN
3+
After=network.target
4+
ConditionPathExists=/var/lib/tailscale/relay.conf
5+
6+
[Service]
7+
EnvironmentFile=/etc/default/tailscale-relay
8+
ExecStart=/usr/sbin/relaynode --config=/var/lib/tailscale/relay.conf --tun=wg0 $PORT $ACL_FILE $FLAGS
9+
Restart=on-failure
10+
11+
[Install]
12+
WantedBy=multi-user.target

cmd/relaynode/default.deb.od

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
exec >&2
2+
dir=${1%/*}
3+
redo-ifchange "$S/oss/version/short.txt" "$S/$dir/package" "$dir/debtmp.dir"
4+
read -r package <"$S/$dir/package"
5+
read -r version <"$S/oss/version/short.txt"
6+
arch=$(dpkg --print-architecture)
7+
8+
(
9+
cd "$S/$dir"
10+
git ls-files debian | xargs redo-ifchange debian/changelog
11+
)
12+
cp -a "$S/$dir/debian" "$dir/debtmp/"
13+
rm -f "$dir/debtmp/debian/$package.debhelper.log"
14+
(
15+
cd "$dir/debtmp" &&
16+
debian/rules build &&
17+
fakeroot debian/rules binary
18+
)
19+
20+
mv "$dir/${package}_${version}_${arch}.deb" "$3"

cmd/relaynode/default.dir.od

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generate a directory tree suitable for forming a tarball of
2+
# this package.
3+
exec >&2
4+
dir=${1%/*}
5+
outdir=$PWD/${1%.dir}
6+
rm -rf "$outdir"
7+
mkdir "$outdir"
8+
touch $outdir/.stamp
9+
sfiles="
10+
tailscale-login
11+
acl.json
12+
debian/*.service
13+
*.defaults
14+
"
15+
ofiles="
16+
relaynode
17+
../taillogin/taillogin
18+
"
19+
redo-ifchange "$outdir/.stamp"
20+
(cd "$S/$dir" && redo-ifchange $sfiles && cp $sfiles "$outdir/")
21+
(cd "$dir" && redo-ifchange $ofiles && cp $ofiles "$outdir/")

cmd/relaynode/default.rpm.od

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
exec >&2
2+
dir=${1%/*}
3+
pkg=${1##*/}
4+
pkg=${pkg%.rpm}
5+
redo-ifchange "$S/oss/version/short.txt" "$dir/$pkg.tar.gz" "$dir/$pkg.spec"
6+
read -r pkgver junk <"$S/oss/version/short.txt"
7+
8+
machine=$(uname -m)
9+
rpmbase=$HOME/rpmbuild
10+
11+
mkdir -p "$rpmbase/SOURCES/"
12+
cp "$dir/$pkg.tar.gz" "$rpmbase/SOURCES/"
13+
rpmbuild -bb "$dir/$pkg.spec"
14+
mv "$rpmbase/RPMS/$machine/$pkg-$pkgver.$machine.rpm" $3

cmd/relaynode/default.spec.od

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
redo-ifchange "$S/$1.in" "$S/oss/version/short.txt"
2+
read -r pkgver junk <"$S/oss/version/short.txt"
3+
basever=${pkgver%-*}
4+
subver=${pkgver#*-}
5+
sed -e "s/Version: 0.00$/Version: $basever/" \
6+
-e "s/Release: 0$/Release: $subver/" \
7+
<"$S/$1.in" >"$3"

cmd/relaynode/default.tar.gz.od

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exec >&2
2+
xdir=${1%.tar.gz}
3+
base=${xdir##*/}
4+
updir=${xdir%/*}
5+
redo-ifchange "$xdir.dir"
6+
OUT="$PWD/$3"
7+
8+
cd "$updir" && tar -czvf "$OUT" --exclude "$base/.stamp" "$base"

cmd/relaynode/dist.od

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Build packages for customer distribution.
2+
dir=${1%/*}
3+
cd "$dir"
4+
targets="tarball"
5+
if which dh_clean fakeroot dpkg >/dev/null; then
6+
targets="$targets deb"
7+
else
8+
echo "Skipping debian packages: debhelper and/or dpkg build tools missing." >&2
9+
fi
10+
if which rpm >/dev/null; then
11+
targets="$targets rpm"
12+
else
13+
echo "Skipping rpm packages: rpm build tools missing." >&2
14+
fi
15+
redo-ifchange $targets

cmd/relaynode/docker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/relaynode

0 commit comments

Comments
 (0)