Skip to content

Commit 8273bd6

Browse files
authored
Merge pull request #242 from adfoster-r7/update-openssl-version
Update openssl version
2 parents 7e83a4a + 4fcc864 commit 8273bd6

5 files changed

Lines changed: 214 additions & 12 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/apps/openssl-vms.cnf b/apps/openssl-vms.cnf
2+
index ac858d6..d1cb967 100644
3+
--- a/apps/openssl-vms.cnf
4+
+++ b/apps/openssl-vms.cnf
5+
@@ -56,6 +56,7 @@ providers = provider_sect
6+
# List of providers to load
7+
[provider_sect]
8+
default = default_sect
9+
+legacy = legacy_sect
10+
# The fips section name should match the section name inside the
11+
# included fipsmodule.cnf.
12+
# fips = fips_sect
13+
@@ -69,8 +70,10 @@ default = default_sect
14+
# OpenSSL may not work correctly which could lead to significant system
15+
# problems including inability to remotely access the system.
16+
[default_sect]
17+
-# activate = 1
18+
+activate = 1
19+
20+
+[legacy_sect]
21+
+activate = 1
22+
23+
####################################################################
24+
[ ca ]
25+
diff --git a/apps/openssl.cnf b/apps/openssl.cnf
26+
index 12bc408..35a4282 100644
27+
--- a/apps/openssl.cnf
28+
+++ b/apps/openssl.cnf
29+
@@ -56,6 +56,7 @@ providers = provider_sect
30+
# List of providers to load
31+
[provider_sect]
32+
default = default_sect
33+
+legacy = legacy_sect
34+
# The fips section name should match the section name inside the
35+
# included fipsmodule.cnf.
36+
# fips = fips_sect
37+
@@ -69,8 +70,10 @@ default = default_sect
38+
# OpenSSL may not work correctly which could lead to significant system
39+
# problems including inability to remotely access the system.
40+
[default_sect]
41+
-# activate = 1
42+
+activate = 1
43+
44+
+[legacy_sect]
45+
+activate = 1
46+
47+
####################################################################
48+
[ ca ]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--- openssl-3.6.0/Configurations/unix-Makefile.tmpl.org 2025-11-14 23:06:09.211938787 -0500
2+
+++ openssl-3.6.0/Configurations/unix-Makefile.tmpl 2025-11-14 23:07:32.383914676 -0500
3+
@@ -670,7 +670,6 @@
4+
install: Makefile ## Install software and documentation, create OpenSSL directories
5+
$(MAKE) install_sw
6+
$(MAKE) install_ssldirs
7+
- {- "\$(MAKE) install_docs" if !$disabled{docs} -}
8+
{- "\$(MAKE) install_fips" if !$disabled{fips} -}
9+
10+
uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} ## Uninstall software and documentation
11+
12+
--- openssl-3.6.0/Configurations/windows-makefile.tmpl.org 2025-11-14 23:06:09.211938787 -0500
13+
+++ openssl-3.6.0/Configurations/windows-makefile.tmpl 2025-11-14 23:07:40.543912555 -0500
14+
@@ -466,7 +466,7 @@
15+
@$(ECHO) "Tests are not supported with your chosen Configure options"
16+
@{- output_on() if !$disabled{tests}; "\@rem" -}
17+
18+
-install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -}
19+
+install: install_sw install_ssldirs {- $disabled{fips} ? "" : "install_fips" -}
20+
21+
uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -}

config/software/libatomic.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# On 32-bit platforms (especially ARM), GCC's libatomic is required for
3+
# 64-bit atomic operations used by OpenSSL 3.x and other libraries.
4+
# This definition copies the system's libatomic into the embedded dir
5+
# so it ships with the package and satisfies the omnibus health check.
6+
#
7+
8+
name "libatomic"
9+
description "GCC runtime library for atomic operations"
10+
license "GPL-3.0 (with GCC Runtime Library Exception)"
11+
skip_transitive_dependency_licensing true
12+
13+
build do
14+
block "Copy libatomic if needed" do
15+
libatomic_path = shellout("gcc -print-file-name=libatomic.so.1 2>/dev/null").stdout.strip
16+
if !libatomic_path.empty? && libatomic_path != "libatomic.so.1" && File.exist?(libatomic_path)
17+
copy libatomic_path, "#{install_dir}/embedded/lib/libatomic.so.1"
18+
link "#{install_dir}/embedded/lib/libatomic.so.1", "#{install_dir}/embedded/lib/libatomic.so"
19+
end
20+
end
21+
end

config/software/metasploit-framework.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def has_windows_metasploit_framework_repo?
3939
whitelist_file "#{install_dir}/embedded/framework/data/exploits/.*"
4040
whitelist_file "#{install_dir}//embedded/framework/data/exploits/.*"
4141

42-
# This depends on Openssl 1.x
42+
# This depends on Openssl 3.x
4343
whitelist_file "#{install_dir}/embedded/lib/ruby/gems/#{ruby_abi_version}/gems/metasploit-payloads.*"
4444

4545
# Also whitelist mettle
@@ -62,7 +62,7 @@ def has_windows_metasploit_framework_repo?
6262
replacements = {
6363
'stringio (= 3.1.1)' => 'stringio (= 3.1.2)',
6464
'stringio (3.1.1)' => 'stringio (3.1.2)',
65-
"spec.add_runtime_dependency 'stringio', '3.1.1'" => "spec.add_runtime_dependency 'stringio', '3.1.2'"
65+
"spec.add_runtime_dependency 'stringio', '3.1.1'" => "spec.add_runtime_dependency 'stringio', '3.1.2'"
6666
}
6767
# Remove problematic dependencies for Windows; Fiddle will need to be re-added in a future build for Ruby 3.3 support
6868
if windows?

config/software/openssl.rb

Lines changed: 122 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
license_file "LICENSE"
2121
skip_transitive_dependency_licensing true
2222

23-
dependency "cacerts"
24-
dependency "openssl-fips" if fips_mode?
23+
# https://github.com/chef/omnibus-software/pull/2032
24+
default_version "3.6.0" # # do not remove - Rapid7 custom - do not remove
2525

26-
default_version "1.1.1t" # # do not remove - Rapid7 custom - do not remove
26+
dependency "cacerts"
27+
dependency "openssl-fips" if fips_mode? && !(version.satisfies?(">= 3.0.0"))
28+
# On 32-bit ARM, GCC emits calls to libatomic for 64-bit atomic operations.
29+
# 64-bit ARM (aarch64) has native 64-bit atomics and doesn't need this.
30+
dependency "libatomic" if linux? && RUBY_PLATFORM =~ /armv7l/
2731

2832
# Openssl builds engines as libraries into a special directory. We need to include
2933
# that directory in lib_dirs so omnibus can sign them during macOS deep signing.
@@ -47,7 +51,19 @@
4751
internal_source url: "#{ENV["ARTIFACTORY_REPO_URL"]}/#{name}/#{name}-#{version}.tar.gz", extract: :lax_tar,
4852
authorization: "X-JFrog-Art-Api:#{ENV["ARTIFACTORY_TOKEN"]}"
4953
end
54+
version("3.2.6") { source sha256: "89681a9ddaa9ed7cf25ea8ef61338db805200bae47d00510490623547380c148" }
55+
version("3.2.4") { source sha256: "b23ad7fd9f73e43ad1767e636040e88ba7c9e5775bfa5618436a0dd2c17c3716" }
56+
version("3.3.3") { source sha256: "712590fd20aaa60ec75d778fe5b810d6b829ca7fb1e530577917a131f9105539" }
57+
version("3.4.1") { source sha256: "002a2d6b30b58bf4bea46c43bdd96365aaf8daa6c428782aa4feee06da197df3" }
58+
version("3.4.4") { source sha256: "7bdf55ac20f2779e99e5eca306f824fad2b37dee5a06cc35ed5a8b85a6060010" }
59+
version("3.6.0") { source sha256: "b6a5f44b7eb69e3fa35dbf15524405b44837a481d43d81daddde3ff21fcbb8e9" }
5060

61+
version("3.1.2") { source sha256: "a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539" } # FIPS validated
62+
63+
version("3.0.15") { source sha256: "23c666d0edf20f14249b3d8f0368acaee9ab585b09e1de82107c66e1f3ec9533" }
64+
version("3.0.12") { source sha256: "f93c9e8edde5e9166119de31755fc87b4aa34863662f67ddfcba14d0b6b69b61" }
65+
version("3.0.11") { source sha256: "b3425d3bb4a2218d0697eb41f7fc0cdede016ed19ca49d168b78e8d947887f55" }
66+
version("3.0.9") { source sha256: "eb1ab04781474360f77c318ab89d8c5a03abc38e63d65a603cabbf1b00a1dc90" } # FIPS validated
5167
version("3.0.5") { source sha256: "aa7d8d9bef71ad6525c55ba11e5f4397889ce49c2c9349dcea6d3e4f0b024a7a" }
5268
version("3.0.4") { source sha256: "2831843e9a668a0ab478e7020ad63d2d65e51f72977472dc73efcefbafc0c00f" }
5369
version("3.0.3") { source sha256: "ee0078adcef1de5f003c62c80cc96527721609c6f3bb42b7795df31f8b558c0b" }
@@ -72,6 +88,7 @@
7288

7389
build do
7490
env = with_standard_compiler_flags(with_embedded_path)
91+
7592
if aix?
7693
env["M4"] = "/opt/freeware/bin/m4"
7794
elsif mac_os_x? && arm?
@@ -94,21 +111,30 @@
94111
"no-idea",
95112
"no-mdc2",
96113
"no-rc5",
97-
"no-ssl2",
98114
"no-ssl3",
99115
"no-zlib",
100116
"shared",
101117
]
102118

119+
# no-ssl2 is only valid for OpenSSL < 3.0; SSLv2 was fully removed in 3.x
120+
configure_args << "no-ssl2" if version.satisfies?("< 3.0.0")
121+
103122
configure_args += ["--libdir=#{install_dir}/embedded/lib"] if version.satisfies?(">=3.0.1")
104123

124+
# OpenSSL >= 3.2 uses C99 syntax and may generate assembly that requires
125+
# binutils >= 2.22. Detect the assembler version at build time and disable
126+
# asm if it's too old. Also ensure C99 mode for old GCC.
127+
if version.satisfies?(">= 3.2.0") && linux?
128+
env["CFLAGS"] << " -std=gnu99"
129+
end
130+
105131
# https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/
106132
configure_args += [ "-DOPENSSL_TRUSTED_FIRST_DEFAULT" ] if version.satisfies?(">= 1.0.2zb") && version.satisfies?("< 1.1.0")
107133

108134
if version.satisfies?("< 3.0.0")
109135
configure_args += ["--with-fipsdir=#{install_dir}/embedded", "fips"] if fips_mode?
110136
else
111-
configure_args += ["-enable-fips"] if fips_mode?
137+
configure_args += ["enable-fips"] if fips_mode?
112138
end
113139

114140
configure_cmd =
@@ -128,7 +154,7 @@
128154
"./Configure #{platform} -static-libgcc"
129155
end
130156
elsif windows?
131-
platform = windows_arch_i386? ? "mingw" : "mingw64"
157+
platform = "mingw64"
132158
"perl.exe ./Configure #{platform}"
133159
else
134160
prefix =
@@ -159,8 +185,21 @@
159185
patch source: "openssl-1.0.1f-do-not-build-docs.patch", env: patch_env
160186
elsif version.start_with? "1.1"
161187
patch source: "openssl-1.1.0f-do-not-install-docs.patch", env: patch_env
162-
elsif version.start_with? "3.0"
188+
elsif version.start_with?("3.0") || version.start_with?("3.1")
163189
patch source: "openssl-3.0.1-do-not-install-docs.patch", env: patch_env
190+
# Some of the algorithms which are being used are deprecated in OpenSSL3 and moved to legacy provider.
191+
# We need those algorithms for the working of chef-workstation and other packages.
192+
# This patch will enable the legacy providers!
193+
configure_args << "enable-legacy"
194+
patch source: "openssl-3.0.0-enable-legacy-provider.patch", env: patch_env
195+
elsif version.satisfies?(">= 3.2.4", "< 3.6")
196+
patch source: "openssl-3.2.4-do-not-install-docs.patch", env: patch_env
197+
configure_args << "enable-legacy"
198+
patch source: "openssl-3.2.4-enable-legacy-provider.patch", env: patch_env
199+
elsif version.satisfies?(">= 3.6.0")
200+
patch source: "openssl-3.6.0-do-not-install-docs.patch", env: patch_env
201+
configure_args << "enable-legacy"
202+
patch source: "openssl-3.2.4-enable-legacy-provider.patch", env: patch_env
164203
end
165204

166205
if version.start_with?("1.0.2") && mac_os_x? && arm?
@@ -172,19 +211,56 @@
172211
patch source: "openssl-1.0.1q-fix-compiler-flags-table-for-msys.patch", env: env
173212
end
174213

214+
# OpenSSL >= 3.2 requires additional Perl modules (IPC::Cmd, Time::Piece, etc.)
215+
# that may not be present on older systems like CentOS 6.
216+
if version.satisfies?(">= 3.2.0")
217+
if windows?
218+
command "perl.exe -MIPC::Cmd -e 1 2>nul || cpan IPC::Cmd", env: env
219+
command "perl.exe -MTime::Piece -e 1 2>nul || cpan Time::Piece", env: env
220+
else
221+
command "perl -MIPC::Cmd -e 1 2>/dev/null || " \
222+
"sudo yum install -y perl-IPC-Cmd 2>/dev/null || " \
223+
"sudo apt-get install -y libipc-cmd-perl 2>/dev/null || " \
224+
"cpan -T IPC::Cmd", env: env
225+
command "perl -MTime::Piece -e 1 2>/dev/null || " \
226+
"sudo yum install -y perl-Time-Piece 2>/dev/null || " \
227+
"sudo apt-get install -y libtime-piece-perl 2>/dev/null || " \
228+
"cpan -T Time::Piece", env: env
229+
end
230+
end
231+
175232
# Out of abundance of caution, we put the feature flags first and then
176233
# the crazy platform specific compiler flags at the end.
177234
configure_args << env["CFLAGS"]
178235

179-
configure_command = configure_args.unshift(configure_cmd).join(" ")
236+
# Detect old assembler at build time and add no-asm if needed.
237+
# Also disable asm on 32-bit hosts where OpenSSL's generated assembly
238+
# may use instructions unsupported by the target architecture.
239+
# block runs at build time (not parse time), so shellout hits the actual build host.
240+
block "Check assembler and libatomic" do
241+
if version.satisfies?(">= 3.2.0") && linux?
242+
is_32bit = shellout("getconf LONG_BIT 2>/dev/null").stdout.strip == "32"
243+
as_output = shellout("as --version 2>/dev/null").stdout
244+
as_ver = as_output.match(/(\d+\.\d+)/)
245+
if is_32bit || as_ver.nil? || Gem::Version.new(as_ver[1]) < Gem::Version.new("2.22")
246+
configure_args << "no-asm"
247+
end
248+
end
249+
end
180250

181-
command configure_command, env: env, in_msys_bash: true
251+
# block above mutates configure_args before this runs.
252+
# In omnibus, block and command are both queued build steps executed in order.
253+
block "Run Configure" do
254+
configure_command = configure_args.unshift(configure_cmd).join(" ")
255+
shellout!(configure_command, env: env, cwd: project_dir)
256+
end
182257

183258
if version.start_with?("1.0.2") && windows?
184259
patch source: "openssl-1.0.1j-windows-relocate-dll.patch", env: env
185260
end
186261

187-
make "depend", env: env
262+
# make depend is only needed for OpenSSL < 3.0; removed in 3.x
263+
make "depend", env: env if version.satisfies?("< 3.0.0")
188264
# make -j N on openssl is not reliable
189265
make env: env
190266
if aix?
@@ -197,5 +273,41 @@
197273
# Bug Ref: http://rt.openssl.org/Ticket/Display.html?id=2986&user=guest&pass=guest
198274
command "sudo /usr/sbin/slibclean", env: env
199275
end
276+
200277
make "install", env: env
278+
279+
if fips_mode? && version.satisfies?(">= 3.0.0")
280+
openssl_fips_version = project.overrides.dig(:openssl, :fips_version) || "3.0.9"
281+
282+
# Downloading the openssl-3.0.9.tar.gz file and extracting it
283+
command "wget https://www.openssl.org/source/openssl-#{openssl_fips_version}.tar.gz"
284+
command "tar -xf openssl-#{openssl_fips_version}.tar.gz"
285+
286+
# Configuring the fips provider
287+
if windows?
288+
platform = windows_arch_i386? ? "mingw" : "mingw64"
289+
command "cd openssl-#{openssl_fips_version} && perl.exe Configure #{platform} enable-fips"
290+
else
291+
command "cd openssl-#{openssl_fips_version} && ./Configure enable-fips"
292+
end
293+
294+
# Building the fips provider
295+
command "cd openssl-#{openssl_fips_version} && make"
296+
297+
fips_provider_path = "#{install_dir}/embedded/lib/ossl-modules/fips.#{windows? ? "dll" : "so"}"
298+
fips_cnf_file = "#{install_dir}/embedded/ssl/fipsmodule.cnf"
299+
300+
# Running the `openssl fipsinstall -out fipsmodule.cnf -module fips.so` command
301+
command "#{install_dir}/embedded/bin/openssl fipsinstall -out #{fips_cnf_file} -module #{fips_provider_path}"
302+
303+
# Copying the fips provider and fipsmodule.cnf file to the embedded directory
304+
command "cp openssl-#{openssl_fips_version}/providers/fips.#{windows? ? "dll" : "so"} #{install_dir}/embedded/lib/ossl-modules/"
305+
command "cp openssl-#{openssl_fips_version}/providers/fipsmodule.cnf #{install_dir}/embedded/ssl/"
306+
307+
# Updating the openssl.cnf file to enable the fips provider
308+
command "sed -i -e 's|# .include fipsmodule.cnf|.include #{fips_cnf_file}|g' #{install_dir}/embedded/ssl/openssl.cnf"
309+
command "sed -i -e 's|# fips = fips_sect|fips = fips_sect|g' #{install_dir}/embedded/ssl/openssl.cnf"
310+
311+
command "#{install_dir}/embedded/bin/openssl list -providers"
312+
end
201313
end

0 commit comments

Comments
 (0)