A Python wrapper for restic

Hello everyone,

What started out as a basic Shell script with some arguments to automate my backups is becoming is relatively useful Python application to automate said backups and provide some monitoring capabilities compliant with the Nagios format, so I decided to open source it and put it on GitHub: https://github.com/sephiroth1395/restic-PyBM

It works using a YAML configuration file and currently supports the following features:

  • Should transparently support all repository locations supported by restic.
  • Already tested with local and REST server repos. Feedback on other types welcome!
  • Repos initialisation
  • Execution of backups
  • Old snapshots cleanup based on an age policy
  • Repository health & age checks with Nagios-compliant outputs

On the middle term, I want to have some integration with HashiCorp Vault. First in a static way, i.e. the repositories passwords are stored in a kv secrets engine. Then, having a database plugin compatible with Vault (which I plan to develop) to generate on-the-fly ephemeral passwords.

The Vault support will come after I’m done implementing my planned backup architecture using restic. There’ll be write-up on my blog about how I designed said architecture and got it working with restic, but to each day its own work :grinning:

Any feedback on the tool is more than welcome. It’s mostly tailor-made for my needs but I thought some of you people out there might benefit from my work.

And by the way, shout out to the restic people. This project is the very definition of simple and efficient, I love it.