Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

oxide auth login not working - "Credentials missing or invalid" #230

Closed
oxidecomputer/omicron
#1359

Description

@smklein

Using release 0.2.6, I tried the following:

$ oxide --debug auth login
Oxide instance host (this assumes https:// unless http:// is given as a part of the URL): http://mercury.oxide-preview.com/
Jul 06 20:06:29.628 DEBG starting new connection: http://mercury.oxide-preview.com/
Jul 06 20:06:29.830 DEBG response '200 OK' for http://mercury.oxide-preview.com/device/auth
Opening http://mercury.oxide-preview.com/device/verify in your browser.
Please verify user code: MQPZ-GRKJ
Jul 06 20:06:30.144 DEBG starting new connection: http://mercury.oxide-preview.com/
Jul 06 20:06:30.349 DEBG response '400 Bad Request' for http://mercury.oxide-preview.com/device/token
Jul 06 20:06:35.350 DEBG starting new connection: http://mercury.oxide-preview.com/
Jul 06 20:06:35.608 DEBG response '400 Bad Request' for http://mercury.oxide-preview.com/device/token

At this point, I went to the console, hit the button, and came back:

Jul 06 20:06:40.609 DEBG starting new connection: http://mercury.oxide-preview.com/
Jul 06 20:06:40.816 DEBG response '200 OK' for http://mercury.oxide-preview.com/device/token
Jul 06 20:06:40.816 DEBG request: RequestBuilder { method: GET, url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("mercury.oxide-preview.com")), port: None, path: "//session/me", query: None, fragment: None }, headers: {"accept": "application/json", "content-type": "application/json", "authorization": "Bearer oxide-token-eb6eb0700e09a36e7060f5deb1e72f6a8cdfc479"} }
Jul 06 20:06:40.816 DEBG starting new connection: http://mercury.oxide-preview.com/
Jul 06 20:06:41.021 DEBG response '401 Unauthorized' for http://mercury.oxide-preview.com//session/me
✘ You are not authenticated: credentials missing or invalid
Try authenticating with: `oxide auth login`

In the Nexus log, I saw the following:

{"msg":"request completed","v":0,"name":"nexus","level":30,"time":"2022-07-06T20:07:10.410363035Z","hostname":"oxz_nexus","pid":16537,"uri":"//session/me","method":"GET","req_id":"b1b13a1e-2ca3-4baf-bcd0-8ba68987d490","remote_addr":"172.20.16.122:59858","local_addr":"172.20.15.226:80","component":"dropshot_external","name":"e6bff1ff-24fb-49dc-a54e-c6a350cd4d6c","error_message_external":"credentials missing or invalid","error_message_internal":"Actor required","response_code":"401"}

Activity

  1. smklein commented on Jul 6, 2022

    @smklein
    ContributorAuthor
  2. smklein commented on Jul 6, 2022

    @smklein
    ContributorAuthor

    Not sure what the "Actor required" message means in this context. Is it invalid to authenticate before setting up something else in the system?

    FWIW, at this point, I was booting a fresh Omicron with no silo / IdP info set up.

  3. plotnick commented on Jul 6, 2022

    @plotnick
    Contributor

    Who did you log in as in the console?

  4. smklein commented on Jul 6, 2022

    @smklein
    ContributorAuthor

    I pressed the "Privileged" button when the option showed up

  5. smklein commented on Jul 6, 2022

    @smklein
    ContributorAuthor

    I'm able to repro the same behavior with the "Unprivileged" user - still seeing 401 unauthorized for session/me

  6. plotnick commented on Jul 6, 2022

    @plotnick
    Contributor

    Ugh, not really sure what's going on here. The token is being granted and used for authentication, so it should be looked up and assigned an actor by the code in authn/external/token.rs. What omicron commit is this running against? Could you connect to the Cockroach DB and run select * from device_access_token;?

  7. plotnick commented on Jul 6, 2022

    @plotnick
    Contributor

    Also happy to pair on this if you'd like, before, during or after the demo dry-run. Just ping me in chat.

  8. smklein commented on Jul 6, 2022

    @smklein
    ContributorAuthor

    Adding client_token to schemes_external caused this to work, in the Nexus config

  9. smklein commented on Jul 6, 2022

    @smklein
    ContributorAuthor

    Specifically, within smf/nexus/config-partial.toml

  10. plotnick commented on Jul 6, 2022

    @plotnick
    Contributor

    Should also generate traces for attempted authn mechanisms to assist debugging.

  11. bnaecker commented on Jul 6, 2022

    @bnaecker
    Contributor

    @plotnick If the system is live, and those messages are logged at a filtered level like trace, you can get them with DTrace: pfexec dtrace -n 'slog*:::trace { printf("%\n", copyinstr(arg0)); }' will print the whole trace message as JSON.

  12. davepacheco commented on Jul 6, 2022

    @davepacheco

    Adding client_token to schemes_external caused this to work, in the Nexus config

    That explains all of this, right? Nexus was configured not to look at the device auth token scheme.

  13. plotnick commented on Jul 6, 2022

    @plotnick
    Contributor

    That explains all of this, right? Nexus was configured not to look at the device auth token scheme.

    Correct. Should be fixed in Omicron#1359.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions