Обновлять сертификат балансировщика без перезапуска процессов

This commit is contained in:
2026-11-22 20:35:45 +03:00
parent 7e61bc4ee3
commit 341b6b887d
5 changed files with 10143 additions and 24 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ from scripts.bootstrap_security import OPERATOR, ROLES, TRUST, write_private
from scripts.prepare_dependencies import attach_policy
from scripts.stand import compose
INSTALL = """import json,os,pathlib,signal,sys,tempfile
INSTALL = """import json,os,pathlib,subprocess,sys,tempfile
data=json.load(sys.stdin)
base=pathlib.Path('/run/identity')
directory=pathlib.Path(tempfile.mkdtemp(prefix='generation-',dir=base))
@@ -28,7 +28,7 @@ certificate=data['certificate']+'\\n'+'\\n'.join(data.get('ca_chain',[]))
for name,value in [('cert.pem',certificate),('key.pem',data['private_key']),('bundle.pem',certificate+'\\n'+data['private_key'])]:
path=directory/name;path.write_text(value);path.chmod(0o600)
link=base/'operator-next';link.unlink(missing_ok=True);link.symlink_to(directory.name);link.replace(base/'current')
if data.get('reload_lb'):os.kill(1,signal.SIGUSR2)
if data.get('reload_lb'):subprocess.run(['tls-gateway','--reload-lb-cert'],check=True)
print('Operator installed a scoped short-lived leaf')
"""