forked from luislavena/homelab-headscale
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Custom nameservers #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7581c27
Make custom upstream nameservers configurable
EdGeraghty 8176ab7
Fix false positives, check the generated config
EdGeraghty 0b46f75
Separate the CI/smoke test defaults from prod
EdGeraghty 48d2eae
The template already prepends the schema
EdGeraghty 765aeaf
Fix indentation
EdGeraghty 49cdd05
Use upstream defaults for CI to stop drift
EdGeraghty 5180432
Appease the linter
EdGeraghty f7e1a1f
Merge branch 'develop' into custom-nameservers
EdGeraghty e506cb0
Initial plan
Copilot 78dfc49
Unfux linebreaks
EdGeraghty 195522f
Export GLOBAL_NAMESERVERS_YAML in all function paths
Copilot 74e254c
Merge branch 'custom-nameservers' into copilot/sub-pr-78
EdGeraghty df4f795
Merge pull request #79 from privacyint/copilot/sub-pr-78
EdGeraghty d8b2d7d
Use upstream defaults for DNS on config tests
EdGeraghty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,76 +1,91 @@ | ||
| # Headscale on an immutable Docker image | ||
|
|
||
| Deploy [Headscale][headscale-wob] using a "serverless" immutable docker image with real-time [Litestream][litestream-wob] database backup and (by default) inbuilt [Caddy][caddy-wob] SSL termination, using a miniscule [Alpine Linux][alpine-linux-wob] base image. Provides a stateless [headscale-admin][headscale-admin-wob] panel at `/admin/`. | ||
|
|
||
| ## Included upstream versions | ||
|
|
||
| | Tool | Upstream Repository | Version | | ||
| | --- | --- | --- | | ||
| | [`Alpine Linux`][alpine-linux-wob] | [Alpine Linux Repo][alpine-linux-repo] | [`v3.23.3`](https://git.alpinelinux.org/aports/log/?h=v3.23.3) | | ||
| | [`Headscale`][headscale-wob] | [Headscale Repo][headscale-repo] | [`v0.28.0`](https://github.com/juanfont/headscale/releases/tag/v0.28.0) | | ||
| | [`Headscale-Admin`][headscale-admin-wob] | [Headscale-Admin Repo][headscale-admin-repo] | [`7da5aa3`](https://github.com/serein-213/headscale-admin-il18n/commit/7da5aa3f89cb1027d086256c176cdb2112d6641c) | | ||
| | [`Litestream`][litestream-wob] | [Litestream Repo][litestream-repo] | [`0.5.11`](https://github.com/benbjohnson/litestream/releases/tag/v0.5.11) | | ||
| | [`Caddy`][caddy-wob] | [Caddy Repo][caddy-repo] | [`v2.11.2`](https://github.com/caddyserver/caddy/releases/tag/v2.11.2) | | ||
|
|
||
| DEPRECATION NOTICE: `Headscale-Admin` is deprecated in this release as it appears to have been abandoned by upstream. We have moved to a fork with patches so we can take advantage of the improvements in Headscale's `0.28.X` release, but are actively testing replacement admin panels before Headscale's `0.29.X` releases. | ||
|
|
||
| ## Versioning | ||
|
|
||
| Because of the mix of upstream tools included, this project will be tagged using the versioning style `YYYY.MM.REVISION`. | ||
|
|
||
| All development should be done against the `develop` branch, `main` is deemed "stable". | ||
|
|
||
| ## Requirements | ||
|
|
||
| * Cloudflare DNS for [ACME `DNS-01` authentication][dns-01-challenge] (Can be deliberately disabled to use [`HTTP-01` authentication][http-01-challenge] instead, or HTTPS can be disabled entirely if you plan to use an external termination point.) | ||
| * S3(Alike)/Azure for [Litestream][litestream-wob] (Can be deliberately disabled for full ephemerality, or if you plan to use persistent storage) | ||
|
|
||
| ## Installation | ||
|
|
||
| Populate your environment variables according to `templates/secrets.template.env` | ||
|
|
||
| The container entrypoint script will guide you on any errors. | ||
|
|
||
| ## Deployment and user creation | ||
|
|
||
| Once app is deployed and green, [generate an API Key][headscale-usage] in order to use the admin interface. | ||
|
|
||
| ```console | ||
| headscale apikeys create | ||
| ``` | ||
|
|
||
| Navigate to the admin gui on `/admin/` and set up your groups, ACLs, tags etc. | ||
|
|
||
| ## Final configuration | ||
|
|
||
| Now that Headscale is running, to have a 100% reproducible setup we need to ensure that private noise key generated during installation is persisted. Within the same console from previous step, print out the server's key: | ||
|
|
||
| ```console | ||
| cat /data/noise_private.key | ||
| ``` | ||
|
|
||
| Then set `HEADSCALE_NOISE_PRIVATE_KEY` to the value obtained above. | ||
|
|
||
| Note that applying this will cause your application to restart, but afterwards no other change will be necessary. | ||
|
|
||
| ## Known to run on | ||
|
|
||
| * Azure Container Apps | ||
| * [Fly.io][fly-io-instructions] | ||
| * ??? Let us know! | ||
|
|
||
| [alpine-linux-wob]: https://www.alpinelinux.org/ | ||
| [alpine-linux-repo]: https://gitlab.alpinelinux.org/alpine | ||
| [caddy-wob]: https://caddyserver.com/ | ||
| [caddy-repo]: https://github.com/caddyserver/caddy | ||
| [headscale-admin-wob]: https://github.com/serein-213/headscale-admin-il18n | ||
| [headscale-admin-repo]: https://github.com/serein-213/headscale-admin-il18n | ||
| [headscale-wob]: https://headscale.net/ | ||
| [headscale-repo]: https://github.com/juanfont/headscale | ||
| [litestream-wob]: https://litestream.io/ | ||
| [litestream-repo]: https://github.com/benbjohnson/litestream | ||
|
|
||
| [dns-01-challenge]: https://letsencrypt.org/docs/challenge-types/#dns-01-challenge | ||
| [http-01-challenge]: https://letsencrypt.org/docs/challenge-types/#http-01-challenge | ||
| [headscale-usage]: https://headscale.net/stable/ref/remote-cli/#create-an-api-key | ||
| [fly-io-instructions]: docs/backends/fly-io.md | ||
| # Headscale on an immutable Docker image | ||
|
|
||
| Deploy [Headscale][headscale-wob] using a "serverless" immutable docker image with real-time [Litestream][litestream-wob] database backup and (by default) inbuilt [Caddy][caddy-wob] SSL termination, using a miniscule [Alpine Linux][alpine-linux-wob] base image. Provides a stateless [headscale-admin][headscale-admin-wob] panel at `/admin/`. | ||
|
|
||
| ## Included upstream versions | ||
|
|
||
| | Tool | Upstream Repository | Version | | ||
| | --- | --- | --- | | ||
| | [`Alpine Linux`][alpine-linux-wob] | [Alpine Linux Repo][alpine-linux-repo] | [`v3.23.3`](https://git.alpinelinux.org/aports/log/?h=v3.23.3) | | ||
| | [`Headscale`][headscale-wob] | [Headscale Repo][headscale-repo] | [`v0.28.0`](https://github.com/juanfont/headscale/releases/tag/v0.28.0) | | ||
| | [`Headscale-Admin`][headscale-admin-wob] | [Headscale-Admin Repo][headscale-admin-repo] | [`7da5aa3`](https://github.com/serein-213/headscale-admin-il18n/commit/7da5aa3f89cb1027d086256c176cdb2112d6641c) | | ||
| | [`Litestream`][litestream-wob] | [Litestream Repo][litestream-repo] | [`0.5.11`](https://github.com/benbjohnson/litestream/releases/tag/v0.5.11) | | ||
| | [`Caddy`][caddy-wob] | [Caddy Repo][caddy-repo] | [`v2.11.2`](https://github.com/caddyserver/caddy/releases/tag/v2.11.2) | | ||
|
|
||
| DEPRECATION NOTICE: `Headscale-Admin` is deprecated in this release as it appears to have been abandoned by upstream. We have moved to a fork with patches so we can take advantage of the improvements in Headscale's `0.28.X` release, but are actively testing replacement admin panels before Headscale's `0.29.X` releases. | ||
|
|
||
| ## Versioning | ||
|
|
||
| Because of the mix of upstream tools included, this project will be tagged using the versioning style `YYYY.MM.REVISION`. | ||
|
|
||
| All development should be done against the `develop` branch, `main` is deemed "stable". | ||
|
|
||
| ## Requirements | ||
|
|
||
| * Cloudflare DNS for [ACME `DNS-01` authentication][dns-01-challenge] (Can be deliberately disabled to use [`HTTP-01` authentication][http-01-challenge] instead, or HTTPS can be disabled entirely if you plan to use an external termination point.) | ||
| * S3(Alike)/Azure for [Litestream][litestream-wob] (Can be deliberately disabled for full ephemerality, or if you plan to use persistent storage) | ||
|
|
||
| ## Installation | ||
|
|
||
| Populate your environment variables according to `templates/secrets.template.env` | ||
|
|
||
| The container entrypoint script will guide you on any errors. | ||
|
|
||
| ## Configuring upstream/global nameservers | ||
|
|
||
| You can now control the nameservers exposed to clients via the `GLOBAL_NAMESERVERS` environment variable. Provide a space-separated list of IP addresses (IPv4 or IPv6). If omitted, the container falls back to the defaults defined in `scripts/defaults.sh`. | ||
|
|
||
| The entrypoint converts the list into a YAML flow-style sequence and injects it into the Headscale config, e.g. `global: [ "1.1.1.1", "8.8.8.8" ]` so there are no YAML indentation issues regardless of the number of entries. | ||
|
|
||
| Example (set in Fly config or your environment): | ||
|
|
||
| ```toml | ||
| [env] | ||
| GLOBAL_NAMESERVERS = "94.140.14.15 94.140.15.16 2a10:50c0::bad1:ff 2a10:50c0::bad2:ff" | ||
| ``` | ||
|
|
||
| The script performs permissive validation (allows IPv4/IPv6 characters). If you need stricter validation or alternative input formats (commas, JSON), say so and I'll update the parser. | ||
|
|
||
| ## Deployment and user creation | ||
|
|
||
| Once app is deployed and green, [generate an API Key][headscale-usage] in order to use the admin interface. | ||
|
|
||
| ```console | ||
| headscale apikeys create | ||
| ``` | ||
|
|
||
| Navigate to the admin gui on `/admin/` and set up your groups, ACLs, tags etc. | ||
|
|
||
| ## Final configuration | ||
|
|
||
| Now that Headscale is running, to have a 100% reproducible setup we need to ensure that private noise key generated during installation is persisted. Within the same console from previous step, print out the server's key: | ||
|
|
||
| ```console | ||
| cat /data/noise_private.key | ||
| ``` | ||
|
|
||
| Then set `HEADSCALE_NOISE_PRIVATE_KEY` to the value obtained above. | ||
|
|
||
| Note that applying this will cause your application to restart, but afterwards no other change will be necessary. | ||
|
|
||
| ## Known to run on | ||
|
|
||
| * Azure Container Apps | ||
| * [Fly.io][fly-io-instructions] | ||
| * ??? Let us know! | ||
|
|
||
| [alpine-linux-wob]: https://www.alpinelinux.org/ | ||
| [alpine-linux-repo]: https://gitlab.alpinelinux.org/alpine | ||
| [caddy-wob]: https://caddyserver.com/ | ||
| [caddy-repo]: https://github.com/caddyserver/caddy | ||
| [headscale-admin-wob]: https://github.com/serein-213/headscale-admin-il18n | ||
| [headscale-admin-repo]: https://github.com/serein-213/headscale-admin-il18n | ||
| [headscale-wob]: https://headscale.net/ | ||
| [headscale-repo]: https://github.com/juanfont/headscale | ||
| [litestream-wob]: https://litestream.io/ | ||
| [litestream-repo]: https://github.com/benbjohnson/litestream | ||
|
|
||
| [dns-01-challenge]: https://letsencrypt.org/docs/challenge-types/#dns-01-challenge | ||
| [http-01-challenge]: https://letsencrypt.org/docs/challenge-types/#http-01-challenge | ||
| [headscale-usage]: https://headscale.net/stable/ref/remote-cli/#create-an-api-key | ||
| [fly-io-instructions]: docs/backends/fly-io.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.