Skip to content

Commit

Permalink
Restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
tlbdk committed May 14, 2020
1 parent 6f5c32e commit 0193674
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 73 deletions.
67 changes: 0 additions & 67 deletions cmd/cert.go

This file was deleted.

11 changes: 8 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"cloud.google.com/go/compute/metadata"
"github.com/connectedcars/auth-wrapper/gcemetadata"
"github.com/connectedcars/auth-wrapper/kms/google"
"github.com/connectedcars/auth-wrapper/server"
"github.com/connectedcars/auth-wrapper/sshagent"
"golang.org/x/crypto/ssh"
Expand Down Expand Up @@ -78,6 +79,10 @@ func main() {
os.Unsetenv("SSH_CA_KEY_PATH")
os.Unsetenv("SSH_CA_KEY_PASSWORD")

if sshCaKeyPath != "" {

}

// Run command with SSH Agent
var exitCode int
var err error
Expand Down Expand Up @@ -149,11 +154,11 @@ func createSSHAgent(config *SSHAgentConfig) (sshAgent agent.Agent, err error) {
caPrivateKeyPath := config.caPrivateKeyPath[6:]

// Start the signing server
caPrivateKey, err := sshagent.NewKMSSigner(caPrivateKeyPath, false)
caPrivateKey, err := google.NewKMSSigner(caPrivateKeyPath, false)
if err != nil {
return nil, err
}
caSSHSigner, err := sshagent.NewSSHSignerFromKMSSigner(caPrivateKey)
caSSHSigner, err := google.NewSSHSignerFromKMSSigner(caPrivateKey)
if err != nil {
return nil, fmt.Errorf("failed NewSignerFromSigner from: %v", err)
}
Expand All @@ -162,7 +167,7 @@ func createSSHAgent(config *SSHAgentConfig) (sshAgent agent.Agent, err error) {
}()

// Setup sshAgent
sshAgent, err = sshagent.NewKMSKeyring(userPrivateKeyPath, caPrivateKeyPath, "http://localhost:3080")
sshAgent, err = google.NewKMSKeyring(userPrivateKeyPath, caPrivateKeyPath, "http://localhost:3080")
if err != nil {
return nil, fmt.Errorf("Failed to setup KMS Keyring %s: %v", userPrivateKeyPath, err)
}
Expand Down
2 changes: 1 addition & 1 deletion sshagent/kms-keyring.go → kms/google/kms-keyring.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sshagent
package google

// TODO: Make generic so it can be used with other key implementation

Expand Down
2 changes: 1 addition & 1 deletion sshagent/kms-signer.go → kms/google/kms-signer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sshagent
package google

// TODO: Move to google kms package instead

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sshagent
package google

import (
"crypto"
Expand Down

0 comments on commit 0193674

Please sign in to comment.