Problem:
I managed to get OpenSCAP working on foreman 2.4.1 for Ubuntu 18.04 and on 3.14 for Ubuntu 22.04.
But my organization uses 2.4.1, so I have to work on a coherent upgrade path when we eventually move to Foreman 3.x (soon™️).
Upgrading the Foreman itself from 2.4 to 2.5 or 3.0 works fine and the openSCAP UI and proxy plugin still allow me to manage all the content, policies and reports.
But upgrading the UI plugin from 4.2.0 to anything higher causes it to complain about a webpack issue.
Trying to figure out what the custom install is missing when upgrading my gem from the current version.
Expected outcome:
When upgrading to higher foreman versions, I expected I could just perform my steps with the updated packages from the yum repo.
Foreman and Proxy versions:
2.4.1
Foreman and Proxy plugin versions:
foreman_openscap 4.2.0 & smart_proxy_openscap 0.8.1
Distribution and version:
Ubuntu 18.04
Other relevant data:
Here’s the error when I try to update the foreman_openscap gem to anything higher than 4.2.0
webpack error
8e2f9059 | /usr/share/foreman/vendor/ruby/2.5.0/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2025-03-30T18:58:51 [I|app|8e2f9059] Rendering common/500.html.erb within layouts/application
2025-03-30T18:58:51 [I|app|8e2f9059] Rendered common/500.html.erb within layouts/application (Duration: 1.7ms | Allocations: 952)
2025-03-30T18:58:51 [I|app|8e2f9059] Rendered layouts/_application_content.html.erb (Duration: 0.1ms | Allocations: 100)
2025-03-30T18:58:51 [I|app|8e2f9059] Rendering layouts/base.html.erb
2025-03-30T18:58:51 [I|app|8e2f9059] Rendered layouts/base.html.erb (Duration: 0.4ms | Allocations: 582)
2025-03-30T18:58:51 [I|app|8e2f9059] Completed 500 Internal Server Error in 96ms (ActiveRecord: 3.3ms | Allocations: 75144)
2025-03-30T18:58:51 [F|app|8e2f9059]
8e2f9059 | ActionView::Template::Error (Can't find entry point 'foreman_openscap:global' in webpack manifest):
8e2f9059 | 13: <%= stylesheet_link_tag *webpack_asset_paths('foreman-vendor', :extension => 'css') %>
8e2f9059 | 14: <%= stylesheet_link_tag *webpack_asset_paths('bundle', :extension => 'css') %>
8e2f9059 | 15: <%= stylesheet_link_tag 'application' %>
8e2f9059 | 16: <%= webpacked_plugins_with_global_css %>
8e2f9059 | 17: <%= yield(:stylesheets) %>
8e2f9059 | 18:
8e2f9059 | 19: <%= csrf_meta_tags %>
8e2f9059 |
8e2f9059 | app/helpers/reactjs_helper.rb:64:in `block (2 levels) in global_css_tags'
8e2f9059 | app/helpers/reactjs_helper.rb:63:in `map'
8e2f9059 | app/helpers/reactjs_helper.rb:63:in `block in global_css_tags'
8e2f9059 | app/helpers/reactjs_helper.rb:62:in `map'
8e2f9059 | app/helpers/reactjs_helper.rb:62:in `global_css_tags'
8e2f9059 | app/helpers/reactjs_helper.rb:22:in `webpacked_plugins_with_global_css'
8e2f9059 | app/views/layouts/base.html.erb:16
8e2f9059 | app/views/layouts/application.html.erb:5
8e2f9059 | app/controllers/application_controller.rb:353:in `generic_exception'
8e2f9059 | lib/foreman/middleware/telemetry.rb:10:in `call'
8e2f9059 | lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
8e2f9059 | lib/foreman/middleware/logging_context_session.rb:22:in `call'
8e2f9059 | lib/foreman/middleware/logging_context_request.rb:11:in `call'
This is how I install a functional version on 2.4.1
Installing OpenSCAP on Foreman 2.4.1 for Ubuntu 18.04
# Instal fpm to convert rpm packages to deb
gem install dotenv -v 2.8.1
gem install --no-document fpm
# Get the Yum packages for 2.4
wget https://yum.theforeman.org/plugins/2.4/el8/x86_64/rubygem-foreman_openscap-4.2.0-1.fm2_4.el8.noarch.rpm
wget https://yum.theforeman.org/plugins/2.4/el8/x86_64/rubygem-smart_proxy_openscap-0.8.1-1.fm2_4.el8.noarch.rpm
# Convert the packages to deb with fpm (with altered names that foreman-installer expects)
fpm -s rpm -t deb --version 4.2.0 --iteration 1.fm2.4.el8 --no-auto-depends --name ruby-foreman-openscap rubygem-foreman_openscap-4.2.0-1.fm2_4.el8.noarch.rpm
fpm -s rpm -t deb --version 0.8.1 --iteration 1.fm2.4.el8 --no-auto-depends --name ruby-smart-proxy-openscap rubygem-smart_proxy_openscap-0.8.1-1.fm2_4.el8.noarch.rpm
# install them
dpkg -i *.deb
cd /usr/share/foreman
# insert the supported gems for foreman 2.4.1 in the bundler.d file
cat <<EOF > bundler.d/foreman_openscap.rb
gem 'foreman_openscap', '4.2.0'
gem 'mini_portile2', '2.5.3'
EOF
sudo -u foreman bundle install
# Add missing link to assets.
ln -sf /usr/share/gems/gems/foreman_openscap-4.2.0/app/assets/foreman_openscap /usr/share/foreman/public/assets
foreman-installer --enable-foreman-plugin-openscap
# Openscap proxy plugin
apt-get install libopenscap8
gem install nokogiri -v 1.12.5
gem install smart_proxy_openscap -v 0.8.1
chown -R foreman-proxy:foreman-proxy /var/lib/foreman-proxy/openscap
chown -R foreman-proxy:foreman-proxy /var/spool/foreman-proxy/
foreman-installer --enable-foreman-proxy-plugin-openscap