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

inconsistent use of env vars #3098

Open
tessus opened this issue Jun 30, 2023 · 4 comments
Open

inconsistent use of env vars #3098

tessus opened this issue Jun 30, 2023 · 4 comments

Comments

@tessus
Copy link

tessus commented Jun 30, 2023

Environment variables are not used consistently.

I start my kopia repository server with KOPIA_SERVER_CONTROL_PASSWORD=control and KOPIA_SERVER_PASSWORD=kopia.

Then I want to run kopia server status, but get an error message ERROR unable to list sources: 401 Unauthorized.

Turns out that the command needs the control password, but the password is read from the wrong env var KOPIA_SERVER_PASSWORD. Even the help shows the wrong info:

    --server-control-password=PASSWORD
                   Server control password ($KOPIA_SERVER_PASSWORD)

This is very confusing and unexpected. This means after starting the server, people have to change the KOPIA_SERVER_PASSWORD env var to the same value as KOPIA_SERVER_CONTROL_PASSWORD. Hmmm. Rather strange, isn't it?

@tessus
Copy link
Author

tessus commented Aug 31, 2023

I wanted to ask what the reasoning is behind this inconsistency. Maybe I just misunderstood something.

@jkowalski sorry for pinging you here. let me know if it is better to start a topic on the forum instead.

@tessus
Copy link
Author

tessus commented Nov 18, 2024

Here's is what I have figured out so far.

For the server component, there are 2 users and there is also the repository password that was used to create the repository on the server (no username).

When starting the server, the following env vars are used:

ENV var CLI argument
KOPIA_SERVER_CONTROL_USER --server-control-username
KOPIA_SERVER_CONTROL_PASSWORD --server-control-password
KOPIA_SERVER_USERNAME --server-username
KOPIA_SERVER_PASSWORD --server-password

see kopia server start --help

When doing a server refresh, the server control password is needed, but the env var used is the one for the server password:

ENV var CLI argument
KOPIA_SERVER_USERNAME --server-control-username
KOPIA_SERVER_PASSWORD --server-control-password

see kopia server refresh --help

This is clearly an inconsistency and extremly confusing. But maybe I am missing something.

@sbn-purchark
Copy link

sbn-purchark commented Nov 20, 2024

I remember having some kind of confusion regarding that which is probably why I have a specific line saying "Add --server-username and --server-password for access to web UI." KOPIA_WEBUI_PASSWORD and --webui-password would have been more clear.

@tessus
Copy link
Author

tessus commented Nov 20, 2024

IMO, all the names are a bit off. e.g. KOPIA_PASSWORD is used for the repository password. afaik this password is only used when creating a repo and changing the password of the repo (this password is used to do the encryption). Thus this should be called KOPIA_REPOSITORY_PASSWORD

Then the KOPIA_SERVER_* passwords are actually credentials that are used when using a client to authehticate against the server. These are the ones that were created when doing server users add. Since these credentials are needed when doing all the snapshort operations, they should have been called KOPIA_USER and KOPIA_PASSWORD.

And last but not least we have user and password credentials that are used for administering the server (--server-control*). So these should have the name SERVER or CONTROL or ADMIN in the name (and the env vars should be consistent).

Kopia is still 0.y.z thus according to semver, breaking changes can still be done w/o having to raise the major version.

IMO this could need a serious cleanup to make it consistent and more logical.

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

No branches or pull requests

2 participants