Configure Google Workspace SSO for WireGuard
How to set up Google Workspace SSO for Wiretastix using OIDC, so your team signs in with their Google account.
This guide will walk you through configuring Google Workspace (or any Google account, via Google Cloud Platform) as your OpenID Connect (OIDC) Identity Provider for Wiretastix, enabling single sign-on (SSO) so users authenticate with their Google account.
Prerequisites
Before you begin, ensure you have:
- A Google Cloud Platform account with administrative access
- Access to the Google Cloud Console
- Your Wiretastix instance URL (e.g.,
https://vpn.example.com) - Administrative access to your Wiretastix configuration
Step 1: Create a Google Cloud Project
If you don’t already have a Google Cloud project, create one:
- Navigate to the Google Cloud Console
- Click the project dropdown at the top of the page
- Click New Project
- Enter a project name (e.g., “Wiretastix VPN”)
- Click Create
- Select your newly created project from the project dropdown
Step 2: Configure the OAuth Consent Screen
Before creating OAuth credentials, you must configure the consent screen:
In the Google Cloud Console, navigate to APIs & Services → OAuth consent screen
Select the user type:
- Internal: Only users in your Google Workspace organization can authenticate (recommended for enterprise)
- External: Any Google account can authenticate (requires verification for production use)
Click Create
Fill in the required fields:
- App name:
Wiretastix VPN(or your preferred name) - User support email: Your support email address
- App logo: (Optional) Upload your organization’s logo
- Application home page: Your Wiretastix URL (e.g.,
https://vpn.example.com) - Authorized domains: Add your domain (e.g.,
example.com) - Developer contact information: Your email address
- App name:
Click Save and Continue
On the Scopes page, click Add or Remove Scopes
Select the following scopes:
openidemailprofile
Click Update and then Save and Continue
If using External user type, add test users on the next page (optional during development)
Click Save and Continue and review your settings
Click Back to Dashboard
Step 3: Create OAuth 2.0 Credentials
Now create the OAuth client credentials:
Navigate to APIs & Services → Credentials
Click + Create Credentials → OAuth client ID
Select Application type: Web application
Enter a Name:
Wiretastix OIDC ClientUnder Authorized redirect URIs, click + Add URI
Add your Wiretastix callback URL:
https://vpn.example.com/callbackReplace
vpn.example.comwith your actual Wiretastix domainClick Create
A dialog will appear with your Client ID and Client Secret
- Save these credentials immediately - you’ll need them for the Wiretastix configuration
- Click Download JSON to save a copy (optional but recommended)
Step 4: Configure Wiretastix
Now configure Wiretastix to use Google as the OIDC provider. Edit your /etc/wiretastix/wiretastix.yaml file:
oidc:
name: Google
client-id: YOUR_CLIENT_ID.apps.googleusercontent.com
client-secret: YOUR_CLIENT_SECRET
redirect-url: https://vpn.example.com/callback
config-issuer: https://accounts.google.com/.well-known/openid-configuration
cookie-secret: GENERATE_A_RANDOM_STRING_HERE
force-approval: false
verbose: false
refresh-min-interval-sec: 300
scopes:
- openid
- email
- profile
constraints:
email:
- user1@example.com
- user2@example.com
Configuration Parameters Explained
name: A friendly name for the provider (displayed in logs)client-id: The Client ID from Step 3 (ends with.apps.googleusercontent.com)client-secret: The Client Secret from Step 3redirect-url: Must match exactly what you configured in Google Cloud Consoleconfig-issuer: Google’s OIDC discovery URL (use the URL shown above)cookie-secret: A random string for session encryption (generate with:openssl rand -base64 32)force-approval: Set totrueto force consent screen on every login (usuallyfalse)verbose: Enable detailed OIDC logging for troubleshootingrefresh-min-interval-sec: Minimum seconds between token refresh attempts (300 = 5 minutes)scopes: Required OAuth scopes - these are standard for Googleconstraints: Access control rules
Understanding Constraints
Google authentication doesn’t provide group claims by default. You must use email-based constraints to control access:
Email Constraints (Required for Google)
Specify which email addresses are allowed to authenticate:
constraints:
email:
- alice@example.com
- bob@example.com
- team@example.com
Important: Google does not provide group membership in standard OIDC claims. If you need group-based access control, consider:
- Using Google Workspace with a custom claim provider
- Using the
default_groupconfiguration parameter in Wiretastix to assign all Google users to a specific group - Manually managing user group memberships in Wiretastix after authentication
Step 5: Generate a Cookie Secret
Generate a secure random string for the cookie-secret parameter:
openssl rand -base64 32
Copy the output and paste it into the cookie-secret field in your configuration.
Step 6: Restart Wiretastix
After updating the configuration, restart the Wiretastix daemon:
sudo systemctl restart wiretastix
Or if running manually:
sudo wiretastix-daemon -c /etc/wiretastix/wiretastix.yaml
Step 7: Test the Integration
- Open your web browser and navigate to your Wiretastix URL (e.g.,
https://vpn.example.com) - You should be redirected to the Google sign-in page
- Sign in with a Google account that matches your email constraints
- If this is the first time, you’ll see the OAuth consent screen - click Allow
- You should be redirected back to Wiretastix and logged in
If successful, you’ll see the Wiretastix dashboard where you can create VPN devices.
Troubleshooting
Error: “redirect_uri_mismatch”
Cause: The redirect URL in your Wiretastix configuration doesn’t match what’s configured in Google Cloud Console.
Solution:
- Check that the redirect URL in
wiretastix.yamlexactly matches what you entered in Google Cloud Console - Ensure there are no trailing slashes or typos
- Common format:
https://your-domain.com/callback(no trailing slash)
Error: “access_denied” or “User not authorized”
Cause: The user’s email is not in the constraints.email list.
Solution:
- Add the user’s email address to the
constraints.emaillist inwiretastix.yaml - Restart Wiretastix daemon
- Try authenticating again
Consent Screen Shows “Unverified App” Warning
Cause: Your OAuth application hasn’t been verified by Google.
Solutions:
- For Internal apps (Google Workspace): No verification needed
- For External apps in development: Users will see a warning but can proceed by clicking “Advanced” → “Go to [app name] (unsafe)”
- For External apps in production: Submit your app for Google OAuth verification
Token Refresh Failures
Cause: Google’s refresh tokens may expire or become invalid.
Solution:
- Wiretastix always requests offline access (Google’s
access_type=offline) regardless of yourscopeslist, so there’s nothing to add here for Google specifically – anoffline_accessscope entry (needed for some other providers) isn’t recognized by Google and wouldn’t help. - If you don’t want users disabled on token refresh failures, disable it via the CLI:
config set auto_disable_on_auth_error 0(this is a runtime parameter, not awiretastix.yamlfield) - Increase
refresh-min-interval-secto reduce refresh frequency
Enable Verbose Logging
For troubleshooting, enable verbose OIDC logging:
oidc:
verbose: true
Restart Wiretastix and check the logs:
sudo journalctl -u wiretastix -f
Google Workspace Considerations
If you’re using Google Workspace (formerly G Suite):
- Internal User Type: Select “Internal” on the OAuth consent screen to restrict access to your organization
- Admin SDK Access: For group-based access, you would need to use Google Admin SDK (requires additional setup not covered by standard OIDC)
- Domain Restriction: You can restrict email constraints to your domain:
constraints:
email:
- "*@yourcompany.com" # Note: Wiretastix may not support wildcards - list users explicitly
Security Best Practices
- Use HTTPS: Always use HTTPS for your Wiretastix instance
- Restrict Email Access: Only add authorized users to the
constraints.emaillist - Secure Cookie Secret: Generate a strong random cookie secret and keep it confidential
- Monitor Access Logs: Regularly review Wiretastix logs for unauthorized access attempts
- Token Expiration: Configure appropriate token refresh intervals based on your security requirements
Next Steps
After successfully configuring Google OIDC:
- Manage Users - Review authenticated users
- Manage Groups - Configure group policies
- Configure Network Rules - Set up firewall rules for VPN traffic
- Managing Peers - Understand peer management