Skip to content

Commit db99cf4

Browse files
Build duplicates of all installer packages for new signing keys (#16049)
Co-authored-by: Nikola Milosavljevic <nikolam@microsoft.com>
1 parent 5c36a77 commit db99cf4

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
<AzureLinuxRPM Include="$(ArtifactsPackagesDir)**/*-azl-*.rpm" />
105105
<AzureLinuxRPM Include="$(ArtifactsPackagesDir)**/*-azl.*-*.rpm" />
106106
<FileSignInfo Include="@(AzureLinuxRPM->'%(Filename)%(Extension)')" CertificateName="LinuxSignMariner" />
107+
108+
<!-- Explicitly use the "new" LinuxSign cert. TODO: Update the cert name to the actual name in MicroBuild once it's added. -->
109+
<NewKeyLinuxRPM Include="$(ArtifactsPackagesDir)**/*-newkey-*.rpm" />
110+
<FileSignInfo Include="@(NewKeyLinuxRPM->'%(Filename)%(Extension)')" CertificateName="LinuxSign500207PGP" />
107111
</ItemGroup>
108112

109113
<!-- The name of the .NET specific certificate, which is a general replacement for Microsoft400

src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.build.targets

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,6 @@
8181
<ExeBundleInstallerFile>$(PackageOutputPath)$(InstallerFileNameWithoutExtension).exe</ExeBundleInstallerFile>
8282
<ExeBundleInstallerEngineFile>$(PackageOutputPath)$(InstallerFileNameWithoutExtension)-engine.exe</ExeBundleInstallerEngineFile>
8383
</PropertyGroup>
84-
85-
<!--
86-
Packages produced for Azure Linux must be signed with a special certificate.
87-
RPM v4 doesn't support multiple signatures, so we must have two separate copies of the RPM for us to sign.
88-
To solve this, we make a copy of the RPM for Azure Linux (which the Arcade SDK will sign with the correct certificate).
89-
If Azure Linux ever switches to RPM v6, we should be able to remove this workaround if our signing tooling adds support for multiple signatures
90-
(something RPM v6 supports but RPM v4 does not).
91-
-->
92-
<PropertyGroup Condition="'$(GenerateRpm)' == 'true'">
93-
<CreateRPMForAzureLinux>true</CreateRPMForAzureLinux>
94-
<!-- PackageTargetOS is a distro-specific version suffix, used for deps packages, including the one for Azure Linux. -->
95-
<CreateRPMForAzureLinux Condition="'$(PackageTargetOS)' != ''">false</CreateRPMForAzureLinux>
96-
</PropertyGroup>
97-
98-
<PropertyGroup Condition="'$(CreateRPMForAzureLinux)' == 'true'">
99-
<_AzureLinuxVersionSuffix>azl</_AzureLinuxVersionSuffix>
100-
<_InstallerBuildPartAzureLinux>$(Version)-$(_AzureLinuxVersionSuffix)-$(_InstallerArchSuffix)</_InstallerBuildPartAzureLinux>
101-
<_InstallerFileNameWithoutExtensionAzureLinux>$(InstallerName)-$(_InstallerBuildPartAzureLinux)$(CrossArchContentsBuildPart)</_InstallerFileNameWithoutExtensionAzureLinux>
102-
<_InstallerFileAzureLinux>$(PackageOutputPath)$(_InstallerFileNameWithoutExtensionAzureLinux)$(InstallerExtension)</_InstallerFileAzureLinux>
103-
</PropertyGroup>
10484
</Target>
10585

10686
<!-- This target is a hook for users to add package info in a target. -->
@@ -345,10 +325,24 @@
345325
<Message Text="$(MSBuildProjectName) -> $(_InstallerFile)" Importance="high" />
346326
</Target>
347327

328+
<!--
329+
Packages produced for Azure Linux must be signed with a special certificate.
330+
Additionally, some distros use old keys (SHA-1 based) so there's a different cert for new packages.
331+
RPM v4 doesn't support multiple signatures, so we must have two separate copies of the RPM for us to sign.
332+
To solve this, we make copies of the packages with special names (which the Arcade SDK will sign with the correct certificate).
333+
PackageTargetOS is a distro-specific version suffix, used for deps packages, including the one for Azure Linux.
334+
As a result, we don't need to create a separate copy of the package for Azure Linux, but we do need to create a copy with the new key (unless the target is Azure Linux).
335+
-->
348336
<Target Name="_BuildAzureLinuxRpm"
349337
AfterTargets="GenerateRpm"
350-
Condition="'$(CreateRPMForAzureLinux)' == 'true'">
338+
Condition="'$(PackageTargetOS)' == ''">
351339
<!-- AzureLinux -->
340+
<PropertyGroup>
341+
<_AzureLinuxVersionSuffix>azl</_AzureLinuxVersionSuffix>
342+
<_InstallerBuildPartAzureLinux>$(Version)-$(_AzureLinuxVersionSuffix)-$(_InstallerArchSuffix)</_InstallerBuildPartAzureLinux>
343+
<_InstallerFileNameWithoutExtensionAzureLinux>$(InstallerName)-$(_InstallerBuildPartAzureLinux)$(CrossArchContentsBuildPart)</_InstallerFileNameWithoutExtensionAzureLinux>
344+
<_InstallerFileAzureLinux>$(PackageOutputPath)$(_InstallerFileNameWithoutExtensionAzureLinux)$(InstallerExtension)</_InstallerFileAzureLinux>
345+
</PropertyGroup>
352346
<Copy SourceFiles="$(_InstallerFile)"
353347
DestinationFiles="$(_InstallerFileAzureLinux)"
354348
OverwriteReadOnlyFiles="True"
@@ -358,6 +352,26 @@
358352
<Message Text="$(MSBuildProjectName) -> $(_InstallerFileAzureLinux)" Importance="high" />
359353
</Target>
360354

355+
<Target Name="_BuildNewKeyLinuxPackage"
356+
AfterTargets="GenerateRpm;GenerateDeb"
357+
Condition="'$(PackageTargetOS)' != 'azl'">
358+
<!-- Packages to be signed with the new key -->
359+
<PropertyGroup>
360+
<_NewKeyVersionSuffix>newkey</_NewKeyVersionSuffix>
361+
<_InstallerBuildPartNewKey>$(Version)-$(_NewKeyVersionSuffix)-$(_InstallerArchSuffix)</_InstallerBuildPartNewKey>
362+
<_InstallerBuildPartNewKey Condition="'$(PackageTargetOS)' != ''">$(Version)-$(PackageTargetOS)-$(_NewKeyVersionSuffix)-$(_InstallerArchSuffix)</_InstallerBuildPartNewKey>
363+
<_InstallerFileNameWithoutExtensionNewKey>$(InstallerName)-$(_InstallerBuildPartNewKey)$(CrossArchContentsBuildPart)</_InstallerFileNameWithoutExtensionNewKey>
364+
<_InstallerFileNewKey>$(PackageOutputPath)$(_InstallerFileNameWithoutExtensionNewKey)$(InstallerExtension)</_InstallerFileNewKey>
365+
</PropertyGroup>
366+
<Copy SourceFiles="$(_InstallerFile)"
367+
DestinationFiles="$(_InstallerFileNewKey)"
368+
OverwriteReadOnlyFiles="True"
369+
SkipUnchangedFiles="False"
370+
UseHardlinksIfPossible="False" />
371+
372+
<Message Text="$(MSBuildProjectName) -> $(_InstallerFileNewKey)" Importance="high" />
373+
</Target>
374+
361375
<!--
362376
Create MSI installer, using WiX tools.
363377
-->

0 commit comments

Comments
 (0)