diff --git a/internal/command/agent/root.go b/internal/command/agent/root.go index 346a634..c5bd044 100644 --- a/internal/command/agent/root.go +++ b/internal/command/agent/root.go @@ -14,6 +14,7 @@ func Root() *cli.Command { openwrt.Root(), config.Root(), RunCommand(), + ShowThumbprintCommand(), }, } } diff --git a/internal/command/agent/show_thumbprint.go b/internal/command/agent/show_thumbprint.go new file mode 100644 index 0000000..f852c4f --- /dev/null +++ b/internal/command/agent/show_thumbprint.go @@ -0,0 +1,30 @@ +package agent + +import ( + "fmt" + + "forge.cadoles.com/Cadoles/emissary/internal/command/common" + "forge.cadoles.com/Cadoles/emissary/internal/machineid" + "github.com/pkg/errors" + "github.com/urfave/cli/v2" +) + +func ShowThumbprintCommand() *cli.Command { + flags := common.Flags() + + return &cli.Command{ + Name: "show-thumbprint", + Usage: "Show the current agent thumbprint", + Flags: flags, + Action: func(ctx *cli.Context) error { + thumbprint, err := machineid.Get() + if err != nil { + return errors.WithStack(err) + } + + fmt.Println(thumbprint) + + return nil + }, + } +}