forked from mtusi2026/mtusi2026lab7
wip: apply pki-ingress-mtls groups 3-5, start group 6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
# Hook-и стенда на HTTPS (change `pki-ingress-mtls`, задача 5.2)
|
||||
|
||||
Дата: 2026-11-16. Код: `5c514b0` и рабочее дерево apply (`scripts/stop-one.sh` по alias —
|
||||
`evidence/security/instance-alias.md`). Стенд — `make run_docker`: LB на
|
||||
`https://localhost:8443`, mTLS LB → реплики. Публичные проверки берут `CA_FILE` стенда из
|
||||
Makefile. Скрипты `restart.sh` и `rolling-update.sh` не менялись — регрессия прошла без правок.
|
||||
Сдвиг очереди round-robin между прогонами для разных реплик — один запрос через LB
|
||||
(`balancer.md`). ID контейнера в строке `STOP_ONE_LOG` укорочен до 12 символов.
|
||||
|
||||
```
|
||||
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "https://localhost:8443" --ca-file "<repo>/.pki/stand/ca.crt"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit=0
|
||||
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh STOP_MODE=stop (replica 1)
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "https://localhost:8443" --ca-file "<repo>/.pki/stand/ca.crt"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 120, "failed_attempts": 0, "first_recovery_seconds": 1.219}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit=0
|
||||
STOP_ONE_LOG:
|
||||
2026-11-16T03:47:08Z TARGET_INSTANCE_ID=25f3831bc035f792 container=bc6852978ba2… mode=stop
|
||||
mtusi-lab7-api-1 6d771a9c6e5f running Up 20 seconds (healthy)
|
||||
mtusi-lab7-api-2 bc6852978ba2 exited Exited (0) 14 seconds ago
|
||||
make replicas exit=0
|
||||
shift: X-Instance-Id 1cc88155d5304436
|
||||
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh STOP_MODE=stop (replica 2)
|
||||
…
|
||||
{"observed_instances_before": 2, "successful_writes": 116, "failed_attempts": 0, "first_recovery_seconds": 1.739}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit=0
|
||||
STOP_ONE_LOG:
|
||||
2026-11-16T03:47:27Z TARGET_INSTANCE_ID=1cc88155d5304436 container=6d771a9c6e5f… mode=stop
|
||||
mtusi-lab7-api-1 6d771a9c6e5f exited Exited (0) 14 seconds ago
|
||||
mtusi-lab7-api-2 bc6852978ba2 running Up 18 seconds (healthy)
|
||||
make replicas exit=0
|
||||
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh STOP_MODE=kill (replica 1)
|
||||
…
|
||||
{"observed_instances_before": 2, "successful_writes": 120, "failed_attempts": 0, "first_recovery_seconds": 0.876}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit=0
|
||||
STOP_ONE_LOG:
|
||||
2026-11-16T03:47:45Z TARGET_INSTANCE_ID=6a8eddeefdf77bfc container=bc6852978ba2… mode=kill
|
||||
mtusi-lab7-api-1 6d771a9c6e5f running Up 18 seconds (healthy)
|
||||
mtusi-lab7-api-2 bc6852978ba2 exited Exited (137) 15 seconds ago
|
||||
make replicas exit=0
|
||||
shift: X-Instance-Id 12813d3c4eb1425f
|
||||
|
||||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh STOP_MODE=kill (replica 2)
|
||||
…
|
||||
{"observed_instances_before": 2, "successful_writes": 120, "failed_attempts": 0, "first_recovery_seconds": 0.886}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
exit=0
|
||||
STOP_ONE_LOG:
|
||||
2026-11-16T03:48:04Z TARGET_INSTANCE_ID=12813d3c4eb1425f container=6d771a9c6e5f… mode=kill
|
||||
mtusi-lab7-api-1 6d771a9c6e5f exited Exited (137) 15 seconds ago
|
||||
mtusi-lab7-api-2 bc6852978ba2 running Up 17 seconds (healthy)
|
||||
make replicas exit=0
|
||||
```
|
||||
|
||||
Восстановление записи через LB после остановки — 0,9–1,7 с (было в лабе 6 того же порядка):
|
||||
новое рукопожатие TLS 1.3 LB → реплика на каждый сеанс клиента цепочку таймаутов не
|
||||
сдвинуло. Тест берёт alias реплики из `X-Instance-Id` первой отправки, hook находит её
|
||||
контейнер по журналу.
|
||||
|
||||
Поочерёдная замена: шаг «новая `healthy`» — через loopback-слушатель health (healthcheck без
|
||||
сертификата клиента), «`UP` в LB» — проверки LB по mTLS:
|
||||
|
||||
```
|
||||
$ make rolling_update
|
||||
…
|
||||
03:48:25 rolling-update: migrate done in 2s
|
||||
03:48:26 rolling-update: replica 1/2: started new cc1a66e643e3
|
||||
03:48:27 rolling-update: replica 1/2: new cc1a66e643e3 addr 192.168.176.13 slot api-3 UP in 2s
|
||||
03:48:28 rolling-update: replica 1/2: drain old 6d771a9c6e5f addr 192.168.176.10 slot api-1
|
||||
03:48:28 rolling-update: replica 1/2: old 6d771a9c6e5f idle after 0s
|
||||
03:48:28 rolling-update: replica 1/2: maint slot api-1, stopping old 6d771a9c6e5f
|
||||
03:48:28 rolling-update: replica 1/2: removed old 6d771a9c6e5f (stop 0s, exit 0)
|
||||
03:48:29 rolling-update: replica 1/2: slot api-1 ready
|
||||
03:48:30 rolling-update: replica 2/2: started new 5a09a9bb6663
|
||||
03:48:31 rolling-update: replica 2/2: new 5a09a9bb6663 addr 192.168.176.10 slot api-1 UP in 2s
|
||||
03:48:31 rolling-update: replica 2/2: drain old bc6852978ba2 addr 192.168.176.11 slot api-2
|
||||
03:48:31 rolling-update: replica 2/2: old bc6852978ba2 idle after 0s
|
||||
03:48:31 rolling-update: replica 2/2: maint slot api-2, stopping old bc6852978ba2
|
||||
03:48:32 rolling-update: replica 2/2: removed old bc6852978ba2 (stop 1s, exit 0)
|
||||
03:48:32 rolling-update: replica 2/2: slot api-2 ready
|
||||
03:48:33 rolling-update: done: 2 replicas cc1a66e643e3 5a09a9bb6663 UP in 12s
|
||||
exit=0
|
||||
mtusi-lab7-api-3 cc1a66e643e3 running Up 7 seconds (healthy)
|
||||
mtusi-lab7-api-4 5a09a9bb6663 running Up 3 seconds (healthy)
|
||||
$ make lb_stats
|
||||
svname addr status check_status scur stot econ wretr wredis hrsp_5xx
|
||||
api-1 192.168.176.10:8080 UP L7OK 0 369 0 0 6 0
|
||||
api-3 192.168.176.13:8080 UP L7OK 0 0 0 0 0 0
|
||||
BACKEND - UP - 0 719 5 0 10 5
|
||||
|
||||
$ make test
|
||||
python3 tests/smoke.py --base-url "https://localhost:8443" --ca-file "<repo>/.pki/stand/ca.crt"
|
||||
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
|
||||
exit=0
|
||||
```
|
||||
|
||||
`econ`, `wredis` и `hrsp_5xx` у `BACKEND` — счётчики с запуска LB за все прогоны выше
|
||||
(остановки реплик посреди записи); у слотов после замены 5xx нет, `failed_attempts` всех
|
||||
прогонов — 0.
|
||||
Reference in New Issue
Block a user