Skip to content

Commit bb83d1e

Browse files
authored
docs: install page checksum signature check (#5473)
* docs: install page checksum file check * docs: update install tab * backend docs update
1 parent 2c228ec commit bb83d1e

2 files changed

Lines changed: 72 additions & 34 deletions

File tree

docs-starlight/src/components/InstallTab.astro

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,36 @@ $version = "${version}"
1515
$binaryName = "terragrunt_\${os}_\${arch}.exe"
1616
try {
1717
$ProgressPreference = 'SilentlyContinue'
18-
# Download binary and checksum
1918
$baseUrl = "https://github.com/gruntwork-io/terragrunt/releases/download/$version"
2019
Write-Host "Downloading Terragrunt $version..."
2120
Invoke-WebRequest -Uri "$baseUrl/$binaryName" -OutFile $binaryName -UseBasicParsing
2221
Invoke-WebRequest -Uri "$baseUrl/SHA256SUMS" -OutFile "SHA256SUMS" -UseBasicParsing
22+
Invoke-WebRequest -Uri "$baseUrl/SHA256SUMS.gpgsig" -OutFile "SHA256SUMS.gpgsig" -UseBasicParsing
23+
24+
# First: Verify GPG signature of checksum file (requires gpg installed)
25+
Write-Host "Importing Gruntwork signing key..."
26+
Invoke-WebRequest -Uri "https://gruntwork.io/.well-known/pgp-key.txt" -OutFile "pgp-key.txt" -UseBasicParsing
27+
gpg --import pgp-key.txt 2>$null
28+
Write-Host "Verifying GPG signature of SHA256SUMS..."
29+
gpg --verify SHA256SUMS.gpgsig SHA256SUMS
30+
if ($LASTEXITCODE -ne 0) {
31+
Write-Error "GPG signature verification failed"
32+
exit 1
33+
}
34+
Write-Host "GPG signature verified!"
35+
36+
# Second: Verify checksum of binary against trusted SHA256SUMS
2337
$actualChecksum = (Get-FileHash -Algorithm SHA256 $binaryName).Hash.ToLower()
2438
$expectedChecksum = (Get-Content "SHA256SUMS" | ForEach-Object { $parts = $_ -split '\s+'; if ($parts[1] -eq $binaryName) { return $parts[0].ToLower() } } | Select-Object -First 1)
2539
if ($actualChecksum -ne $expectedChecksum) {
2640
Write-Error "Checksum verification failed"
2741
exit 1
2842
}
29-
Write-Host "Terragrunt $version has been downloaded and verified successfully"
43+
Write-Host "Checksum verified!"
44+
Write-Host "Terragrunt $version downloaded and verified successfully"
3045
}
3146
catch {
32-
Write-Error "Failed to download: $_"
47+
Write-Error "Failed: $_"
3348
exit 1
3449
}
3550
finally {
@@ -51,25 +66,33 @@ OS="${os}"
5166
ARCH="${arch}"
5267
VERSION="${version}"
5368
BINARY_NAME="terragrunt_\${OS}_\${ARCH}"
69+
BASE_URL="https://github.com/gruntwork-io/terragrunt/releases/download/\$VERSION"
5470
55-
# Download the binary
56-
curl -sL "https://github.com/gruntwork-io/terragrunt/releases/download/\$VERSION/\$BINARY_NAME" -o "\$BINARY_NAME"
57-
58-
# Generate the checksum
59-
CHECKSUM="\$(${os == 'linux' ? 'sha256sum' : 'shasum -a 256'} "\$BINARY_NAME" | awk '{print \$1}')"
71+
# Download binary and verification files
72+
curl -sL "\$BASE_URL/\$BINARY_NAME" -o "\$BINARY_NAME"
73+
curl -sL "\$BASE_URL/SHA256SUMS" -o SHA256SUMS
74+
curl -sL "\$BASE_URL/SHA256SUMS.gpgsig" -o SHA256SUMS.gpgsig
6075
61-
# Download the checksum file
62-
curl -sL "https://github.com/gruntwork-io/terragrunt/releases/download/\$VERSION/SHA256SUMS" -o SHA256SUMS
76+
# First: Import Gruntwork signing key and verify GPG signature of checksum file
77+
curl -s https://gruntwork.io/.well-known/pgp-key.txt | gpg --import 2>/dev/null
78+
if gpg --verify SHA256SUMS.gpgsig SHA256SUMS 2>/dev/null; then
79+
echo "GPG signature verified!"
80+
else
81+
echo "GPG signature verification failed!"
82+
exit 1
83+
fi
6384
64-
# Grab the expected checksum (exact match on filename)
85+
# Second: Verify checksum of binary against trusted SHA256SUMS
86+
CHECKSUM="\$(${os == 'linux' ? 'sha256sum' : 'shasum -a 256'} "\$BINARY_NAME" | awk '{print \$1}')"
6587
EXPECTED_CHECKSUM="\$(awk -v binary="\$BINARY_NAME" '\$2 == binary {print \$1; exit}' SHA256SUMS)"
6688
67-
# Compare the checksums
68-
if [ "\$CHECKSUM" == "\$EXPECTED_CHECKSUM" ]; then
69-
echo "Checksums match!"
70-
else
71-
echo "Checksums do not match!"
72-
fi`}
89+
if [ "\$CHECKSUM" != "\$EXPECTED_CHECKSUM" ]; then
90+
echo "Checksum verification failed!"
91+
exit 1
92+
fi
93+
echo "Checksum verified!"
94+
95+
echo "Terragrunt \$VERSION downloaded and verified successfully"`}
7396
frame='terminal'
7497
>
7598
</Code>

docs-starlight/src/content/docs/01-getting-started/03-install.mdx

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ Run `curl -sL https://terragrunt.gruntwork.io/install | bash -s -- --help` to se
2727
## Download from releases page
2828

2929
1. Go to the [Releases Page](https://github.com/gruntwork-io/terragrunt/releases).
30-
2. Download the binary for your operating system: e.g., if you're on a Mac, download `terragrunt_darwin_amd64`; if you're on Windows, download `terragrunt_windows_amd64.exe`, etc.
31-
3. Optionally, follow the instructions below on [verifying the checksum](#verifying-the-checksum).
32-
4. Rename the downloaded file to `terragrunt`.
33-
5. Add execute permissions to the binary: e.g., On Linux and Mac: `chmod u+x terragrunt`.
34-
6. Put the binary somewhere on your `PATH`: e.g., On Linux and Mac: `mv terragrunt /usr/local/bin/terragrunt`.
30+
2. Download the archive for your operating system: e.g., if you're on a Mac, download `terragrunt_darwin_amd64.tar.gz`; if you're on Windows, download `terragrunt_windows_amd64.exe.zip`, etc.
31+
3. Download `SHA256SUMS` and optionally `SHA256SUMS.gpgsig` for signature verification.
32+
4. Verify the checksum and optionally the signature (see [Verifying the checksum](#verifying-the-checksum) below).
33+
5. Extract the archive: e.g., `tar -xzf terragrunt_darwin_amd64.tar.gz` or unzip on Windows.
34+
6. Add execute permissions to the binary (Linux/Mac): `chmod u+x terragrunt`.
35+
7. Put the binary somewhere on your `PATH`: e.g., On Linux and Mac: `mv terragrunt /usr/local/bin/terragrunt`.
3536

3637
### Verifying the checksum
3738

@@ -54,6 +55,21 @@ curl -s https://gruntwork.io/.well-known/pgp-key.txt | gpg --import
5455
gpg --verify SHA256SUMS.gpgsig SHA256SUMS
5556
```
5657

58+
:::caution[Verify Key Fingerprint]
59+
After importing the key, verify its fingerprint matches exactly:
60+
61+
```bash
62+
gpg --fingerprint 577774ACA847CC49
63+
```
64+
65+
Expected output:
66+
```
67+
pub ed25519 2026-01-12 [SC]
68+
68C8 0F86 DF98 E710 C0F2 2E2E 5777 74AC A847 CC49
69+
uid [ unknown] Gruntwork (Code Signing Key) <security@gruntwork.io>
70+
```
71+
:::
72+
5773
7. Alternatively, verify with Cosign:
5874

5975
```bash
@@ -68,6 +84,10 @@ cosign verify-blob SHA256SUMS \
6884

6985
<InstallTabs version={version} />
7086

87+
:::note
88+
These scripts automatically verify the SHA256 checksum and GPG signature before completing.
89+
:::
90+
7191
## Install via a package manager
7292

7393
Note that all the different package managers are third party. The third party Terragrunt packages may not be updated with the latest version, but are often close. Please check your version against the latest available on the [Releases Page](https://github.com/gruntwork-io/terragrunt/releases).
@@ -138,15 +158,10 @@ Colleagues and CI/CD pipelines can then install the associated tool manager, and
138158

139159
Note that the tools Terragrunt integrates with, such as OpenTofu and Terraform, can also be managed by these tool managers, so you can also pin the versions of those tools in the same file.
140160

141-
Also note that the asdf plugin that `asdf` relies on is maintained by a third party:
142-
143-
https://github.com/ohmer/asdf-terragrunt
161+
**Backend details:**
144162

145-
Gruntwork makes no guarantees about the safety or reliability of third-party plugins.
146-
147-
The asdf plugin relied upon by `mise` is maintained by Gruntwork, as requested by the community:
148-
149-
https://github.com/gruntwork-io/asdf-terragrunt
163+
- **mise** uses [aqua](https://aquaproj.github.io/) as its default backend to install Terragrunt.
164+
- **asdf** uses the asdf-terragrunt plugin, which is maintained by Gruntwork: https://github.com/gruntwork-io/asdf-terragrunt
150165

151166
## Building from source
152167

@@ -183,12 +198,12 @@ terragrunt --install-autocomplete
183198

184199
Once the autocomplete support is installed, you will need to restart your shell.
185200

201+
## Gruntwork Pipelines
202+
203+
Gruntwork offers a commercial CI/CD solution for Terragrunt called [Pipelines](https://www.gruntwork.io/platform/pipelines). Pipelines is a fully managed CI/CD service that is designed to work seamlessly with Terragrunt. It provides an out of the box solution for running Terragrunt in CI/CD without the need to setup and maintain your own CI/CD infrastructure.
204+
186205
## Terragrunt GitHub Action
187206

188207
Terragrunt is also available as a GitHub Action.
189208

190209
Instructions on how to use it can be found at [https://github.com/gruntwork-io/terragrunt-action](https://github.com/gruntwork-io/terragrunt-action).
191-
192-
## Gruntwork Pipelines
193-
194-
Gruntwork offers a commercial CI/CD solution for Terragrunt called [Pipelines](https://www.gruntwork.io/platform/pipelines). Pipelines is a fully managed CI/CD service that is designed to work seamlessly with Terragrunt. It provides an out of the box solution for running Terragrunt in CI/CD without the need to setup and maintain your own CI/CD infrastructure.

0 commit comments

Comments
 (0)