Skip to content

Commit b03e433

Browse files
committed
Flesh out steps for creating a new key, move to new section and add section for using a subkey of an existing key as per #32
Signed-off-by: Carnage <[email protected]>
1 parent 6fc8768 commit b03e433

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ to your project or organization:
2828
- `GIT_AUTHOR_EMAIL` - email address of the author of your releases: can be an email address of a bot account.
2929
- `SIGNING_SECRET_KEY` - a **password-less** private GPG key in ASCII format, to be used for signing your releases:
3030
please use a dedicated GPG subkey for this purpose. Unsigned releases are not supported, and won't be supported.
31-
To generate a new GPG key use the following commands
32-
`gpg2 --full-generate-key` Pick option 4, then type 4096 for key size, select your desired expiry. Fill out the user information and leave the password blank.
33-
Once generated it will output something like `gpg: key <Key ID> marked as ultimately trusted` take a note of this Key Id to use in the next step
34-
`gpg --output private.key --armor --export-secret-key <Key ID>` This will output the key to the file private.key in the correct format to paste into github. Delete the file once you are done and don't share it with anyone else
35-
Optionally you can use `gpg --output public.key --armor --export <Key ID>` to export the corresponding public key. You can publish this key on your project webpage to allow users to verify your signed releases.
3631
- `ORGANIZATION_ADMIN_TOKEN` - if you use the file from [`examples/.github/workflows/release-on-milestone-closed.yml`](examples/.github/workflows/release-on-milestone-closed.yml),
3732
then you have to provide a `ORGANIZATION_ADMIN_TOKEN` (with a full repo scope), which is a github token with
3833
administrative rights over your organization (issued by a user that has administrative rights over your project).
@@ -45,11 +40,45 @@ you when you enable GitHub Actions. To learn more about how it works, read
4540
["Authenticating with the GITHUB\_TOKEN"](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)
4641
in the GitHub Docs.
4742

48-
### Branches
43+
### Setting up GPG keys
4944

50-
You will also need to setup the initial branches used by this project.
45+
#### Using a subkey from an existing GPG key
5146

52-
@TODO
47+
First open your master key for editing `gpg --edit-key "<YOUR MASTER KEY ID>"` type `addkey` and select signing or s for
48+
capabilities. RSA key type is recommended for greatest compatibility. Type `save` to persist the new subkey to your
49+
master key. Make a note of the Key ID as you will need it in the next step.
50+
51+
Next export the new sub key `gpg --output private.key --armor --export-secret-subkeys "<SubKey ID>!"` this will be exported to
52+
the file private.key the ! at the end is important as it limits the export to just the sub key
53+
**Delete the file once you are done and don't share it with anyone else**
54+
55+
If your master key is password protected, you will need to remove the password from the subkey before you can add it into
56+
github settings, you can skip this if your master key is not password protected.
57+
58+
To remove the password from the subkey create a ephemeral gpg home directory `mkdir /tmp/gpg` and ensure that it works with gpg
59+
`gpg --homedir /tmp/gpg --list-keys` You can ignore the warning about unsafe directory permissions.
60+
Import your subkey `gpg --homedir /tmp/gpg --import private.key` and enter edit mode `gpg --homedir /tmp/gpg --edit-key <SubKey ID>`
61+
type `passwd` entering your current password and then set the password to "" to remove it.
62+
Type `save` to exit edit mode and reexport your subkey `gpg --homedir /tmp/gpg --output private.key --armor --export-secret-subkeys "<SubKey ID>!"`.
63+
Finally, remove the ephemeral directory: `rm --rf /tmp/gpg`
64+
65+
You will now need to do `gpg --output public.key --armor --export <YOUR MASTER KEY ID>` to export your master public key
66+
with the new subkey public key to the file `public.key`. Then republish it to anywhere that you currently publish your public keys
67+
68+
#### Using a new key
69+
70+
To generate a new GPG key use the following command `gpg2 --full-generate-key` Pick option 4, then type 4096 for key size, select your desired expiry.
71+
Fill out the user information and leave the password blank.
72+
73+
Once generated it will output something like `gpg: key <Key ID> marked as ultimately trusted` take a note of this Key Id to use in the next step.
74+
75+
`gpg --output private.key --armor --export-secret-key <Key ID>` This will output the key to the file `private.key` in the correct format to put into the environment
76+
variable required for setup. **Delete the file once you are done and don't share it with anyone else**
77+
78+
Optionally you can use `gpg --output public.key --armor --export <Key ID>` to export the corresponding public key to the file `public.key`.
79+
You can publish this key on your project webpage to allow users to verify your signed releases.
80+
81+
You could sign this new key with your personal key and the keys of other project maintainers to establish its provenance.
5382

5483
## Usage
5584

0 commit comments

Comments
 (0)