salt-ssh doesn't allow use of agent forwarding
I want to run salt-ssh on a remote host, and not have to keep the keys on that host. So I want to use ssh agent forwarding, which with just ssh it will just work. Instead of just working salt-ssh explicitly expects the priv setting to be set. My workaround was to comment out the if statement that tries to use priv. A better solution would either to add an explicit agent forwarding option to salt-ssh to go into the Saltfile, or just add an if to say if priv isn't set, ignore it, hence assuming agent forwarding.
salt/client/ssh/__init__.py:
if not os.path.isfile(priv):
try:
salt.client.ssh.shell.gen_key(priv)
except OSError:
raise salt.exceptions.SaltClientError('salt-ssh could not be run because it could not generate keys.\n\nYou can probably resolve this by executing this script with increased permissions via sudo or by running as root.\nYou could also use the \'-c\' option to supply a configuration directory that you have permissions to read and write to.')
I have tested a solution and created a pull request. PR #22629
@ngrennan-inflection, thanks for working on this. Please feel free to close this issue when your code is merged.
raise salt.exceptions.SaltClientError('salt-ssh could not be run because it could not generate keys.\n\nYou can probably resolve this by executing this script with increased permissions via sudo or by running as root.\nYou could also use the '-c' option to supply a configuration directory that you have permissions to read and write to.') salt.exceptions.SaltClientError: salt-ssh could not be run because it could not generate keys.