Advanced Zero Trust Security: Configuring Tailscale Lock and OIDC Authentik on VPS
This guide details the configuration of advanced Zero Trust security using Tailscale Lock and Authentik OIDC on a VPS, ensuring secure access, multi-factor authentication, and...
This guide details the configuration of advanced Zero Trust security using Tailscale Lock and Authentik OIDC on a VPS, ensuring secure access, multi-factor authentication, and strict access control policies. The setup leverages Tailscale’s network-level security with Authentik as an OpenID Connect identity provider to enforce user authentication and authorization.
Introduction to Advanced Zero Trust Security on VPS
In an era of increasing cyber threats, adopting a Zero Trust model is essential for safeguarding systems. Zero Trust operates on the principle of “never trust, always verify,” minimizing the risk of unauthorized access. This guide demonstrates how to configure Tailscale Lock and OIDC Authentik on a VPS to build a robust security framework, allowing only authorized users to access network resources.
Prerequisites
- A Linux-based VPS with Ubuntu 22.04 or equivalent installed.
- A registered Tailscale account and basic Tailscale setup.
- An Authentik instance installed and running on a VPS or dedicated server.
- Familiarity with Docker, networking, and OIDC authentication protocols.
- SSH access to the VPS for administration.
Configuring Tailscale Lock and Authentik OIDC
To implement Zero Trust security, we use Tailscale Lock for access control and Authentik as an Identity Provider (IdP) to authenticate users via OIDC.
Step 1: Install and Configure Authentik
Authentik is an open-source identity and access management platform. Deploy Authentik on your VPS using Docker:
docker run -d \
--name authentik \
-p 443:443 \
-e AUTHENTIK__DATABASE__TYPE=sqlite \
-e AUTHENTIK__SECRET_KEY=your-secret-key \
-e AUTHENTIK__SITE_URL=https://authentik.example.com \
-e AUTHENTIK__BASE_URL=https://authentik.example.com \
-e AUTHENTIK__PROVIDERS__OIDC__CLIENT__SECRET=your-client-secret \
-e AUTHENTIK__PROVIDERS__OIDC__CLIENT__ID=your-client-id \
-v /path/to/data:/data \
--restart unless-stopped \
authentikio/authentik
Replace your-secret-key, authentik.example.com, your-client-secret, and your-client-id with your actual values. After starting the container, access https://authentik.example.com to complete the setup.
Step 2: Set Up Tailscale Lock with OIDC Authentik
To integrate Tailscale Lock with Authentik, follow these steps:
- Log in to the Tailscale Admin Console.
- Select the device or device group to secure.
- In the Lock section, enable Require authentication.
- Select OIDC as the authentication method.
- Enter the OIDC Provider URL:
https://authentik.example.com/api/v3/providers/oidc/ - Input the Client ID and Client Secret from Authentik.
- Save the configuration and test access from a different device.
Verification and Testing
To ensure the configuration works correctly, perform the following checks:
- Access the Tailscale dashboard to verify connection status.
- Attempt to access from an unauthorized device—access should be denied.
- Try accessing from an authenticated device—access should be granted.
- Confirm that Authentik successfully issued authentication via OIDC.
Troubleshooting
- Cannot access Authentik: Verify the Docker service is running and port 443 is not blocked.
- OIDC not working: Double-check the Client ID, Client Secret, and provider URL in Tailscale.
- Tailscale Lock not enabled: Ensure the Lock policy is active and OIDC is selected as the authentication method.
References
Recommended NVMe Cloud VPS Plans to Deploy This Setup
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-3E
10% VAT included
- CPU: 2 vCPU
- RAM: 4 GB
- SSD: 50 GB NVMe
