conjur-asset-proxy 0.3.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 33c7c309c97f11b81d0ff2279a45cec58f0abef0
4
+ data.tar.gz: 5c822a7b65fa193fccffc608f9ca3efcbf8c3c2e
5
+ SHA512:
6
+ metadata.gz: 2cc41fa816077395219eb4f4ec575693dca789a25e5d3c61bd363f239e595182b976036f51d824c65b4be712a372b1571b7d289532dfdad43d3451ae9179ab22
7
+ data.tar.gz: f2e1905f67c87c30da20df68c12da7a09be88f67af616a4e20e963d194db25539f9d55e31558fc3913079cdd2afc7acef42463e7d35c92afc6dff064aedfb651
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.project ADDED
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>conjur-asset-proxy</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>com.aptana.ide.core.unifiedBuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>com.aptana.ruby.core.rubynature</nature>
16
+ <nature>com.aptana.projects.webnature</nature>
17
+ </natures>
18
+ </projectDescription>
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ #ruby-gemset=conjur-asset-proxy
4
+
5
+ # Specify your gem's dependencies in conjur-asset-proxy.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Conjur Inc.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Conjur::Asset::Proxy
2
+
3
+ Simple HTTP proxy which adds Conjur authentication headers.
4
+
5
+ ## Installation
6
+
7
+ $ gem install conjur-asset-proxy-api
8
+
9
+ Add `proxy` to `plugins` in your `.conjurrc`.
10
+
11
+ ## Usage
12
+
13
+ $ conjur proxy http://protected-service.example.com
14
+
15
+ Conjur proxy to http://protected-service.example.com started on http://localhost:32123
16
+ Press Ctrl-C to stop.
17
+
18
+ ## Contributing
19
+
20
+ 1. Fork it ( https://github.com/[my-github-username]/conjur-asset-proxy/fork )
21
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
22
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
23
+ 4. Push to the branch (`git push origin my-new-feature`)
24
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,19 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :headers do
4
+ require 'rubygems'
5
+ require 'copyright_header'
6
+
7
+ args = {
8
+ :license => 'MIT',
9
+ :copyright_software => 'Conjur CLI proxy plugin',
10
+ :copyright_software_description => "Simple HTTP proxy which adds Conjur authentication headers",
11
+ :copyright_holders => ['Conjur Inc.'],
12
+ :copyright_years => ['2014'],
13
+ :add_path => 'lib',
14
+ :output_dir => './'
15
+ }
16
+
17
+ command_line = CopyrightHeader::CommandLine.new( args )
18
+ command_line.execute
19
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'conjur/asset/proxy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "conjur-asset-proxy"
8
+ spec.version = Conjur::Asset::Proxy::VERSION
9
+ spec.authors = ["Rafał Rzepecki"]
10
+ spec.email = ["rafal@conjur.net"]
11
+ spec.summary = %q{Simple HTTP proxy which adds Conjur authentication headers}
12
+ spec.homepage = "https://github.com/conjurinc/conjur-asset-host-factory"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "gli", "~> 2.12.0"
21
+
22
+ spec.add_runtime_dependency "conjur-cli", "~> 4.12"
23
+ spec.add_runtime_dependency "rack", "~> 1.5"
24
+ spec.add_runtime_dependency "rack-streaming-proxy", "~> 2.0"
25
+ spec.add_runtime_dependency "thin", "~> 1.6"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.6"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "copyright-header"
30
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # Copyright (C) 2014 Conjur Inc.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
21
+
22
+ require 'conjur/asset/proxy/version'
@@ -0,0 +1,27 @@
1
+ #
2
+ # Copyright (C) 2014 Conjur Inc.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
21
+ module Conjur
22
+ module Asset
23
+ module Proxy
24
+ VERSION = "0.3.2"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,63 @@
1
+ #
2
+ # Copyright (C) 2014 Conjur Inc.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
21
+
22
+ class Conjur::Command::Proxy < Conjur::Command
23
+ desc "Proxy to a protected HTTP service"
24
+ long_desc <<-DESC
25
+ Launch an HTTP proxy to a Conjur-protected service. The proxy adds a Conjur
26
+ authorization header to every request. This allows eg. using browser to access
27
+ a UI of a Conjur-protected web application. The proxy will keep running until
28
+ terminated.
29
+ DESC
30
+
31
+ arg :url
32
+ command :proxy do |c|
33
+ c.flag :p, :port,
34
+ desc: "port to bind to",
35
+ default_value: 8080,
36
+ type: Integer
37
+
38
+ c.flag :a, :address,
39
+ desc: "address to bind to",
40
+ default_value: "127.0.0.1"
41
+
42
+ c.switch :k,
43
+ desc: "Don't verificate HTTPS certificate"
44
+
45
+ c.flag :cacert,
46
+ desc: "Verify SSL using the provided cert file"
47
+
48
+ c.action do |global_options, options, args|
49
+ url = args.shift or help_now!("missing URL")
50
+
51
+ if options[:k]
52
+ options[:insecure] = true
53
+ end
54
+
55
+ options.slice! :port, :address, :insecure, :cacert
56
+ options.delete :port unless options[:port].respond_to? :to_i
57
+
58
+ require 'conjur/proxy'
59
+
60
+ Conjur::Proxy.new(url, api).start options
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,77 @@
1
+ #
2
+ # Copyright (C) 2014 Conjur Inc.
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
21
+
22
+ require 'rack'
23
+ require 'rack/streaming_proxy'
24
+
25
+ module Conjur
26
+ class Proxy
27
+ def initialize url, conjur
28
+ @conjur = conjur
29
+ @proxy = Rack::StreamingProxy::Proxy.new nil do |request|
30
+ ret = "#{url}#{request.path}"
31
+
32
+ unless request.query_string.empty?
33
+ ret = "#{ret}?#{request.query_string}"
34
+ end
35
+
36
+ ret
37
+ end
38
+ end
39
+
40
+ attr_reader :proxy, :conjur
41
+
42
+ def call env
43
+ env["HTTP_AUTHORIZATION"] = conjur.credentials[:headers][:authorization]
44
+
45
+ ret = proxy.call env
46
+
47
+ # hack for Docker Hub & Registry API
48
+ if ret[1].include?('x-docker-endpoints')
49
+ ret[1]['x-docker-endpoints'] = env['HTTP_HOST']
50
+ end
51
+
52
+ ret
53
+ end
54
+
55
+ def start options
56
+ if options[:insecure]
57
+ Net::HTTP.class_eval do
58
+ def use_ssl=(flag)
59
+ flag = flag ? true : false
60
+ if started? and @use_ssl != flag
61
+ raise IOError, "use_ssl value changed, but session already started"
62
+ end
63
+ @use_ssl = flag
64
+
65
+ self.verify_mode = OpenSSL::SSL::VERIFY_NONE
66
+ end
67
+ end
68
+ end
69
+
70
+ if options[:cacert]
71
+ OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE.add_file options[:cacert]
72
+ end
73
+
74
+ Rack::Server.start app: self, Port: options[:port] || 8080, Host: options[:address] || '127.0.0.1'
75
+ end
76
+ end
77
+ end
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: conjur-asset-proxy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
+ platform: ruby
6
+ authors:
7
+ - Rafał Rzepecki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gli
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 2.12.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 2.12.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: conjur-cli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '4.12'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '4.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-streaming-proxy
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thin
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.6'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: copyright-header
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description:
126
+ email:
127
+ - rafal@conjur.net
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - .gitignore
133
+ - .project
134
+ - Gemfile
135
+ - LICENSE.txt
136
+ - README.md
137
+ - Rakefile
138
+ - conjur-asset-proxy.gemspec
139
+ - lib/conjur-asset-proxy.rb
140
+ - lib/conjur/asset/proxy/version.rb
141
+ - lib/conjur/command/proxy.rb
142
+ - lib/conjur/proxy.rb
143
+ homepage: https://github.com/conjurinc/conjur-asset-host-factory
144
+ licenses:
145
+ - MIT
146
+ metadata: {}
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 2.0.14
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Simple HTTP proxy which adds Conjur authentication headers
167
+ test_files: []
168
+ has_rdoc: