Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ruby 3.1 #195

Merged
merged 5 commits into from
May 20, 2024

Conversation

adfoster-r7
Copy link
Contributor

@adfoster-r7 adfoster-r7 commented Apr 19, 2024

Supercedes #191

Adds support for Metasploit omnibus to run under Github actions as well as adding support for building Ruby 3.1

image

Omnibus fork changes: rapid7/omnibus#3

@@ -1,9 +1,24 @@
# docker build -t rapid7/msf-debian-aarch64-omnibus .
FROM forumi0721/debian-aarch64-base:latest
FROM rapid7/msf-debian-aarch64-omnibus:2020_03
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original docker image has been yanked, extending the previous one for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this container actually used anymore? I think the build is actually executed in an AWS gravition system natively for arm64 now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirmed that now 💯

I think it makes sense to keep this setup around for testing on Github actions - and when Github ARM builders become GA this can likely be removed


ENV JENKINS_HOME /home/jenkins
RUN useradd -d "$JENKINS_HOME" -u 1001 -m -s /bin/sh jenkins
RUN id jenkins || useradd -d "$JENKINS_HOME" -u 1001 -m -s /bin/sh jenkins
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idempotent user add since we're still extending the previous rapid7/msf-debian-aarch64-omnibus:2020_03 - but might not in the future

@@ -3,7 +3,8 @@
FROM rapid7/build:kali109_64
MAINTAINER Rapid7 Release Engineering <r7_re@rapid7.com>

RUN echo "deb http://old.kali.org/kali moto main non-free contrib" > /etc/apt/sources.list
# package/ruby: needs gcc and host gcc >= 4.9, available only in Sana - https://www.kali.org/blog/kali-moto-eol/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing the compile error:

thread_pthread.h:108:43: error: expected '=', ',', ';', 'asm' or 'attribute' before 'struct'
RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;

https://lists.buildroot.org/pipermail/buildroot/2021-October/626816.html

crt_path = possible_crt_paths.find { |path| File.exist?(path) }
raise "Could not find valid CRT path - tried #{possible_crt_paths.join(", ")}." if crt_path.nil?
%>
<Merge Id="CRT" Language="0" SourceFile="<%= crt_path %>" DiskId="1" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original issue on github actions

The following shell command exited with status 103:
  $ light.exe -nologo -sval -ext WixUIExtension -cultures:en-us -loc "D:\a\_temp\metasploit-framework20240418-1808-v6mss1\localization-en-us.wxl" project-files.wixobj source.wixobj -out "C:\omnibus-ruby\pkg\metasploit-framework-0.0.0-20240418232212-1rapid7-1-x64.msi"
  Output:
    D:\a\_temp\metasploit-framework20240418-1808-v6mss1\source.wxs(79) : error LGHT0103 : The system cannot find the file 'C:\Program Files (x86)\Common Files\Merge Modules\microsoft_vc120_crt_x64.msm'.
  Error:
    (nothing)

Installing Microsoft.VisualStudio.Component.VC.Redist.MSM and using the new path works, but we'll still most likely use vs2013 behind the scenes on Jenkins

I don't think this is a great pattern, we could probably resolve %VCToolsRedistDir% etc and be smarter with this logic, but for MVP it should work for us - as right now we're running either in Github actions or on one of the predefined build envs; there's also enough of a paper trail for the next developer to resolve this issue in a short period of time

local/cache Outdated Show resolved Hide resolved
RUN yum upgrade -y && yum clean all
RUN yum install -y centos-release-SCL && yum clean all
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this was needed for signing; Maybe I'll need to circle back to this

@adfoster-r7 adfoster-r7 force-pushed the update-support-for-ruby-3.1 branch 2 times, most recently from 41203c8 to 7559107 Compare May 16, 2024 10:19
@adfoster-r7 adfoster-r7 force-pushed the update-support-for-ruby-3.1 branch 20 times, most recently from d82c433 to ae01d55 Compare May 17, 2024 10:57
@adfoster-r7 adfoster-r7 merged commit a7e39a6 into rapid7:master May 20, 2024
9 checks passed
@jmartin-tech
Copy link
Contributor

Awesome, thanks for getting this across the line!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants