smart_proxy_container_gateway 3.0.0 → 3.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 129561beba74e2d626b09ec8236defd0d7fc01b9f2a3a55f18c8da358f9b22d7
|
4
|
+
data.tar.gz: e7ad6221d17625f4dfd236ae5299a18d19b2d97f92fb13fcb1d2246394f1b48a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf49a821ff8e81465ec017be198c8b7a3217a236c223a33934ee7fc3e530daf2761e628710694937609be70f5e1823065fb9ad47addc33fddd12da1fc8267468
|
7
|
+
data.tar.gz: 6bd2923fcf74cdcae8ff5828ec38eeca41e29b52d759ca4b306da5bc377d1b2c07fab9180fb5acd3d2e8d88277905e4ed4852dadee9d0c24fc0564dedc92a7d9
|
@@ -50,18 +50,28 @@ module Proxy
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
put '/v2/*/manifests/*/?' do
|
54
|
+
throw_unsupported_error
|
55
|
+
end
|
56
|
+
|
53
57
|
get '/v2/*/blobs/*/?' do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
head_or_get_blobs
|
59
|
+
end
|
60
|
+
|
61
|
+
head '/v2/*/blobs/*/?' do
|
62
|
+
head_or_get_blobs
|
63
|
+
end
|
64
|
+
|
65
|
+
post '/v2/*/blobs/uploads/?' do
|
66
|
+
throw_unsupported_error
|
67
|
+
end
|
68
|
+
|
69
|
+
put '/v2/*/blobs/uploads/*/?' do
|
70
|
+
throw_unsupported_error
|
71
|
+
end
|
72
|
+
|
73
|
+
patch '/v2/*/blobs/uploads/*/?' do
|
74
|
+
throw_unsupported_error
|
65
75
|
end
|
66
76
|
|
67
77
|
get '/v2/*/tags/list/?' do
|
@@ -80,10 +90,10 @@ module Proxy
|
|
80
90
|
end
|
81
91
|
|
82
92
|
get '/v1/search/?' do
|
83
|
-
# Checks for
|
93
|
+
# Checks for v2 client and issues a 404 in that case. Podman
|
84
94
|
# examines the response from a /v1/search request. If the result
|
85
95
|
# is a 4XX, it will then proceed with a request to /_catalog
|
86
|
-
if
|
96
|
+
if request.env['HTTP_DOCKER_DISTRIBUTION_API_VERSION'] == 'registry/2.0'
|
87
97
|
halt 404, "not found"
|
88
98
|
end
|
89
99
|
|
@@ -198,6 +208,46 @@ module Proxy
|
|
198
208
|
|
199
209
|
private
|
200
210
|
|
211
|
+
def head_or_get_blobs
|
212
|
+
repository = params[:splat][0]
|
213
|
+
digest = params[:splat][1]
|
214
|
+
handle_repo_auth(repository, auth_header, request)
|
215
|
+
pulp_response = container_gateway_main.blobs(repository, digest, translated_headers_for_proxy)
|
216
|
+
if pulp_response.code.to_i >= 400
|
217
|
+
status pulp_response.code.to_i
|
218
|
+
body pulp_response.body
|
219
|
+
else
|
220
|
+
redirection_location = pulp_response['location']
|
221
|
+
redirect to(redirection_location)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def throw_unsupported_error
|
226
|
+
content_type :json
|
227
|
+
body({
|
228
|
+
"errors" => [
|
229
|
+
{
|
230
|
+
"code" => "UNSUPPORTED",
|
231
|
+
"message" => "Pushing content is unsupported"
|
232
|
+
}
|
233
|
+
]
|
234
|
+
}.to_json)
|
235
|
+
halt 404
|
236
|
+
end
|
237
|
+
|
238
|
+
def throw_repo_not_found_error
|
239
|
+
content_type :json
|
240
|
+
body({
|
241
|
+
"errors" => [
|
242
|
+
{
|
243
|
+
"code" => "NAME_UNKNOWN",
|
244
|
+
"message" => "Repository name unknown"
|
245
|
+
}
|
246
|
+
]
|
247
|
+
}.to_json)
|
248
|
+
halt 404
|
249
|
+
end
|
250
|
+
|
201
251
|
def translated_headers_for_proxy
|
202
252
|
current_headers = {}
|
203
253
|
env = request.env.select do |key, _value|
|
@@ -220,7 +270,7 @@ module Proxy
|
|
220
270
|
return if container_gateway_main.authorized_for_repo?(repository, user_token_is_valid, username)
|
221
271
|
|
222
272
|
redirect_authorization_headers
|
223
|
-
|
273
|
+
throw_repo_not_found_error
|
224
274
|
end
|
225
275
|
|
226
276
|
def redirect_authorization_headers
|
@@ -160,6 +160,9 @@ module Proxy
|
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
|
+
# Returns:
|
164
|
+
# true if the user is authorized to access the repo, or
|
165
|
+
# false if the user is not authorized to access the repo or if it does not exist
|
163
166
|
def authorized_for_repo?(repo_name, user_token_is_valid, username = nil)
|
164
167
|
repository = database.connection[:repositories][{ name: repo_name }]
|
165
168
|
|
@@ -5,6 +5,7 @@ module Proxy
|
|
5
5
|
attr_reader :connection
|
6
6
|
|
7
7
|
def initialize(connection_string, prior_sqlite_db_path = nil)
|
8
|
+
Sequel.default_timezone = :local
|
8
9
|
@connection = Sequel.connect(connection_string)
|
9
10
|
if connection_string.start_with?('sqlite://')
|
10
11
|
@connection.run("PRAGMA foreign_keys = ON;")
|
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: 3.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Ballou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,57 +16,63 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '6.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '8'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: pg
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '1.5'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - "
|
44
|
+
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '1.5'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: sequel
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
53
|
+
version: '5.0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
60
|
+
version: '5.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: sqlite3
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - "
|
65
|
+
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
67
|
+
version: '1.4'
|
62
68
|
type: :runtime
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - "
|
72
|
+
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
-
description: Pulp 3 container registry support
|
74
|
+
version: '1.4'
|
75
|
+
description: Foreman Smart Proxy plug-in for Pulp 3 container registry support
|
70
76
|
email: ianballou67@gmail.com
|
71
77
|
executables: []
|
72
78
|
extensions: []
|
@@ -93,7 +99,7 @@ files:
|
|
93
99
|
- settings.d/container_gateway.yml.example
|
94
100
|
homepage: https://github.com/Katello/smart_proxy_container_gateway
|
95
101
|
licenses:
|
96
|
-
-
|
102
|
+
- GPL-3.0-only
|
97
103
|
metadata: {}
|
98
104
|
post_install_message:
|
99
105
|
rdoc_options: []
|