relishable 0.34 → 0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -8
- data/lib/relish.rb +0 -1
- data/lib/relish/release.rb +1 -0
- data/lib/relish/version.rb +1 -1
- metadata +16 -4
- data/lib/relish/cloudfront_helper.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bf410339f64a0e2526441a2717017414062e45d
|
4
|
+
data.tar.gz: f7f11bf1ac673c8a73de78967a1152c86c358ab1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a3dd84d20f1bed8e335ddf3999569dc005e7a8a05ba015d6b28f51326ee5431a7aa53589c753889e867f457a8feac0e620181bf508f7d97dff406916571f310
|
7
|
+
data.tar.gz: c0e8e81b5bf9b9555c75640db400b5888e768cbbabaa4af24cae118b69cd1a9d180428a6f33a1266cdfec418235433389634e297a4743c8d13eeb5c40510fc19
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relishable (0.
|
4
|
+
relishable (0.35)
|
5
5
|
fog (~> 1.23.0)
|
6
6
|
legacy-fernet (~> 1.6.3)
|
7
7
|
|
@@ -25,17 +25,15 @@ GEM
|
|
25
25
|
fog-core (~> 1.22)
|
26
26
|
fog-json
|
27
27
|
inflecto (~> 0.0.2)
|
28
|
-
fog-core (1.
|
28
|
+
fog-core (1.33.0)
|
29
29
|
builder
|
30
30
|
excon (~> 0.45)
|
31
31
|
formatador (~> 0.2)
|
32
32
|
mime-types
|
33
|
-
net-scp (~> 1.1)
|
34
|
-
net-ssh (>= 2.1.3)
|
35
33
|
fog-json (1.0.2)
|
36
34
|
fog-core (~> 1.0)
|
37
35
|
multi_json (~> 1.10)
|
38
|
-
fog-softlayer (1.0.
|
36
|
+
fog-softlayer (1.0.2)
|
39
37
|
fog-core
|
40
38
|
fog-json
|
41
39
|
formatador (0.2.5)
|
@@ -46,11 +44,9 @@ GEM
|
|
46
44
|
mime-types (2.6.2)
|
47
45
|
mini_portile (0.6.2)
|
48
46
|
multi_json (1.11.2)
|
49
|
-
net-scp (1.2.1)
|
50
|
-
net-ssh (>= 2.6.5)
|
51
|
-
net-ssh (3.0.1)
|
52
47
|
nokogiri (1.6.6.2)
|
53
48
|
mini_portile (~> 0.6.0)
|
49
|
+
power_assert (0.2.2)
|
54
50
|
rake (10.4.2)
|
55
51
|
rspec (3.1.0)
|
56
52
|
rspec-core (~> 3.1.0)
|
@@ -65,6 +61,8 @@ GEM
|
|
65
61
|
rspec-support (~> 3.1.0)
|
66
62
|
rspec-support (3.1.2)
|
67
63
|
safe_yaml (1.0.4)
|
64
|
+
test-unit (3.0.8)
|
65
|
+
power_assert
|
68
66
|
webmock (1.19.0)
|
69
67
|
addressable (>= 2.3.6)
|
70
68
|
crack (>= 0.3.2)
|
@@ -76,6 +74,7 @@ DEPENDENCIES
|
|
76
74
|
rake (> 0)
|
77
75
|
relishable!
|
78
76
|
rspec (~> 3.1.0)
|
77
|
+
test-unit
|
79
78
|
webmock (~> 1.19.0)
|
80
79
|
|
81
80
|
BUNDLED WITH
|
data/lib/relish.rb
CHANGED
data/lib/relish/release.rb
CHANGED
data/lib/relish/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relishable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.35'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Fine
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog
|
@@ -69,6 +69,20 @@ dependencies:
|
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: 3.1.0
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: test-unit
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
72
86
|
- !ruby/object:Gem::Dependency
|
73
87
|
name: webmock
|
74
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +110,6 @@ files:
|
|
96
110
|
- Gemfile
|
97
111
|
- Gemfile.lock
|
98
112
|
- lib/relish.rb
|
99
|
-
- lib/relish/cloudfront_helper.rb
|
100
113
|
- lib/relish/dynamo_helper.rb
|
101
114
|
- lib/relish/encryption_helper.rb
|
102
115
|
- lib/relish/release.rb
|
@@ -126,4 +139,3 @@ signing_key:
|
|
126
139
|
specification_version: 4
|
127
140
|
summary: releases
|
128
141
|
test_files: []
|
129
|
-
has_rdoc:
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# Adapted from https://github.com/stlondemand/aws_cf_signer
|
2
|
-
# Modified to support in-memory instead of on-disk signing keys
|
3
|
-
require 'openssl'
|
4
|
-
require 'time'
|
5
|
-
require 'base64'
|
6
|
-
|
7
|
-
class Relish
|
8
|
-
class CloudFrontHelper
|
9
|
-
|
10
|
-
attr_reader :key_pair_id
|
11
|
-
|
12
|
-
def initialize(pem, key_pair_id)
|
13
|
-
@key = OpenSSL::PKey::RSA.new(pem)
|
14
|
-
@key_pair_id = key_pair_id
|
15
|
-
end
|
16
|
-
|
17
|
-
def sign(url_to_sign, policy_options = {})
|
18
|
-
separator = url_to_sign =~ /\?/ ? '&' : '?'
|
19
|
-
if policy_options[:policy_file]
|
20
|
-
policy = IO.read(policy_options[:policy_file])
|
21
|
-
"#{url_to_sign}#{separator}Policy=#{encode_policy(policy)}&Signature=#{create_signature(policy)}&Key-Pair-Id=#{@key_pair_id}"
|
22
|
-
else
|
23
|
-
raise ArgumentError.new("'ending' argument is required") if policy_options[:ending].nil?
|
24
|
-
if policy_options.keys.size == 1
|
25
|
-
# Canned Policy - shorter URL
|
26
|
-
expires_at = epoch_time(policy_options[:ending])
|
27
|
-
policy = %({"Statement":[{"Resource":"#{url_to_sign}","Condition":{"DateLessThan":{"AWS:EpochTime":#{expires_at}}}}]})
|
28
|
-
"#{url_to_sign}#{separator}Expires=#{expires_at}&Signature=#{create_signature(policy)}&Key-Pair-Id=#{@key_pair_id}"
|
29
|
-
else
|
30
|
-
# Custom Policy
|
31
|
-
resource = policy_options[:resource] || url_to_sign
|
32
|
-
policy = generate_custom_policy(resource, policy_options)
|
33
|
-
"#{url_to_sign}#{separator}Policy=#{encode_policy(policy)}&Signature=#{create_signature(policy)}&Key-Pair-Id=#{@key_pair_id}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def generate_custom_policy(resource, options)
|
39
|
-
conditions = ["\"DateLessThan\":{\"AWS:EpochTime\":#{epoch_time(options[:ending])}}"]
|
40
|
-
conditions << "\"DateGreaterThan\":{\"AWS:EpochTime\":#{epoch_time(options[:starting])}}" if options[:starting]
|
41
|
-
conditions << "\"IpAddress\":{\"AWS:SourceIp\":\"#{options[:ip_range]}\"" if options[:ip_range]
|
42
|
-
%({"Statement":[{"Resource":"#{resource}","Condition":{#{conditions.join(',')}}}}]})
|
43
|
-
end
|
44
|
-
|
45
|
-
def epoch_time(timelike)
|
46
|
-
case timelike
|
47
|
-
when String then Time.parse(timelike).to_i
|
48
|
-
when Time then timelike.to_i
|
49
|
-
else raise ArgumentError.new("Invalid argument - String or Time required - #{timelike.class} passed.")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def encode_policy(policy)
|
54
|
-
url_safe(Base64.encode64(policy))
|
55
|
-
end
|
56
|
-
|
57
|
-
def create_signature(policy)
|
58
|
-
url_safe(Base64.encode64(@key.sign(OpenSSL::Digest::SHA1.new, (policy))))
|
59
|
-
end
|
60
|
-
|
61
|
-
def url_safe(s)
|
62
|
-
s.gsub('+','-').gsub('=','_').gsub('/','~').gsub(/\n/,'').gsub(' ','')
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|