feat: add private s3 storage with restricted api user

This commit is contained in:
2026-11-05 13:38:18 +03:00
parent 4ffde2494c
commit 51f4adfd58
4 changed files with 139 additions and 9 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
import sys
import urllib.error
import urllib.request
bucket, key = sys.argv[1:3]
base = 'http://s3:9000/' + bucket
attempts = (
('GET', '/<object>', base + '/' + key, None),
('GET', '/', base + '/', None),
('PUT', '/anon.txt', base + '/anon.txt', b'x'),
)
failed = False
for method, label, url, data in attempts:
try:
code = urllib.request.urlopen(urllib.request.Request(url, data=data, method=method), timeout=5).status
except urllib.error.HTTPError as error:
code = error.code
print(method, bucket + label, '->', code)
failed = failed or code != 403
sys.exit(1 if failed else 0)