server-prep.sh: valid_pubkey accepts a private key when bash is older than 5.1
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
Direzione di ricerca
Leggi valid_pubkey in server-prep.sh e il test della chiave privata in tests/unit/server-prep.bats, aggiunto in #214. Aggiorna il controllo per usare ssh-keygen -l -f - con lo standard input, quindi rimuovi lo skip del test in base alla versione di bash. Il lavoro è completato quando le chiavi private vengono rifiutate e quelle pubbliche accettate in tutte le versioni di bash supportate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What
valid_pubkey in server-prep.sh checks a key with:
valid_pubkey() { [[ -n "$1" ]] && ssh-keygen -l -f /dev/stdin <<<"$1" >/dev/null 2>&1; }
Whether it rejects a private key depends on how bash passes the herestring:
- bash 5.1 and later pass a short herestring through a pipe.
ssh-keygensees "PRIVATE KEY" on the first line, opens/dev/stdinagain to read it as a private key, finds the pipe empty and fails: the key is rejected (good). - bash 5.0 and older use a temporary file. Opening
/dev/stdinagain reads the file from the start,ssh-keygenfingerprints the private key and exits 0: the private key is accepted asADMIN_PUBKEYorPANEL_PUBKEY.
Every supported system (Ubuntu 22.04+, Debian 12/13) has bash 5.1 or later, so this does not happen on a server today. It is a robustness fix, so the check does not depend on the bash version.
Checked with OpenSSH 10.2: a private key given as a regular file on stdin to ssh-keygen -l -f /dev/stdin exits 0; with -f - it exits 255 both from a pipe and from a file, and a public key still exits 0.
Proposed change
Read the key from standard input with -f -, which never falls back to loading a private key:
valid_pubkey() { [[ -n "$1" ]] && printf '%s\n' "$1" | ssh-keygen -l -f - >/dev/null 2>&1; }
ssh-keygen -l -f - (fingerprint from standard input) is much older than the OpenSSH of any supported system.
Then the private-key test in tests/unit/server-prep.bats (from #214) no longer needs its skip before bash 5.1.
Where it came from
Review of #214 (bats unit tests): https://github.com/exceev-consulting/server-prep/pull/214
🤖 Automated by Claude Code (review-fixer routine). A maintainer reviews before anything is merged.
- Lingua principale
- Shell
- Stelle
- 2
- Fork
- 3
- Merge medio
- 2g 14m
- PR unite (30g)
- 47
Preparare l'ambiente
- Nessun Dockerfile né 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 exceev-consulting/server-prep
-
area: docs bug claude documentation good first issue priority: low size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
exceev-consulting/server-prep#225 ·
I maintainer di solito rispondono entro 2 giorni
-
area: preconfig bug claude priority: medium size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
exceev-consulting/server-prep#224 ·
I maintainer di solito rispondono entro 2 giorni
-
e2e flake: boot fails on debian-13 when its genericcloud image is missing from SHA512SUMSForse già presa @exceev-claude l’ha presa 1 giorno fa. Apertaarea: ci bug claude priority: high size: S
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
exceev-consulting/server-prep#212 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
server-audit.sh: flag world-writable directories in /etc such as /etc/dokploy (GHSA-qxjv-6cvh-32c6)Apertaarea: audit claude enhancement panel: dokploy priority: high security size: S triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
exceev-consulting/server-prep#211 ·
I maintainer di solito rispondono entro 2 giorni
-
e2e flake: prep-rerun fails on every system when a new docker-compose-plugin is released between the two runsForse già presa @exceev-claude l’ha presa 1 giorno fa. Apertaarea: ci bug claude priority: medium size: S
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
exceev-consulting/server-prep#207 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di exceev-consulting/server-prep
Issue simili
-
bot-found documentation priority: P3
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
madenvel/KalinkaPlayer#602 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/kernels#1006 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 94/100
I maintainer di solito rispondono entro 2 giorni
-
severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
luainkernel/lunatik#2594 ·
I maintainer di solito rispondono entro 1 giorno