ipecache 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.gitignore +2 -0
- data/CHANGELOG.md +10 -3
- data/README.md +10 -0
- data/ipecache.gemspec +2 -1
- data/lib/ipecache/plugins/cloudfront.rb +69 -0
- data/lib/ipecache/plugins/fastly.rb +5 -9
- data/plugins/Cloudfront.md +46 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTdkNDBiMDBhNWNiMGUxYThkMmUxZmZlOTZlYTM1NTdlZWI2MTI0Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzdjZjA2MjY3ZDM0ZmY0Mjk0ZmZlMmRmODNkOWI2YTVhM2ZjYWZmOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODI5YWYxMzY3OTAyMmFkY2Q3NTgzN2E5OThiZTFjMGIzYmUwZDVkNWIzZTJk
|
10
|
+
N2EzMDMwNjgxOWRlNGY5ZjIyODJlMzJiZDBhNDU1OWZkOWQ2NzRhOWMxY2Fm
|
11
|
+
Njg5NzAwNjgwNzhkYjQxZmQ2YTM1NGZiOTMxYWQzY2UyNjJkN2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTRlODk2ZmU0ZTNlMmQxZmY1YTg0MTAxNGU4ZGNjMjA0MTIxNjk4MzBjOGMw
|
14
|
+
ZGY0NGNjOTU3OTJjZDcyMzU1Mjc0ZmFiN2MyZmE5YTU1ZmViYWNjMmJiMDgw
|
15
|
+
MzA0YzU2ZTkyMWMzY2U3MDdhZjRkYWU0MGI0Nzg4MDA4MTEwMzQ=
|
data/.gitignore
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
-
## 0.0.
|
1
|
+
## 0.0.10 (January 8th, 2015)
|
2
|
+
|
3
|
+
Bugfixes:
|
4
|
+
|
5
|
+
- Fix Fastly plugin to work without SSLv3, due to it being deprecated as a result of the POODLE vulnerability (Re-fixing https://github.com/jonlives/ipecache/issues/10)
|
6
|
+
|
7
|
+
|
8
|
+
## 0.0.9 (December 16th, 2014)
|
2
9
|
|
3
10
|
Features:
|
4
11
|
|
5
|
-
-
|
6
|
-
|
12
|
+
- Cloudfront plugin (Thanks to https://github.com/danieleva)
|
13
|
+
|
7
14
|
## 0.0.8 (August 14th, 2014)
|
8
15
|
|
9
16
|
Features:
|
data/README.md
CHANGED
@@ -56,6 +56,14 @@ plugins:
|
|
56
56
|
swisstxt_cdn:
|
57
57
|
api_key: sample_key_e8e55aff-61e3-4588-ab98-4d3ea58be7c8
|
58
58
|
api_secret: xyz5678xyz5678xyz5678xyz5678xyz5678xyz5678xyz5678
|
59
|
+
cloudfront:
|
60
|
+
access_key_id: yyyyyyyyyyyyyyyy
|
61
|
+
secret_access_key: xxxxxxxxxxxxxxxxxx
|
62
|
+
region: eu-west-1
|
63
|
+
batch_size: 3000
|
64
|
+
distributions:
|
65
|
+
- distribution1
|
66
|
+
- distribution2
|
59
67
|
```
|
60
68
|
|
61
69
|
#### atschef
|
@@ -79,6 +87,8 @@ For more information on how to configure the Local plugin, please read the [plug
|
|
79
87
|
#### SWISS TXT CDN
|
80
88
|
For more information on how to configure the SWISS TXT CDN plugin, please read the [plugins/SWISS_TXT_CDN.md](plugins/SWISS_TXT_CDN.md) file.
|
81
89
|
|
90
|
+
#### Amazon Cloudfront
|
91
|
+
For more information on how to configure the Amazon Cloudfront CDN plugin, please read the [plugins/Cloudfront.md](plugins/Cloudfront.md) file.
|
82
92
|
|
83
93
|
Ipecache Usage
|
84
94
|
-----------
|
data/ipecache.gemspec
CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'ipecache'
|
5
|
-
gem.version = '0.0.
|
5
|
+
gem.version = '0.0.10'
|
6
6
|
gem.authors = ["Jon Cowie"]
|
7
7
|
gem.email = 'jonlives@gmail.com'
|
8
8
|
gem.homepage = 'https://github.com/jonlives/ipecache'
|
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_runtime_dependency 'choice', '>= 0.1.6'
|
20
20
|
gem.add_runtime_dependency 'faraday_middleware', '>= 0.9.0'
|
21
21
|
gem.add_runtime_dependency 'public_suffix', '>= 1.4.2'
|
22
|
+
gem.add_runtime_dependency 'aws-sdk-v1', '>= 1.0'
|
22
23
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'ipecache/plugins/plugin'
|
2
|
+
|
3
|
+
module Ipecache
|
4
|
+
module Plugins
|
5
|
+
class CloudFront < Plugin
|
6
|
+
name :cloudfront
|
7
|
+
hooks :cdn_purge
|
8
|
+
|
9
|
+
def perform
|
10
|
+
safe_require 'aws-sdk-v1'
|
11
|
+
safe_require 'uri'
|
12
|
+
|
13
|
+
access_key_id = config.access_key_id
|
14
|
+
secret_access_key = config.secret_access_key
|
15
|
+
region = config.region
|
16
|
+
distributions = config.distributions
|
17
|
+
batch_size = config.batch_size || 3000
|
18
|
+
|
19
|
+
if access_key_id.nil?
|
20
|
+
plugin_puts "Cloudfront access id not specified, Exiting..."
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
if secret_access_key.nil?
|
25
|
+
plugin_puts "Cloudfront access key not specified, Exiting..."
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
29
|
+
if distributions.nil?
|
30
|
+
plugin_puts "Cloudfront distributions not specified, Exiting..."
|
31
|
+
exit 1
|
32
|
+
end
|
33
|
+
|
34
|
+
if region.nil?
|
35
|
+
plugin_puts "Cloudfront region not specified, Exiting..."
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
plugin_puts "Beginning URL Purge from CloudFront..."
|
40
|
+
|
41
|
+
AWS.config(
|
42
|
+
:access_key_id => access_key_id,
|
43
|
+
:secret_access_key => secret_access_key,
|
44
|
+
:region => region
|
45
|
+
)
|
46
|
+
cf = AWS::CloudFront.new()
|
47
|
+
|
48
|
+
urls.each_slice(batch_size) do |u|
|
49
|
+
paths = []
|
50
|
+
u.each { |x| paths << URI.parse(x).path}
|
51
|
+
distributions.each do |distri|
|
52
|
+
plugin_puts "Purging #{u.length} items from #{distri}"
|
53
|
+
result = cf.client.create_invalidation(
|
54
|
+
:distribution_id => distri,
|
55
|
+
:invalidation_batch => {
|
56
|
+
:paths => {
|
57
|
+
:quantity => paths.length,
|
58
|
+
:items => paths
|
59
|
+
},
|
60
|
+
:caller_reference => "Ipecache_#{Time.now}"
|
61
|
+
}
|
62
|
+
)
|
63
|
+
plugin_puts "#{result[:id]}: #{result[:status]}, #{result[:invalidation_batch][:paths][:items].length} item(s)"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -22,10 +22,10 @@ module Ipecache
|
|
22
22
|
urls.each do |u|
|
23
23
|
url = u.chomp
|
24
24
|
plugin_puts ("Purging #{url}")
|
25
|
-
hostname = URI.parse(url).host
|
26
|
-
path = URI.parse(url).path
|
27
25
|
|
28
|
-
|
26
|
+
uri = URI.parse("https://api.fastly.com/purge/#{url}")
|
27
|
+
|
28
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
29
29
|
http.use_ssl = true
|
30
30
|
|
31
31
|
# Fix for https://github.com/jonlives/ipecache/issues/10
|
@@ -33,16 +33,12 @@ module Ipecache
|
|
33
33
|
# which causes Fastly's API to return a 400
|
34
34
|
# as the hostname is changed to the URL being purged after
|
35
35
|
# SSL handshake.
|
36
|
-
http.ssl_version = 'SSLv3'
|
37
36
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
38
37
|
|
39
|
-
request = Net::HTTP::
|
40
|
-
request.add_field("X-Forwarded-For", "0.0.0.0")
|
38
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
41
39
|
request.add_field("Accept", "application/json")
|
42
40
|
request.add_field("User-Agent", "Ipecache")
|
43
|
-
request.add_field("
|
44
|
-
request.add_field("X-Fastly-Key", api_key)
|
45
|
-
request.add_field("Host", hostname)
|
41
|
+
request.add_field("Fastly-Key", api_key)
|
46
42
|
|
47
43
|
response = http.request(request)
|
48
44
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
CloudFront
|
2
|
+
==========
|
3
|
+
Purge URLs from the CloudFront CDN.
|
4
|
+
|
5
|
+
Hooks
|
6
|
+
-----
|
7
|
+
- `cdn_purge`
|
8
|
+
|
9
|
+
Configuration
|
10
|
+
-------------
|
11
|
+
```yaml
|
12
|
+
plugins:
|
13
|
+
cloudfront:
|
14
|
+
access_key_id: yyyyyyyyyyyyyyyy
|
15
|
+
secret_access_key: xxxxxxxxxxxxxxxxxx
|
16
|
+
region: eu-west-1
|
17
|
+
batch_size: 3000
|
18
|
+
distributions:
|
19
|
+
- distribution1
|
20
|
+
- distribution2
|
21
|
+
```
|
22
|
+
|
23
|
+
#### access_key_id
|
24
|
+
This is your aws access id
|
25
|
+
|
26
|
+
- Type: `String`
|
27
|
+
|
28
|
+
#### secret_access_key
|
29
|
+
This is your aws access key
|
30
|
+
|
31
|
+
- Type: `String`
|
32
|
+
|
33
|
+
#### distributions
|
34
|
+
This is a list of CF distributions
|
35
|
+
|
36
|
+
- Type `Array`
|
37
|
+
|
38
|
+
### region
|
39
|
+
This is the AWS region of your CF distributions
|
40
|
+
|
41
|
+
- Type `String`
|
42
|
+
|
43
|
+
### batch_size
|
44
|
+
This is the number of items to be included for each invalidation request, default to 3000 (aws max limit)
|
45
|
+
|
46
|
+
- Type `Integer`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipecache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Cowie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: app_conf
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.4.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: aws-sdk-v1
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
69
83
|
description: An extensible tool for purging urls from caches and CDNs
|
70
84
|
email: jonlives@gmail.com
|
71
85
|
executables:
|
@@ -73,6 +87,7 @@ executables:
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
90
|
+
- .gitignore
|
76
91
|
- CHANGELOG.md
|
77
92
|
- Gemfile
|
78
93
|
- Gemfile.lock
|
@@ -86,6 +101,7 @@ files:
|
|
86
101
|
- lib/ipecache/plugins/akamai.rb
|
87
102
|
- lib/ipecache/plugins/ats_chef.rb
|
88
103
|
- lib/ipecache/plugins/cloudflare.rb
|
104
|
+
- lib/ipecache/plugins/cloudfront.rb
|
89
105
|
- lib/ipecache/plugins/edgecast.rb
|
90
106
|
- lib/ipecache/plugins/fastly.rb
|
91
107
|
- lib/ipecache/plugins/local.rb
|
@@ -95,6 +111,7 @@ files:
|
|
95
111
|
- plugins/ATSChef.md
|
96
112
|
- plugins/Akamai.md
|
97
113
|
- plugins/CloudFlare.md
|
114
|
+
- plugins/Cloudfront.md
|
98
115
|
- plugins/Edgecast.md
|
99
116
|
- plugins/Fastly.md
|
100
117
|
- plugins/Local.md
|