diff --git a/README.md b/README.md index 61a380e1b..3429e890b 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,9 @@ tsidp can be used as IdP server for any application that supports custom OIDC pr > [!IMPORTANT] > Note: If you'd like to use tsidp to login to a SaaS application outside of your tailnet rather than a self-hosted app inside of your tailnet, you'll need to run tsidp with `--funnel` enabled. -- (TODO) Proxmox +- [Proxmox](docs/proxmox/README.md) + +### TODOs - (TODO) Grafana - (TODO) open-webui - (TODO) Jellyfin diff --git a/docs/proxmox/README.md b/docs/proxmox/README.md new file mode 100644 index 000000000..4c361a2aa --- /dev/null +++ b/docs/proxmox/README.md @@ -0,0 +1,162 @@ +# Proxmox Setup with tsidp + +This section covers: +- Deploying tsidp in a Docker container within a Linux Container (LXC) +- Configuring Proxmox to use tsidp for authentication + +## Deploy tsidp in Docker within an LXC + +### Prerequisites + +Before starting, download an LXC template: +- See the [Proxmox Linux Container documentation](https://pve.proxmox.com/wiki/Linux_Container) for details +- For video guidance, see [this tutorial](https://www.youtube.com/watch?v=iIfRchzYSzM&t=300s) by [Christian Lempa](https://www.youtube.com/@christianlempa) +- This guide uses `alpine-3.21-default_20241217_amd64.tar.xz`, though other templates should work + +### Create the LXC + +1. **Log in to Proxmox** and create a new LXC (we'll name it `tsidp-lxc`, but any name works) + + ![Create LXC](create-lxc.png) + +2. **Configure the container** with these settings: + - **General** + - ✅ Enable "Unprivileged container" + - ✅ Enable "Nesting" (required for Docker) + - **Template** + - Select `alpine-3.21-default_20241217_amd64.tar.xz` + - **Disks** + - Disk size: 4 GiB + - **CPU** + - Cores: 1 + - **Memory** + - Memory: 512 MiB + - Swap: 512 MiB + - **Network** + - Use default settings + - **DNS** + - Use default settings + - **Confirm** + - ✅ Enable "Start after created" + - Click "Finish" + + > **Note**: We're not enabling `keyctl=1` as tsidp doesn't use Docker secrets. + +### Set Up Docker and tsidp + +1. **Access the container console** in Proxmox + - Log in as `root` with the password you specified + +2. **Update packages and install dependencies** + ```bash + apk update + apk add docker git + ``` + +3. **Start and enable Docker** + ```bash + rc-service docker start + rc-update add docker boot + ``` + > You may see warnings, but should see `* Starting Docker Daemon ... [ ok ]` + +4. **Verify Docker installation** + ```bash + docker --version + ``` + +5. **Clone the tsidp repository** + ```bash + mkdir -p /usr/local/src && cd /usr/local/src + git clone https://github.com/tailscale/tsidp.git + ``` + +6. **Build and run tsidp** + - Follow the [Building your own container](../../README.md) instructions to launch tsidp inside of a Docker container in the LXC + +### Configure Auto-start + +Once `https://idp...` is working: + +1. **Enable Docker container auto-restart** + ```bash + docker update --restart unless-stopped tsidp + ``` + +2. **Enable LXC auto-start** in Proxmox UI: + - Select the container + - Go to Options → Set "Start at boot" to "Yes" + +3. **Test the configuration** by rebooting the LXC and/or Proxmox server + +## Configure Proxmox to Use tsidp + +This example assumes: +- Proxmox server: `https://scruggs.yourtailnet.ts.net:8006` +- tsidp instance: `https://idp.yourtailnet.ts.net` + +### Register Proxmox as a Client in tsidp + +1. **Visit** `https://idp.yourtailnet.ts.net` and click "Add New Client" + + ![Add New Client](add-oidc-client.png) + +2. **Configure the client**: + - Add redirect URIs for each way you access Proxmox + - Save the generated Client ID and Client Secret; you'll use these next + + ![Configure the client](tsidp-multiple-uri-redirects.png) + +### Configure OpenID Connect in Proxmox + +1. **Navigate to** Datacenter → Permissions → Realms -> **Add an OpenID Connect Server** + + ![Create Realm](create-realm.png) + +2. **Configure the OpenID Connect Server realm** with these settings: + - **Issuer URL**: `https://idp.yourtailnet.ts.net` + - **Realm**: `tailscale` (or your preferred name) + - **Client ID**: (from tsidp) + - **Client Secret**: (from tsidp) + - **Default**: Yes + - **Autocreate Users**: Yes + - **Username Claim**: `email` + + ![OpenID Connect Server Configuration](configure-realm.png) + +### Test the Authentication + +1. **Open an incognito browser window** and navigate to `https://scruggs.yourtailnet.ts.net:8006` + +2. **Log in** using the `tailscale` realm + - Authentication should work immediately + - Proxmox will auto-create a user account (due to "Autocreate Users: yes") + - However, this user account will have no permissions. + + ![Login with Tailscale Realm](login-using-tailscale-realm.png) + +3. **Close the incognito window** + +### Assign User Permissions + +1. **Create an admin group**: + - Go to Datacenter → Permissions → Groups + - Create a group called `tsadmins` + +2. **Grant administrator privileges**: + - Go to Datacenter → Permissions + - Add a Group Permission: + - **Path**: `/` + - **Group**: `tsadmins` + - **Role**: `Administrator` + + ![Group Permission Configuration](add-group-permission.png) + +3. **Add users to the admin group**: + - Go to Datacenter → Permissions → Users + - Edit the auto-created user + - Add them to the `tsadmins` group + +## Final Verification + +Log out of Proxmox and log back in using the new Tailscale realm to verify everything is working correctly. \ No newline at end of file diff --git a/docs/proxmox/add-group-permission.png b/docs/proxmox/add-group-permission.png new file mode 100644 index 000000000..c064f036d Binary files /dev/null and b/docs/proxmox/add-group-permission.png differ diff --git a/docs/proxmox/add-oidc-client.png b/docs/proxmox/add-oidc-client.png new file mode 100644 index 000000000..5a641aff3 Binary files /dev/null and b/docs/proxmox/add-oidc-client.png differ diff --git a/docs/proxmox/configure-realm.png b/docs/proxmox/configure-realm.png new file mode 100644 index 000000000..6a2e892a6 Binary files /dev/null and b/docs/proxmox/configure-realm.png differ diff --git a/docs/proxmox/create-lxc.png b/docs/proxmox/create-lxc.png new file mode 100644 index 000000000..6e3f8288a Binary files /dev/null and b/docs/proxmox/create-lxc.png differ diff --git a/docs/proxmox/create-realm.png b/docs/proxmox/create-realm.png new file mode 100644 index 000000000..8a093d41c Binary files /dev/null and b/docs/proxmox/create-realm.png differ diff --git a/docs/proxmox/login-using-tailscale-realm.png b/docs/proxmox/login-using-tailscale-realm.png new file mode 100644 index 000000000..a79aeb5a6 Binary files /dev/null and b/docs/proxmox/login-using-tailscale-realm.png differ diff --git a/docs/proxmox/tsidp-multiple-uri-redirects.png b/docs/proxmox/tsidp-multiple-uri-redirects.png new file mode 100644 index 000000000..751102ada Binary files /dev/null and b/docs/proxmox/tsidp-multiple-uri-redirects.png differ