Skip to content

Conversation

@mgajda
Copy link
Contributor

@mgajda mgajda commented Dec 31, 2025

Summary

Implements --no-keyring flag to address issue #643 where users on WSL and ARM systems experience keyring access failures.

Changes

  • Added --no-keyring global flag to disable system keyring integration
  • Added support for no-keyring configuration option in upctl.yaml
  • Modified account login command to save tokens to config file when keyring is disabled
  • Skipped credentials.Parse() calls when keyring is disabled to avoid access attempts
  • Added helpful error messages suggesting --no-keyring when keyring operations fail

Motivation

Users on WSL, ARM, and other environments often encounter keyring errors like:

Error: failed to unlock correct collection '/org/freedesktop/secrets/aliases/default'

This PR allows them to bypass the keyring entirely and use configuration file storage instead.

Usage

# Use --no-keyring flag
upctl account login --with-token --no-keyring

Or set in config file:

echo "no-keyring: true" >> ~/.config/upctl.yaml

Works with all commands

upctl server list --no-keyring

Testing

  • Tested login with --no-keyring flag saves token to config file
  • Tested config file option no-keyring: true works
  • Verified normal keyring flow still works when flag is not set
  • Confirmed helpful error hints are shown on keyring failures

For #643

Addresses issue UpCloudLtd#643 where users on WSL and ARM experience keyring access issues.

Changes:
- Add --no-keyring global flag to disable system keyring integration
- Support no-keyring configuration option in upctl.yaml
- When --no-keyring is set, save tokens to config file instead of keyring
- Skip credentials.Parse() when keyring is disabled to avoid access attempts
- Update account login command to save tokens to config when keyring disabled

This allows users experiencing keyring issues to still use token authentication
by storing tokens in the configuration file instead.
When keyring operations fail, provide clear hints about alternative options:
- Using --no-keyring flag
- Setting no-keyring in config file
- Using environment variables

This helps users quickly resolve keyring access issues on WSL, ARM, and other
environments with problematic keyring support.
@mgajda mgajda requested a review from a team as a code owner December 31, 2025 10:49
Comment on lines +105 to +108
flags.BoolVar(
&conf.GlobalFlags.NoKeyring, "no-keyring", false,
"Disable system keyring integration for credential storage.",
)
Copy link
Member

@kangasta kangasta Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment from #643 to make it visible for other reviewers:

There should be no need for --no-keyring flag: keyring has least priority when parsing the credentials, so with --no-keyring user would just get a slightly different error message. I.e., if credentials are defined in environment variables, the keyring should not be accessed. Maybe instead of adding --no-keyring flag the keyring access failed error message could be clarified.

For login --with-token, the --no-keyring flag would not make sense as we do not currently have any alternative methods for saving the token. One alternative would be to save the token to upctl configuration file, but in that case the parameter should be about allowing this less secure fallback.

if noKeyring {
// Get config file path from flag if specified
configFile, _ := s.Cobra().Root().PersistentFlags().GetString("config")
msg := "Saving token to configuration file (keyring disabled)."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the token saved with upctl in our other tooling as well (see credentials helper), so this should be saved in more generic location (e.g. UpCloud level config instead of UpCloud CLI level) 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we open a separate issue for this? Such a separate place should also have a config option to alter it.

noKeyring = v.GetBool("no-keyring")
}
}
if noKeyring {
Copy link
Member

@kangasta kangasta Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking for --no-keyring we could write to a config file if keyring access failed because of a specific error. In that case an warning should be printed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case keyring is available the token is put in there unless --no-keyring option is present. The PR also fixes an example when --config option was ignored.

@mgajda
Copy link
Contributor Author

mgajda commented Jan 1, 2026

Replaced by #654 after feedback.

@mgajda mgajda closed this Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants