June 12th, 2015
Cloud Files Monitor is a new program I recently wrote to monitor my sites for unauthorized changes. It allows you to know when any of the files in your Rackspace Cloud Files containers have been modified and quickly restore them.
This program stores the MD5 hash of all files stored in a Rackspace Cloud Files container inside of a SQLite database. At a user-configurable interval, the program reaches out to Cloud Files and grabs the MD5 hash of each file. If the hashes do not match what is in the database (or any files have been added), Cloud Files Monitor sends out an email to inform you that there have been changes made to this sitepy. This email tells you:
- Which container was modified
- Which files in the container have been changed
- A link to approve the changes
- A link to revert those changes
Cloud Files Monitor spins up an HTTP listener to allow these links to work. The approve link simply adds the new hashes to your files to the database. The restore link will run a command that can be configured per-site to restore the database. I use this in conjunction with Cloud Files Deploy to allow easy restoration of the site from a local copy.
This program has been written to be easily extended with new cloud providers. I have started with Rackspace Cloud Files since I use them to host my sites.
The source code and a more detailed README file can be found on this project’s page on GitHub.