-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathkms-cryptsetup.go
42 lines (38 loc) · 1.51 KB
/
kms-cryptsetup.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
package main
import (
"fmt"
"github.com/alecthomas/kingpin"
)
var (
computerContextCommand = kingpin.Command("computer-context", "Print the computer context")
grantComputerCommand = kingpin.Command("grant-computer", "Grant a computer access")
storeEncryptionKeyCommand = kingpin.Command("store-encryption-key", "store an encryption key for a disk")
encryptDiskCommand = kingpin.Command("encrypt-disk", "Encrypt a disk")
checkShellCommand = kingpin.Command("check-shell", "Output the key via the base64 command to check the command pipeline")
outputKeyCommand = kingpin.Command("output-key", "Output the key to stdout")
revokeComputerCommand = kingpin.Command("revoke-computer", "Revoke a computer's access")
createTableCommand = kingpin.Command("create-table", "Create DynamoDB Table")
device = kingpin.Flag("device", "Device to encrypt").Short('d').String()
computerContext = kingpin.Flag("computer-context", "Supply Computer Context up-front").Short('c').String()
deviceName = kingpin.Flag("device-name", "Supply device name up-front").Short('n').String()
)
func main() {
switch kingpin.Parse() {
case "revoke-computer":
RevokeGrant()
case "computer-context":
fmt.Println(ComputerContext())
case "grant-computer":
ComputerGrant()
case "store-encryption-key":
GetEncryptedDiskKey()
case "create-table":
DynamoTable()
case "encrypt-disk":
EncryptDisk()
case "check-shell":
CheckShell()
case "output-key":
StdOutKey()
}
}