juanfont/headscale · error

autogroup not supported for SSH destinations

Error message

autogroup not supported for SSH destinations

What it means

Returned by validateAutogroupForSSHDst (hscontrol/policy/v2/types.go:2135) when an autogroup in an SSH rule's dst is not in autogroupForSSHDst = {autogroup:member, autogroup:tagged, autogroup:self} (types.go:2001). autogroup:internet in SSH dst returns ErrAutogroupInternetSrc instead (2131). SSH destinations describe which devices accept SSH, so internet/danger-all make no sense there.

Source

Thrown at hscontrol/policy/v2/types.go:141

	ErrGroupNotDefined             = errors.New("group not defined in policy")
	ErrInvalidGroupMember          = errors.New("invalid group member type")
	ErrGroupValueNotArray          = errors.New("group value must be an array of users")
	ErrInvalidHostIP               = errors.New("hostname contains invalid IP address")
	ErrTagNotDefined               = errors.New("tag not found")
	ErrAutoApproverNotAlias        = errors.New("auto approver is not an alias")
	ErrInvalidACLAction            = errors.New("invalid ACL action")
	ErrInvalidSSHAction            = errors.New("invalid SSH action")
	ErrInvalidProtocolNumber       = errors.New("invalid protocol number")
	ErrProtocolLeadingZero         = errors.New("leading 0 not permitted in protocol number")
	ErrProtocolOutOfRange          = errors.New("protocol number out of range (0-255)")
	ErrAutogroupNotSupported       = errors.New("autogroup not supported in headscale")
	ErrAutogroupInternetSrc        = errors.New("autogroup:internet can only be used in ACL destinations")
	ErrAutogroupSelfSrc            = errors.New("\"autogroup:self\" not valid on the src side of a rule")
	ErrAutogroupNotSupportedACLSrc = errors.New("autogroup not supported for ACL sources")
	ErrAutogroupNotSupportedACLDst = errors.New("autogroup not supported for ACL destinations")
	ErrAutogroupDangerAllDst       = errors.New("cannot use autogroup:danger-all as a dst")
	ErrAutogroupNotSupportedSSHSrc = errors.New("autogroup not supported for SSH sources")
	ErrAutogroupNotSupportedSSHDst = errors.New("autogroup not supported for SSH destinations")
	ErrHostNotDefined              = errors.New("host not defined in policy")
	ErrSSHSourceAliasNotSupported  = errors.New("alias not supported for SSH source")
	ErrSSHDestAliasNotSupported    = errors.New("alias not supported for SSH destination")
	ErrUnknownField                = errors.New("unknown field")
	ErrProtocolNoSpecificPorts     = errors.New("protocol does not support specific ports")
	ErrTestEmptyAssertions         = errors.New("test entry must have at least one of \"accept\" or \"deny\"")
	ErrTestProtocolNotAllowed      = errors.New("test protocol must be tcp, udp, sctp, or empty")
	ErrTestDestinationMultiPort    = errors.New("test destination port must be a single port")
	ErrTestDestinationCIDR         = errors.New("test destination must be a single host, not a CIDR range")
	ErrAutogroupInternetTestDst    = errors.New("autogroup:internet not valid as a test destination")
	ErrSSHTestEmptySrc             = errors.New("SSH tests entry must have a non-empty src")
	ErrSSHTestEmptyDst             = errors.New("SSH tests entry must have at least one dst")
	ErrSSHTestDstUnknownTag        = errors.New("SSH tests dst contains unknown tag")
	ErrSSHTestDstDisallowedElement = errors.New("SSH tests dst contains disallowed element")
)

type resolved struct {
	ips netipx.IPSet

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Use autogroup:member, autogroup:tagged, or autogroup:self as SSH dst
  2. For 'SSH to these servers', list the tag (e.g. "tag:server") instead of a catch-all autogroup
  3. Check the error message's allowed list ('can be [...]') for the exact legal set in your headscale version

Example fix

// before
"ssh": [{"action": "check", "src": ["group:admin"], "dst": ["autogroup:danger-all"], "users": ["root"]}]

// after
"ssh": [{"action": "check", "src": ["group:admin"], "dst": ["tag:server"], "users": ["root"]}]
Defensive patterns

Strategy: validation

Validate before calling

sshDstAutogroups := map[string]bool{"autogroup:member": true, "autogroup:tagged": true, "autogroup:self": true}
for _, r := range sshRules {
	for _, d := range r.Dst {
		if strings.HasPrefix(d, "autogroup:") && !sshDstAutogroups[d] {
			return fmt.Errorf("%s not allowed as SSH dst", d)
		}
	}
}

Type guard

func isAutogroupNotSupportedSSHDst(err error) bool {
	return errors.Is(err, policy.ErrAutogroupNotSupportedSSHDst)
}

Try / catch

if err := p.Validate(); err != nil {
	if errors.Is(err, policy.ErrAutogroupNotSupportedSSHDst) {
		return fmt.Errorf("SSH dst autogroup must be member, tagged, or self: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: An SSH rule with dst containing autogroup:danger-all, or any future autogroup outside member/tagged/self. autogroup:internet in SSH dst reports the internet-specific error.

Common situations: Trying to allow SSH 'to everything' with danger-all, or reusing an ACL dst line inside an ssh rule. Remember SSH dst cannot carry ports.

Related errors


AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15). Data as JSON: /api/errors/2c5b4b2fd675a041. Report an issue: GitHub.