-
Notifications
You must be signed in to change notification settings - Fork 219
/
Copy pathcli_attestation.go
157 lines (136 loc) Β· 4.49 KB
/
cli_attestation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//go:build secretcli
// +build secretcli
package main
import (
"github.com/spf13/cobra"
)
const flagReset = "reset"
func InitAttestation() *cobra.Command {
cmd := &cobra.Command{
Use: "init-enclave [output-file]",
Short: "Perform remote attestation of the enclave",
Long: `Create attestation report, signed by Intel which is used in the registation process of
the node to the chain. This process, if successful, will output a certificate which is used to authenticate with the
blockchain. Writes the certificate in DER format to ~/attestation_cert
`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
cmd.Flags().Bool(flagReset, false, "Optional flag to regenerate the enclave registration key")
return cmd
}
func InitBootstrapCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "init-bootstrap [node-exchange-file] [io-exchange-file]",
Short: "Perform bootstrap initialization",
Long: `Create attestation report, signed by Intel which is used in the registration process of
the node to the chain. This process, if successful, will output a certificate which is used to authenticate with the
blockchain. Writes the certificate in DER format to ~/attestation_cert
`,
Args: cobra.MaximumNArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}
func ParseCert() *cobra.Command {
cmd := &cobra.Command{
Use: "parse [cert file]",
Short: "Verify and parse a certificate file",
Long: "Helper to verify generated credentials, and extract the public key of the secret node, which is used to" +
"register the node, during node initialization",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}
func DumpBin() *cobra.Command {
cmd := &cobra.Command{
Use: "dump [binary file]",
Short: "Dump a binary file",
Long: "Helper to display the contents of a binary file, and extract the public key of the secret node, which is used to" +
"register the node, during node initialization",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}
func MigrateSealings() *cobra.Command {
cmd := &cobra.Command{
Use: "migrate_sealing",
Short: "Migrate sealed files to the current format",
Long: "Re-create SGX-sealed files according to the current format",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}
func ConfigureSecret() *cobra.Command {
cmd := &cobra.Command{
Use: "configure-secret [master-key] [seed]",
Short: "After registration is successful, configure the secret node with the master key file and the encrypted " +
"seed that was written on-chain",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}
func HealthCheck() *cobra.Command {
cmd := &cobra.Command{
Use: "check-enclave",
Short: "Test enclave status",
Long: "Help diagnose issues by performing a basic sanity test that SGX is working properly",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}
func ResetEnclave() *cobra.Command {
cmd := &cobra.Command{
Use: "reset-enclave",
Short: "Reset registration & enclave parameters",
Long: "This will delete all registration and enclave parameters. Use when something goes wrong and you want to start fresh." +
"You will have to go through registration again to be able to start the node",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}
func AutoRegisterNode() *cobra.Command {
cmd := &cobra.Command{
Use: "auto-register",
Short: "Perform remote attestation of the enclave",
Long: `Automatically handles all registration processes. ***EXPERIMENTAL***
Please report any issues with this command
`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
println("This is a secretd only function, yo")
return nil
},
}
return cmd
}