Bug 1227767

Summary: ssh-agent unable to export its variables
Product: [openSUSE] openSUSE Tumbleweed Reporter: Tamara Schmitz <tamara.zoe.schmitz>
Component: NetworkAssignee: E-mail List <screening-team-bugs>
Status: RESOLVED INVALID QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: nwr10cst-oslnx
Version: Current   
Target Milestone: ---   
Hardware: aarch64   
OS: openSUSE Tumbleweed   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: ssh-agent strace

Description Tamara Schmitz 2024-07-15 08:53:36 UTC
Created attachment 876048 [details]
ssh-agent strace

In a bash shell, launching ssh-agent is unable to export its variables after launching. I observed this both on a desktop and a headless MicroOS system both running aarch64 CPUs from different vendors and different microarchitectures. So I believe this to be an aarch64 specific bug.

The ssh-agent binary is part of the openssh-clients package which is built from the openssh.spec.

Observed behaviour:
$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-XXXXXX4k26MF/agent.26053; export SSH_AUTH_SOCK;
SSH_AGENT_PID=26054; export SSH_AGENT_PID;
echo Agent pid 26054;
$ ssh-agent -k
SSH_AGENT_PID not set, cannot kill agent
$ printenv | grep -i SSH
$

System Info:
openSUSE Tumbleweed Aarch64 VERSION_ID="20240629"
openssh-clients-9.6p1-11.1.aarch64
SELinux originally Enforcing, but using setenforce changed to Permissive. No change.

Attached is an strace of running ssh-agent.
Comment 1 Tamara Schmitz 2024-07-15 08:55:18 UTC
As an additional note. The export is failing and so `ssh-agent -k` is failing but ssh-agent is running as I can confirm with `pidof ssh-agent`. The envs are not set correctly, that is the problem.
Comment 2 Neil Rickert 2024-07-16 00:34:22 UTC
To me, this looks normal.

If you use the command:

 ssh-agent bash

Then it will export its environment variable to the "bash" shell that it starts.

But if you just use:

 ssh-agent

then there is no subcommand to which it can export.

You should probably be using:

 eval `ssh-agent -s`

or

 eval $(ssh-agent -s)

When starting "ssh-agent" this way, its output is caught by the shell and then run as a shell command.  And the shell then exports the needed variables.

Check the man pages for "ssh-agent".
Comment 3 Tamara Schmitz 2024-07-16 15:08:21 UTC
Yeah oops. Does seem to be a misunderstanding on my part.