Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

SSH_AUTH_SOCK environment variable not available to Rex

Aperta
#1,615 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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

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

triage needed
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

  1. Include a Hostname with the IP address of the server
  2. Ensure ForwardAgent is "yes" for the server
  3. 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RexOps/Rex

Tutte le issue di RexOps/Rex

Issue simili

Altre issue su Perl

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.