smart_proxy_container_gateway 1.0.1 → 1.0.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
  SHA256:
3
- metadata.gz: b4cb6e121153f6b5e5688c79f71d45a7c6b3787a1662df5481b965e8932b3e7f
4
- data.tar.gz: b320254d5ff2858487a58dbd63defdfd20d0b9fb7a6d2fde8fe1028d2eb9cecb
3
+ metadata.gz: 4a911ad6150f04b74e216b6f23aa6ac56e95d40b9e356a9a10ff371910e3f417
4
+ data.tar.gz: d4555205824e57baadc3dbadb8e27a417dea5c473d9ad8523d48364a87bc3116
5
5
  SHA512:
6
- metadata.gz: 3ad8f095b5450474a87a091b2c8e0807e0aa0a2780dec65e42c114bac24f3bc209d2aee7cf715983b87d91a4bac3767150cf91bbc03757943bd4748a920d3424
7
- data.tar.gz: 18d5c87875083932ff68abe7095872487250cbe2e0e15637031766d8facd12f5d2eac443a6a377b724e3b378df89d5ffd73be056407f09855866ebf437cdb505
6
+ metadata.gz: dde5105d42b3b1c566f8713e2e0727dd8af35417266f44bc74b86ea06263c290272f92d2caaa023cc0a23cc7ca9551e2f5b1c7e7b57e1fc061ea13e53aca51ae
7
+ data.tar.gz: 2710e2eed201d458c22193ae9f06ccd78b3de6e9a669585de93970646d2cdeff2f1f88aee428d4b1c7f9c46108f00f61aa115b2dcfca7ed5b2ee2bb7fbd3aa88
@@ -5,14 +5,23 @@ module Proxy
5
5
  class Plugin < ::Proxy::Plugin
6
6
  plugin 'container_gateway', Proxy::ContainerGateway::VERSION
7
7
 
8
- default_settings :pulp_endpoint => "https://#{`hostname`.strip}",
9
- :katello_registry_path => '/v2/',
10
- :sqlite_db_path => '/var/lib/foreman-proxy/smart_proxy_container_gateway.db'
8
+ begin
9
+ SETTINGS = Proxy::Settings.initialize_global_settings
11
10
 
12
- http_rackup_path File.expand_path('smart_proxy_container_gateway/container_gateway_http_config.ru',
13
- File.expand_path('..', __dir__))
14
- https_rackup_path File.expand_path('smart_proxy_container_gateway/container_gateway_http_config.ru',
15
- File.expand_path('..', __dir__))
11
+ default_settings :pulp_endpoint => "https://#{`hostname`.strip}",
12
+ :pulp_client_ssl_ca => SETTINGS.foreman_ssl_ca,
13
+ :pulp_client_ssl_cert => SETTINGS.foreman_ssl_cert,
14
+ :pulp_client_ssl_key => SETTINGS.foreman_ssl_key,
15
+ :katello_registry_path => '/v2/',
16
+ :sqlite_db_path => '/var/lib/foreman-proxy/smart_proxy_container_gateway.db'
17
+ rescue Errno::ENOENT
18
+ logger.warn("Default settings could not be loaded. Default certs will not be set.")
19
+ default_settings :pulp_endpoint => "https://#{`hostname`.strip}",
20
+ :katello_registry_path => '/v2/',
21
+ :sqlite_db_path => '/var/lib/foreman-proxy/smart_proxy_container_gateway.db'
22
+ end
23
+
24
+ rackup_path File.join(__dir__, 'container_gateway_http_config.ru')
16
25
  end
17
26
  end
18
27
  end
@@ -10,6 +10,7 @@ module Proxy
10
10
  class << self
11
11
  def pulp_registry_request(uri)
12
12
  http_client = Net::HTTP.new(uri.host, uri.port)
13
+ http_client.ca_file = pulp_ca
13
14
  http_client.cert = pulp_cert
14
15
  http_client.key = pulp_key
15
16
  http_client.use_ssl = true
@@ -116,13 +117,17 @@ module Proxy
116
117
  Sequel::Migrator.run(db_connection, "#{container_gateway_path}/smart_proxy_container_gateway/sequel_migrations")
117
118
  end
118
119
 
120
+ def pulp_ca
121
+ Proxy::ContainerGateway::Plugin.settings.pulp_client_ssl_ca
122
+ end
123
+
119
124
  def pulp_cert
120
- OpenSSL::X509::Certificate.new(File.open(Proxy::ContainerGateway::Plugin.settings.pulp_client_ssl_cert, 'r').read)
125
+ OpenSSL::X509::Certificate.new(File.read(Proxy::ContainerGateway::Plugin.settings.pulp_client_ssl_cert))
121
126
  end
122
127
 
123
128
  def pulp_key
124
129
  OpenSSL::PKey::RSA.new(
125
- File.open(Proxy::ContainerGateway::Plugin.settings.pulp_client_ssl_key, 'r').read
130
+ File.read(Proxy::ContainerGateway::Plugin.settings.pulp_client_ssl_key)
126
131
  )
127
132
  end
128
133
  end
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module ContainerGateway
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.0.2'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  :enabled: true
3
3
  :pulp_endpoint: 'https://your_pulp_3_server_here.com'
4
+ :pulp_client_ssl_ca: 'CA Cert for authenticating with Pulp'
4
5
  :pulp_client_ssl_cert: 'X509 certificate for authenticating with Pulp'
5
6
  :pulp_client_ssl_key: 'RSA private key for the Pulp certificate'
7
+ :katello_registry_path: 'Katello container registry suffix, e.g., /v2/'
6
8
  :sqlite_db_path: '/var/lib/foreman-proxy/smart_proxy_container_gateway.db'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_container_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ballou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-26 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel