juanfont/headscale · error

autogroup not supported for SSH sources

Error message

autogroup not supported for SSH sources

What it means

Returned by validateAutogroupForSSHSrc (hscontrol/policy/v2/types.go:2119) when an autogroup in an SSH rule's src is not in autogroupForSSHSrc = {autogroup:member, autogroup:tagged} (types.go:2000). autogroup:internet in SSH src gets the dedicated ErrAutogroupInternetSrc (2115) first. SSH sources describe who may initiate SSH, so only device-class autogroups are legal.

Source

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

	ErrInvalidOwner                = errors.New("invalid owner format")
	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 {

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Use autogroup:member (user-owned devices) or autogroup:tagged (tagged devices) as SSH src
  2. Replace autogroup:self src with the specific user or group that should connect
  3. Validate ssh and sshTests sections together — both go through the same validator

Example fix

// before
"ssh": [{"action": "accept", "src": ["autogroup:self"], "dst": ["tag:server"], "users": ["root"]}]

// after
"ssh": [{"action": "accept", "src": ["autogroup:member"], "dst": ["tag:server"], "users": ["root"]}]
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func isAutogroupNotSupportedSSHSrc(err error) bool {
	return errors.Is(err, policy.ErrAutogroupNotSupportedSSHSrc)
}

Try / catch

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

Prevention

When it happens

Trigger: An SSH rule like {"src": ["autogroup:self"], ...} — self is not a legal SSH source and hits this (it is not special-cased on the SSH path, unlike the ACL path). Any non-member/tagged autogroup other than internet lands here.

Common situations: Porting ACL habits into sshTests/ssh sections; assuming autogroup:self works in SSH src because it exists in the ACL vocabulary.

Related errors


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