Skip to content
🔒Password protection (and encryption) for your laravel backups.
Branch: master
Clone or download
Latest commit 42ad7e8 Apr 9, 2019

README.md

Laravel Backup Shield

Latest Version on Packagist Software License Build Status Scrutinizer Score

backup-shield

Secure your backups

This package helps you encrypt and password-protect your backups taken with Spatie's fantastic spatie/laravel-backup-package.

Backup Shield simply listens for when the .zip-file generated by Laravel-backup is done, grabs it and applies your password and encryption of your liking.

Using Laravel 5.2? Check out the v1 branch.

Installation

composer require olssonm/laravel-backup-shield

Requires PHP: "^7.0" and laravel/framework: "^5.3". As long as other requirements are met, all versions of spatie/laravel-backup above 4.0 should work.

In Laravel > 5.5 the service provider will be automatically added. You can also add the service provider to your app.php manually if needed:

'providers' => [
    Olssonm\BackupShield\BackupShieldServiceProvider::class
]

Configuration

Publish your configuration using php artisan vendor:publish. Or if you're using a version of Laravel prior to 5.5 via php artisan vendor:publish --provider="Olssonm\BackupShield\BackupShieldServiceProvider".

You only have the ability to set two different options; password and encryption.

// Default configuration; backup-shield.php
return [
    'password' => env('APP_KEY'),
    'encryption' => \Olssonm\BackupShield\Encryption::ENCRYPTION_DEFAULT
];

Password

Your password (duh). The default is the application key (APP_KEY in your .env-file). You might want to set something more appropriate. Remember to use long strings and to keep your password safe – without it you will never be able to open your backup.

Set to NULL if you want to keep your backup without a password.

Encryption

Set your type of encryption. Available options are:

\Olssonm\BackupShield\Encryption::ENCRYPTION_DEFAULT (PKWARE/ZipCrypto)
\Olssonm\BackupShield\Encryption::ENCRYPTION_WINZIP_AES_128 (AES 128)
\Olssonm\BackupShield\Encryption::ENCRYPTION_WINZIP_AES_192 (AES 192)
\Olssonm\BackupShield\Encryption::ENCRYPTION_WINZIP_AES_256 (AES 256)

Important information regarding encryption

Using the ENCRYPTION_DEFAULT (PKWARE/ZipCrypto) crypto gives you the best portability as most operating systems can natively unzip the file – however, ZipCrypto might be weak. The Winzip AES-methods on the other hand might require a separate app and/or licence to be able to unzip depending on your OS; suggestions for macOS are Keka and Stuffit Expander.

Also to note is that when zipping very large files ZipCrypto might be very inefficient as the entire data-set will have to be loaded into memory to perform the encryption, if the zipped file's content is bigger than your available RAM you will run out of memory.

Testing

$ composer test

or

$ phpunit

License

The MIT License (MIT). Please see the LICENSE.md for more information.

© 2019 Marcus Olsson.

You can’t perform that action at this time.