google-workspacetwo-factor-authenticationtailscale

Tailscale and configuring additional Google Workspace two-factor authentication for SSH connections


We are trialing Tailscale set-up for production server SSH connections. We are using Google Workspace as the identity provider for Tailscale.

Because production servers are more security critical than general data related to Google Workspaces, we'd like to ensure that any Tailscale session has a shorter session timeout and always be asked for two-factor authentication.

By default, Google Workspace asks two-factor authentication only once per browser, which is fine if you want to access Docs, email and such. It does not do additional two-factor authentication request after user has logged into the service in their browser.


Solution

  • One way to solve this is to use Passkey authentication (currently in beta mode for Tailscale).

    Here is an example how to configure timeout:

    {
        "acls": [
            // Allow all connections.
            {"action": "accept", "src": ["*"], "dst": ["*:*"]},
        ],
        "groups": {
            "group:operator": [
                "foo@passkey",
                "bar@passkey",
            ],
        },
        "tagOwners": {
            "tag:prod": ["group:operator"],
        },
        "ssh": [
            // The default SSH policy, which lets users SSH into devices they own.
            // Learn more at https://tailscale.com/kb/1193/tailscale-ssh/
            {
                "action":      "check",
                "src":         ["group:operator"],
                "dst":         ["tag:prod"],
                "users":       ["autogroup:nonroot"],
                // Force reauth every 24h
                "checkPeriod": "24h",
            },
        ],