GithubHelp home page GithubHelp logo

mortal / merkelbackup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antialize/merkelbackup

0.0 2.0 0.0 202 KB

Incrememetal backup solution based on merkel trees

License: MIT License

Dockerfile 0.72% Rust 90.02% Python 8.91% Shell 0.35%

merkelbackup's Introduction

MerkelBackup

Travis Build Status MIT licensed

MerkelBackup is a simple backup solution based on merkel trees. MerkelBackup backups are:

  • Incremental: Files are split into chunks of 64MB and only changed chunks are stored.
  • Encrypted: The data on the server is encrypted using chacha20, so that a compromise of the backup server does not leak the data.
  • Deduplicated: File chunks and folders are stored by hash value in the merkel tree on the server, so duplicate files even from different servers are only stored once.
  • Checksumed: File chenks and folders are stored in a merkel tree by hash value on the server, and the integrity of the data is validated on restore.

MerkelBackup consists of a server mbackupd and a client mbackup. The client connects to the server over a REST api.

Installing

To install the server and client extract the source and run

cargo build --release
cargo install --path . --root /usr

Running the server

First create a config file in /etc/mbackupd.toml with content like below:

bind = "0.0.0.0:3321"
data_dir = "/var/mbackup"
ssl_cert = "/etc/cert.pxf"
ssl_key = "hunter1"

[[users]]
name = "backup"
password = "hunter2"
access_level = "Put"

[[users]]
name = "recover"
password = "hunter3"
access_level = "Get"

[[users]]
name = "admin"
password = "hunter4"
access_level = "Delete"

Make sure that /etc/cert.pxf is a valid DER-formatted PKCS #12 archive for the host the backup server is running on, and that ssl_key is the key the certificiate is encrypted with. To generate a .pfx from an openssl certificate run

openssl pkcs12 -export -out cert.pfx -inkey key.pem -in cert.pem -certfile chain_certs.pem

Also make sure that the /var/mbackup directory exists and is writable by whatever user you want the server to run as.

Finally you can run the backup server as

mbackup -c /etc/mbackupd.toml

Note that the server does not demonize, if you want that create a systemd service file or run the server through docker. Also note that the server uses simple http basic auth, and that the passwords are stored in plain text, so use long auto generated passwords like the output from sh pwgen -n 30

Running the client

First create a config file in /etc/mbackup.toml with content like below:

user = "backup"
password = "hunter2"
encryption_key = "MySecretEncryptionKey"
server = "https://backup.example.com"
backup_dirs = [
    "/home/importantuser",
    "/var/importantdata",
]
cache_db = "/var/cache/mbackup/cache.db"

Make sure that the /var/cache/mbackup/ dir exists and is writable by whatever user the backup client should be run as.

To perform a backup run

mbackup backup

To recover from a backup run

mbackup -c /etc/mbackup.toml --user recover --password hunter3 roots

To get a list of backup roots, find the id of the root you want to restore from (say 42) and run

mbackup -c /etc/mbackup.toml --user recover --password hunter3 restore 42 -p /home/importantuser/mydir

To remove old backups and free up space run

mbackup -c /etc/mbackup.toml --user admin --password hunter4 prune --age 90

This will remove all backups older than 90 days.

To validate the integrety of the backedup date run

mbackup -c /etc/mbackup.toml --user recover --password hunter3 validate --full

Stability

This software has has not been tested extensively so use it at your own peril.

merkelbackup's People

Contributors

antialize avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.