Add a new `--encrypt-state` flag to `cmd/tailscaled`. Based on that
flag, migrate the existing state file to/from encrypted format if
needed.
Updates #15830
Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
flag.StringVar(&args.tunname,"tun",defaultTunName(),`tunnel interface name; use "userspace-networking" (beta) to not use TUN`)
flag.StringVar(&args.tunname,"tun",defaultTunName(),`tunnel interface name; use "userspace-networking" (beta) to not use TUN`)
flag.Var(flagtype.PortValue(&args.port,defaultPort()),"port","UDP port to listen on for WireGuard and peer-to-peer traffic; 0 means automatically select")
flag.Var(flagtype.PortValue(&args.port,defaultPort()),"port","UDP port to listen on for WireGuard and peer-to-peer traffic; 0 means automatically select")
flag.StringVar(&args.statepath,"state","","absolute path of state file; use 'kube:<secret-name>' to use Kubernetes secrets or 'arn:aws:ssm:...' to store in AWS SSM; use 'mem:' to not store state and register as an ephemeral node. If empty and --statedir is provided, the default is <statedir>/tailscaled.state. Default: "+paths.DefaultTailscaledStateFile())
flag.StringVar(&args.statepath,"state","","absolute path of state file; use 'kube:<secret-name>' to use Kubernetes secrets or 'arn:aws:ssm:...' to store in AWS SSM; use 'mem:' to not store state and register as an ephemeral node. If empty and --statedir is provided, the default is <statedir>/tailscaled.state. Default: "+paths.DefaultTailscaledStateFile())
flag.BoolVar(&args.encryptState,"encrypt-state",defaultEncryptState(),"encrypt the state file on disk; uses TPM on Linux and Windows, on all other platforms this flag is not supported")
flag.StringVar(&args.statedir,"statedir","","path to directory for storage of config state, TLS certs, temporary incoming Taildrop files, etc. If empty, it's derived from --state when possible.")
flag.StringVar(&args.statedir,"statedir","","path to directory for storage of config state, TLS certs, temporary incoming Taildrop files, etc. If empty, it's derived from --state when possible.")
flag.StringVar(&args.socketpath,"socket",paths.DefaultTailscaledSocket(),"path of the service unix socket")
flag.StringVar(&args.socketpath,"socket",paths.DefaultTailscaledSocket(),"path of the service unix socket")
flag.StringVar(&args.birdSocketPath,"bird-socket","","path of the bird unix socket")
flag.StringVar(&args.birdSocketPath,"bird-socket","","path of the bird unix socket")
@ -268,6 +271,28 @@ func main() {
}
}
}
}
ifargs.encryptState{
ifruntime.GOOS!="linux"&&runtime.GOOS!="windows"{
log.SetFlags(0)
log.Fatalf("--encrypt-state is not supported on %s",runtime.GOOS)
@ -278,6 +279,14 @@ See https://tailscale.com/kb/1315/mdm-keys#set-your-organization-name for more d
If you enable or don't configure this policy, the onboarding flow will be shown to new users who have not yet signed in to a Tailscale account.
If you enable or don't configure this policy, the onboarding flow will be shown to new users who have not yet signed in to a Tailscale account.
If you disable this policy, the onboarding flow will never be shown.]]></string>
If you disable this policy, the onboarding flow will never be shown.]]></string>
<string id="EncryptState">Encrypt client state file stored on disk</string>
<string id="EncryptState_Help"><![CDATA[This policy configures encryption of the Tailscale client state file on disk.
If you enable this policy, the state file will be encrypted using the local TPM device. If a local TPM device is not present or not accessible, Tailscale will fail to start.
If you disable this policy, the state file is stored in plaintext.
If the policy is unconfigured, state encryption will be enabled on newer client versions when the device has a properly-configured TPM.]]></string>