SSH_AUTH_SOCK environment variable not available to Rex
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- git, perl
- Ambito
- devops, infrastructure
Direzione di ricerca
Inizia riproducendo il problema con una voce di configurazione SSH che imposta Hostname sull’indirizzo IP del server e ForwardAgent su yes, quindi confronta rex -H server PrintEnv con ssh -A server printenv. Traccia la connessione SSH di Rex e la gestione dell’ambiente remoto; il lavoro è completato quando SSH_AUTH_SOCK è disponibile tramite Rex e un git pull remoto riesce con l’autenticazione inoltrata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
I ran into a bug where SSH ForwardAgent was enabled for a server, and I could run from the command-line
ssh -A server "cd /dir && git pull origin main"
but when running that git command in Rex (including using the SCM checkout function) did not work, and received a "Permission denied (public key)" error. See https://groups.google.com/g/rex-users/c/5FavxuXgeb0
The problem was caused by the .ssh/config having a Hostname parameter for the server that specified the IP address. Removing the Hostname fixed the issue.
Upon further investigation, I created a Rex task
task "PrintEnv" => sub {
my $out = run "printenv";
say $out if $out;
}
and compared using rex -H server PrintEnv with ssh -A server printenv
A notable difference is that the SSH_AUTH_SOCK environment variable was not set when run through Rex.
When removing the Hostname and re-running the Rex task, SSH_AUTH_SOCK was present. (This seems to have nothing to do with the .ssh/known_hosts although removing it the first time prompts SSH to accept the host fingerprint.)
Expected behavior
Git and other tools being run through Rex would have had their authentication forwarded.
How to reproduce it
For a .ssh/config of a particular server
- Include a
Hostnamewith the IP address of the server - Ensure
ForwardAgentis "yes" for the server - Run a Rex command on the server that requires forwarded authentication, e.g.
git pull
Code example
No response
Additional context
No response
Rex version
1.14.3
Perl version
5.34.0
Operating system running rex
Linux (Ubuntu 22.04.1)
Operating system managed by rex
Linux (Ubuntu 18.04.6, Debian 6.1.85-1)
How rex was installed?
cpan client
- Lingua principale
- Perl
- Stelle
- 737
- Fork
- 214
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
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 RexOps/Rex
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
triage needed
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
feature request
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
openfoodfacts/openfoodfacts-server#14724 ·
I maintainer di solito rispondono entro 1 giorno
-
question
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
Bug Priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
canonical/chisel-releases#1235 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
linuxmuster/sophomorix4#190 ·