mirror of
https://github.com/cloudflare/redoctober.git
synced 2026-09-20 06:24:14 +00:00
Add CLI support for restore endpoint.
+ Add the relevant parts to the command line tool and the client package. + Small improvements to cryptor's restore function: + Don't try to restore if the store is already active. + Flush the persistence key cache once the restoration occurs. + The redoctober program now explicitly mentions that a config file is invalid when that's the case.
This commit is contained in:
@@ -45,6 +45,7 @@ var commandSet = map[string]command{
|
||||
"order": command{Run: runOrder, Desc: "place an order for delegations"},
|
||||
"owners": command{Run: runOwner, Desc: "show owners list"},
|
||||
"status": command{Run: runStatus, Desc: "show Red October persistent delegation state"},
|
||||
"restore": command{Run: runRestore, Desc: "perform a restore delegation"},
|
||||
}
|
||||
|
||||
func registerFlags() {
|
||||
@@ -132,6 +133,29 @@ func runDelegate() {
|
||||
fmt.Println(resp.Status)
|
||||
}
|
||||
|
||||
func runRestore() {
|
||||
req := core.DelegateRequest{
|
||||
Name: user,
|
||||
Password: pswd,
|
||||
Uses: uses,
|
||||
Time: duration,
|
||||
}
|
||||
|
||||
resp, err := roServer.Restore(req)
|
||||
processError(err)
|
||||
|
||||
if resp.Status != "ok" {
|
||||
fmt.Fprintf(os.Stderr, "failed: %s\n", resp.Status)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var st core.StatusData
|
||||
err = json.Unmarshal(resp.Response, &st)
|
||||
processError(err)
|
||||
|
||||
fmt.Println("Restore delegation complete; persistence is now", st.Status)
|
||||
}
|
||||
|
||||
// TODO: summary response needs better formatting
|
||||
func runSummary() {
|
||||
req := core.SummaryRequest{
|
||||
|
||||
Reference in New Issue
Block a user