1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30
Sebastiaan van Stijn 37c4a6b158 remove uses of golang.org/x/sys/execabs
the "golang.org/x/sys/execabs" package was introduced to address a security
issue on Windows, and changing the default behavior of os/exec was considered
a breaking change. go1.19 applied the behavior that was previously implemented
in the execabs package;

from the release notes: https://go.dev/doc/go1.19#os-exec-path

> Command and LookPath no longer allow results from a PATH search to be found
> relative to the current directory. This removes a common source of security
> problems but may also break existing programs that depend on using, say,
> exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe)
> in the current directory. See the os/exec package documentation for information
> about how best to update such programs.
>
> On Windows, Command and LookPath now respect the NoDefaultCurrentDirectoryInExePath
> environment variable, making it possible to disable the default implicit search
> of “.” in PATH lookups on Windows systems.

With those changes, we no longer need to use the execabs package, and we can
switch back to os/exec.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-26 02:11:17 +02:00
2023-04-16 12:29:03 +02:00
2022-08-27 00:32:19 +02:00
2022-08-28 20:53:51 +02:00
2022-08-30 13:09:08 +02:00
2023-04-16 12:29:03 +02:00
2023-04-16 12:29:03 +02:00
2023-05-26 02:11:17 +02:00
2023-04-16 12:07:42 +02:00
2016-02-07 18:20:36 -08:00
2022-08-28 20:53:51 +02:00
2023-01-30 12:19:07 +01:00

GitHub release PkgGoDev Build Status Codecov Go Report Card

Introduction

docker-credential-helpers is a suite of programs to use native stores to keep Docker credentials safe.

Installation

Go to the Releases page and download the binary that works better for you. Put that binary in your $PATH, so Docker can find it.

Building

You can build the credential helpers using Docker:

# create builder
$ docker buildx create --use

# build credential helpers from remote repository and output to ./bin/build
$ docker buildx bake "https://github.com/docker/docker-credential-helpers.git"

# or from local source
$ git clone https://github.com/docker/docker-credential-helpers.git
$ cd docker-credential-helpers
$ docker buildx bake

Or if the toolchain is already installed on your machine:

1 - Download the source.

$ git clone https://github.com/docker/docker-credential-helpers.git
$ cd docker-credential-helpers

2 - Use make to build the program you want. That will leave an executable in the bin directory inside the repository.

$ make osxkeychain

3 - Put that binary in your $PATH, so Docker can find it.

$ cp bin/build/docker-credential-osxkeychain /usr/local/bin/

Usage

With the Docker Engine

Set the credsStore option in your ~/.docker/config.json file with the suffix of the program you want to use. For instance, set it to osxkeychain if you want to use docker-credential-osxkeychain.

{
  "credsStore": "osxkeychain"
}

With other command line applications

The sub-package client includes functions to call external programs from your own command line applications.

There are three things you need to know if you need to interact with a helper:

  1. The name of the program to execute, for instance docker-credential-osxkeychain.
  2. The server address to identify the credentials, for instance https://example.com.
  3. The username and secret to store, when you want to store credentials.

You can see examples of each function in the client documentation.

Available programs

  1. osxkeychain: Provides a helper to use the OS X keychain as credentials store.
  2. secretservice: Provides a helper to use the D-Bus secret service as credentials store.
  3. wincred: Provides a helper to use Windows credentials manager as store.
  4. pass: Provides a helper to use pass as credentials store.

Note

pass needs to be configured for docker-credential-pass to work properly. It must be initialized with a gpg2 key ID. Make sure your GPG key exists is in gpg2 keyring as pass uses gpg2 instead of the regular gpg.

Development

A credential helper can be any program that can read values from the standard input. We use the first argument in the command line to differentiate the kind of command to execute. There are four valid values:

  • store: Adds credentials to the keychain. The payload in the standard input is a JSON document with ServerURL, Username and Secret.
  • get: Retrieves credentials from the keychain. The payload in the standard input is the raw value for the ServerURL.
  • erase: Removes credentials from the keychain. The payload in the standard input is the raw value for the ServerURL.
  • list: Lists stored credentials. There is no standard input payload.

This repository also includes libraries to implement new credentials programs in Go. Adding a new helper program is pretty easy. You can see how the OS X keychain helper works in the osxkeychain directory.

  1. Implement the interface credentials.Helper in YOUR_PACKAGE/
  2. Create a main program in YOUR_PACKAGE/cmd/.
  3. Add make tasks to build your program and run tests.

License

MIT. See LICENSE for more information.

S
Description
Programs to keep Docker login credentials safe by storing in platform keystores
Readme MIT 4.9 MiB
0.9.3 Latest
2025-06-08 01:37:48 +05:30
Languages
Go 79.9%
Dockerfile 6.3%
C 5.8%
Makefile 4.1%
Shell 2.6%
Other 1.3%