{ "info": { "author": "Jonathan Buys", "author_email": "jonathan.buys@targetsmart.com", "bugtrack_url": null, "classifiers": [], "description": "# cloudchain: Easy, Secure Secrets\n\ncloudchain is designed to make it easy to store and retrieve secrets using AWS. cloudchain relies on the AWS Identity and Access Management (IAM) [Key Management Service][1] (KMS) to securely store and manage access to encryption keys, and stores the encrypted secret in a [DynamoDB][2] table.\n\nThere are three steps in the process. First, cloudchain retrieves an encryption key from KMS and uses it to encrypt the plain text secret. The boto3 library used returns a dictionary with a \"Ciphertext\" entry containing the encrypted key. cloudchain then base64 encodes the encrypted key into a string, and saves that string to a DynamoDB table named, by default, \"safedb\". \n\n## Setup\n\nInstall with pip:\n\n`pip install cloudchain`\n\nA new encryption key should be created in KMS. Using the console makes this easy, and sets up permissions to the key using IAM users or Roles. IAM users should be given permission individually, while instances launching in AWS should be identified by a role. \n\nA new DynamoDB table should be created as well. Run this command using the AWS CLI tools:\n\n\n\taws dynamodb create-table \\\n\t--table-name safedb \\\n\t--attribute-definitions \\\n\tAttributeName=Service,AttributeType=S \\\n\tAttributeName=Username,AttributeType=S \\\n\t--key-schema \\\n\tAttributeName=Service,KeyType=HASH \\\n\tAttributeName=Username,KeyType=RANGE \\\n\t--provisioned-throughput \\\n\tReadCapacityUnits=1,WriteCapacityUnits=1 \n\n\n\nThis will create the DynamoDB table with two attributes: Service and Username. cloudchain assumes that the combination of a service and a username will require a unique secret. The first time a secret is written to the table the third \"Secret\" attribute is created. \n\n## Configuration\n\nThe cloudchain cli, `cchain`, looks for a configuration file at `~/.cchainrc`. This should be a standard Python ConfigParser compatible file with the following format:\n\n\t[dynamo]\n\tregion_name = us-east-1\n\tendpoint_url = https://dynamodb.us-east-1.amazonaws.com\n\ttablename = safedb\n\n\t[IAMKMS]\n\tkeyalias = alias/key\n\nThe \"keyalias\" should be the name of the KMS encryption key created during the setup, prefixed by \"alias/\". The \"endpoint_url\" should point at the closest HTTPS endpoint, or at localhost if using a local development environment. \n\n## Import cloudchain as a Module\n\nBoth the `test.py` unit tests and the `cchain` cli import `cloudchain.py`. After importing, cloudchain expects four variables to be set:\n\n* region_name\n* endpoint_url\n* tablename \n* keyalias\n\nReasonable defaults are mentioned in the configuration section above, but the `keyalias` must be unique. \n\nAfter importing, cloudchain can be called on to encrypt and decrypt secrets:\n\nTo Encrypt:\n\n`cloudchain.savecreds(args['service'], args['user'], args['save'])`\n\nTo Decrypt: \n`cloudchain.readcreds(args['service'], args['user'])`\n\nWhere:\n\n* service = The service name the username and secret are associated with\n* user = The username\n* save = The unencrypted secret to encrypt\n\n## Command Line Use\n\nThe command line script supports five arguments:\n\n\t -h, --help show this help message and exit\n\t -u USER, --user USER User name\n\t -e SERVICE, --service SERVICE\n\t\t\t\t\t\t\tService or application\n\t -s SAVE, --save SAVE Save password to the safe\n\t -r, --read Read password from the safe\n\n\n* The `--save` and `--read` arguments are mutually exclusive, and cannot be used at the same time. \n* `--save` expects the unencrypted secret as an argument, and requires both `--user` and `--service` flags.\n* `--user` expects the username as an argument.\n* `--service` expects the service name as an argument.\n* `--read` requires no arguments, and requires both `--user` and `--service` flags.\n\n\n\n### Examples\n\nTo save a secret:\n\n`cchain -u testuser --service testservice --save testsecreet` \n\nTo retrieve a secret:\n\n`cchain -u testuser --service testservice --read`\n\n\n[1]: https://aws.amazon.com/kms/?tag=duckduckgo-osx-20\n[2]: https://aws.amazon.com/dynamodb/\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/targetsmart-devops/cloudchain.git", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/targetsmart-devops/cloudchain.git", "keywords": "secrets,password,account", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "cloudchain", "package_url": "https://pypi.org/project/cloudchain/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cloudchain/", "project_urls": { "Download": "https://github.com/targetsmart-devops/cloudchain.git", "Homepage": "https://github.com/targetsmart-devops/cloudchain.git" }, "release_url": "https://pypi.org/project/cloudchain/0.1.4/", "requires_dist": null, "requires_python": null, "summary": "Secure, easy secrets.", "version": "0.1.4" }, "last_serial": 2342807, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "59bc9b102108ed4a160ff4396dc3439e", "sha256": "8a1431fbaa7abd792af75219effea6cd7e3a236ba694a00c6eb4b40256342769" }, "downloads": -1, "filename": "cloudchain-0.1.2.tar.gz", "has_sig": false, "md5_digest": "59bc9b102108ed4a160ff4396dc3439e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5697, "upload_time": "2016-07-14T13:19:33", "url": "https://files.pythonhosted.org/packages/ea/4b/35f76fc9129ac532cc053f72ce23d5ed4d8bb1a74183f9a403720a274f2b/cloudchain-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "6528509351024ca0c99b11383dd7e3ca", "sha256": "f52ec39dd0fc429198b250f8874c0f6075cab4320809fe2252e5e6a764707e98" }, "downloads": -1, "filename": "cloudchain-0.1.3.tar.gz", "has_sig": false, "md5_digest": "6528509351024ca0c99b11383dd7e3ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5914, "upload_time": "2016-08-12T13:02:37", "url": "https://files.pythonhosted.org/packages/91/64/0a18de90fa91c2cd3dd7d0791bfd429ce7b94fee76f8db68b20f2afa448e/cloudchain-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "bca4b69e04896291f693079602e328af", "sha256": "a512861dbfd3647a342c5c9b123981f8ede4e0d01b930e23f35e65313cbb883b" }, "downloads": -1, "filename": "cloudchain-0.1.4.tar.gz", "has_sig": false, "md5_digest": "bca4b69e04896291f693079602e328af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6007, "upload_time": "2016-09-14T18:22:08", "url": "https://files.pythonhosted.org/packages/3b/d7/43e1bdb1b8c26cc1abecbdb2bfbcaec1ed506f0b145236fd1b854137351b/cloudchain-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bca4b69e04896291f693079602e328af", "sha256": "a512861dbfd3647a342c5c9b123981f8ede4e0d01b930e23f35e65313cbb883b" }, "downloads": -1, "filename": "cloudchain-0.1.4.tar.gz", "has_sig": false, "md5_digest": "bca4b69e04896291f693079602e328af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6007, "upload_time": "2016-09-14T18:22:08", "url": "https://files.pythonhosted.org/packages/3b/d7/43e1bdb1b8c26cc1abecbdb2bfbcaec1ed506f0b145236fd1b854137351b/cloudchain-0.1.4.tar.gz" } ] }