lab7: BROKER_URL из окружения, Redis operator для регрессии ACL, исправления тестов, no-new-privileges tempo-init; перенос исправлений lab6

This commit is contained in:
2026-11-12 14:19:15 +03:00
parent b5b55fda89
commit 1c453e9f0a
16 changed files with 104 additions and 33 deletions
+8 -1
View File
@@ -159,12 +159,19 @@ def ensure_creds():
def write_backend_files(creds):
acl = OP / 'redis_users.acl'
h = hashlib.sha256(creds['api']['redis_password'].encode()).hexdigest()
# Операторская учётка Redis (администрирование, регрессионный тест ACL); приложениям не выдаётся.
opf = OP / 'redis_operator_password'
if not opf.exists():
opf.write_text(rnd.token_hex(24))
os.chmod(opf, 0o600)
ho = hashlib.sha256(opf.read_text().strip().encode()).hexdigest()
# default отключён; api — только свои ключи и нужные команды; healthcheck — только PING.
acl.write_text(
'user default off\n'
'user healthcheck on nopass resetkeys resetchannels -@all +ping +hello +auth\n'
'user api on #%s resetchannels ~session:* ~messages:* ~rl:* -@all +@connection '
'+get +set +del +ttl +scan +incr +expire +multi +exec +discard +ping\n' % h)
'+get +set +del +ttl +scan +incr +expire +multi +exec +discard +ping\n'
'user operator on #%s ~* &* +@all\n' % (h, ho))
s3 = OP / 's3_users.txt'
s3.write_text(''.join('%s %s %s\n' % (s, creds[s]['s3_access_key'], creds[s]['s3_secret_key']) for s in SERVICES))
for p in (acl, s3):