You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: toolkit/Makefile
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -164,8 +164,13 @@ else
164
164
VALIDATE_TOOLCHAIN_GPG ?= y
165
165
endif
166
166
endif
167
+
##help:var:VALIDATE_IMAGE_GPG:{y,n}=Enable RPM GPG signature verification during package fetching and image builds. When enabled, all packages must be signed - this validates that packages have completed the signing process. Default is 'n' for local development with unsigned packages. Production builds use a multi-step workflow (build packages -> sign packages -> build images) and should set 'y' for the final image build step to enforce that all packages are signed. Keys used for validation can be modified with the IMAGE_GPG_VALIDATION_KEYS variable.
Copy file name to clipboardExpand all lines: toolkit/docs/building/building.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -865,6 +865,10 @@ Authentication mode for downloading source files for SRPM packing. Valid options
865
865
| INCREMENTAL_TOOLCHAIN | n | Only build toolchain RPM packages if they are not already present
866
866
| RUN_CHECK | n | Run the %check sections when compiling packages
867
867
| ALLOW_TOOLCHAIN_REBUILDS | n | Do not treat rebuilds of toolchain packages during regular package build phase as errors.
868
+
| VALIDATE_TOOLCHAIN_GPG | (auto - based on toolchain build mode) | Enable RPM GPG signature verification for toolchain packages. Automatically set to `y` when downloading pre-built toolchain packages (`REBUILD_TOOLCHAIN=n`), and `n` when rebuilding locally or using `DAILY_BUILD_ID`. Packages are validated against keys specified in `TOOLCHAIN_GPG_VALIDATION_KEYS`.
869
+
| TOOLCHAIN_GPG_VALIDATION_KEYS | `$(PROJECT_ROOT)/SPECS/azurelinux-repos/MICROSOFT-*-GPG-KEY $(toolkit_root)/repos/MICROSOFT-*-GPG-KEY` | Space separated list of GPG key files used to validate RPM signatures when `VALIDATE_TOOLCHAIN_GPG=y`.
870
+
| VALIDATE_IMAGE_GPG | n | Enable RPM GPG signature verification during image builds. When set to `y`, all packages fetched for image generation must have valid GPG signatures. Packages are validated against keys specified in `IMAGE_GPG_VALIDATION_KEYS`. Production builds should enable this to ensure all packages have completed the signing process.
871
+
| IMAGE_GPG_VALIDATION_KEYS | `$(PROJECT_ROOT)/SPECS/azurelinux-repos/MICROSOFT-*-GPG-KEY $(toolkit_root)/repos/MICROSOFT-*-GPG-KEY` | Space separated list of GPG key files used to validate RPM signatures when `VALIDATE_IMAGE_GPG=y`.
868
872
| PACKAGE_BUILD_RETRIES | 1 | Number of build retries for each package
869
873
| CHECK_BUILD_RETRIES | 1 | Minimum number of check section retries for each package if RUN_CHECK=y and tests fail.
870
874
| MAX_CASCADING_REBUILDS | | When a package rebuilds, how many additional layers of dependent packages will be forced to rebuild (leave unset for unbounded, i.e., all downstream packages will rebuild)
When building images or ISOs for production deployment, enable explicit GPG signature verification to ensure all packages have completed the signing process:
4
+
5
+
```bash
6
+
sudo make image VALIDATE_IMAGE_GPG=y CONFIG_FILE=<your-config>
7
+
```
8
+
9
+
This validates that all RPM packages fetched during image generation have valid GPG signatures from the expected signing keys.
10
+
11
+
## Build Workflow
12
+
13
+
A typical production workflow separates package building from image generation:
14
+
15
+
1.**Build packages** - Compile packages from source
16
+
2.**Sign packages** - Sign built packages with your GPG key
17
+
3.**Build images** - Generate images with `VALIDATE_IMAGE_GPG=y` to enforce all packages are signed
18
+
19
+
This separation ensures unsigned or improperly signed packages cannot be included in final images.
20
+
21
+
## Related Variables
22
+
23
+
| Variable | Description |
24
+
|:---------|:------------|
25
+
|`VALIDATE_IMAGE_GPG`| Set to `y` to require valid GPG signatures on all image packages |
26
+
|`IMAGE_GPG_VALIDATION_KEYS`| GPG key files for signature validation |
27
+
|`VALIDATE_TOOLCHAIN_GPG`| Automatically enabled when downloading pre-built toolchain |
28
+
|`TOOLCHAIN_GPG_VALIDATION_KEYS`| GPG key files for toolchain validation |
29
+
30
+
See [build variables](../building/building.md#all-build-variables) for full details.
// TDNF 3.x uses repositories from installchroot instead of host. Passing setopt for repo files directory to use local repo for installroot installation
769
+
// TDNF 3.x uses repositories from installchroot instead of host. Passing setopt for repo files directory to use local repo for installroot installation.
770
+
// Note: --nogpgcheck is used here because GPG signature validation is performed earlier during package fetching (imagepkgfetcher)
771
+
// when VALIDATE_IMAGE_GPG=y is set. Packages in the local repo have already been verified.
inputSummaryFile=app.Flag("input-summary-file", "Path to a file with the summary of packages cloned to be restored").String()
50
51
outputSummaryFile=app.Flag("output-summary-file", "Path to save the summary of packages cloned").String()
51
52
53
+
enableGpgCheck=app.Flag("enable-gpg-check", "Enable RPM GPG signature verification for all repositories during package fetching.").Bool()
54
+
gpgKeyPaths=app.Flag("gpg-key", "Path to a GPG key file for signature validation. May be specified multiple times. Required if enable-gpg-check is set.").ExistingFiles()
55
+
52
56
logFlags=exe.SetupLogFlags(app)
53
57
profFlags=exe.SetupProfileFlags(app)
54
58
timestampFile=app.Flag("timestamp-file", "File that stores timestamps for this program.").String()
@@ -73,6 +77,10 @@ func main() {
73
77
logger.Log.Fatal("input-graph must be provided if external-only is set.")
74
78
}
75
79
80
+
if*enableGpgCheck&&len(*gpgKeyPaths) ==0 {
81
+
logger.Log.Fatal("--enable-gpg-check requires at least one --gpg-key path")
82
+
}
83
+
76
84
timestamp.StartEvent("initialize and configure cloner", nil)
0 commit comments