mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-27 15:57:04 -05:00
Remove keypusher util (functionality now implemented by constellation recover
)
Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
parent
17d73813a9
commit
8153390a57
@ -1,60 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/base64"
|
|
||||||
"flag"
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"os"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/coordinator/atls"
|
|
||||||
"github.com/edgelesssys/constellation/state/keyservice/keyproto"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"google.golang.org/grpc/credentials"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ip = flag.String("ip", "", "IP of the node to push the key to (required)")
|
|
||||||
port = flag.String("port", "9000", "Port of the node to push the key to (required)")
|
|
||||||
key = flag.String("key", "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUE=", "base64 encoded state disk key")
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if *ip == "" || *port == "" || *key == "" {
|
|
||||||
flag.Usage()
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
decryptionKey, err := base64.StdEncoding.DecodeString(*key)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
addr := net.JoinHostPort(*ip, *port)
|
|
||||||
log.Printf("Pushing key %v to node at %s", decryptionKey, addr)
|
|
||||||
|
|
||||||
clientCfg, err := atls.CreateUnverifiedClientTLSConfig()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(credentials.NewTLS(clientCfg)))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
|
|
||||||
client := keyproto.NewAPIClient(conn)
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
if _, err := client.PushStateDiskKey(ctx, &keyproto.PushStateDiskKeyRequest{
|
|
||||||
StateDiskKey: decryptionKey,
|
|
||||||
}); err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Println("Successfully pushed key to node")
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user