use ssh agent to auth to remote

This commit is contained in:
William Banfield
2022-12-01 11:17:03 -05:00
parent b7fccf0138
commit de20e3d224
5 changed files with 29 additions and 21 deletions
+9 -5
View File
@@ -5,11 +5,12 @@ import (
"errors"
"fmt"
"math/rand"
"net"
"os"
"path/filepath"
"strconv"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/agent"
"github.com/tendermint/tendermint/libs/log"
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
@@ -91,10 +92,13 @@ func NewCLI() *CLI {
switch inft {
case "docker":
cli.infp = &docker.Provider{Testnet: testnet}
case "digitalocean":
// TMP: hardcoded key
cfg, err := e2essh.NewClientConfig(filepath.Join(os.Getenv("HOME"), ".ssh", "PVT_KEY"))
case "digital-ocean":
c, err := net.Dial("unix", os.Getenv("SSH_AUTH_SOCK")) // TODO(williambanfield): Ensure this is a consistent location for the authentication socket of the agent.
if err != nil {
return err
}
ac := agent.NewClient(c)
cfg, err := e2essh.NewClientConfig(ac)
if err != nil {
return err
}
+3 -3
View File
@@ -56,7 +56,7 @@ func Start(testnet *e2e.Testnet, p infra.Provider) error {
if _, err := waitForNode(node, 0, 15*time.Second); err != nil {
return err
}
logger.Info("start", "msg", log.NewLazySprintf("Node %v up on http://127.0.0.1:%v", node.Name, node.ProxyPort))
logger.Info("start", "msg", log.NewLazySprintf("Node %v up on http://%s:%v", node.Name, node.IP, node.ProxyPort))
}
networkHeight := testnet.InitialHeight
@@ -116,8 +116,8 @@ func Start(testnet *e2e.Testnet, p infra.Provider) error {
if err != nil {
return err
}
logger.Info("start", "msg", log.NewLazySprintf("Node %v up on http://127.0.0.1:%v at height %v",
node.Name, node.ProxyPort, status.SyncInfo.LatestBlockHeight))
logger.Info("start", "msg", log.NewLazySprintf("Node %v up on http://%s:%v at height %v",
node.Name, node.IP, node.ProxyPort, status.SyncInfo.LatestBlockHeight))
}
return nil