Package: s3sfe
s3sfes3sfe (S3 Sync Filelist Encrypted) Sync a list of files to S3, using server-side encryption with customer-provided keys.IntroductionThis is a quick script I wrote for my own purposes. It’s not terribly well tested,
and it serves a small niche use case. If you’re looking to securely sync your
backups to S3 or another offsite storage, I’d highly encourage you to look into the
other options.My use case is relatively simple:I want to sync just some files from my backups to S3; a specific whitelist of
files and directories.I don’t want to keep history, I just want the latest versions somewhere offsite.I want to useS3 Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C); I’m fine keeping the key on my computer, because if someone can get it, they can get the original files too. I’m not worried about Amazon snooping on my data. I’m not concerned with anyone being able to access the filenames or metadata. All I’m really concerned about is that if a malicious party gets access to my AWS account, they don’t also implicitly get the file contents.This tool takes a list of files or directories on the local filesystem and syncs them to S3, using server-side encryption. It uses the files’ md5sums to only upload files that differ from what’s already in S3.RequirementsPython 2.7 or 3.3+ (currently tested with 2.7, 3.3+ and developed with 3.6)PythonVirtualEnvandpip(recommended installation method; your OS/distribution should have packages for these)InstallationIt’s recommended that you install into a virtual environment (virtualenv /
venv). See thevirtualenv usage documentationfor information on how to create a venv.pipinstalls3sfeConfigurations3sfe takes all of its configuration via command-line options. It does, however,
expect a few elements of configuration to be present on the system:Your AWS Credentials must be available to the program in one of themethods supported by boto3, typically either environment variables or one of the supported credentials files (~/.aws/credentialsor~/.aws/config) or boto configuration files (~/.botoor/etc/boto.cfg).Your encryption key forS3 Server-Side Encryption with Customer-Provided Encryption Keys (SSE-C)must be stored in a file readable by this program. This must be a 256-bit AES256 key, stored in binary format.UsageTo backup:s3sfe--helpTo restore:s3sfe-restore--helpBugs and Feature RequestsBug reports and feature requests are happily accepted via theGitHub Issue Tracker. Pull requests are
welcome. Issues that don’t have an accompanying pull request will be worked on
as my time and priority allows.DevelopmentTo install for development:Fork thes3sferepository on GitHubCreate a new branch off of master in your fork.$virtualenvs3sfe$cds3sfe&&sourcebin/activate$pipinstall-egit+git@github.com:YOURNAME/s3sfe.git@BRANCHNAME#egg=s3sfe$cdsrc/s3sfeThe git clone you’re now in will probably be checked out to a specific commit,
so you may want togit checkout BRANCHNAME.Guidelinespep8 compliant with some exceptions (see pytest.ini)100% test coverage with pytest (with valid tests)TestingTesting is done viapytest, driven bytox.testing is as simple as:pip install toxtoxIf you want to pass additional arguments to pytest, add them to the tox command line after “–”. i.e., for verbose pytext output on py27 tests:tox-epy27---vRelease ChecklistOpen an issue for the release; cut a branch off master for that issue.Confirm that there are CHANGES.rst entries for all major changes.Ensure that Travis tests passing in all environments.Ensure that test coverage is no less than the last release (ideally, 100%).Increment the version number in s3sfe/version.py and add version and release date to CHANGES.rst, then push to GitHub.Confirm that README.rst renders correctly on GitHub.Upload package to testpypi:Make sure your ~/.pypirc file is correct (a repo calledtestforhttps://testpypi.python.org/pypi)rm-Rfdistpython setup.py register-rhttps://testpypi.python.org/pypipython setup.py sdist bdist_wheeltwine upload-rtest dist/*Check that the README renders athttps://testpypi.python.org/pypi/s3sfeCreate a pull request for the release to be merged into master. Upon successful Travis build, merge it.Tag the release in Git, push tag to GitHub:tag the release. for now the message is quite simple:git tag-s-aX.Y.Z-m'X.Y.Z releasedYYYY-MM-DD'push the tag to GitHub:git push origin X.Y.ZUpload package to live pypi:twine upload dist/*make sure any GH issues fixed in the release were closed.