1
0
Fork 0
server-configuration/README.md

33 lines
1.0 KiB
Markdown
Raw Normal View History

2025-02-22 12:01:14 +00:00
# VPN server configuration
2025-02-21 07:49:45 +00:00
2025-02-22 12:01:14 +00:00
This is an experimental configuration for my Hetzner VPS and Cloudflare to run a VPN using OpenTofu and Nix, based on [NixOS/nixos-wiki-infra on Github](https://github.com/NixOS/nixos-wiki-infra).
2025-02-21 07:49:45 +00:00
## How to use
2025-02-21 11:41:47 +00:00
Copy `.env.example` to `.env` and fill in the values.
2025-02-21 07:49:45 +00:00
To generate a token with Hetzner, go to the project and click `Security -> API Tokens`.
2025-02-22 05:16:37 +00:00
For cross-compiling, you will need to add a builder by visiting the following resources:
- https://nix.dev/tutorials/nixos/distributed-builds-setup.html
- https://nix.dev/manual/nix/2.25/advanced-topics/distributed-builds
2025-02-21 07:49:45 +00:00
2025-02-22 05:16:37 +00:00
Run `nix develop` at the root of the project directory to access a shell where OpenTofu is accessible.
2025-02-22 12:01:14 +00:00
In the `targets` directory, run `./apply.sh` to update the configurations.
## VPN
To set up the VPN, on the VPS run:
```bash
headscale users create default
headscale preauthkeys create --user default --reusable
```
On the client run:
```bash
tailscale up --login-server <HEADSCALE_URL> --auth-key <KEY>
```