kms_encrypted 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 844c888ff1036e25341d665534193770b363f2d1
4
- data.tar.gz: 042e30c929e4db3e7d7c18d692cc78ce220932c7
3
+ metadata.gz: 4319f0f40f5294c89119d36ebaba64696eb9abeb
4
+ data.tar.gz: 46933afe998badcf3b95814e0d9c1144f432d822
5
5
  SHA512:
6
- metadata.gz: 14e1be577cf7639c7f4eea48f1b03a56315adcd82d6efc4d38ecf6662793947202c4ded1f0d674eb860b60da4e8081a65515949a3810384c6c7b91d666d8bc9a
7
- data.tar.gz: 359927d6b27361c62434e49be3b1a90d9498119d73a5f098f903eadbad4afef3a879bb61ee19d8f8d41753a91e11cbe461a4b79a307d6a4b06238a5908a9cbea
6
+ metadata.gz: 2ca6b3da8040d329ee3a4bac21e0a06e82c9c423fed259e62508dd92332196eac46034d3803760baffc3c312a7618594fd1c0caefe7b25ebc8b57305e176501d
7
+ data.tar.gz: 56520a00ea21504b321e6e93f8f43283cd37a1b75d84661cb4e2a85d2ead8dda11062eb307bb8b4258c26ebdc3b0fcad017d335e9e9471314e0f393e69632f50
@@ -1,3 +1,7 @@
1
+ ## 0.1.2
2
+
3
+ - Use `KMS_KEY_ID` env variable by default
4
+
1
5
  ## 0.1.1
2
6
 
3
7
  - Added key rotation
data/README.md CHANGED
@@ -33,7 +33,7 @@ Add a column to store encrypted KMS data keys
33
33
  add_column :users, :encrypted_kms_key, :string
34
34
  ```
35
35
 
36
- Create a [KMS master key](https://console.aws.amazon.com/iam/home#/encryptionKeys) and set it in your environment (we recommend [dotenv](https://github.com/bkeepers/dotenv))
36
+ Create a [KMS master key](https://console.aws.amazon.com/iam/home#/encryptionKeys) and set it in your environment ([dotenv](https://github.com/bkeepers/dotenv) is great for this)
37
37
 
38
38
  ```sh
39
39
  KMS_KEY_ID=arn:aws:kms:...
@@ -43,7 +43,7 @@ And update your model
43
43
 
44
44
  ```ruby
45
45
  class User < ApplicationRecord
46
- has_kms_key ENV["KMS_KEY_ID"]
46
+ has_kms_key
47
47
 
48
48
  attr_encrypted :email, key: :kms_key
49
49
  end
@@ -78,7 +78,7 @@ class User < ApplicationRecord
78
78
  end
79
79
  ```
80
80
 
81
- We recommend [Amazon Athena](https://aws.amazon.com/athena/) for querying CloudTrail logs. Create a table (thanks to [this post](http://www.1strategy.com/blog/2017/07/25/auditing-aws-activity-with-cloudtrail-and-athena/) for the table structure) with:
81
+ [Amazon Athena](https://aws.amazon.com/athena/) is great for querying CloudTrail logs. Create a table (thanks to [this post](http://www.1strategy.com/blog/2017/07/25/auditing-aws-activity-with-cloudtrail-and-athena/) for the table structure) with:
82
82
 
83
83
  ```sql
84
84
  CREATE EXTERNAL TABLE cloudtrail_logs (
@@ -159,7 +159,7 @@ KMS_KEY_ID=arn:aws:kms:...
159
159
 
160
160
  and run
161
161
 
162
- ```sh
162
+ ```ruby
163
163
  User.find_each do |user|
164
164
  user.rotate_kms_key!
165
165
  end
@@ -179,8 +179,8 @@ And update your model
179
179
 
180
180
  ```ruby
181
181
  class User < ApplicationRecord
182
- has_kms_key ENV["KMS_KEY_ID"]
183
- has_kms_key ENV["KMS_KEY_ID"], name: :phone
182
+ has_kms_key
183
+ has_kms_key name: :phone, key_id: "..."
184
184
 
185
185
  attr_encrypted :email, key: :kms_key
186
186
  attr_encrypted :phone, key: :kms_key_phone
@@ -8,7 +8,8 @@ module KmsEncrypted
8
8
  end
9
9
 
10
10
  module Model
11
- def has_kms_key(key_id, name: nil)
11
+ def has_kms_key(legacy_key_id = nil, name: nil, key_id: nil)
12
+ key_id ||= legacy_key_id || ENV["KMS_KEY_ID"]
12
13
  raise ArgumentError, "Missing key id" unless key_id
13
14
 
14
15
  key_method = name ? "kms_key_#{name}" : "kms_key"
@@ -1,3 +1,3 @@
1
1
  module KmsEncrypted
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kms_encrypted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-24 00:00:00.000000000 Z
11
+ date: 2017-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-kms