cabal firewall demo - michaelmworthington/codesamples GitHub Wiki

Introduction

This page walks through the steps to set up NXRM and a Haskell Docker container to test Cabal Firewall using http://hackage.haskell.org/

See the community docs at  https://github.com/sonatype-nexus-community/nexus-repository-cabal

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 http://hackage.haskell.org/ as the Remote URL. Accept default values for the remainder of the settings.

Step 2. Enable Firewall for the New Proxy Repo

Step 3. Run the Docker Image in Interactive Mode

docker run -it --rm haskell bash

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

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

First run cabal user-config update to create the config file. Then update ~/.cabal/config to

repository cabal-hackage.haskell.org-proxy
   url: http://host.docker.internal:8081/repository/cabal-hackage.haskell.org-proxy/
   -- secure: False
   -- root-keys:
   -- key-threshold: 3

TIP: if needed, install vim

apt-get update
apt-get install vim

Step 5. Use cabal to Install a package

mkdir testproject 
cd testproject
cabal update
cabal install titlecase

Observe the inbound requests to NXRM in the request.log file:

172.17.0.1 - - [12/Nov/2020:15:49:16 +0000] "GET /repository/cabal-hackage.haskell.org-proxy/00-index.tar.gz HTTP/1.1" 200 - 21342857 3956 "cabal-install/3.2.0.0 (linux; x86_64)" [qtp553156788-50]
172.17.0.1 - - [12/Nov/2020:15:49:41 +0000] "GET /repository/cabal-hackage.haskell.org-proxy/package/titlecase-1.0.1.tar.gz HTTP/1.1" 200 - 5210 798 "cabal-install/3.2.0.0 (linux; x86_64)" [qtp553156788-50]

Step 6. Browse the Proxy Repo

Step 7. Go to the Firewall Report

Repo List

IQ Server Report

Step 8. Test Quarantine

Not Supported

Step 9. Notes

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

Not Supported
⚠️ **GitHub.com Fallback** ⚠️