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

automatic user and password authentication for dvc get and dvc.api.open with WebDav #4974

Closed
AnnKatrinBecker opened this issue Nov 26, 2020 · 3 comments
Labels
enhancement Enhances DVC feature request Requesting a new feature fs: webdav Related to the Webdav filesystem

Comments

@AnnKatrinBecker
Copy link

I recently started using DVC and are very excited about the simple version control it provides for large Data files.

Now I use WebDav as a remote storage for project A.
I am using user and password authentication for webdav which are stored in my local dvc config file in projectA.
Pushing and Pulling inside project A works well.

Now I have another project B (not a dvc project) which should use files from project A.
Yet I could not retrieve files from project A via dvc get or the Python API dvc.api.open().

If I use the file resource_url retrieved by dvc.api.get_url().
I can use wget --user user --ask-password resource_url to copy individual files to my workspace.
Yet if I run dvc.api.open() with the same params it raises an "Configuration for WebDav ... is invalid" error.
According to the source code this error is raised if the webdav3.client is not valid.

Thus I tried to initialize my own webdav3.client with
from webdav3.client import Client options = { "webdav_hostname": "http://webdav_url", "webdav_login": "user", "webdav_password": "Passwortsystems" } client = Client(options)
In this case I receive a working client.
client.valid() returns True
and client.check(pathtofile) returns True as well

I realized the problem is that project B has no access to the username and password required to access WebDav.
It would be nice if the error message could point to this as a possible issue.

After I specified the "user" and set "ask_password" to True in the global config file of project A. I can use dvc.api.open() successfully if I type my password during execution.

Now my question is, is there any possibility to provide a local config file in Project B with the password for webdav that is automatically retrieved by dvc.api.open(), so that the script can run without user interaction?

@pmrowla
Copy link
Contributor

pmrowla commented Nov 26, 2020

Just to clarify:

After I specified the "user" and set "ask_password" to True in the global config file of project A. I can use dvc.api.open() successfully if I type my password during execution.

Do you mean global config as in dvc remote modify --global / dvc config --global? Or do you mean in project A's repository level .dvc/config? In DVC, .dvc/config is generally referred to as the repository config, and --global refers to the user global ($HOME/.dvc/config) config.


dvc get and dvc.api.open() currently do not support reading any local configs (meaning any .dvc/... files in project B). It will only read the .dvc/config file from the source git/DVC repo (meaning .dvc/config in project A).

Currently the only workarounds for this would be:

  • commit user and password for the remote into project A's repository level .dvc/config (not recommended, credentials should not be stored in Git)
  • have the user running the project B code to configure the remote using --global
    and set the user and password fields for the appropriate remote name

We are currently considering ways to pass local config information into commands like dvc get and api.open, but at the very least it can't be implemented until #4604 is finished as a prerequisite.

@pmrowla pmrowla added the awaiting response we are waiting for your reply, please respond! :) label Nov 26, 2020
@AnnKatrinBecker
Copy link
Author

Thank you for the fast reply.

Just to clarify:
Do you mean global config as in dvc remote modify --global / dvc config --global? Or do you mean in project A's repository level .dvc/config? In DVC, .dvc/config is generally referred to as the repository config, and --global refers to the user global ($HOME/.dvc/config) config.

Sorry for the misused "global" here. I meant project A's repository .dvc/config as you assumed.

Thanks for the suggested workarounds.
For now we can work with the second workaround.

For the future it would be helpful to be able to pass local config information to api.open as well. Thank you for considering this.

@pmrowla pmrowla added enhancement Enhances DVC feature request Requesting a new feature and removed awaiting response we are waiting for your reply, please respond! :) labels Nov 26, 2020
@efiop
Copy link
Contributor

efiop commented Nov 30, 2020

Closing in favor of #4604

@efiop efiop closed this as completed Nov 30, 2020
@skshetry skshetry added the fs: webdav Related to the Webdav filesystem label Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances DVC feature request Requesting a new feature fs: webdav Related to the Webdav filesystem
Projects
None yet
Development

No branches or pull requests

4 participants