[BUG] - Docker image incompatible with readOnlyRootFilesystem (Kubernetes security best practice)
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Internal/External
External
Area
Other - Docker image / Nix wrapper / run-node script
Summary
The cardano-node Docker image (10.6.2) is incompatible with readOnlyRootFilesystem: true in Kubernetes due to two separate issues:
- Scripts mode (
NETWORK=mainnet): The Nix-generated wrapper hardcodes RTS option-tcardano-node.statswhich tries to write to the current working directory - Custom mode (
runarg): The/usr/local/bin/run-nodescript writes to/usr/local/bin/env
Running with readOnlyRootFilesystem: true is a Kubernetes security best practice recommended by CIS benchmarks.
Steps to reproduce
Issue 1 - Scripts mode:
docker run --read-only -e NETWORK=mainnet ghcr.io/intersectmbo/cardano-node:10.6.2
Error: cardano-node: Can't open stats file cardano-node.stats
Issue 2 - Custom mode:
docker run --read-only ghcr.io/intersectmbo/cardano-node:10.6.2 run
Error: /usr/local/bin/run-node: line 93: /usr/local/bin/env: Read-only file system
Expected behavior
The node should start successfully with readOnlyRootFilesystem: true.
System info:
- OS: Kubernetes (EKS) with containerd
- Node version: cardano-node 10.6.2
- Docker image:
ghcr.io/intersectmbo/cardano-node:10.6.2
Logs - Issue 1 (Scripts mode)
Starting: exec /nix/store/.../cardano-node run
...
+RTS
--machine-readable
-tcardano-node.stats
...
-RTS
cardano-node: Can't open stats file cardano-node.stats
Logs - Issue 2 (Custom mode)
Running cardano node ...
CARDANO_BIND_ADDR=0.0.0.0
CARDANO_BLOCK_PRODUCER=false
CARDANO_CONFIG=/opt/cardano/config/mainnet/config.json
CARDANO_DATABASE_PATH=/data/db
CARDANO_LOG_DIR=/opt/cardano/logs
CARDANO_PORT=3001
CARDANO_SOCKET_PATH=/ipc/node.socket
CARDANO_TOPOLOGY=/configuration/topology.json
/usr/local/bin/run-node: line 93: /usr/local/bin/env: Read-only file system
Root Cause
- The Nix wrapper at
/nix/store/.../cardano-node-mainnethardcodes-tcardano-node.statsRTS option - The
run-nodescript'swriteRootEnv()function writes to/usr/local/bin/env
Suggested Fix
- Make the stats file path configurable or write to
/tmpor/data - Write the env file to a writable location like
/tmp/envinstead of/usr/local/bin/env - Or provide a "minimal" mode that skips these writes entirely
Workaround
Disable readOnlyRootFilesystem (reduces security posture).
- Lingua principale
- Haskell
- Stelle
- 3.2k
- Fork
- 762
- Merge medio
- 1g 23h
- PR unite (30g)
- 21
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di IntersectMBO/cardano-node
-
Stale
Difficoltà 1/5 1-3 ore Idoneità per principianti 75/100
IntersectMBO/cardano-node#6597 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Stale
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
IntersectMBO/cardano-node#6578 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
IntersectMBO/cardano-node#6522 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 44/100
IntersectMBO/cardano-node#6734 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
increase in memory usageAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
IntersectMBO/cardano-node#6718 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di IntersectMBO/cardano-node
Issue simili
-
bug core-libs
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
objectionary/phino#1951 ·
I maintainer di solito rispondono entro 1 giorno
-
The Hackage corpus takes in every package in its cache directory, not only the listed releasesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
ndmitchell/hlint#1710 ·
-
CJK text is italicizedForse già presa @daniel-gregg l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100