rubygems firewall demo - michaelmworthington/codesamples GitHub Wiki

Introduction

This page walks through the steps to set up NXRM and a Ruby Docker container to test RubyGems Firewall using https://rubygems.org/

See the official docs at  https://help.sonatype.com/repomanager3/rubygems-repositories

Table of Contents

Prerequisites

  • IQ Server installed and running
  • NXRM 3 installed and running and configured with the IQ Server
  • Docker for Mac installed and running

Step 1. Create a new Proxy Repository in NXRM

Use https://rubygems.org/ as the Remote URL

Step 2. Enable Firewall for the New Proxy Repo

Step 3. Run the Docker Image in Interactive Mode

docker run -it --rm ruby bash

unlike the centos image used in the Yum Firewall Demo, this image runs the 'ruby' command when starting the container, rather than plain 'bash'. since i want to run a couple gem commands, force docker to run bash.

Step 4. Use the gem command line to set up the repo sources

gem sources --add http://host.docker.internal:8083/nexus/repository/rubygems.org-releases/
gem sources --remove https://rubygems.org/
gem sources -c

Pro Tip - shortcut to remove the last configured source

gem sources --remove `gem sources | tail -n 1`

Step 5. Use gem to Install a package

gem install rdoc

Step 6. Browse the Proxy Repo

Step 7. Go to the Firewall Report

Repo List

IQ Server Report

Step 8. Test Quarantine

rdoc 6.0.2 has CVE-2014-0026 with CVSS 5.4, so you'll need to have Quarantine enabled in the capability you created in step 2 and Proxy=Fail in your Security-Medium policy in IQ Server

gem install rdoc -v 6.0.1

Console Output

Repo List

IQ Server Report

Step 9. Notes

The NXRM Tree View shows the Quarantined component:

You can reproduce the 403 - Quarantined error by clicking on the "Path" link: http://host.docker.internal:8083/nexus/repository/rubygems.org-releases/gems/rdoc-6.0.1.gem

You can view the component information panel (CIP) right in NXRM

⚠️ **GitHub.com Fallback** ⚠️