Compare commits

...

18 commits

Author SHA1 Message Date
Kristoffer Dalby
55f14d1d64
Merge 46ccfff71d into 6275399327 2024-11-19 00:10:59 +13:00
Nathan Sweet
6275399327
Update tls.md to mention using the full cert chain (#2243)
Some checks failed
Build / build (push) Has been cancelled
Build documentation / build (push) Has been cancelled
Tests / test (push) Has been cancelled
Build documentation / deploy (push) Has been cancelled
2024-11-18 06:12:12 +00:00
nblock
29119bb7f4
Misc doc fixes (#2240)
Some checks are pending
Build / build (push) Waiting to run
Build documentation / build (push) Waiting to run
Build documentation / deploy (push) Blocked by required conditions
Tests / test (push) Waiting to run
* Link back to node registration docs
* adjust wording in apple docs
* Mention client specific page to check if headscale works

Ref: #2238
2024-11-18 05:46:58 +01:00
Kristoffer Dalby
46ccfff71d
pull_request_target
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-13 08:43:47 +02:00
Kristoffer Dalby
71607ae13c
disable sbom
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-13 08:35:29 +02:00
Kristoffer Dalby
8e26fcfeea
remove pr number again
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-13 08:24:21 +02:00
Kristoffer Dalby
610223df67
add back pr attempt in hope for more perms
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 10:04:42 +02:00
Kristoffer Dalby
10a9eda893
restore write all
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:56:02 +02:00
Kristoffer Dalby
9a4c7e4446
run ko with nix
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:48:47 +02:00
Kristoffer Dalby
aba61ceb1b
test without pr number
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:47:21 +02:00
Kristoffer Dalby
1efb817acc
all
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:29:52 +02:00
Kristoffer Dalby
49952dda40
derp
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:27:30 +02:00
Kristoffer Dalby
53a08e5ab6
derp
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:26:23 +02:00
Kristoffer Dalby
52cce46cd8
debug pr number
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:22:29 +02:00
Kristoffer Dalby
68669238f9
debug pr name
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:18:04 +02:00
Kristoffer Dalby
0d6a25d6ee
env it
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:16:50 +02:00
Kristoffer Dalby
e1416a72cb
make it so ko.yaml changes trigger build
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:15:15 +02:00
Kristoffer Dalby
cec46716b6
build docker images on PR
Sometimes we want people to test features in PRs and
not everyone is used to using git, build go and docker.

This commit builds docker containers and pushes them to
GHCR (not dockerhub) for testing on pushes to branches
that has open pull requests to main using Ko.
This is configured to mimic the debug images produced
by goreleaser.

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-08-12 09:09:08 +02:00
8 changed files with 122 additions and 43 deletions

71
.github/workflows/build-docker-pr.yml vendored Normal file
View file

@ -0,0 +1,71 @@
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: dorny/paths-filter@v3
with:
filters: |
files:
- '*.nix'
- 'go.*'
- '**/*.go'
- 'integration_test/'
- 'config-example.yaml'
- uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.files == 'true'
- name: Run build
id: build
if: steps.changed-files.outputs.files == 'true'
run: |
nix build |& tee build-result
BUILD_STATUS="${PIPESTATUS[0]}"
OLD_HASH=$(cat build-result | grep specified: | awk -F ':' '{print $2}' | sed 's/ //g')
NEW_HASH=$(cat build-result | grep got: | awk -F ':' '{print $2}' | sed 's/ //g')
echo "OLD_HASH=$OLD_HASH" >> $GITHUB_OUTPUT
echo "NEW_HASH=$NEW_HASH" >> $GITHUB_OUTPUT
exit $BUILD_STATUS
- name: Nix gosum diverging
uses: actions/github-script@v6
if: failure() && steps.build.outcome == 'failure'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.pulls.createReviewComment({
pull_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Nix build failed with wrong gosum, please update "vendorSha256" (${{ steps.build.outputs.OLD_HASH }}) for the "headscale" package in flake.nix with the new SHA: ${{ steps.build.outputs.NEW_HASH }}'
})
- uses: actions/upload-artifact@v4
if: steps.changed-files.outputs.files == 'true'
with:
name: headscale-linux
path: result/bin/headscale

View file

@ -1,10 +1,7 @@
name: Build name: Build Docker images for PRs
on: on:
push: pull_request_target:
branches:
- main
pull_request:
branches: branches:
- main - main
@ -31,41 +28,34 @@ jobs:
- '**/*.go' - '**/*.go'
- 'integration_test/' - 'integration_test/'
- 'config-example.yaml' - 'config-example.yaml'
- '.ko.yaml'
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.files == 'true' if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.files == 'true' if: steps.changed-files.outputs.files == 'true'
- name: Run build # - uses: actions/github-script@v7
# id: get_pr_data
# with:
# script: |
# return (
# await github.rest.repos.listPullRequestsAssociatedWithCommit({
# commit_sha: context.sha,
# owner: context.repo.owner,
# repo: context.repo.repo,
# })
# ).data[0];
# - name: Pull Request data
# run: |
# echo '${{steps.get_pr_data.outputs.result}}'
- name: Run ko build
id: build id: build
if: steps.changed-files.outputs.files == 'true' if: steps.changed-files.outputs.files == 'true'
env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/headscale
# TAG_PR_NAME: pr-${{ fromJson(steps.get_pr_data.outputs.result).number }}
TAG_SHA: ${{ github.sha }}
run: | run: |
nix build |& tee build-result nix develop --command -- ko build --sbom=none --tags=$TAG_SHA ./cmd/headscale
BUILD_STATUS="${PIPESTATUS[0]}"
OLD_HASH=$(cat build-result | grep specified: | awk -F ':' '{print $2}' | sed 's/ //g')
NEW_HASH=$(cat build-result | grep got: | awk -F ':' '{print $2}' | sed 's/ //g')
echo "OLD_HASH=$OLD_HASH" >> $GITHUB_OUTPUT
echo "NEW_HASH=$NEW_HASH" >> $GITHUB_OUTPUT
exit $BUILD_STATUS
- name: Nix gosum diverging
uses: actions/github-script@v6
if: failure() && steps.build.outcome == 'failure'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.pulls.createReviewComment({
pull_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Nix build failed with wrong gosum, please update "vendorSha256" (${{ steps.build.outputs.OLD_HASH }}) for the "headscale" package in flake.nix with the new SHA: ${{ steps.build.outputs.NEW_HASH }}'
})
- uses: actions/upload-artifact@v4
if: steps.changed-files.outputs.files == 'true'
with:
name: headscale-linux
path: result/bin/headscale

View file

@ -28,8 +28,6 @@ builds:
- -mod=readonly - -mod=readonly
ldflags: ldflags:
- -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}} - -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}}
tags:
- ts2019
archives: archives:
- id: golang-cross - id: golang-cross

16
.ko.yaml Normal file
View file

@ -0,0 +1,16 @@
defaultBaseImage: gcr.io/distroless/base-debian12:debug
defaultPlatforms:
- linux/arm64
- linux/arm/v7
- linux/amd64
- linux/386
builds:
- id: headscale
main: ./cmd/headscale
env:
- CGO_ENABLED=0
flags:
- -mod=readonly
ldflags:
- -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Git.ShortCommit}}

View file

@ -45,11 +45,11 @@ headscale server.
ACLs have to be written in [huJSON](https://github.com/tailscale/hujson). ACLs have to be written in [huJSON](https://github.com/tailscale/hujson).
When registering the servers we will need to add the flag When [registering the servers](../usage/getting-started.md#register-a-node) we
`--advertise-tags=tag:<tag1>,tag:<tag2>`, and the user that is will need to add the flag `--advertise-tags=tag:<tag1>,tag:<tag2>`, and the user
registering the server should be allowed to do it. Since anyone can add tags to that is registering the server should be allowed to do it. Since anyone can add
a server they can register, the check of the tags is done on headscale server tags to a server they can register, the check of the tags is done on headscale
and only valid tags are applied. A tag is valid if the user that is server and only valid tags are applied. A tag is valid if the user that is
registering it is allowed to do it. registering it is allowed to do it.
To use ACLs in headscale, you must edit your `config.yaml` file. In there you will find a `policy.path` parameter. This will need to point to your ACL file. More info on how these policies are written can be found [here](https://tailscale.com/kb/1018/acls/). To use ACLs in headscale, you must edit your `config.yaml` file. In there you will find a `policy.path` parameter. This will need to point to your ACL file. More info on how these policies are written can be found [here](https://tailscale.com/kb/1018/acls/).

View file

@ -9,6 +9,8 @@ tls_cert_path: ""
tls_key_path: "" tls_key_path: ""
``` ```
The certificate should contain the full chain, else some clients, like the Tailscale Android client, will reject it.
## Let's Encrypt / ACME ## Let's Encrypt / ACME
To get a certificate automatically via [Let's Encrypt](https://letsencrypt.org/), set `tls_letsencrypt_hostname` to the desired certificate hostname. This name must resolve to the IP address(es) headscale is reachable on (i.e., it must correspond to the `server_url` configuration parameter). The certificate and Let's Encrypt account credentials will be stored in the directory configured in `tls_letsencrypt_cache_dir`. If the path is relative, it will be interpreted as relative to the directory the configuration file was read from. To get a certificate automatically via [Let's Encrypt](https://letsencrypt.org/), set `tls_letsencrypt_hostname` to the desired certificate hostname. This name must resolve to the IP address(es) headscale is reachable on (i.e., it must correspond to the `server_url` configuration parameter). The certificate and Let's Encrypt account credentials will be stored in the directory configured in `tls_letsencrypt_cache_dir`. If the path is relative, it will be interpreted as relative to the directory the configuration file was read from.

View file

@ -60,7 +60,7 @@ Install the official Tailscale tvOS client from the [App Store](https://apps.app
### Configuring the headscale URL ### Configuring the headscale URL
- Go Settings (the apple tvOS settings) > Apps > Tailscale - Open Settings (the Apple tvOS settings) > Apps > Tailscale
- Under `ALTERNATE COORDINATION SERVER URL`, select `URL` - Under `ALTERNATE COORDINATION SERVER URL`, select `URL`
- Enter the URL of your headscale instance (e.g `https://headscale.example.com`) and press `OK` - Enter the URL of your headscale instance (e.g `https://headscale.example.com`) and press `OK`
- Return to the tvOS Home screen - Return to the tvOS Home screen

View file

@ -9,6 +9,8 @@ This page helps you get started with headscale and provides a few usage examples
installation instructions. installation instructions.
* The configuration file exists and is adjusted to suit your environment, see * The configuration file exists and is adjusted to suit your environment, see
[Configuration](../ref/configuration.md) for details. [Configuration](../ref/configuration.md) for details.
* Headscale is reachable from the Internet. Verify this by opening client specific setup instructions in your
browser, e.g. https://headscale.example.com/windows
* The Tailscale client is installed, see [Client and operating system support](../about/clients.md) for more * The Tailscale client is installed, see [Client and operating system support](../about/clients.md) for more
information. information.