fix(be): SSH connecting with wrong username https://github.com/semaphoreui/semaphore/issues/1964

This commit is contained in:
fiftin 2024-04-28 22:50:14 +05:00
parent eed4586af1
commit 85f7d75720
No known key found for this signature in database
GPG Key ID: 044381366A5D4731

View File

@ -130,6 +130,7 @@ func (key *AccessKey) Install(usage AccessKeyRole, logger task_logger.Logger) (i
var agent ssh.Agent var agent ssh.Agent
agent, err = key.startSSHAgent(logger) agent, err = key.startSSHAgent(logger)
installation.SSHAgent = &agent installation.SSHAgent = &agent
installation.Login = key.SshKey.Login
} }
case AccessKeyRoleAnsiblePasswordVault: case AccessKeyRoleAnsiblePasswordVault:
if key.Type != AccessKeyLoginPassword { if key.Type != AccessKeyLoginPassword {
@ -148,7 +149,7 @@ func (key *AccessKey) Install(usage AccessKeyRole, logger task_logger.Logger) (i
var agent ssh.Agent var agent ssh.Agent
agent, err = key.startSSHAgent(logger) agent, err = key.startSSHAgent(logger)
installation.SSHAgent = &agent installation.SSHAgent = &agent
installation.Login = key.LoginPassword.Login installation.Login = key.SshKey.Login
case AccessKeyLoginPassword: case AccessKeyLoginPassword:
installation.Login = key.LoginPassword.Login installation.Login = key.LoginPassword.Login
installation.Password = key.LoginPassword.Password installation.Password = key.LoginPassword.Password