Compare commits

..

No commits in common. "0cb4bc43f928f1e07d50337958ded5540217b59a" and "b139865f8942ba913a8b5e4e202cb22e4fa49d82" have entirely different histories.

2 changed files with 3 additions and 22 deletions

View file

@ -27,7 +27,6 @@ function main() {
install -m 0400 /tmp/functions.sh /usr/local/lib/ install -m 0400 /tmp/functions.sh /usr/local/lib/
install -m 0400 /tmp/pg-functions.sh /usr/local/lib/ install -m 0400 /tmp/pg-functions.sh /usr/local/lib/
install -m 0400 /tmp/file-functions.sh /usr/local/lib/ install -m 0400 /tmp/file-functions.sh /usr/local/lib/
install -m 0740 /tmp/restic_management.clj /usr/local/bin/
cleanupDocker cleanupDocker
} }

View file

@ -26,26 +26,8 @@
(catch RuntimeException e (catch RuntimeException e
(printf "Error parsing edn file '%s': %s\n" "backup-repository-state.edn" (.getMessage e))))) (printf "Error parsing edn file '%s': %s\n" "backup-repository-state.edn" (.getMessage e)))))
(defn read-secret [s] (println (read-backup-repository-state))
(slurp (str "/var/run/secrets/" s)))
;"/var/run/secrets/rotation-credential-secret/rotation-credential"))
;(println (read-backup-repository-state)) (println (:state (read-backup-repository-state)))
;(println (:state (read-backup-repository-state))) (println (s/valid? ::backup-repository-state (read-backup-repository-state)))
;(println (s/valid? ::backup-repository-state (read-backup-repository-state)))
(println (read-secret "rotation-credential-secret/rotation-credential"))
(println (read-secret "backup-secrets/restic-password"))
(s/def ::new-password string?)
(s/def ::old-password string?)
(s/def ::password-state
(s/keys :req-un [::new-password ::old-password]))
(defn rotate []
(let [state {:new-password (read-secret "rotation-credential-secret/rotation-credential")
:old-password (read-secret "backup-secrets/restic-password")}]
(store-backup-repository-state (prn-str state))))
(rotate)