Skip to content

docker-credential-pass warning when running docker logout <private registry> #174

@jrpalma

Description

@jrpalma

I installed docker-credentials-pass and managed to make it work. However, there is an annoying warning when you run the command "sudo docker logout ". I did some searches and came across issue #102. I get the following warning:

WARNING: could not erase credentials: error erasing credentials - err: exit status 1, out: `exit status 1: Error: docker-credential-helpers/[CRED_FOLDER_NAME] is not in the password store.`

I also ran

sudo docker login registry
pass
Password Store
└── docker-credential-helpers [error opening dir]
sudo ls -lhrt ~/.password-store/
total 4.0K
drwx------ 3 root root 4.0K Feb 17 22:17 docker-credential-helpers

Therefore, to my surprise, this was successful:

sudo pass
Password Store
└── docker-credential-helpers
    └── cmVnaXN0cnk=
        └── docker
sudo pass rm -rf docker-credential-helpers/cmVnaXN0cnk=
removed '/home/user/.password-store/docker-credential-helpers/cmVnaXN0cnk=/docker.gpg'
removed directory '/home/user/.password-store/docker-credential-helpers/cmVnaXN0cnk=/'

This should have failed like it did with docker-credential-pass warning. I am puzzled as to why this warning is displayed by docker-credentials-pass but not when called from the terminal.

According to pass:

Password management should be simple and follow Unix philosophy. With pass, each password lives inside of a gpg encrypted file whose filename is the title of the website or resource that requires the password. These encrypted files may be organized into meaningful folder hierarchies, copied from computer to computer, and, in general, manipulated using standard command line file management utilities.

So, I changed the code which no longer shows the warning

diff --git a/pass/pass_linux.go b/pass/pass_linux.go
index 342e538..33a0482 100644
--- a/pass/pass_linux.go
+++ b/pass/pass_linux.go
@@ -97,7 +97,7 @@ func (h Pass) Delete(serverURL string) error {
        }
 
        encoded := base64.URLEncoding.EncodeToString([]byte(serverURL))
-       _, err := h.runPass("", "rm", "-rf", path.Join(PASS_FOLDER, encoded))
+       err := os.RemoveAll(path.Join(getPassDir(), PASS_FOLDER, encoded))
        return err
 }

Can we just do a remove? The pass documentation make it seem like this is ok. I understand this might not be proper, but the warning is annoying.

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