chore(ssh-agent): sock file name

This commit is contained in:
Denis Gukov 2023-10-01 23:02:32 +02:00
parent 6c0ff218bb
commit 85d9936082
2 changed files with 1 additions and 24 deletions

View File

@ -98,7 +98,7 @@ func (key *AccessKey) startSshAgent(logger lib.Logger) (lib.SshAgent, error) {
Passphrase: []byte(key.SshKey.Passphrase),
},
},
SocketFile: path.Join(util.Config.TmpPath, fmt.Sprintf("ssh-agent-%d-%d.sock", time.Now().Unix(), 0)),
SocketFile: path.Join(util.Config.TmpPath, fmt.Sprintf("ssh-agent-%d-%d.sock", key.ID, time.Now().Unix())),
}
return sshAgent, sshAgent.Listen()

View File

@ -24,29 +24,6 @@ type Inventory struct {
Type string `db:"type" json:"type"`
}
//func (i *Inventory) StartSshAgent(logger lib.Logger) (lib.SshAgent, error) {
//
// sshAgent := lib.SshAgent{
// Logger: logger,
// Keys: []lib.SshAgentKey{
// {
// Key: []byte(i.SSHKey.SshKey.PrivateKey),
// Passphrase: []byte(i.SSHKey.SshKey.Passphrase),
// },
// },
// SocketFile: path.Join(util.Config.TmpPath, fmt.Sprintf("ssh-agent-%d-%d.sock", time.Now().Unix(), 0)),
// }
//
// if i.BecomeKeyID != nil {
// sshAgent.Keys = append(sshAgent.Keys, lib.SshAgentKey{
// Key: []byte(i.BecomeKey.SshKey.PrivateKey),
// Passphrase: []byte(i.BecomeKey.SshKey.Passphrase),
// })
// }
//
// return sshAgent, sshAgent.Listen()
//}
func FillInventory(d Store, inventory *Inventory) (err error) {
if inventory.SSHKeyID != nil {
inventory.SSHKey, err = d.GetAccessKey(inventory.ProjectID, *inventory.SSHKeyID)