{"record":{"id":"6624d90cd646700e","repo":"juanfont/headscale","slug":"wildcard-is-not-supported-as-ssh-destination","errorCode":null,"errorMessage":"wildcard (*) is not supported as SSH destination","messagePattern":"wildcard \\(\\*\\) is not supported as SSH destination","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hscontrol/policy/v2/types.go","lineNumber":46,"sourceCode":"var policyJSONOpts = []json.Options{\n\tjson.DefaultOptionsV2(),\n\tjson.MatchCaseInsensitiveNames(true),\n\tjson.RejectUnknownMembers(true),\n}\n\nconst Wildcard = Asterix(0)\n\nvar ErrAutogroupSelfRequiresPerNodeResolution = errors.New(\"autogroup:self requires per-node resolution and cannot be resolved in this context\")\n\nvar ErrUndefinedTagReference = errors.New(\"references undefined tag\")\n\n// SSH validation errors.\nvar (\n\tErrSSHTagSourceToUserDest             = errors.New(\"tags in SSH source cannot access user-owned devices\")\n\tErrSSHUserDestRequiresSameUser        = errors.New(\"user destination requires source to contain only that same user\")\n\tErrSSHAutogroupSelfRequiresUserSource = errors.New(\"autogroup:self destination requires source to contain only users or groups, not tags or autogroup:tagged\")\n\tErrSSHTagSourceToAutogroupMember      = errors.New(\"tags in SSH source cannot access autogroup:member (user-owned devices)\")\n\tErrSSHWildcardDestination             = errors.New(\"wildcard (*) is not supported as SSH destination\")\n\tErrSSHCheckPeriodAboveMax             = errors.New(\"is above the max (168h)\")\n\tErrSSHCheckPeriodNegative             = errors.New(\"must be a positive duration\")\n\tErrSSHCheckPeriodOnNonCheck           = errors.New(\"checkPeriod is only valid with action \\\"check\\\"\")\n\tErrInvalidLocalpart                   = errors.New(\"invalid localpart format, must be localpart:*@<domain>\")\n\tErrSSHUsersMustBeSpecified            = errors.New(\"users must be specified\")\n\tErrSSHUserInvalid                     = errors.New(\"is not valid\")\n\tErrSSHAcceptEnvEmpty                  = errors.New(\"acceptEnv values cannot be empty\")\n\tErrSSHActionMustBeSpecified           = errors.New(\"action must be specified\")\n\tErrSSHActionInvalid                   = errors.New(\"is not a valid action\")\n\tErrSSHDestinationHostAlias            = errors.New(\"invalid dst\")\n\tErrTagNameMustStartWithLetter         = errors.New(\"tag names must start with a letter, after 'tag:'\")\n\tErrGroupMembersCannotBeRecursive      = errors.New(\"group members cannot be recursive\")\n)\n\n// SSH check period constants per Tailscale docs:\n// https://tailscale.com/docs/features/tailscale-ssh#checkperiod\n// SaaS imposes no minimum (0s is accepted) so headscale matches.\nconst (","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/policy/v2/types.go#L28-L64","documentation":"SSH unmarshaling error (hscontrol/policy/v2/types.go:2936-2939): an SSH destination alias list contains '*' (Asterix). Wildcards are not supported as SSH destinations; the error text steers you to autogroup:member (user-owned devices), autogroup:tagged (tagged devices), or explicit tags/users. Raised during policy parse, before validation proper.","triggerScenarios":"\"ssh\": [{\"src\": [\"group:ops\"], \"dst\": [\"*\"], \"users\": [\"root\"], \"action\": \"accept\"}] — SSHDstAliases.UnmarshalJSON hits the Asterix case and returns the wrapped error.","commonSituations":"Porting old policies that used '*' dsts as 'anywhere'; misunderstanding that ACL '*' semantics do not carry over to SSH; IaC templates with wildcard placeholders.","solutions":["Replace '*' with 'autogroup:member' + 'autogroup:tagged' (together they cover every node), or list explicit tags","Keep the src side user/group-only if you also use autogroup:self dsts (see the companion validation errors)","Run 'headscale policy check' after the edit"],"exampleFix":"// before\n{\"src\": [\"group:ops\"], \"dst\": [\"*\"], \"users\": [\"root\"], \"action\": \"accept\"}\n\n// after\n{\"src\": [\"group:ops\"], \"dst\": [\"autogroup:member\", \"autogroup:tagged\"], \"users\": [\"autogroup:nonroot\"], \"action\": \"check\", \"checkPeriod\": \"8h\"}","handlingStrategy":"validation","validationCode":"func sshDstValid(dst []string) bool { return !slices.Contains(dst, \"*\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Substitute '*' with autogroup:member + autogroup:tagged for full coverage","Ban wildcard placeholders in policy templates"],"tags":["policy","ssh","validation","config","headscale"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}