Skip to content

Commit

Permalink
Add security integrity check (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli authored Apr 30, 2022
1 parent b8b9739 commit bd06926
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions cmd/security_integrity.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package cmd

import (
"fmt"

helper "github.com/home-assistant/cli/client"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

var securityIntegrityCmd = &cobra.Command{
Use: "integrity",
Aliases: []string{"int", "trust"},
Short: "Execute security integrity check",
Long: `
This command execute a full system integrity check.
This need content trust to be enabled.`,
Example: `
ha security integrity`,
Run: func(cmd *cobra.Command, args []string) {
log.WithField("args", args).Debug("security")

section := "security"
command := "integrity"

ProgressSpinner.Start()
resp, err := helper.GenericJSONPost(section, command, nil)
ProgressSpinner.Stop()

if err != nil {
fmt.Println(err)
ExitWithError = true
} else {
ExitWithError = !helper.ShowJSONResponse(resp)
}
},
}

func init() {
// add cmd to root command
securityCmd.AddCommand(securityIntegrityCmd)
}

0 comments on commit bd06926

Please sign in to comment.