Skip to content

Commit 8f93d56

Browse files
committed
release: validate linux signatures
Upload GCM's public key as a release asset. Add instructions for users to import this key and use it to validate the latest Debian package and tarball.
1 parent 961a213 commit 8f93d56

File tree

3 files changed

+112
-2
lines changed

3 files changed

+112
-2
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,9 @@ jobs:
582582
create-github-release:
583583
name: Publish GitHub draft release
584584
runs-on: ubuntu-latest
585+
env:
586+
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
587+
GPG_PUBLIC_KEY_SECRET_NAME: ${{ secrets.GPG_PUBLIC_KEY_SECRET_NAME }}
585588
environment: release
586589
needs: [ prereqs, validate ]
587590
steps:
@@ -613,6 +616,20 @@ jobs:
613616
zip -jr win-x86-payload-and-symbols/gcm-win-x86-$version.zip windows-artifacts/payload
614617
zip -jr win-x86-payload-and-symbols/gcm-win-x86-$version-symbols.zip windows-artifacts/symbols
615618
619+
- name: Log into Azure
620+
uses: azure/login@v1
621+
with:
622+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
623+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
624+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
625+
626+
- name: Download GPG public key signature file
627+
run: |
628+
az keyvault secret show --name "$GPG_PUBLIC_KEY_SECRET_NAME" \
629+
--vault-name "$AZURE_VAULT" --query "value" \
630+
| sed -e 's/^"//' -e 's/"$//' | base64 -d >gcm-public.asc
631+
mv gcm-public.asc linux-artifacts
632+
616633
- uses: actions/github-script@v6
617634
with:
618635
script: |

docs/install.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ installation method.
7272

7373
#### Install
7474

75-
Download the latest [.deb package][latest-release], and run the following:
75+
Download the latest [.deb package][latest-release]*, and run the following:
7676

7777
```shell
7878
sudo dpkg -i <path-to-package>
@@ -86,13 +86,16 @@ git-credential-manager unconfigure
8686
sudo dpkg -r gcm
8787
```
8888

89+
*If you'd like to validate the package's signature after downloading, check out
90+
the instructions [here][linux-validate-gpg-debian].
91+
8992
---
9093

9194
### Tarball
9295

9396
#### Install
9497

95-
Download the latest [tarball][latest-release], and run the following:
98+
Download the latest [tarball][latest-release]*, and run the following:
9699

97100
```shell
98101
tar -xvf <path-to-tarball> -C /usr/local/bin
@@ -106,6 +109,9 @@ git-credential-manager unconfigure
106109
rm $(command -v git-credential-manager)
107110
```
108111

112+
*If you would like to validate the tarball's signature after downloading, check
113+
out the instructions [here][linux-validate-gpg-tarball].
114+
109115
---
110116

111117
### Install from source helper script
@@ -238,4 +244,6 @@ dotnet tool uninstall -g git-credential-manager
238244
[git-for-windows-screenshot]: https://user-images.githubusercontent.com/5658207/140082529-1ac133c1-0922-4a24-af03-067e27b3988b.png
239245
[latest-release]: https://github.com/git-ecosystem/git-credential-manager/releases/latest
240246
[linux-uninstall]: linux-fromsrc-uninstall.md
247+
[linux-validate-gpg-debian]: ./linux-validate-gpg.md#debian-package
248+
[linux-validate-gpg-tarball]: ./linux-validate-gpg.md#tarball
241249
[ms-wsl]: https://aka.ms/wsl#

docs/linux-validate-gpg.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Validating GCM's GPG signature
2+
3+
Follow the below instructions to import GCM's public key and use it to validate
4+
the latest Debian package and/or tarball signature.
5+
6+
## Debian package
7+
8+
```shell
9+
# Install needed packages
10+
apt-get install -y curl debsig-verify
11+
12+
# Download public key signature file
13+
curl -s https://api.github.com/repos/git-ecosystem/git-credential-manager/releases/latest \
14+
| grep -E 'browser_download_url.*gcm-public.asc' \
15+
| cut -d : -f 2,3 \
16+
| tr -d \" \
17+
| xargs -I 'url' curl -L -o gcm-public.asc 'url'
18+
19+
# De-armor public key signature file
20+
gpg --output gcm-public.gpg --dearmor gcm-public.asc
21+
22+
# Note that the fingerprint of this key is "3C853823978B07FA", which you can
23+
# determine by running:
24+
gpg --show-keys gcm-public.asc | head -n 2 | tail -n 1 | tail -c 17
25+
26+
# Copy de-armored public key to debsig keyring folder
27+
mkdir /usr/share/debsig/keyrings/3C853823978B07FA
28+
mv gcm-public.gpg /usr/share/debsig/keyrings/3C853823978B07FA/
29+
30+
# Create an appropriate policy file
31+
mkdir /etc/debsig/policies/3C853823978B07FA
32+
cat > /etc/debsig/policies/3C853823978B07FA/generic.pol << EOL
33+
<?xml version="1.0"?>
34+
<!DOCTYPE Policy SYSTEM "https://www.debian.org/debsig/1.0/policy.dtd">
35+
<Policy xmlns="https://www.debian.org/debsig/1.0/">
36+
37+
<Origin Name="Git Credential Manager" id="3C853823978B07FA" Description="Git Credential Manager public key"/>
38+
39+
<Selection>
40+
<Required Type="origin" File="gcm-public.gpg" id="3C853823978B07FA"/>
41+
</Selection>
42+
43+
<Verification MinOptional="0">
44+
<Required Type="origin" File="gcm-public.gpg" id="3C853823978B07FA"/>
45+
</Verification>
46+
47+
</Policy>
48+
EOL
49+
50+
# Download Debian package
51+
curl -s https://api.github.com/repos/git-ecosystem/git-credential-manager/releases/latest \
52+
| grep "browser_download_url.*deb" \
53+
| cut -d : -f 2,3 \
54+
| tr -d \" \
55+
| xargs -I 'url' curl -L -o gcm.deb 'url'
56+
57+
# Verify
58+
debsig-verify gcm.deb
59+
```
60+
61+
## Tarball
62+
```shell
63+
# Download the public key signature file
64+
curl -s https://api.github.com/repos/git-ecosystem/git-credential-manager/releases/latest \
65+
| grep -E 'browser_download_url.*gcm-public.asc' \
66+
| cut -d : -f 2,3 \
67+
| tr -d \" \
68+
| xargs -I 'url' curl -L -o gcm-public.asc 'url'
69+
70+
# Import the public key
71+
gpg --import gcm-public.asc
72+
73+
# Download the tarball and its signature file
74+
curl -s https://api.github.com/repos/ldennington/git-credential-manager/releases/latest \
75+
| grep -E 'browser_download_url.*gcm-linux.*[0-9].[0-9].[0-9].tar.gz' \
76+
| cut -d : -f 2,3 \
77+
| tr -d \" \
78+
| xargs -I 'url' curl -LO 'url'
79+
80+
# Trust the public key
81+
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key 3C853823978B07FA trust
82+
83+
# Verify the signature
84+
gpg --verify gcm-linux_amd64*.tar.gz.asc gcm-linux*.tar.gz
85+
```

0 commit comments

Comments
 (0)