smart_proxy_container_gateway 4.0.2 → 4.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 271e1e6cb4519a3267a367bcfb454ff673031b470be686f4442906ff8d522326
4
- data.tar.gz: b7d8d2610a9a7bb307b198bdc8e25e4d476fcee2c5e95e9d5d0aba35612448fa
3
+ metadata.gz: 4071f3495101c182650fbb5a894701d1d60d6a552eb43e4f1f7e07c558e75d7e
4
+ data.tar.gz: d7b251ba17c8e9360bc7fe88bbca8764be924f16ec41b061be0dc525604cebae
5
5
  SHA512:
6
- metadata.gz: edadb66c3f7a9633d1e20f423d2d34a23dfac78085b1d23ed0add423bb1d1b564698e24401d3eeacf650a36d25f180d4a10158175f6590b1315d432dcf75c2ae
7
- data.tar.gz: 880574aea904a3b8fe068b3c35250c47572ef47193be75687efdd4407c4d71dbc00a2e48b964746b5b3295f54f47858ea2c86a6c24ac107a078065690f44d068
6
+ metadata.gz: c6c2eede99c97f359b6a9803b94eeab8d74325b84e2fb381c71e7a1626a7248c7f098737a8bbf2fb4418f0f0b246bae7e6084d69d7b05404ae133f5b9b30cf64
7
+ data.tar.gz: 88d1890fcd6a3c2ca7724151175cc29badc8ae21b7a1e94a7f7098c20d18a777c133c874d25598c47fb7d2cf1435d50b1d0e6fd3ae9603c43ae10da0d715bd0b
data/README.md CHANGED
@@ -30,7 +30,7 @@ The Container Gateway plugin requires a Pulp 3 instance to connect to. Related
30
30
  ```
31
31
  :pulp_endpoint: 'https://your_pulp_3_server_here.com'
32
32
  :pulp_client_ssl_cert: 'Path to X509 certificate for authenticating with Pulp'
33
- :pulp_client_ssl_key: 'Path to RSA private key for the Pulp certificate'
33
+ :pulp_client_ssl_key: 'Path to private key for the Pulp certificate'
34
34
  ```
35
35
 
36
36
  # Database information
@@ -78,10 +78,19 @@ module Proxy
78
78
  if pulp_response.code.to_i >= 400
79
79
  status pulp_response.code.to_i
80
80
  body pulp_response.body
81
- else
81
+ elsif [301, 302, 307].include?(pulp_response.code.to_i)
82
82
  redirection_uri = URI(pulp_response['location'])
83
83
  redirection_uri.host = URI(container_gateway_main.client_endpoint).host
84
84
  redirect(redirection_uri.to_s)
85
+ else
86
+ status pulp_response.code.to_i
87
+ digest = pulp_response['docker-content-digest']
88
+ content_type = pulp_response['content-type']
89
+ content_length = pulp_response['content-length']
90
+ response.headers['Docker-Content-Digest'] = digest if digest
91
+ response.headers['Content-Type'] = content_type if content_type
92
+ response.headers['Content-Length'] = content_length if content_length
93
+ body pulp_response.body
85
94
  end
86
95
  end
87
96
 
@@ -181,11 +190,11 @@ module Proxy
181
190
  get '/v2/token' do
182
191
  response.headers['Docker-Distribution-API-Version'] = 'registry/2.0'
183
192
 
184
- # Flatpak client requests do not contain the account param that podman relies on.
185
- # It contains Base64 encoded username in the Authorization header.
186
- # We need to extract the username from the Authorization header and
187
- # set it as the account param to be used when inserting new token record.
188
- if flatpak_client? && auth_header.raw_header.present?
193
+ # Some clients (e.g. Flatpak, Cincinnati) do not include the account
194
+ # query parameter in the token request. Extract the username from the
195
+ # Base64-encoded Basic Authorization header and use it as the account
196
+ # param when inserting a new token record.
197
+ if request.params['account'].nil? && auth_header.raw_header.present?
189
198
  encoded_string = auth_header.raw_header&.split(' ')&.[](1)
190
199
  decoded_string = Base64.decode64(encoded_string) if encoded_string.present?
191
200
  username = decoded_string.split(':')[0] if decoded_string.present?
@@ -19,9 +19,7 @@ module Proxy
19
19
  @client_endpoint = client_endpoint || pulp_endpoint
20
20
  @pulp_client_ssl_ca = pulp_client_ssl_ca
21
21
  @pulp_client_ssl_cert = OpenSSL::X509::Certificate.new(File.read(pulp_client_ssl_cert))
22
- @pulp_client_ssl_key = OpenSSL::PKey::RSA.new(
23
- File.read(pulp_client_ssl_key)
24
- )
22
+ @pulp_client_ssl_key = OpenSSL::PKey.read(File.read(pulp_client_ssl_key))
25
23
  end
26
24
  # rubocop:enable Metrics/ParameterLists, Layout/LineLength
27
25
 
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module ContainerGateway
3
- VERSION = '4.0.2'.freeze
3
+ VERSION = '4.0.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_container_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ballou