How to use without the UI?

In order to meet unique security requirements, we are looking at disabling/removing the UI from anyone but an admin accessing.

However I cannot find a way to do any user/password actions without using the UI.

How does a user create/mange API keys without the UI? Or is this simply not possible?

You can create API keys with the following CLI command

maas apikey --username $USERNAME

Then login with

maas login $PROFILE $URL $API_KEY

There is a bit about this in the maas-cli docs.

This only allows you to create additional API keys, correct?

You still have to have a single valid API key for that user ine the first place, yes?

If the user deletes the API key without realizing it is the last one, are they not locked out?

We found undocumented solutions through the codebase.

  1. According to code in apikey.py we can have MAAS CLI generate the token for another user, which solves our problem with managing tokens for users who may not have a valid token anymore

https://github.com/maas/maas/blob/2.8/src/maasserver/management/commands/apikey.py

  1. According to code in helpers.py#L256 we can authenticate and automatically create a token if no token is found, which solves our problem with if a user deletes their last token

https://github.com/maas/python-libmaas/blob/master/maas/client/bones/helpers.py#L256

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.