8000 oneuptime/IronBank at main · seragAhmed/oneuptime · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
 
 

IronBank

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Iron Bank

Iron Bank is the US Department of Defense's registry of hardened container images (registry1.dso.mil), run by Platform One. DoD programs pull images from it instead of from Docker Hub. To be listed, an image has to be rebuilt by Iron Bank's own pipeline from a project on Repo1 (repo1.dso.mil, Platform One's GitLab), and every finding of Iron Bank's scans has to be fixed or justified in VAT (vat.dso.mil), its vulnerability tracker.

Each folder here holds exactly the files of one of OneUptime's Iron Bank projects. Together they are the four OneUptime images the Helm chart runs; the worker and the telemetry writer run the App's image.

Folder Image Copies the release's Iron Bank base image Repo1 project
App the App, Enterprise Edition oneuptime/app:enterprise-<version> opensource/nodejs/nodejs26: Node.js 26, Alpine 3.24 dsop/oneuptime/app
Ingress the nginx ingress oneuptime/nginx:<version> opensource/nginx/nginx-alpine: nginx 1.30, Alpine 3.24 dsop/oneuptime/ingress
Runner the runner oneuptime/runner:<version> opensource/nodejs/debian/nodejs: Node.js 26, Debian 13 dsop/oneuptime/runner
Probe the probe oneuptime/probe:<version> opensource/debian/debian: Debian 12 dsop/oneuptime/probe

Iron Bank's onboarding team picks the final Repo1 paths; keep each manifest's name the same as its path. PostgreSQL, ClickHouse, Valkey and kubectl are already in Iron Bank, and values.yaml runs them from Registry1 with OneUptime's four images ("Installing from Registry1" below).

Justifications is not pushed to Repo1. It holds, per project, the findings OneUptime justifies, with the text to give for each in VAT.

How the images are built

Iron Bank builds each project's Dockerfile without internet access. The image must start from one of Iron Bank's own images, and anything else the build reads must be a resource that hardening_manifest.yaml pins by digest or checksum. Iron Bank's pipeline can still reach Alpine's and Debian's package repositories through its proxy.

So nothing is built from source here. Each manifest pins its image of a OneUptime release (linux/amd64, on Docker Hub) by digest. Each Dockerfile copies what that image adds onto an Iron Bank base image of the same distribution. It then installs the same Alpine or Debian packages and sets the release's environment, user, entrypoint and start command again. Because the distributions match, what the release compiled runs unchanged: its native modules, and the JavaScript its build compiled from OneUptime's TypeScript (the start command runs Index.js after Common's PrecompiledSourceMaps.js; no Iron Bank image loads TypeScript or ts-node).

/usr/src is copied from a shipped stage: the release with its test directories (/usr/src/Common/Tests, /usr/src/app/Tests) removed, so that no layer of the image carries them. No image runs its tests, and one of Common's test fixtures (an SVG data URI with a script in it) is what ClamAV calls phishing. Iron Bank's pipeline fails an image on any ClamAV detection. Tests/Ops/IronBankApp.test.js and IronBankProjects.test.js hold each Dockerfile to the Dockerfile its release is built from (packages/<Service>/Dockerfile.tpl). When one of those changes what its image sets, those suites say what to change here.

  • App. It copies /usr/src and installs bash, curl and the PostgreSQL clients that backups use. Only the Enterprise Edition is on Iron Bank, as a "commercial" image. Production use of it needs an Enterprise license (ee/LICENSE). Without one it runs a 14-day trial, for evaluation. After that, SCIM and audit logging stop and enterprise configuration becomes read-only, while core monitoring carries on. Activating a license turns the enterprise features back on without a restart.
  • Ingress. It copies the nginx configuration, the certificate sidecar in /usr/src and the Node.js that runs it. Iron Bank's nginx image already has nginx 1.30's modules, njs included, so this adds only libxml2, which njs links.
  • Runner. It copies /usr/src, kubectl (which the release downloads and checks against its sha256), the release's CA certificates and the JavaScript sandbox in /usr/lib/oneuptime-runner: the launcher that starts each of a global Runner's JavaScript steps as a user of its own (setuid root, run by the node group alone, which the Dockerfile sets again) and the bundle that step's process runs.
  • Probe. It copies /usr/src, the Node.js that runs it, the Chromium and Firefox that Playwright downloaded, and the synthetic monitors' native helpers. Playwright's own install-deps installs the browsers' libraries. It leaves out the release's curl, which only the release's build uses. Microsoft's ODBC Driver 18 for SQL Server comes from Microsoft's repository, which Iron Bank's pipeline cannot reach. So the manifest pins its package by URL and sha256. Update both values from Microsoft's package index.

Running as root

Iron Bank asks for a justification for an image that runs as root. The App and the runner run as node. The ingress and the probe run as root, as their releases do:

  • Ingress: its start script renders nginx's configuration into /etc/nginx/conf.d and provisions certificates, then starts nginx, whose worker processes run as the nginx user, as with the official nginx image.
  • Probe: ping, traceroute and tcpdump open raw sockets.

Scripts/IronBank/lint.sh accepts root for those two only, and the workflow lists them.

Scripts/IronBank/PinRelease.js moves a project to another release. It updates the tag, the version label, the resource's digest, the release stage, APP_VERSION, GIT_SHA and the revision label together, from the release's image on Docker Hub:

node Scripts/IronBank/PinRelease.js --project Probe --version 16.0.0

It refuses, pinning and with --check, a release whose own start command runs another file than the project's Dockerfile does. The App's, the Probe's and the Runner's Dockerfiles start Index.js, which releases ship from 16.0.0 on, since the images compile their JavaScript; earlier releases started Index.ts through ts-node, so they cannot be pinned under these Dockerfiles. A pull request's preflight checks and builds the committed pins, so when a change to the Dockerfiles needs a newer release than they name, move all four projects to it as soon as it is published.

What CI does: the Iron Bank Preflight workflow

.github/workflows/iron-bank.yml runs daily, on pull requests that change IronBank/ or Scripts/IronBank/, and by hand (Actions → Iron Bank Preflight → Run workflow, optionally with a version). It runs one job per project, and does to each what Iron Bank will do, so the findings are known before a merge request reaches Repo1:

  1. Pins the project to the latest published release, or the one asked for. On a pull request, it instead checks that the committed pin matches the release on Docker Hub.

  2. Runs Tests/Ops/IronBank*.test.js.

  3. Lints the project with Iron Bank's own schema and semgrep rules, fetched from Repo1 (Scripts/IronBank/lint.sh).

  4. With Registry1 credentials, it also:

    • fetches the manifest's resources as Iron Bank's pipeline does;
    • builds the image on Iron Bank's base image with the manifest's labels;
    • for the App, checks it is the Enterprise Edition and boots it with PostgreSQL, ClickHouse and Valkey (Tests/Ops/AppImageRuntime.test.js);
    • for the others, runs their smoke tests (Scripts/IronBank/smoke_test.sh): nginx loads its configuration, the runner's tools run, the probe's SQL Server driver and browsers work;
    • scans the image and its base image with Grype and Trivy, and its files with ClamAV.
  5. Writes the findings into the run's summary (Scripts/IronBank/NewFindings.js). Each finding is sorted into one of three groups:

    • inherited: the base image has it too, so Iron Bank answers for it;
    • justified: it is in Justifications/<Project>.yaml;
    • new: it needs a fix in the release, or a justification.

    A new high or critical finding fails the App's and the ingress's jobs. The runner's and the probe's report theirs with a warning for now, because they have hundreds to work through: remove report_only from the workflow's matrix once they are dealt with. Each job uploads an artifact, iron-bank-<Project>-<version>, holding repo1/ (the files to push) and scans/ (the reports).

Registry1 credentials are two repository secrets, REGISTRY1_USERNAME and REGISTRY1_PASSWORD. Use a Registry1 robot account: open a "Robot Account" issue in dccscr, and Iron Bank emails the credentials. Without the secrets, the workflow runs steps 1 to 3 and warns.

One more job, Install the chart from Iron Bank's images, builds all four images under the names they will have on Registry1, and installs the Helm chart with values.yaml on a KinD cluster, on Iron Bank's own PostgreSQL, ClickHouse and Valkey (HelmChart/Tests/suites/iron-bank-install.sh). It fails when a workload does not become ready or restarts, when OneUptime's schema does not reach a database, when a metric does not reach its rollup, or when ClickHouse refuses something OneUptime sends as beyond its version. KinD's volumes take no fsGroup, so that part of the values is checked by what the chart renders (suites/iron-bank.sh), and first meets real storage on a customer's cluster.

Installing from Registry1

values.yaml runs every image the chart runs by default from Registry1. OneUptime's four images are there once Iron Bank has approved them.

kubectl create namespace oneuptime
kubectl create secret docker-registry registry1 --namespace oneuptime --docker-server=registry1.dso.mil --docker-username=<Registry1 username> --docker-password=<Registry1 CLI secret>
helm install oneuptime oneuptime/oneuptime --namespace oneuptime -f values.yaml

What differs from a stock install:

Stock install With these values
PostgreSQL postgres:latest opensource/postgres/postgresql:17.11, as user 1001
ClickHouse clickhouse/clickhouse-server:26.7 opensource/clickhouse:26.3.20.7, as user 998
Valkey valkey/valkey:9.1-alpine opensource/valkey-io/valkey:9.1.3, as user 1001
kubectl, for the cleanup CronJobs (off by default) bitnami/kubectl:latest opensource/kubernetes/kubectl:v1.36.6
helm test runs oneuptime/test off: that image is not on Iron Bank
  • For new installs. An existing install's data cannot move onto these images: ClickHouse does not support going back from 26.7 to 26.3, and PostgreSQL's data directory belongs to one major version.
  • ClickHouse is older than the chart's. Iron Bank carries the 26.3 long-term support line, and OneUptime's other tests run on 26.7. The install job above is what shows OneUptime's schema, its background jobs and a metric's way to its rollup work on 26.3. It does not send telemetry through OneUptime's ingest or run its dashboards there.
  • What the chart leaves off by default is not moved. Turning on home, pgbouncer, vllm or the ClickHouse Keeper pulls from Docker Hub unless you give image.overrides an image for it.
  • Your own registry. Each reference in image.overrides is used as written, so global.imageRegistry does not move them. To mirror Registry1, replace registry1.dso.mil/ironbank in the file with your mirror's path.
  • Valkey's persistence is off by default. To turn it on, also add dir /data to valkey.commonConfiguration: Iron Bank's image works in /home/data, and the chart mounts the volume at /data.

Shipping a release to Iron Bank

For each project:

  1. Take the iron-bank-<Project>-<version> artifact of a green run for the release. The daily run checks the latest release; run the workflow by hand for another one.
  2. Fix or justify every new finding. A justification is written in VAT. Add the same text to Justifications/<Project>.yaml, so later runs count the finding as answered.
  3. Push the contents of repo1/ to a feature branch of the Repo1 project, and open a merge request to development. Iron Bank's pipeline runs on it. Give VAT the text in Justifications/<Project>.yaml, justify anything its scans add, then add the Status::Review label to the project's issue.
  4. Iron Bank's Container Hardening Team reviews the image and the justifications. Once the image is merged to master, Iron Bank publishes it at registry1.dso.mil/ironbank/oneuptime/<image>:<version>.

Each base image's tag (BASE_TAG) moves on Repo1 through Renovate (each project's renovate.json). When Renovate moves it, update it here too: IronBankProjects.test.js expects the Dockerfile and the manifest to agree.

The ingress's BASE_TAG is also the nginx the Iron Bank ingress runs, because the image is built on Iron Bank's nginx-alpine, not on the release's nginx. NginxVersion.test.js holds it to the release's nginx line, and to the first nginx release that fixes nginx's published vulnerabilities. Until Iron Bank publishes that release, IRON_BANK_NGINX_WAITING in that test names the tag the ingress stays on and the issue that tracks it. For example, Iron Bank's nginx-alpine was still at 1.30.3 when the release moved to 1.30.7 (#9844).

Onboarding, once

  1. Create a Platform One account (login.dso.mil).

  2. Submit the "Platform One Iron Bank Onboarding Requests" form (forms.osi.apps.mil/r/s8rtWD1eCP; the older form linked from Onboarding Services points there), choosing "Vendor & Contributor Onboarding". It asks for:

    • a main point of contact and a technical one (the technical one by their Platform One username);
    • a Government point of contact: a DoD military or civilian user (not a contractor) who will use or support OneUptime and can validate the mission need. This person does not have to fund it, but Iron Bank requires one: they give the initial approval, and are the one requesting the onboarding (dccscr #6531).

    It also asks for commitments: public images and scan results, updates on the day of each release, timely justifications, and builds and runs without internet access.

  3. Iron Bank's onboarding team creates the project on Repo1, emails the contacts, and assigns an initial issue to the engineers. Its onboarding checklist (the dccscr "Onboarding" template) mentions a quote, but Iron Bank says there is currently no cost to onboard or host an application (same issue).

  4. Keep the maintainers in each hardening_manifest.yaml the same as the engineers the onboarding request names, by their Repo1 usernames.

  5. Push the first feature branch. Then open a "VAT Pipeline Access Request" in dccscr: the pipeline fails at lint until the onboarding team approves the project.

  6. After a green feature-branch pipeline, open a "VAT User Access Request" in dccscr. It gives write access to VAT, which you need to justify findings.

  7. Request the robot account for CI (above).

For questions, comment on the project's issue (add /cc @ironbank-notifications/onboarding if nobody answers). Iron Bank also runs a working session, "IB Weekly", every Wednesday from 16:00 to 17:00 Eastern. Registration is linked from the project's initial issue.

0