Implement cred_rot commands
This commit is contained in:
parent
5c583fd72f
commit
4330173084
1 changed files with 20 additions and 13 deletions
|
@ -38,27 +38,34 @@
|
||||||
|
|
||||||
; Refer to "docs/CredentialRotation.md" for specifics
|
; Refer to "docs/CredentialRotation.md" for specifics
|
||||||
|
|
||||||
(defn-spec list-passwords-command ::cd/command
|
(defn-spec base-command ::cd/command
|
||||||
[config ::config]
|
[config ::config
|
||||||
|
command ::cd/command]
|
||||||
(let [{:keys [restic-repository password-file
|
(let [{:keys [restic-repository password-file
|
||||||
certificate-file new-password-file]} config]
|
certificate-file new-password-file]} config]
|
||||||
(into
|
(into
|
||||||
[]
|
[]
|
||||||
(concat ["restic" "-r" restic-repository "key" "list" "--json"]
|
(concat ["restic" "-r" restic-repository]
|
||||||
(cond
|
(cond
|
||||||
(some? certificate-file)
|
(some? certificate-file)
|
||||||
["--cacert" certificate-file]
|
["--cacert" certificate-file]
|
||||||
(some? password-file)
|
(some? password-file)
|
||||||
["--password-file" password-file]
|
["--password-file" password-file]
|
||||||
:else
|
:else
|
||||||
[])))))
|
[])
|
||||||
|
command))))
|
||||||
|
|
||||||
(defn-spec add-new-password! nil?
|
(defn-spec list-passwords-command ::cd/command
|
||||||
[new-password-file ::new-password-file]
|
[config ::config]
|
||||||
; TODO
|
(base-command config ["key" "list" "--json"]))
|
||||||
)
|
|
||||||
|
|
||||||
(defn-spec replace-old-password! nil?
|
(defn-spec add-password-command ::cd/command
|
||||||
[]
|
[config ::config]
|
||||||
; TODO
|
(let [{:keys [new-password-file]} config]
|
||||||
)
|
(base-command config ["key" "add" "--new-password-file" new-password-file])))
|
||||||
|
|
||||||
|
(defn-spec remove-password-command ::cd/command
|
||||||
|
[config ::config
|
||||||
|
new-id ::id
|
||||||
|
old-id ::id]
|
||||||
|
(base-command config ["key" "remove" "--key-hint" new-id old-id]))
|
||||||
|
|
Loading…
Reference in a new issue