Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ability for unprivileged Windows to upgrade #4649

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/pkg/agent/install/user_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const (
USER_UF_SCRIPT = 1
USER_UF_NORMAL_ACCOUNT = 512
USER_UF_DONT_EXPIRE_PASSWD = 65536

accountRightCreateSymbolicLink gowin32.AccountRightName = "SeCreateSymbolicLinkPrivilege"
)

// FindGID returns the group's GID on the machine.
Expand Down Expand Up @@ -151,6 +153,10 @@ func CreateUser(name string, _ string) (string, error) {
if err != nil {
return "", fmt.Errorf("failed to set service logon: %w", err)
}
err = sp.AddAccountRight(sid, accountRightCreateSymbolicLink)
if err != nil {
return "", fmt.Errorf("failed to add right to create symbolic link: %w", err)
}

return FindUID(name)
}
Expand Down
Loading