Skip to content

Commit 6a0a342

Browse files
authored
Merge branch 'master' into gems
2 parents 0c881ff + a1da62b commit 6a0a342

15 files changed

+402
-23
lines changed

configs/components/_base-rubygem.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
# If a gem needs more command line options to install set the :gem_install_options
4141
# in its component file rubygem-<compoment>, before the instance_eval of this file.
4242
gem_install_options = settings["#{pkg.get_name}_gem_install_options".to_sym]
43-
if gem_install_options.nil?
44-
pkg.install do
45-
"#{settings[:gem_install]} #{name}-#{version}.gem"
46-
end
47-
else
48-
pkg.install do
49-
"#{settings[:gem_install]} #{name}-#{version}.gem #{gem_install_options}"
50-
end
43+
remove_older_versions = settings["#{pkg.get_name}_remove_older_versions".to_sym]
44+
pkg.install do
45+
steps = []
46+
steps << "#{settings[:gem_uninstall]} #{name}" if remove_older_versions
47+
steps << if gem_install_options.nil?
48+
"#{settings[:gem_install]} #{name}-#{version}.gem"
49+
else
50+
"#{settings[:gem_install]} #{name}-#{version}.gem #{gem_install_options}"
51+
end
5152
end
52-

configs/components/curl.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
elsif platform.is_windows?
2828
pkg.build_requires "runtime-#{settings[:runtime_project]}"
2929
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(PATH)"
30+
pkg.environment "NM" , "/usr/bin/nm" if platform.name =~ /windowsfips-2016/
3031
pkg.environment "CYGWIN", settings[:cygwin]
3132
elsif platform.is_aix? && platform.name != 'aix-7.1-ppc'
3233
pkg.environment "PKG_CONFIG_PATH", "/opt/puppetlabs/puppet/lib/pkgconfig"
@@ -47,6 +48,7 @@
4748
pkg.apply_patch 'resources/patches/curl/CVE-2023-46218.patch'
4849
pkg.apply_patch 'resources/patches/curl/CVE-2024-2004.patch'
4950
pkg.apply_patch 'resources/patches/curl/CVE-2024-2398.patch'
51+
pkg.apply_patch 'resources/patches/curl/CVE-2024-7264.patch'
5052
end
5153

5254
configure_options = []

configs/components/openssl-1.0.2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
'no-ssl3',
130130
]
131131

132-
configure_flags += ['fips', "--with-fipsdir=#{settings[:prefix]}/usr/local/ssl/fips-2.0"] if platform.name =~ /windowsfips-2012r2/
132+
configure_flags += ['fips', "--with-fipsdir=#{settings[:prefix]}/usr/local/ssl/fips-2.0"] if platform.name =~ /windowsfips-/
133133

134134
# Individual projects may provide their own openssl configure flags:
135135
project_flags = settings[:openssl_extra_configure_flags] || []

configs/components/ruby-2.7.8.rb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
pkg.apply_patch "#{base}/uri-redos-cve-2023-36617.patch"
4444
pkg.apply_patch "#{base}/stringio_cve-2024-27280.patch"
4545

46+
pkg.apply_patch "#{base}/0001-Filter-marshaled-objects-ruby30.patch"
47+
pkg.apply_patch "#{base}/0001-Use-safe_load-and-safe_load_file-for-rdoc_options.patch"
48+
4649
if platform.is_cross_compiled?
4750
unless platform.is_macos?
4851
pkg.apply_patch "#{base}/uri_generic_remove_safe_nav_operator_r2.5.patch"
@@ -141,7 +144,8 @@
141144
'windows-2012r2-x64',
142145
'windows-2012r2-x86',
143146
'windows-2019-x64',
144-
'windowsfips-2012r2-x64'
147+
'windowsfips-2012r2-x64',
148+
'windowsfips-2016-x64'
145149
]
146150

147151
unless without_dtrace.include? platform.name
@@ -170,6 +174,19 @@
170174
]
171175
end
172176

177+
if(platform.name =~ /windowsfips-2016/)
178+
# We need the below patch since during ruby build step for windowsfips-2016-x64 agent-runtime builds,
179+
# the rbconfig.rb file that gets generated contains '\r' trailing character in 'ruby_version' config.
180+
# We patch rbconfig.rb to remove the '\r' character.
181+
# This patch has to run after the build step since rbconfig.rb is generated during the build step.
182+
# This is sort of a hacky way to do this. We need to find why the '\r' character gets appended to
183+
# 'ruby_version' field in the future so that this patch can be removed - PA-6902.
184+
pkg.add_source("#{base}/rbconfig_win.patch")
185+
pkg.build do
186+
["TMP=/var/tmp /usr/bin/patch.exe --binary --strip=1 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../rbconfig_win.patch"]
187+
end
188+
end
189+
173190
#########
174191
# INSTALL
175192
#########

configs/components/ruby-3.2.5.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@
161161
'windows-2012r2-x64',
162162
'windows-2012r2-x86',
163163
'windows-2019-x64',
164-
'windowsfips-2012r2-x64'
164+
'windowsfips-2012r2-x64',
165+
'windowsfips-2016-x64'
165166
]
166167

167168
unless without_dtrace.include? platform.name
@@ -195,6 +196,19 @@
195196
]
196197
end
197198

199+
if(platform.name =~ /windowsfips-2016/)
200+
# We need the below patch since during ruby build step for windowsfips-2016-x64 agent-runtime builds,
201+
# the rbconfig.rb file that gets generated contains '\r' trailing character in 'ruby_version' config.
202+
# We patch rbconfig.rb to remove the '\r' character.
203+
# This patch has to run after the build step since rbconfig.rb is generated during the build step.
204+
# This is sort of a hacky way to do this. We need to find why the '\r' character gets appended to
205+
# 'ruby_version' field in the future so that this patch can be removed - PA-6902.
206+
pkg.add_source("#{base}/rbconfig_win.patch")
207+
pkg.build do
208+
["TMP=/var/tmp /usr/bin/patch.exe --binary --strip=1 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../rbconfig_win.patch"]
209+
end
210+
end
211+
198212
#########
199213
# INSTALL
200214
#########
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
component 'rubygem-rexml' do |pkg, settings, platform|
2-
pkg.version '3.3.5'
3-
pkg.md5sum 'cdd5c83f1d7230a7d44406f69e9f3d2d'
2+
pkg.version '3.3.6'
3+
pkg.md5sum 'be54ad1a5f661ebf9824bf6ca36e50eb'
4+
5+
settings["#{pkg.get_name}_remove_older_versions".to_sym] = true
46

57
# If the platform is solaris with sparc architecture in agent-runtime-7.x project, we want to gem install rexml
68
# ignoring the dependencies, this is because the pl-ruby version used in these platforms is ancient so it gets
@@ -9,6 +11,6 @@
911
if platform.name =~ /solaris-(10|11)-sparc/ && settings[:ruby_version].to_i < 3
1012
settings["#{pkg.get_name}_gem_install_options".to_sym] = "--ignore-dependencies"
1113
end
12-
14+
1315
instance_eval File.read('configs/components/_base-rubygem.rb')
1416
end
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
platform "windowsfips-2016-x64" do |plat|
2+
plat.vmpooler_template 'win-2016-fips-x86_64'
3+
4+
plat.servicetype 'windows'
5+
visual_studio_version = '2017'
6+
visual_studio_sdk_version = 'win8.1'
7+
8+
# We need to ensure we install chocolatey prior to adding any nuget repos. Otherwise, everything will fall over
9+
plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/generic/buildsources/windows/chocolatey/install-chocolatey-1.4.0.ps1"
10+
plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe feature enable -n useFipsCompliantChecksums"
11+
12+
plat.add_build_repository "https://artifactory.delivery.puppetlabs.net/artifactory/api/nuget/nuget"
13+
14+
# C:\tools is likely added by mingw, however because we also want to use that
15+
# dir for vsdevcmd.bat we create it for safety
16+
plat.provision_with "mkdir -p C:/tools"
17+
# We don't want to install any packages from the chocolatey repo by accident
18+
plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe sources remove -name chocolatey"
19+
20+
packages = [
21+
"cmake",
22+
"pl-gdbm-#{self._platform.architecture}",
23+
"pl-iconv-#{self._platform.architecture}",
24+
"pl-libffi-#{self._platform.architecture}",
25+
"pl-pdcurses-#{self._platform.architecture}",
26+
"pl-toolchain-#{self._platform.architecture}",
27+
"pl-zlib-#{self._platform.architecture}",
28+
"mingw-w64 -version 5.2.0 -debug",
29+
]
30+
31+
packages.each do |name|
32+
plat.provision_with("C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress #{name}")
33+
end
34+
# We use cache-location in the following install because msvc has several long paths
35+
# if we do not update the cache location choco will fail because paths get too long
36+
plat.provision_with "C:/ProgramData/chocolatey/bin/choco.exe install msvc.#{visual_studio_version}-#{visual_studio_sdk_version}.sdk.en-us -y --cache-location=\"C:\\msvc\" --no-progress"
37+
# The following creates a batch file that will execute the vsdevcmd batch file located within visual studio.
38+
# We create the following batch file under C:\tools\vsdevcmd.bat so we can avoid using both the %ProgramFiles(x86)%
39+
# evironment var, as well as any spaces in the path when executing things with cygwin. This makes command execution
40+
# through cygwin much easier.
41+
#
42+
# Note that the unruly \'s in the following string escape the following sequence to literal chars: "\" and then \""
43+
plat.provision_with "touch C:/tools/vsdevcmd.bat && echo \"\\\"%ProgramFiles(x86)%\\Microsoft Visual Studio\\#{visual_studio_version}\\BuildTools\\Common7\\Tools\\vsdevcmd\\\"\" >> C:/tools/vsdevcmd.bat"
44+
45+
plat.install_build_dependencies_with "C:/ProgramData/chocolatey/bin/choco.exe install -y --no-progress"
46+
47+
plat.make "/usr/bin/make"
48+
plat.patch "TMP=/var/tmp /usr/bin/patch.exe --binary"
49+
50+
plat.platform_triple "x86_64-w64-mingw32"
51+
52+
plat.package_type "archive"
53+
plat.output_dir "windows"
54+
end

configs/projects/_shared-agent-components.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
elsif platform.name =~ /^redhatfips-.*/
2727
proj.component "openssl-1.1.1-fips"
2828
else
29-
proj.component "openssl-fips-2.0.16" if platform.name =~ /windowsfips-2012r2/ && proj.openssl_version =~ /1.0.2/
29+
proj.component "openssl-fips-2.0.16" if platform.name =~ /windowsfips-/ && proj.openssl_version =~ /1.0.2/
3030
proj.component "openssl-#{proj.openssl_version}"
3131
end
3232

@@ -62,6 +62,12 @@
6262
proj.component 'rubygem-fast_gettext'
6363
proj.component 'rubygem-ffi'
6464

65+
# We add rexml explicitly in here because even though ruby 3 ships with rexml as its default gem, the version
66+
# of rexml it ships with contains CVE-2024-41946, CVE-2024-41123, CVE-2024-35176 and CVE-2024-39908.
67+
# So, we add it here to update to a higher version
68+
# free from the CVEs.
69+
proj.component 'rubygem-rexml'
70+
6571
if platform.is_windows? || platform.is_solaris? || platform.is_aix?
6672
proj.component 'rubygem-minitar'
6773
end

configs/projects/_shared-agent-settings.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
end
132132

133133
proj.setting(:gem_install, "#{proj.host_gem} install --no-rdoc --no-ri --local ")
134+
proj.setting(:gem_uninstall, "#{proj.host_gem} uninstall --all --ignore-dependencies ")
134135

135136
# For AIX, we use the triple to install a better rbconfig
136137
if platform.is_aix?
@@ -147,7 +148,7 @@
147148
proj.setting(:openssl_version, '3.0')
148149
elsif platform.name =~ /^redhatfips-/
149150
proj.setting(:openssl_version, '1.1.1-fips')
150-
elsif platform.name =~ /^windowsfips-2012r2/
151+
elsif platform.name =~ /^windowsfips-/
151152
proj.setting(:openssl_version, '1.0.2')
152153
else
153154
proj.setting(:openssl_version, '1.1.1')
@@ -168,7 +169,7 @@
168169
proj.setting(:cflags, "#{proj.cppflags}")
169170

170171
ldflags = "-L#{proj.tools_root}/lib -L#{proj.gcc_root}/lib -L#{proj.libdir} -Wl,--nxcompat"
171-
if platform.name !~ /windowsfips-2012r2/ || name != 'agent-runtime-7.x'
172+
if platform.name !~ /windowsfips-/ || name != 'agent-runtime-7.x'
172173
ldflags += ' -Wl,--dynamicbase'
173174
end
174175
proj.setting(:ldflags, ldflags)

configs/projects/agent-runtime-7.x.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@
6161
proj.component 'rubygem-thor'
6262
proj.component 'rubygem-scanf'
6363

64-
# We add rexml explicitly in here because even though ruby 2 ships with rexml as its default gem, the version
65-
# of rexml it ships with contains CVE-2024-35176 and CVE-2024-39908. So, we add it here to update to a higher version
66-
# free from the CVEs.
67-
proj.component 'rubygem-rexml'
68-
6964
if platform.is_linux?
7065
proj.component "virt-what"
7166
proj.component "dmidecode" unless platform.architecture =~ /ppc64/

0 commit comments

Comments
 (0)