https://github.com/alan-turing-institute/nexus-allowlist

Enforce allowlists for Nexus3

https://github.com/alan-turing-institute/nexus-allowlist

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.8%) to scientific vocabulary

Keywords

data-safe-haven hut23 hut23-1304 hut23-612

Keywords from Contributors

interactive projection sequences archival genomics observability autograding hacking shellcodes modular
Last synced: 10 months ago · JSON representation

Repository

Enforce allowlists for Nexus3

Basic Info
  • Host: GitHub
  • Owner: alan-turing-institute
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 266 KB
Statistics
  • Stars: 3
  • Watchers: 6
  • Forks: 2
  • Open Issues: 4
  • Releases: 3
Topics
data-safe-haven hut23 hut23-1304 hut23-612
Created about 3 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

Nexus Allowlist

All Contributors <!-- ALL-CONTRIBUTORS-BADGE:END -->

A package for configuring Sonatype Nexus Repository Manager OSS to only allow selected packages to be installed from proxy repositories.

Supports creating CRAN and PyPI proxies which allow either all, or only named packages.

Docker

A Dockerfile and example docker compose configuration demonstrate how to use the script in conjunction with a Nexus OSS container.

Instructions

Test deployment

Check and, if you would like, change the following environment variables for the Nexus Allowlist container in docker-compose.yaml.

| Environment variable | meaning | | ---------------------- | ------------------------------------------------------------------------------------------------------------- | | NEXUSADMINPASSWORD | Password for the Nexus OSS admin user (changes from the default on first rune then used for authentication) | | NEXUSPACKAGES | Whether to allow all packages or only selected packages [all, selected] | | NEXUSHOST | Hostname of Nexus OSS host | | NEXUSPORT | Port of Nexus OSS | | NEXUSPATH | Context path of Nexus OSS. Only used if the Nexus is hosted behind a reverse proxy with a URL like https://your_url.domain/nexus/. If not defined, the base URI remains /. | | ENTR_FALLBACK | If defined, don't use entr to check for allowlist updates (this will be less reactive but we have found entr to not work in some situations) |

Example allowlist files are included in the repository for PyPI and CRAN. The PyPI allowlist includes numpy, pandas, matplotlib and their dependencies. The CRAN allowlist includes cli and data.table You can add more packages by writing the package names, one per line, in the allowlist files.

Start the Nexus and Nexus Allowlist containers using docker compose

docker compose up -d

You can monitor the Nexus Allowlist container instance

docker compose logs -f allowlist

How it works

The container command

  1. Ensures that allowlist files /allowlists/pypi.allowlist and /allowlists/cran.allowlist exist
  2. Waits for Nexus OSS to be available at NEXUS_HOST:NEXUS_PORT
  3. If the Nexus OSS initial password file is present (at /nexus-data/admin.password)
    1. Changes the admin password to NEXUS_ADMIN_PASSWORD
    2. Runs initial configuration (creates a role, repositories, content selectors, etc.)
  4. Reruns the content selector configuration (which enforces the allowlists) every time either of the allowlist files are modified

Caddy acts as a reverse proxy, passing requests to the Nexus OSS server. The configuration file replaces 401 responses from Nexus OSS with 403 so that pip does not prompt a user for authentication when attempting to install a blocked package.

Usage

Pip

You can edit ~/.config/pip/pip.conf to use the Nexus PyPI proxy. To apply globally edit /etc/pip.conf. For example

[global] index = http://localhost:8080/repository/pypi-proxy/pypi index-url = http://localhost:8080/repository/pypi-proxy/simple

You should now only be able to install packages from the allowlist. For example,

  • pip install numpy should succeed
  • pip install mkdocs should fail

R

You can edit ~/.Rprofileto use the Nexus CRAN proxy. To apply globally edit /etc/R/Rprofile.site. For example

local({ r <- getOption("repos") r["CRAN"] <- "http://localhost:8080/repository/cran-proxy" options(repos=r) }) You should now only be able to install packages from the allowlist. For example,

  • install.packages("data.table") should succeed
  • install.packages("ggplot2") should fail

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Jim Madge
Jim Madge

🐛 💻 📖 🤔 🚇 👀 ⚠️
Matt Craddock
Matt Craddock

🐛 💻 🚇
James Robinson
James Robinson

🐛 💻 👀
Jbaudon
Jbaudon

💻 📖 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Owner

  • Name: The Alan Turing Institute
  • Login: alan-turing-institute
  • Kind: organization
  • Email: info@turing.ac.uk

The UK's national institute for data science and artificial intelligence.

GitHub Events

Total
  • Create event: 19
  • Issues event: 3
  • Release event: 2
  • Watch event: 1
  • Delete event: 14
  • Issue comment event: 17
  • Push event: 21
  • Pull request event: 36
  • Pull request review event: 33
  • Pull request review comment event: 18
Last Year
  • Create event: 19
  • Issues event: 3
  • Release event: 2
  • Watch event: 1
  • Delete event: 14
  • Issue comment event: 17
  • Push event: 21
  • Pull request event: 36
  • Pull request review event: 33
  • Pull request review comment event: 18

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 106
  • Total Committers: 4
  • Avg Commits per committer: 26.5
  • Development Distribution Score (DDS): 0.179
Past Year
  • Commits: 106
  • Committers: 4
  • Avg Commits per committer: 26.5
  • Development Distribution Score (DDS): 0.179
Top Committers
Name Email Commits
Jim Madge j****e@t****k 87
dependabot[bot] 4****] 17
Jim Madge j****b@j****m 1
James Robinson j****n@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 9
  • Total pull requests: 76
  • Average time to close issues: 3 days
  • Average time to close pull requests: 2 days
  • Total issue authors: 3
  • Total pull request authors: 5
  • Average comments per issue: 0.78
  • Average comments per pull request: 0.18
  • Merged pull requests: 71
  • Bot issues: 0
  • Bot pull requests: 46
Past Year
  • Issues: 2
  • Pull requests: 25
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Issue authors: 2
  • Pull request authors: 4
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.48
  • Merged pull requests: 20
  • Bot issues: 0
  • Bot pull requests: 18
Top Authors
Issue Authors
  • jemrobinson (3)
  • craddm (2)
  • Jbaudon (1)
  • JimMadge (1)
  • dependabot[bot] (1)
Pull Request Authors
  • dependabot[bot] (53)
  • JimMadge (26)
  • Jbaudon (4)
  • craddm (3)
  • jemrobinson (1)
Top Labels
Issue Labels
bug (2) dependencies (1) python (1) enhancement (1)
Pull Request Labels
dependencies (53) python (44) github_actions (6) docker (3) enhancement (2)