certmeister 0.2.3 → 0.3.0

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: 2a1dc0d6cb9c023dff3eb527f546afbad9f7a5a8
4
- data.tar.gz: aa70c68eaa079200a7c7e32aa61d7199da762e91
3
+ metadata.gz: 1a3a1d325b8d922702cdc4b1f6a7188e2c4cb8c0
4
+ data.tar.gz: 6aa00bbb80a4e13cfa652f664c2e0a56435c14d8
5
5
  SHA512:
6
- metadata.gz: 72ff500fc3e710490fdb428b0d2691f98ed7f3d4ea67a39cb39b30af3639512d073f257bff2150615787ab6e062da4a61be2fefbc4c91fb66c6f0e04f308df53
7
- data.tar.gz: d575f3badcad0e32659395b2446d5e4549e0e50299070512ed648bd186dccd9d1f60ee075027b8086499278ba31e670bd4f6b025ed279680d6b13451c5b230bc
6
+ metadata.gz: 3fae8dfbe3b3a6dc499551b127723ca41eb714d87482b42b88f81bcdff6e89903b8cb6ffde0847136f8b004cef88810c79397e383eac8c11aa9e388e44dfb4db
7
+ data.tar.gz: c2692563e1c2007e6a0ebee23d30efafd30eb57c09efd929e99b0e3503aba1dc5b95e3d8b437a2ba9cf568ca990fbffad6ec2d0677b39f3ee2420abe466870a9
data/.semver CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 2
4
- :patch: 3
3
+ :minor: 3
4
+ :patch: 0
5
5
  :special: ''
6
6
  :metadata: ''
data/Gemfile.lock CHANGED
@@ -1,15 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- certmeister (0.2.3)
5
- certmeister-redis (0.2.3)
6
- certmeister (= 0.2.3)
4
+ certmeister (0.3.0)
5
+ semver2 (~> 3.3)
6
+ certmeister-rack (0.3.0)
7
+ certmeister (= 0.3.0)
8
+ rack (~> 1.5)
9
+ certmeister-redis (0.3.0)
10
+ certmeister (= 0.3.0)
7
11
  redis-sentinel (~> 1.4)
8
12
 
9
13
  GEM
10
14
  remote: http://rubygems.org/
11
15
  specs:
12
16
  diff-lcs (1.2.5)
17
+ rack (1.5.2)
18
+ rack-test (0.6.2)
19
+ rack (>= 1.0)
13
20
  rake (0.9.6)
14
21
  redis (3.0.7)
15
22
  redis-sentinel (1.4.2)
@@ -30,7 +37,8 @@ PLATFORMS
30
37
  DEPENDENCIES
31
38
  bundler (~> 1.5)
32
39
  certmeister!
40
+ certmeister-rack!
33
41
  certmeister-redis!
42
+ rack-test (~> 0.6)
34
43
  rake (~> 0)
35
44
  rspec (~> 2.14)
36
- semver2 (~> 3.3)
data/Rakefile CHANGED
@@ -14,20 +14,19 @@ end
14
14
  namespace :bump do
15
15
  bump_version = ->(component) do
16
16
  sh 'bundle', 'exec', 'semver', 'inc', component
17
- sh 'bundle'
18
- sh 'bundle', 'exec', 'semver', 'format', "New version: v%M.%m.%p%s"
17
+ puts "Remember to update Gemfile.lock with bundle install"
19
18
  end
20
19
 
21
20
  desc 'Bump version [major]'
22
- task :major => :build do
21
+ task :major do
23
22
  bump_version.call('major')
24
23
  end
25
24
  desc 'Bump version [minor]'
26
- task :minor => :build do
25
+ task :minor do
27
26
  bump_version.call('minor')
28
27
  end
29
28
  desc 'Bump version [patch]'
30
- task :patch => :build do
29
+ task :patch do
31
30
  bump_version.call('patch')
32
31
  end
33
32
  end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'certmeister/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "certmeister-rack"
8
+ spec.version = Certmeister::VERSION
9
+ spec.authors = ["Sheldon Hearn"]
10
+ spec.email = ["sheldonh@starjuice.net"]
11
+ spec.summary = %q{Rack application for certmeister}
12
+ spec.description = %q{This gem provides a rack application to offer an HTTP service around certmeister, the conditional autosigning certificate authority.}
13
+ spec.homepage = "https://github.com/sheldonh/certmeister"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z lib/certmeister spec/certmeister`.split("\x0").grep(/rack/)
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "certmeister", Certmeister::VERSION
21
+ spec.add_dependency "rack", "~> 1.5"
22
+
23
+ spec.add_development_dependency "rack-test", "~> 0.6"
24
+ end
data/certmeister.gemspec CHANGED
@@ -22,10 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
23
  spec.require_paths = ["lib"]
24
24
 
25
+ spec.add_dependency "semver2", "~> 3.3"
26
+
25
27
  spec.add_development_dependency "bundler", "~> 1.5"
26
28
  spec.add_development_dependency "rake", "~> 0"
27
29
  spec.add_development_dependency "rspec", "~> 2.14"
28
- spec.add_development_dependency "semver2", "~> 3.3"
29
30
  end
30
-
31
-
data/contrib/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- certmeister (0.0.2)
5
- certmeister-redis (0.0.2)
6
- certmeister (= 0.0.2)
4
+ certmeister (0.2.3)
5
+ semver2 (~> 3.3)
6
+ certmeister-redis (0.2.3)
7
+ certmeister (= 0.2.3)
7
8
  redis-sentinel (~> 1.4)
8
9
 
9
10
  GEM
@@ -13,6 +14,7 @@ GEM
13
14
  redis (3.0.7)
14
15
  redis-sentinel (1.4.2)
15
16
  redis
17
+ semver2 (3.3.3)
16
18
 
17
19
  PLATFORMS
18
20
  ruby
data/contrib/config.ru CHANGED
@@ -3,6 +3,7 @@ require 'rack'
3
3
 
4
4
  require 'certmeister'
5
5
  require 'certmeister/redis/store'
6
+ require 'certmeister/rack/app'
6
7
  require 'redis'
7
8
 
8
9
  allow = Certmeister::Policy::Noop.new
@@ -17,61 +18,12 @@ ca = Certmeister.new(
17
18
  ca_key: File.read("../fixtures/ca.key"),
18
19
  )
19
20
  )
21
+ certmeister = Certmeister::Rack::App.new(ca)
20
22
 
21
- sign_action = ->(params) do
22
- response = ca.sign(params)
23
- if response.error?
24
- [500, {'Content-Type' => 'text/plain'}, ["500 Internal Server Error (#{response.error})"]]
25
- elsif response.denied?
26
- [403, {'Content-Type' => 'text/plain'}, ["403 Forbidden (#{response.error})"]]
27
- else
28
- [303, {'Content-Type' => 'text/plain',
29
- 'Location' => "/certificate/#{params[:cn]}"}, ["303 See Other"]]
23
+ app = Rack::Builder.new do
24
+ map "/ca" do
25
+ run certmeister
30
26
  end
31
27
  end
32
28
 
33
- fetch_action = ->(params) do
34
- response = ca.fetch(params)
35
- if response.error?
36
- [500, {'Content-Type' => 'text/plain'}, ["500 Internal Server Error (#{response.error})"]]
37
- elsif response.denied?
38
- [403, {'Content-Type' => 'text/plain'}, ["403 Forbidden (#{response.error})"]]
39
- elsif response.miss?
40
- [404, {'Content-Type' => 'text/plain'}, ["404 Not Found"]]
41
- else
42
- [200, {'Content-Type' => 'application/x-pem-file'}, [response.pem]]
43
- end
44
- end
45
-
46
- remove_action = ->(params) do
47
- response = ca.remove(params)
48
- if response.error?
49
- [500, {'Content-Type' => 'text/plain'}, ["500 Internal Server Error (#{response.error})"]]
50
- elsif response.denied?
51
- [403, {'Content-Type' => 'text/plain'}, ["403 Forbidden (#{response.error})"]]
52
- elsif response.miss?
53
- [404, {'Content-Type' => 'text/plain'}, ["404 Not Found"]]
54
- else
55
- [200, {'Content-Type' => 'text/plain'}, ["200 OK"]]
56
- end
57
- end
58
-
59
- router = ->(env) do
60
- req = Rack::Request.new(env)
61
- if req.path_info =~ /^\/certificate\/(.+)/
62
- params = req.params.tap do |p|
63
- p[:cn] = $1
64
- p[:ip] = req.ip
65
- end
66
- case req.request_method
67
- when 'POST' then sign_action.call(params)
68
- when 'GET' then fetch_action.call(params)
69
- when 'DELETE' then remove_action.call(params)
70
- else [405, {'Content-Type' => 'text-plain'}, ["405 Method Not Allowed"]]
71
- end
72
- else
73
- [501, {'Content-Type' => 'text-plain'}, ["501 Not Implemented"]]
74
- end
75
- end
76
-
77
- run router
29
+ run app
@@ -1,7 +1,24 @@
1
- require 'semver'
1
+ begin
2
2
 
3
- module Certmeister
3
+ require 'semver'
4
+
5
+ module Certmeister
6
+
7
+ VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
8
+
9
+ end
10
+
11
+ rescue LoadError
12
+
13
+ $stderr.puts "warning: ignoring missing semver gem for initial bundle"
14
+ $stderr.puts "warning: please run bundle again to fix certmeister version number"
15
+
16
+ module Certmeister
17
+
18
+ VERSION = '0'
19
+
20
+ end
4
21
 
5
- VERSION = SemVer.find.format("%M.%m.%p%s") unless defined?(VERSION)
6
-
7
22
  end
23
+
24
+
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: certmeister
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Hearn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: semver2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
20
- type: :development
19
+ version: '3.3'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '2.14'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '2.14'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: semver2
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '3.3'
61
+ version: '2.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '3.3'
68
+ version: '2.14'
69
69
  description: Certificate authority that can be configured to make decisions about
70
70
  whether to autosign certificate signing requests for clients. This gem provides
71
71
  the protocol-agnostic library, which is expected to be used within something like
@@ -86,6 +86,7 @@ files:
86
86
  - LICENSE
87
87
  - README.md
88
88
  - Rakefile
89
+ - certmeister-rack.gemspec
89
90
  - certmeister-redis.gemspec
90
91
  - certmeister.gemspec
91
92
  - contrib/.ruby-gemset