DE-IBH / apt-dater

terminal-based remote package update manager
GNU General Public License v2.0
101 stars 24 forks source link

apt-dater always spawns new agent when spawn-agent="true" #142

Closed rhonda closed 1 month ago

rhonda commented 7 years ago

I am trying to set up a global hosts file and have different admins use their personal account to ssh to the machines controlled by apt-dater. I have though the strange issue that apt-dater spawns a new ssh-agent which then obviously doesn't has the key.

I am somehow unable to figure out why this is happening, and how to disable that. The funny thing is, if I ssh to the machine with the global hosts file as root, everything works fine from there on. When I ssh in as regular user and try to connect through apt-dater it asks me for passwords, even though the exact same connection works in the shell that I started apt-dater from. And yes, default ssh-user is set in the hosts file, too.

Any hint on how to further debug this would be appreciated. Additional see this as a chance to improve the documentation about shared hosts file usage. :)

Enjoy, and thanks, Rhonda

rhonda commented 7 years ago

Ok, found the thing. The variable spawn-agent is set to true in the default systemwide xml file (at least on Debian that is). And contrary to the documentation there is always a new agent spawned. I'm uncertain how the check works, but it does definitely spawn a new agent when agent forwarding is enabled for the user (but not for root somehow). I guess there might be some issue with the check for "agent already running" that I'm stumbling into here. I've explicitly set spawn-agent to false now, and the already existing forwarded agent is used and everything works fine from there.

But please try to dig into why this is needed. From my understanding it shouldn't (and it does work for root).

EDIT: The difference between root and the user was that root had its own apt-dater.conf file which didn't include the global one, so it's a general issue that a new agent is spawned regardless of whether there is one that can be used or not.

liske commented 6 years ago

If spawn-agent is true apt-dater will spawn the agent if SSH_AGENT_PID is not set. Do you have agent forwarding enabled when the users are logging into the host where apt-dater is run?