{"id":20435879,"url":"https://github.com/andyneff/gpg_agent","last_synced_at":"2026-04-21T04:02:37.890Z","repository":{"id":90969498,"uuid":"47465209","full_name":"andyneff/gpg_agent","owner":"andyneff","description":null,"archived":false,"fork":false,"pushed_at":"2015-12-06T22:01:09.000Z","size":11,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T06:43:43.715Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andyneff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-05T17:21:12.000Z","updated_at":"2015-12-05T18:00:10.000Z","dependencies_parsed_at":"2023-03-14T10:00:16.108Z","dependency_job_id":null,"html_url":"https://github.com/andyneff/gpg_agent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andyneff/gpg_agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyneff%2Fgpg_agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyneff%2Fgpg_agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyneff%2Fgpg_agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyneff%2Fgpg_agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyneff","download_url":"https://codeload.github.com/andyneff/gpg_agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyneff%2Fgpg_agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32076295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T08:38:16.148Z","updated_at":"2026-04-21T04:02:37.875Z","avatar_url":"https://github.com/andyneff.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TL;DR #\n\nTodo\n\n```\n./preload.bsh mykey.key\n\ndocker run --volumes-from gpg-agent -e GNUPGHOME=/tmp/gpg-agent somedocker\n```\n\n# How to use #\n\nThe idea behind the gpg-agent docker is to start a gpg-agent daemon once for \nmultiple dockers to use. This is useful for signing, etc... in multiple dockers\nusing properly secure keys, but not having to enter the passphase many times, or\nat random times during the build step. It's all up to how you want to used this\n\n1. I just want to have it cache as I go. Just run `./start.bsh`, and run your \ndockers with `-v ?:$GNUPGHOME\" You will be prompted for passphases as you go, and\nit will cache all the keys.\n2. I want to cache all my keys, and run my dockers. Just run \n`./preload.bsh _keyfiles_` and it will cache your keyfiles, and ask you all your \npassphases right then and there. All you have to do is run your dockers with the\n`-v ?:$GNUPGHOME` flag, and it will use the cached keys\n\n-e \"$(docker exec gpg-agent cat /tmp/gpg-agent/gpg_agent_info)\"\n\nWhat is `$GNUPGHOME`? This is the GPG home, typically `~/.gnupg`.\n\n## Script usage ##\n\nTo prevent MANY passphrase entries at random times, a gpg-agent docker is used to\ncache your signing key. Pre-caching keys is done by calling `./preload.bsh`. It \nwill ask you for your passphrase, once for each unique key out of all the keys \nspecified. So if you use the same key but call it multiple times, it will only \nprompt once. If you have 5 different keys, you'll have prompts, with only the the \nkey ID to tell you which is which. Keys will also cache in any docker mounting the\n$GNUPGHOME dir at run time.\n\nThe gpg agent TTL is set to 1 year. If this is not acceptable for you, set the \n`GPG_MAX_CACHE` and `GPG_DEFAULT_CACHE` environment variables (in seconds) before\nstarting the gpg-agent daemon.\n\n`./start.bsh` starts the gpg-agent daemon. It is called \nautomatically by `./preload.bsh`\n\n`./stop.bsh` stops the gpg-agent daemon. It is called automatically by \n`./preload.bsh` when the -r flag is specified as the first argument\n\n`./preload.bsh -r` - Stops and restarts the gpg agent daemon.\nThis is useful for reloading keys when you update them in your host.\n\n## Arguments ##\n\n`./start.bsh` - No arguments\n\n`./stop.bsh` - No arguments\n\n`./preload.bsh [-r] [keyfile/dir1] [keyfile/dir2...]` - All optional\n\n- `-r` - Will stop and then restart the gpg-agent docker if it is currently running.\nThe default it to just start the gpg-agent docker as a docker daemon.\n- `keyfile/dir` - Any filename that will be treated as a key for gpg to import, or\ndirectory containing *.key files to be imported.\n\nPreload can be called multiple times, and each time the keys are just added, unless\n`-r` is used, in which case it resets each call, and only the latest call's keys\nwill be loaded\n\n## Environment variables ##\n\nGPG_MAX_CACHE - Default: 1 year. Set for gpg-agent. Units in seconds.\n\nGPG_DEFAULT_CACHE - Default: 1 year. Set for gpg-agent. Units in seconds.\n\nCONTAINER_NAME - Default: gpg-agent. You can change the name used, and\neven deploy multiple unique instances by overwriting this when calling the bash \nscripts.\n\n## What about different distros? ##\n\nWhile the gpg-agent uses it the one that ships with debian 8 (2.0.26), it has been\ntested against CentOS 5, CentOS 6, CentOS 7, Debian 7, and Debian 8, and all work\nwithout issue.\n\n## Generating new keys ##\n\nEnter a docker and make sure the appropriate gpg packages are installed\n\n    docker run -it --rm -v `pwd`:/key centos:7\n    gpg --gen-key\n    ... Go through the steps\n    gpg --export-secret-key '12345678!' \u003e /key/mykey.key\n\nIf during the gpg-key-gen, it says waiting for entropy, you CAN run haveged to \nget the entropy count high. This is **NOT** recommend for production use.\nYou can start a docker `gpg_agent:entropy` to run haveged for you. In another window\n\n    docker run --rm --privileged andyneff/gpg_agent:entropy\n\nCtrl+C when done","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyneff%2Fgpg_agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyneff%2Fgpg_agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyneff%2Fgpg_agent/lists"}