Skip to content

Commit facd3b4

Browse files
committed
Build Ruby 3.1
1 parent 6caf200 commit facd3b4

File tree

17 files changed

+259
-109
lines changed

17 files changed

+259
-109
lines changed

.github/workflows/verify.yml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ jobs:
2828
# The job checkout structure is:
2929
# .
3030
# ├── metasploit-omnibus
31-
# └── metasploit-framework (Only if ARM/Windows builds)
32-
# For windows we additionally move metasploit-framework into the omnibus local cache
31+
# └── metasploit-framework (Only if ARM or Windows builds)
3332
#
3433
docker_arm:
3534
runs-on: ${{ matrix.os }}
@@ -264,12 +263,27 @@ jobs:
264263
fail-fast: false
265264
matrix:
266265
os:
267-
- windows-2019
266+
- windows-2022
268267
ruby:
269268
- 3.0.6
270269

271270
name: ${{ matrix.os }}
272271
steps:
272+
# https://github.com/actions/runner-images/issues/5143
273+
# https://github.com/actions/runner-images/issues/9701
274+
- name: Install visual studio components
275+
run: |
276+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
277+
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
278+
$componentsToRemove= @(
279+
"Microsoft.VisualStudio.Component.VC.Redist.MSM"
280+
)
281+
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --add " + $_}
282+
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
283+
# should be run twice
284+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
285+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
286+
273287
- name: Checkout omnibus
274288
uses: actions/checkout@v4
275289
with:
@@ -289,6 +303,20 @@ jobs:
289303
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
290304
bundler: 2.2.33
291305

306+
# We need to create the pcaprub gem ourselves until 0.13.2 is released (https://github.com/pcaprub/pcaprub/issues/67)
307+
- name: Checkout pcaprub
308+
uses: actions/checkout@v4
309+
with:
310+
repository: pcaprub/pcaprub
311+
path: pcaprub
312+
ref: '5440ca93dafd15e7d3bb009fc1bb9a15e80d03f9'
313+
314+
- name: Create pcaprub gem
315+
run: |
316+
cd pcaprub
317+
bundle
318+
rake gem
319+
292320
# Checkout framework
293321
- name: Checkout metasploit-framework code
294322
uses: actions/checkout@v4
@@ -300,12 +328,16 @@ jobs:
300328
run: |
301329
cd metasploit-omnibus
302330
xz -d local/cache/*.xz
331+
ls local/cache
303332
304333
- name: Run omnibus
334+
shell: cmd
335+
env:
336+
MSYSTEM: MINGW64
305337
run: |
306-
# mkdir -p metasploit-omnibus/local/cache/git_cache/c
307-
# mv metasploit-framework/ metasploit-omnibus/local/cache/git_cache/c
308-
# dir metasploit-omnibus/local/cache/git_cache/c
309-
# dir metasploit-omnibus/local/cache/git_cache/c/metasploit-framework
310338
cd metasploit-omnibus
311-
make
339+
make dependencies
340+
341+
rem Don't run the main build itslef under `make`, as the process will be spawned under msys2
342+
rem and the ridk.cmd Ruby installer will forcibly kill the msys2 process before attempting to install ruby
343+
ruby bin/omnibus build metasploit-framework

.gitmodules

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "local/cache"]
22
path = local/cache
3-
url = https://github.com/rapid7/metasploit-omnibus-cache.git
3+
url = https://github.com/adfoster-r7/metasploit-omnibus-cache.git
4+
branch = prepare-for-ruby-3.1-update

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
22

33
# Install omnibus
44
# gem 'omnibus', '~> 4.0'
5-
gem 'omnibus', git: 'https://github.com/rapid7/omnibus', branch: 'r7_8.2.4_custom'
5+
gem 'omnibus', git: 'https://github.com/rapid7/omnibus', branch: 'r7_9.0.23_custom'
66

77
# Use Chef's software definitions. It is recommended that you write your own
88
# software definitions, but you can clone/fork Chef's to get you started.

Gemfile.lock

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,128 @@
11
GIT
22
remote: https://github.com/rapid7/omnibus
3-
revision: 5b238e62088797782f6b7ca1ddda3a0e7128c224
4-
branch: r7_8.2.4_custom
3+
revision: c6dc312d985e85fb35b8e9f8e49b607abd91665c
4+
branch: r7_9.0.23_custom
55
specs:
6-
omnibus (8.2.4)
7-
aws-sdk-s3 (~> 1)
6+
omnibus (9.0.23)
7+
aws-sdk-s3 (~> 1.116.0)
88
chef-cleanroom (~> 1.0)
99
chef-utils (>= 15.4)
1010
contracts (>= 0.16.0, < 0.17.0)
1111
ffi-yajl (~> 2.2)
1212
license_scout (~> 1.0)
1313
mixlib-shellout (>= 2.0, < 4.0)
1414
mixlib-versioning
15-
ohai (>= 15, < 17)
15+
ohai (>= 16, < 19)
1616
pedump
17+
rexml (~> 3.2)
1718
ruby-progressbar (~> 1.7)
1819
thor (>= 0.18, < 2.0)
1920

2021
GEM
2122
remote: https://rubygems.org/
2223
specs:
23-
addressable (2.8.0)
24-
public_suffix (>= 2.0.2, < 5.0)
24+
addressable (2.8.6)
25+
public_suffix (>= 2.0.2, < 6.0)
2526
awesome_print (1.9.2)
26-
aws-eventstream (1.2.0)
27-
aws-partitions (1.522.0)
28-
aws-sdk-core (3.121.5)
29-
aws-eventstream (~> 1, >= 1.0.2)
30-
aws-partitions (~> 1, >= 1.520.1)
31-
aws-sigv4 (~> 1.1)
32-
jmespath (~> 1.0)
33-
aws-sdk-kms (1.50.0)
34-
aws-sdk-core (~> 3, >= 3.121.2)
27+
aws-eventstream (1.3.0)
28+
aws-partitions (1.916.0)
29+
aws-sdk-core (3.192.1)
30+
aws-eventstream (~> 1, >= 1.3.0)
31+
aws-partitions (~> 1, >= 1.651.0)
32+
aws-sigv4 (~> 1.8)
33+
jmespath (~> 1, >= 1.6.1)
34+
aws-sdk-kms (1.79.0)
35+
aws-sdk-core (~> 3, >= 3.191.0)
3536
aws-sigv4 (~> 1.1)
36-
aws-sdk-s3 (1.104.0)
37-
aws-sdk-core (~> 3, >= 3.121.2)
37+
aws-sdk-s3 (1.116.0)
38+
aws-sdk-core (~> 3, >= 3.127.0)
3839
aws-sdk-kms (~> 1)
3940
aws-sigv4 (~> 1.4)
40-
aws-sigv4 (1.4.0)
41+
aws-sigv4 (1.8.0)
4142
aws-eventstream (~> 1, >= 1.0.2)
4243
byebug (11.1.3)
4344
chef-cleanroom (1.0.5)
44-
chef-config (16.16.13)
45+
chef-config (18.4.12)
4546
addressable
46-
chef-utils (= 16.16.13)
47+
chef-utils (= 18.4.12)
4748
fuzzyurl
4849
mixlib-config (>= 2.2.12, < 4.0)
4950
mixlib-shellout (>= 2.0, < 4.0)
5051
tomlrb (~> 1.2)
51-
chef-utils (16.16.13)
52+
chef-utils (18.4.12)
53+
concurrent-ruby
5254
citrus (3.0.2)
5355
coderay (1.1.3)
56+
concurrent-ruby (1.2.3)
5457
contracts (0.16.1)
55-
ffi (1.15.4)
56-
ffi-yajl (2.4.0)
58+
ffi (1.16.3)
59+
ffi-yajl (2.6.0)
5760
libyajl2 (>= 1.2)
5861
fuzzyurl (0.9.0)
59-
iostruct (0.0.4)
62+
iostruct (0.0.5)
6063
ipaddress (0.8.3)
6164
jmespath (1.6.2)
62-
json (2.6.1)
65+
json (2.7.2)
6366
libyajl2 (2.1.0)
64-
license_scout (1.2.13)
67+
license_scout (1.3.7)
6568
ffi-yajl (~> 2.2)
6669
mixlib-shellout (>= 2.2, < 4.0)
6770
toml-rb (>= 1, < 3)
6871
method_source (1.0.0)
6972
mixlib-cli (2.1.8)
70-
mixlib-config (3.0.9)
73+
mixlib-config (3.0.27)
7174
tomlrb
7275
mixlib-log (3.0.9)
73-
mixlib-shellout (3.2.5)
76+
mixlib-shellout (3.2.7)
7477
chef-utils
7578
mixlib-versioning (1.2.12)
76-
multipart-post (2.1.1)
77-
net-scp (3.0.0)
78-
net-ssh (>= 2.6.5, < 7.0.0)
79-
net-ssh (6.1.0)
80-
ohai (16.13.0)
81-
chef-config (>= 12.8, < 17)
82-
chef-utils (>= 16.0, < 17)
79+
multipart-post (2.4.0)
80+
net-scp (4.0.0)
81+
net-ssh (>= 2.6.5, < 8.0.0)
82+
net-ssh (7.2.3)
83+
ohai (18.1.3)
84+
chef-config (>= 14.12, < 19)
85+
chef-utils (>= 16.0, < 19)
8386
ffi (~> 1.9)
8487
ffi-yajl (~> 2.2)
8588
ipaddress
8689
mixlib-cli (>= 1.7.0)
8790
mixlib-config (>= 2.0, < 4.0)
8891
mixlib-log (>= 2.0.1, < 4.0)
89-
mixlib-shellout (>= 2.0, < 4.0)
92+
mixlib-shellout (~> 3.2, >= 3.2.5)
9093
plist (~> 3.1)
9194
train-core
9295
wmi-lite (~> 1.0)
93-
pedump (0.6.2)
96+
pedump (0.6.7)
9497
awesome_print
9598
iostruct (>= 0.0.4)
9699
multipart-post (>= 2.0.0)
97100
rainbow
98101
zhexdump (>= 0.0.2)
99-
plist (3.6.0)
100-
pry (0.13.1)
102+
plist (3.7.1)
103+
pry (0.14.2)
101104
coderay (~> 1.1)
102105
method_source (~> 1.0)
103-
pry-byebug (3.9.0)
106+
pry-byebug (3.10.1)
104107
byebug (~> 11.0)
105-
pry (~> 0.13.0)
106-
public_suffix (4.0.6)
107-
rainbow (3.0.0)
108-
ruby-progressbar (1.11.0)
109-
thor (1.1.0)
110-
toml-rb (2.1.0)
108+
pry (>= 0.13, < 0.15)
109+
public_suffix (5.0.5)
110+
rainbow (3.1.1)
111+
rexml (3.2.6)
112+
ruby-progressbar (1.13.0)
113+
thor (1.3.1)
114+
toml-rb (2.2.0)
111115
citrus (~> 3.0, > 3.0)
112116
tomlrb (1.3.0)
113-
train-core (3.8.1)
117+
train-core (3.12.3)
114118
addressable (~> 2.5)
115119
ffi (!= 1.13.0)
116120
json (>= 1.8, < 3.0)
117121
mixlib-shellout (>= 2.0, < 4.0)
118-
net-scp (>= 1.2, < 4.0)
119-
net-ssh (>= 2.9, < 7.0)
120-
wmi-lite (1.0.5)
121-
zhexdump (0.0.2)
122+
net-scp (>= 1.2, < 5.0)
123+
net-ssh (>= 2.9, < 8.0)
124+
wmi-lite (1.0.7)
125+
zhexdump (0.1.0)
122126

123127
PLATFORMS
124128
ruby
@@ -128,4 +132,4 @@ DEPENDENCIES
128132
pry-byebug
129133

130134
BUNDLED WITH
131-
2.1.4
135+
2.2.33

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
.DEFAULT_GOAL := all
22

33
.PHONY: all
4-
all: certs/ca-certificates.crt
4+
all: certs/ca-certificates.crt dependencies
55
# export SSL_CERT_FILE=${PWD}/certs/ca-certificates.crt
66

7+
# build the metasploit-framework package
8+
ruby bin/omnibus build metasploit-framework
9+
10+
.PHONY: dependencies
11+
dependencies:
712
# Ensure consistent bundler versions
813
gem install bundler -v 2.2.3
914

@@ -13,9 +18,6 @@ all: certs/ca-certificates.crt
1318

1419
gem install win32-process -v 0.9.0
1520

16-
# build the metasploit-framework package
17-
ruby bin/omnibus build metasploit-framework
18-
1921
certs/ca-certificates.crt:
2022
mkdir -p certs
2123
curl -L -o certs/ca-certificates.crt https://curl.haxx.se/ca/cacert.pem

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ docker build --tag metasploit-omnibus-builder - < ./docker/ubuntu1204-x86/Docker
3232
Or on OSX you can use the following script to build all images following the latest Docker image naming convention:
3333

3434
```shell
35-
export BUILD_DATE=$(date "+%Y_%m"); ls ./docker | xargs -I IMAGE_NAME /bin/bash -x -c "docker build --tag rapid7/IMAGE_NAME-omnibus:$BUILD_DATE -f ./docker/IMAGE_NAME/Dockerfile ./docker/IMAGE_NAME"
35+
export BUILD_DATE=$(date "+%Y_%m_%d"); ls ./docker | xargs -I IMAGE_NAME /bin/bash -x -c "docker build --tag rapid7/IMAGE_NAME-omnibus:$BUILD_DATE -f ./docker/IMAGE_NAME/Dockerfile ./docker/IMAGE_NAME"
3636
```
3737

3838
You can then run a new container using the above tagged image, whilst mounting the current directory as a volume:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/load.c b/load.c
2+
index a2b9da4..05ea96e 100644
3+
--- a/load.c
4+
+++ b/load.c
5+
@@ -981,6 +981,11 @@ search_required(rb_vm_t *vm, VALUE fname, volatile VALUE *path, feature_func rb_
6+
if (loading) *path = rb_filesystem_str_new_cstr(loading);
7+
return 'r';
8+
}
9+
+ else if ((ft = rb_feature_p(vm, ftptr, 0, FALSE, FALSE, &loading)) == 's') {
10+
+ if (loading) *path = rb_filesystem_str_new_cstr(loading);
11+
+ return 's';
12+
+ }
13+
+
14+
tmp = fname;
15+
type = rb_find_file_ext(&tmp, ft == 's' ? ruby_ext : loadable_ext);
16+
switch (type) {

config/software/metasploit-framework.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
if linux? && File.exist?("/metasploit-framework")
33
# supply current version of metasploit-framework at root of filesystem
44
source path: "/metasploit-framework"
5+
elsif windows? && File.exist?('../metasploit-framework')
6+
# supply current version of metasploit-framework relative to the current directory
7+
source path: "../metasploit-framework"
58
else
69
source git: "https://github.com/rapid7/metasploit-framework.git"
710
default_version "master"
@@ -19,7 +22,7 @@
1922
dependency "postgresql"
2023
end
2124

22-
ruby_abi_version = "3.0.0"
25+
ruby_abi_version = "3.1.0"
2326
# This depends on extra system libraries on OS X
2427
whitelist_file "#{install_dir}//embedded/framework/data/isight.bundle"
2528

@@ -77,7 +80,9 @@
7780
end
7881

7982
bundle "config set force_ruby_platform true", env: env
80-
bundle "install", env: env
83+
bundle_env = with_standard_compiler_flags(with_embedded_path)
84+
bundle_env['MAKE'] = 'make -j4'
85+
bundle "install --jobs=4", env: bundle_env
8186

8287
if windows?
8388
delete "#{install_dir}/embedded/msys64"

0 commit comments

Comments
 (0)