diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-06-06 14:52:17 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-06-06 14:52:17 +0100 |
commit | c074b8694f28ab6b3cc1ccb31474cfa507f73e81 (patch) | |
tree | c3e7b5214368b9010dd292e886940c77e726bd6f /cmd | |
parent | 067ad51b6a6ee8829612f51a6e6b2ade3eaa61b3 (diff) | |
parent | 5fcb82c2b1938f696372d11b31145ddb36e5ed94 (diff) |
Merge pull request #18 from nsheridan/agent_lifetime
Remove certs from the agent when they expire
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/cashier/main.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/cashier/main.go b/cmd/cashier/main.go index 768ebcd..3a34108 100644 --- a/cmd/cashier/main.go +++ b/cmd/cashier/main.go @@ -31,10 +31,12 @@ var ( ) func installCert(a agent.Agent, cert *ssh.Certificate, key key) error { + lifetime := time.Unix(int64(cert.ValidBefore), 0).Sub(time.Now()).Seconds() pubcert := agent.AddedKey{ - PrivateKey: key, - Certificate: cert, - Comment: cert.KeyId, + PrivateKey: key, + Certificate: cert, + Comment: cert.KeyId, + LifetimeSecs: uint32(lifetime), } if err := a.Add(pubcert); err != nil { return fmt.Errorf("error importing certificate: %s", err) |