Four dated measurement scripts that carried the paths of the machine they ran on are no longer in this copy (dated notes in the two evidence documents; logs and results unchanged); the R18 fixture of the agent-witness test and a generator comment no longer name machine paths or internal tools

This commit is contained in:
Aere Network committed 2026-11-26 15:08:47 +02:00
1 parent 63fffa87c6
commit 4690449873
10 files changed
+17 -235

No files matched your search

+5 -1
View File
@@ -12,7 +12,7 @@ wrote it.
Paths that DO resolve are written relative to a side-by-side checkout of the Aere repositories, so they begin with a Paths that DO resolve are written relative to a side-by-side checkout of the Aere repositories, so they begin with a
repository name, for example `aere-contracts/contracts/pqc/AereCryptoRegistry.sol`. repository name, for example `aere-contracts/contracts/pqc/AereCryptoRegistry.sol`.
Unresolvable distinct paths in this repository: **21**. Unresolvable distinct paths in this repository: **25**.
- `ContainerApps_ListBySubscription.json` cited in: aere-quantum/verify-layer/fixturi-cloud/README.md - `ContainerApps_ListBySubscription.json` cited in: aere-quantum/verify-layer/fixturi-cloud/README.md
- `VirtualMachine_List_MaximumSet_Gen.json` cited in: aere-quantum/verify-layer/fixturi-cloud/README.md - `VirtualMachine_List_MaximumSet_Gen.json` cited in: aere-quantum/verify-layer/fixturi-cloud/README.md
@@ -26,7 +26,11 @@ Unresolvable distinct paths in this repository: **21**.
- `data/service.lock` cited in: aere-quantum/pq-secrets/README.md - `data/service.lock` cited in: aere-quantum/pq-secrets/README.md
- `fixturi-cloud/deriva.mjs` cited in: aere-quantum/README.md - `fixturi-cloud/deriva.mjs` cited in: aere-quantum/README.md
- `libs.versions.toml` cited in: aere-quantum/crypto-inventory/README.md - `libs.versions.toml` cited in: aere-quantum/crypto-inventory/README.md
- `masoara-apache-haproxy-rpc2.sh` cited in: aere-quantum/control-plane/dovezi/retete-2026-10-18/CITESTE-MA.md
- `masoara-haproxy2-rpc2.sh` cited in: aere-quantum/control-plane/dovezi/retete-2026-10-18/CITESTE-MA.md
- `masoara-nginx-rpc2.sh` cited in: aere-quantum/control-plane/dovezi/retete-2026-10-18/CITESTE-MA.md
- `plic-aip23.json` cited in: aere-quantum/exposure-report/README.md - `plic-aip23.json` cited in: aere-quantum/exposure-report/README.md
- `pqgw-imagine-rpc2.sh` cited in: aere-quantum/pq-gateway/dovezi/imagine-docker-2026-10-18.md
- `proba-client-real.mjs` cited in: aere-quantum/readiness/README.md - `proba-client-real.mjs` cited in: aere-quantum/readiness/README.md
- `probele-b2.sh` cited in: aere-quantum/agents/README.md - `probele-b2.sh` cited in: aere-quantum/agents/README.md
- `raport.json` cited in: aere-quantum/exposure-report/README.md - `raport.json` cited in: aere-quantum/exposure-report/README.md
+1 -1
View File
@@ -66,4 +66,4 @@ interface, command line and data (`definePolicy`, `verifyLedger`, `approve`, ...
## Licence ## Licence
MIT, see [LICENSE](LICENSE). Files: 1257 (pq-gateway 9, pq-kms 10, pq-secrets 6, pq-pki 6, crypto-inventory 73, verify-layer 56, proof-kinds 3, control-plane 33, agents 46, identity 24, proof-of-ai 3, ai-trust 6, verifiable-data 7, market-settlement 10, payments 10, conformance 803, device-identity 11, device-operation 114, exposure-report 18, readiness 4). MIT, see [LICENSE](LICENSE). Files: 1253 (pq-gateway 8, pq-kms 10, pq-secrets 6, pq-pki 6, crypto-inventory 73, verify-layer 56, proof-kinds 3, control-plane 30, agents 46, identity 24, proof-of-ai 3, ai-trust 6, verifiable-data 7, market-settlement 10, payments 10, conformance 803, device-identity 11, device-operation 114, exposure-report 18, readiness 4).
+3 -3
View File
@@ -702,14 +702,14 @@ console.log(JSON.stringify({ cod: g.status, corp: t, sanatate: h.status })); awa
await rand('9.R18 o notarizare cazuta cu un mesaj care poarta o cale: in /health si in starea capului apare numai codul (unfunded; fara cod: notarization_failed), niciodata mesajul; codul notarizatorului real pe lantul 2800: chain_refused', async () => { await rand('9.R18 o notarizare cazuta cu un mesaj care poarta o cale: in /health si in starea capului apare numai codul (unfunded; fara cod: notarization_failed), niciodata mesajul; codul notarizatorului real pe lantul 2800: chain_refused', async () => {
const mm = M.deschideMartor(fs.mkdtempSync(path.join(T, 'r18b-')), { ceas: () => Date.now() }); const id = newAgentIdentity(); const mm = M.deschideMartor(fs.mkdtempSync(path.join(T, 'r18b-')), { ceas: () => Date.now() }); const id = newAgentIdentity();
const r = mm.primeste(M.cerereMartor(registruBrut(id, 1), id, { createdAt: iso(Date.now()) })); const r = mm.primeste(M.cerereMartor(registruBrut(id, 1), id, { createdAt: iso(Date.now()) }));
await tur(mm, { notarizeaza: async () => ({ ok: false, cod: 'unfunded', motiv: "unfunded: Cannot find module '/opt/aere/notar/node_modules/ethers' Require stack" }) }); await tur(mm, { notarizeaza: async () => ({ ok: false, cod: 'unfunded', motiv: "unfunded: Cannot find module '/srv/notar/node_modules/ethers' Require stack" }) });
const h1 = mm.sanatate(); const s1 = mm.stareaCapului(r.corp.id).corp; const h1 = mm.sanatate(); const s1 = mm.stareaCapului(r.corp.id).corp;
await tur(mm, { notarizeaza: async () => ({ ok: false, motiv: "ENOSPC: open '/opt/aere/martor-agenti/stare-28001/x.json'" }) }); await tur(mm, { notarizeaza: async () => ({ ok: false, motiv: "ENOSPC: open '/var/lib/martor/stare-28001/x.json'" }) });
const h2 = mm.sanatate(); mm.inchide(); const h2 = mm.sanatate(); mm.inchide();
const ethFals = { JsonRpcProvider: class { async getNetwork() { return { chainId: 2800n }; } }, parseEther: () => 0n, Wallet: class {} }; const ethFals = { JsonRpcProvider: class { async getNetwork() { return { chainId: 2800n }; } }, parseEther: () => 0n, Wallet: class {} };
const nr = await notarizatorReal({ rpc: 'x', cheieFisier: path.join(T, 'r18-nu.key'), ethers: ethFals })(plicNenot); const nr = await notarizatorReal({ rpc: 'x', cheieFisier: path.join(T, 'r18-nu.key'), ethers: ethFals })(plicNenot);
const tot = JSON.stringify([h1, s1, h2]); const tot = JSON.stringify([h1, s1, h2]);
return [h1.lastCheckpoint.lastError === 'unfunded' && s1.notarization.lastError === 'unfunded' && h2.lastCheckpoint.lastError === 'notarization_failed' && !/\/opt|Require|ENOSPC/.test(tot) && nr.cod === 'chain_refused', JSON.stringify([h1.lastCheckpoint, s1.notarization, h2.lastCheckpoint, nr.cod])]; return [h1.lastCheckpoint.lastError === 'unfunded' && s1.notarization.lastError === 'unfunded' && h2.lastCheckpoint.lastError === 'notarization_failed' && !/\/srv|\/var|Require|ENOSPC/.test(tot) && nr.cod === 'chain_refused', JSON.stringify([h1.lastCheckpoint, s1.notarization, h2.lastCheckpoint, nr.cod])];
}); });
// ---- 9.R6 (controlul negativ planteaza fiecare paznic numit) se masoara in control-negativ-martor-agenti.mjs (acoperirea markerilor) // ---- 9.R6 (controlul negativ planteaza fiecare paznic numit) se masoara in control-negativ-martor-agenti.mjs (acoperirea markerilor)
void mPrincipal; void g2c; void mPrincipal; void g2c;
+1 -1
View File
@@ -547,7 +547,7 @@ const PROASPETE_IN_PLUS = {
for (const [n, r] of [['strangerAsOriginator', ['message-id']], ['forOtherVasp', ['message-recipient']], ['createdEarlier', ['message-freshness']], ['kemAlg', ['kem-alg']], ['kemCiphertextCut', ['kem-open']], ['ciphertextByte', ['ciphertext']], ['headerAmount', ['ciphertext']]]) cere(n, deschide(forged[n]), r); for (const [n, r] of [['strangerAsOriginator', ['message-id']], ['forOtherVasp', ['message-recipient']], ['createdEarlier', ['message-freshness']], ['kemAlg', ['kem-alg']], ['kemCiphertextCut', ['kem-open']], ['ciphertextByte', ['ciphertext']], ['headerAmount', ['ciphertext']]]) cere(n, deschide(forged[n]), r);
cere('receiptByOther', TR.verifyReceipt(forged.receiptByOther, { message: M, beneficiaryId: B.id }), ['receipt-from']); cere('receiptByOther', TR.verifyReceipt(forged.receiptByOther, { message: M, beneficiaryId: B.id }), ['receipt-from']);
// the KEM key files carry their private half (it is what opens a message), declared test material at the scene: the secret gate // the KEM key files carry their private half (it is what opens a message), declared test material at the scene: the secret gate
// (scripts/poarta-secrete.cjs) reads the AERE-SINTETIC marker on the line or the two lines above a private key in DER and reports // of the publication step reads the AERE-SINTETIC marker on the line or the two lines above a private key in DER and reports
// it as seen, not blocking; without the marker a PKCS8 key in a public folder is BLOCANT, as it must be // it as seen, not blocking; without the marker a PKCS8 key in a public folder is BLOCANT, as it must be
const sintetic = (k) => ({ ...k, private: { 'AERE-SINTETIC': 'a hybrid KEM key pair (X25519 + ML-KEM-768) made at generation for these conformance vectors; test material that opens only the messages of these vectors', ...k.private } }); const sintetic = (k) => ({ ...k, private: { 'AERE-SINTETIC': 'a hybrid KEM key pair (X25519 + ML-KEM-768) made at generation for these conformance vectors; test material that opens only the messages of these vectors', ...k.private } });
return { at: at(0), now: at(30), later: at(3700), nonce: NONCE, messageId: MID, registries: [reg.id], otherRegistries: [regStrain.id], ids: { originator: A.id, beneficiary: B.id, other: C.id, stranger: strain.id }, return { at: at(0), now: at(30), later: at(3700), nonce: NONCE, messageId: MID, registries: [reg.id], otherRegistries: [regStrain.id], ids: { originator: A.id, beneficiary: B.id, other: C.id, stranger: strain.id },
@@ -38,3 +38,7 @@ vedea HSTS, fiindca regulile `http-response` nu se aplica unui raspuns generat i
masurare trece raspunsul unui backend real prin frontend, si antetul apare; (2) comanda de preconditie a retetei `haproxy -vv | grep -i masurare trece raspunsul unui backend real prin frontend, si antetul apare; (2) comanda de preconditie a retetei `haproxy -vv | grep -i
"running on openssl"` NU prinde nimic pe HAProxy 3.4: randul e "Running on SSL library version : OpenSSL 3.5.9"; reteta spune acum "running on openssl"` NU prinde nimic pe HAProxy 3.4: randul e "Running on SSL library version : OpenSSL 3.5.9"; reteta spune acum
`grep -i "SSL library version"`. Ramane NEMASURAT: un Apache/HAProxy de productie cu configuratia lui intreaga, clienti reali (browsere). `grep -i "SSL library version"`. Ramane NEMASURAT: un Apache/HAProxy de productie cu configuratia lui intreaga, clienti reali (browsere).
*Nota 2026-11-26:* cele trei scripturi care au rulat masuratorile pe masina noastra (`masoara-nginx-rpc2.sh`,
`masoara-apache-haproxy-rpc2.sh`, `masoara-haproxy2-rpc2.sh`) nu sunt in copia publica: purtau caile acelei masini. Jurnalele lor si
rezultatele de mai sus raman cum au fost scrise; reteta de reprodus e cea din tabel si din sondele `tls-sonda.mjs` / `scaneaza-local.mjs`.
@@ -1,92 +0,0 @@
#!/bin/bash
# masoara-apache-haproxy-rpc2.sh (PE rpc2, copiat cu scp si chemat pe nume): retetele `apache` si `haproxy` ale remedierii
# (cloud-gateway/control-plane/remediere.mjs, GENERATOARE.apache / GENERATOARE.haproxy) masurate pe servere REALE, in containere
# (httpd:alpine, haproxy:alpine, fiecare cu OpenSSL-ul lui Alpine), publicate NUMAI pe 127.0.0.1 (8447 Apache, 8448 HAProxy; nimic pe
# porturile gazdei), cu EXACT fragmentele retetei pentru hndl-exposed + tls12-accepted + hsts-missing:
# apache: SSLOpenSSLConfCmd Groups X25519MLKEM768:X25519 / SSLProtocol -all +TLSv1.3 / Header always set Strict-Transport-Security "max-age=31536000"
# haproxy: ssl-default-bind-curves X25519MLKEM768:X25519 / ssl-default-bind-options ssl-min-ver TLSv1.3 / http-response set-header Strict-Transport-Security "max-age=31536000"
# Preconditiile retetei se citesc cum le cere ea (randul de pornire al lui Apache cu OpenSSL/; `haproxy -vv` "Running on OpenSSL"), si
# comenzile ei de verificare ruleaza in container (`httpd -t` = apachectl configtest; `haproxy -c -f`). Sonde: node 24 de pe rpc2
# (/root/reteta-sonda.mjs: hibrid singur, clasic singur, hibrid+clasic, TLS 1.2 refuzat), HSTS prin curl -k. Containere si imagini sterse
# la sfarsit; RPC-ul local cronometrat inainte si dupa. Iesire 0 = 8 din 8 sonde cum trebuie, 1 altfel.
set -u
D=/root/reteta-ah; rm -rf "$D"; mkdir -p "$D/certs" "$D/apache" "$D/haproxy"; cd "$D" || exit 2
N=/opt/node24/bin/node; S=/root/reteta-sonda.mjs
[ -x "$N" ] || { echo "NEMASURAT: node 24 lipseste la $N"; exit 2; }
[ -f "$S" ] || { echo "NEMASURAT: sonda lipseste la $S"; exit 2; }
rpc() { local t0=$(date +%s%N); curl -s -m 5 -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' http://127.0.0.1:8545 | grep -o '"result":"0x[0-9a-f]*"' | head -1; echo " ($(( ($(date +%s%N) - t0) / 1000000 )) ms)"; }
echo "== RPC inainte: $(rpc)"
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -keyout certs/privkey.pem -out certs/fullchain.pem -days 2 -subj '/CN=proba.local' > /dev/null 2>&1 && cat certs/privkey.pem certs/fullchain.pem > certs/proba.pem && chmod 644 certs/*.pem && echo "cert ok (autosemnat, 2 zile)"
rele=0
cere() { local nume="$1" ast="$2"; shift 2; out=$("$@" 2>&1); c=$?; if [ "$c" = "$ast" ]; then echo " OK $nume -> cod $c: $(printf '%s' "$out" | cut -c1-170)"; else echo " RAU $nume -> cod $c (asteptat $ast): $(printf '%s' "$out" | cut -c1-170)"; rele=$((rele + 1)); fi; }
sonde() { local port="$1" nume="$2"
cere "$nume: hibrid singur (X25519MLKEM768)" 0 $N $S 127.0.0.1 $port X25519MLKEM768
cere "$nume: clasic singur (X25519, rezerva din reteta)" 0 $N $S 127.0.0.1 $port X25519
cere "$nume: hibrid + clasic (preferinta)" 0 $N $S 127.0.0.1 $port X25519MLKEM768:X25519
cere "$nume: client TLS 1.2 (refuz)" 1 $N $S 127.0.0.1 $port X25519 TLSv1.2
echo " -- $nume: HSTS (curl -k)"; curl -sk -m 10 -D - -o /dev/null https://127.0.0.1:$port/ | grep -iE '^(strict-transport-security|HTTP)' | tr -d '\r' | sed 's/^/ /'; }
# ------------------------------------------------------------------ Apache httpd
echo "== APACHE: imaginea httpd:alpine"; docker pull -q httpd:alpine > /dev/null 2>&1; docker image inspect httpd:alpine --format 'imagine: {{.Id}} {{.Size}} octeti' | cut -c1-90
docker run --rm httpd:alpine httpd -v 2>&1 | head -2 | sed 's/^/ /'
# httpd.conf al imaginii + modulele cerute de reteta (ssl, socache, headers) + gazda virtuala cu EXACT fragmentul retetei
docker run --rm httpd:alpine cat /usr/local/apache2/conf/httpd.conf > apache/httpd.conf 2>/dev/null
sed -i -e 's/^#LoadModule ssl_module/LoadModule ssl_module/' -e 's/^#LoadModule socache_shmcb_module/LoadModule socache_shmcb_module/' -e 's/^#LoadModule headers_module/LoadModule headers_module/' apache/httpd.conf
cat >> apache/httpd.conf <<'EOF'
# ---- proba retetei AERE (remediere.mjs, profilul apache) ----
Listen 8447
<VirtualHost *:8447>
ServerName proba.local
DocumentRoot "/usr/local/apache2/htdocs"
SSLEngine on
SSLCertificateFile /usr/local/apache2/conf/certs/fullchain.pem
SSLCertificateKeyFile /usr/local/apache2/conf/certs/privkey.pem
# EXACT fragmentul retetei:
SSLOpenSSLConfCmd Groups X25519MLKEM768:X25519
SSLProtocol -all +TLSv1.3
Header always set Strict-Transport-Security "max-age=31536000"
</VirtualHost>
EOF
grep -c 'LoadModule ssl_module' apache/httpd.conf | sed 's/^/ LoadModule ssl_module randuri: /'
docker rm -f apache-reteta > /dev/null 2>&1
docker run -d --name apache-reteta -p 127.0.0.1:8447:8447 -v "$D/apache/httpd.conf:/usr/local/apache2/conf/httpd.conf:ro" -v "$D/certs:/usr/local/apache2/conf/certs:ro" httpd:alpine > /dev/null; sleep 3
docker ps --filter name=apache-reteta --format ' container: {{.Status}}'
echo " -- verificarea retetei: httpd -t (apachectl configtest) in container"; docker exec apache-reteta httpd -t 2>&1 | tail -1 | sed 's/^/ /'
echo " -- preconditia retetei: randul de pornire cu OpenSSL/ (jurnalul serverului)"; docker logs apache-reteta 2>&1 | grep -i 'openssl/' | tail -1 | cut -c1-160 | sed 's/^/ /'
sonde 8447 apache
docker logs apache-reteta 2>&1 | grep -iE 'error|emerg' | grep -v 'AH00558' | head -3 | sed 's/^/ jurnal: /'
# ------------------------------------------------------------------ HAProxy
echo "== HAPROXY: imaginea haproxy:alpine"; docker pull -q haproxy:alpine > /dev/null 2>&1; docker image inspect haproxy:alpine --format 'imagine: {{.Id}} {{.Size}} octeti' | cut -c1-90
echo " -- preconditia retetei: haproxy -vv | grep -i 'running on openssl'"; docker run --rm haproxy:alpine haproxy -vv 2>&1 | grep -iE 'HAProxy version|running on openssl|built with openssl' | cut -c1-120 | sed 's/^/ /'
cat > haproxy/haproxy.cfg <<'EOF'
global
# EXACT fragmentul retetei (sectiunea global):
ssl-default-bind-curves X25519MLKEM768:X25519
ssl-default-bind-options ssl-min-ver TLSv1.3
defaults
mode http
timeout connect 5s
timeout client 10s
timeout server 10s
frontend proba
bind :8448 ssl crt /usr/local/etc/haproxy/certs/proba.pem
# EXACT fragmentul retetei (frontend-ul HTTPS):
http-response set-header Strict-Transport-Security "max-age=31536000"
http-request return status 200 content-type text/plain string "ok\n"
EOF
docker rm -f haproxy-reteta > /dev/null 2>&1
echo " -- verificarea retetei: haproxy -c -f"; docker run --rm -v "$D/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro" -v "$D/certs:/usr/local/etc/haproxy/certs:ro" haproxy:alpine haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg 2>&1 | tail -2 | sed 's/^/ /'
docker run -d --name haproxy-reteta -p 127.0.0.1:8448:8448 -v "$D/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro" -v "$D/certs:/usr/local/etc/haproxy/certs:ro" haproxy:alpine > /dev/null; sleep 3
docker ps --filter name=haproxy-reteta --format ' container: {{.Status}}'
sonde 8448 haproxy
docker logs haproxy-reteta 2>&1 | grep -iE 'alert|error|emerg' | head -3 | sed 's/^/ jurnal: /'
echo "== curatenie"; docker rm -f apache-reteta haproxy-reteta > /dev/null 2>&1; docker rmi httpd:alpine haproxy:alpine > /dev/null 2>&1 && echo " imaginile sterse"
cd /root && rm -rf "$D"; docker ps -a --format '{{.Names}}' | grep -cE 'apache-reteta|haproxy-reteta' | sed 's/^/ containere ramase: /'
echo "== RPC dupa: $(rpc)"
echo "retetele apache + haproxy: $((8 - rele)) din 8 sonde cum trebuie"
[ "$rele" = 0 ] && exit 0 || exit 1
@@ -1,59 +0,0 @@
#!/bin/bash
# masoara-haproxy2-rpc2.sh (PE rpc2): a doua masurare a retetei `haproxy`, dupa ce prima (masoara-apache-haproxy-rpc2.sh) a aratat doua
# lucruri despre PROBA, nu despre reteta: (1) `http-request return` genereaza raspunsul in HAProxy si regulile `http-response` NU se
# aplica unui raspuns generat intern (numai `http-after-response`), deci HSTS-ul retetei nu avea cum sa apara; (2) `haproxy -c -f`
# tace la succes si grep-ul pe `-vv` nu a prins randurile bibliotecii SSL. Aici: un backend HTTP simplu FARA HSTS (httpd:alpine pe
# 127.0.0.1:8449, control: curl direct pe el nu are antetul), HAProxy cu reteaua gazdei legat NUMAI pe 127.0.0.1:8448 (ssl) si cu
# backend-ul acela, deci raspunsul trece prin calea de raspuns si `http-response set-header` al retetei se vede sau nu; `haproxy -c -f`
# cu codul tiparit; `haproxy -vv` cu toate randurile despre SSL/OpenSSL si grupurile ML-KEM. Fragmentele retetei NESCHIMBATE.
set -u
D=/root/reteta-hp; rm -rf "$D"; mkdir -p "$D/certs" "$D/haproxy"; cd "$D" || exit 2
N=/opt/node24/bin/node; S=/root/reteta-sonda.mjs
[ -x "$N" ] || { echo "NEMASURAT: node 24 lipseste"; exit 2; }; [ -f "$S" ] || { echo "NEMASURAT: sonda lipseste"; exit 2; }
rpc() { local t0=$(date +%s%N); curl -s -m 5 -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' http://127.0.0.1:8545 | grep -o '"result":"0x[0-9a-f]*"' | head -1; echo " ($(( ($(date +%s%N) - t0) / 1000000 )) ms)"; }
echo "== RPC inainte: $(rpc)"
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -keyout certs/privkey.pem -out certs/fullchain.pem -days 2 -subj '/CN=proba.local' > /dev/null 2>&1 && cat certs/privkey.pem certs/fullchain.pem > certs/proba.pem && chmod 644 certs/*.pem && echo "cert ok"
rele=0
cere() { local nume="$1" ast="$2"; shift 2; out=$("$@" 2>&1); c=$?; if [ "$c" = "$ast" ]; then echo " OK $nume -> cod $c: $(printf '%s' "$out" | cut -c1-170)"; else echo " RAU $nume -> cod $c (asteptat $ast): $(printf '%s' "$out" | cut -c1-170)"; rele=$((rele + 1)); fi; }
docker pull -q httpd:alpine > /dev/null 2>&1; docker pull -q haproxy:alpine > /dev/null 2>&1
echo "== haproxy -vv: versiunea, biblioteca SSL, grupurile"; docker run --rm haproxy:alpine haproxy -vv 2>&1 | grep -iE 'HAProxy version|SSL|TLS|QUIC' | cut -c1-140 | sed 's/^/ /'
echo "== backend-ul simplu (httpd:alpine implicit, fara HSTS) pe 127.0.0.1:8449"
docker rm -f backend-reteta haproxy-reteta > /dev/null 2>&1
docker run -d --name backend-reteta -p 127.0.0.1:8449:80 httpd:alpine > /dev/null; sleep 2
echo " control: curl direct pe backend (fara HAProxy) -> antetele:"; curl -s -m 10 -D - -o /dev/null http://127.0.0.1:8449/ | grep -iE '^(strict-transport-security|HTTP)' | tr -d '\r' | sed 's/^/ /'
cat > haproxy/haproxy.cfg <<'EOF'
global
# EXACT fragmentul retetei (sectiunea global):
ssl-default-bind-curves X25519MLKEM768:X25519
ssl-default-bind-options ssl-min-ver TLSv1.3
defaults
mode http
timeout connect 5s
timeout client 10s
timeout server 10s
frontend proba
bind 127.0.0.1:8448 ssl crt /usr/local/etc/haproxy/certs/proba.pem
# EXACT fragmentul retetei (frontend-ul HTTPS):
http-response set-header Strict-Transport-Security "max-age=31536000"
default_backend simplu
backend simplu
server s1 127.0.0.1:8449
EOF
echo "== verificarea retetei: haproxy -c -f"; docker run --rm --network host -v "$D/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro" -v "$D/certs:/usr/local/etc/haproxy/certs:ro" haproxy:alpine haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg > "$D/hc.txt" 2>&1; hc=$?; echo " cod $hc: $(tr '\n' ' ' < "$D/hc.txt" | cut -c1-160)"
docker run -d --name haproxy-reteta --network host -v "$D/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro" -v "$D/certs:/usr/local/etc/haproxy/certs:ro" haproxy:alpine > /dev/null; sleep 3
docker ps --filter name=haproxy-reteta --format ' container: {{.Status}}'
cere "haproxy: hibrid singur (X25519MLKEM768)" 0 $N $S 127.0.0.1 8448 X25519MLKEM768
cere "haproxy: clasic singur (X25519, rezerva din reteta)" 0 $N $S 127.0.0.1 8448 X25519
cere "haproxy: hibrid + clasic (preferinta)" 0 $N $S 127.0.0.1 8448 X25519MLKEM768:X25519
cere "haproxy: client TLS 1.2 (refuz)" 1 $N $S 127.0.0.1 8448 X25519 TLSv1.2
echo " -- HSTS prin HAProxy (raspuns venit de la backend-ul fara HSTS, curl -k):"; curl -sk -m 10 -D - -o /dev/null https://127.0.0.1:8448/ > "$D/h.txt"; grep -iE '^(strict-transport-security|HTTP)' "$D/h.txt" | tr -d '\r' | sed 's/^/ /'
if grep -qi '^strict-transport-security: max-age=31536000' "$D/h.txt"; then echo " OK HSTS pus de HAProxy (backend-ul nu il are)"; else echo " RAU HSTS lipseste prin HAProxy"; rele=$((rele + 1)); fi
docker logs haproxy-reteta 2>&1 | grep -iE 'alert|error|emerg' | head -3 | sed 's/^/ jurnal: /'
echo "== curatenie"; docker rm -f backend-reteta haproxy-reteta > /dev/null 2>&1; docker rmi httpd:alpine haproxy:alpine > /dev/null 2>&1 && echo " imaginile sterse"
cd /root && rm -rf "$D"; docker ps -a --format '{{.Names}}' | grep -cE 'backend-reteta|haproxy-reteta' | sed 's/^/ containere ramase: /'
echo "== RPC dupa: $(rpc)"
echo "reteta haproxy (a doua masurare): $((5 - rele)) din 5 cum trebuie (4 sonde + HSTS)"
[ "$rele" = 0 ] && [ "$hc" = 0 ] && exit 0 || exit 1
@@ -1,44 +0,0 @@
#!/bin/bash
# masoara-nginx-rpc2.sh (PE rpc2, trimis cu `ssh ... 'bash -s'`): reteta nginx a remedierii (profilul `nginx`) masurata pe un nginx REAL,
# in container (nginx:alpine, cu OpenSSL-ul lui Alpine), pe 127.0.0.1:8446, cu EXACT directivele retetei pentru hndl-exposed +
# tls12-accepted + hsts-missing: `ssl_ecdh_curve X25519MLKEM768:X25519; ssl_protocols TLSv1.3; add_header Strict-Transport-Security
# "max-age=31536000" always;`. Preconditia retetei (nginx legat de OpenSSL >= 3.5) se citeste din `nginx -V`. Sonde: node 24 de pe rpc2
# (hibrid singur, clasic singur, TLS 1.2 refuzat), HSTS prin curl. Container si imagine sterse la sfarsit. RPC-ul local cronometrat.
set -u
D=/root/nginx-reteta; rm -rf "$D"; mkdir -p "$D/certs" "$D/conf"; cd "$D" || exit 2
N=/opt/node24/bin/node
rpc() { local t0=$(date +%s%N); curl -s -m 5 -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' http://127.0.0.1:8545 | grep -o '"result":"0x[0-9a-f]*"' | head -1; echo " ($(( ($(date +%s%N) - t0) / 1000000 )) ms)"; }
echo "== RPC inainte: $(rpc)"
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -keyout certs/privkey.pem -out certs/fullchain.pem -days 2 -subj '/CN=proba.local' > /dev/null 2>&1 && chmod 644 certs/*.pem && echo "cert ok"
cat > conf/default.conf <<'EOF'
server {
listen 127.0.0.1:8446 ssl;
server_name proba.local;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
# EXACT fragmentul retetei (remediere.mjs, profilul nginx):
ssl_ecdh_curve X25519MLKEM768:X25519;
ssl_protocols TLSv1.3;
add_header Strict-Transport-Security "max-age=31536000" always;
location / { return 200 "ok\n"; }
}
EOF
cp tls-sonda.mjs "$D/" 2>/dev/null || true
echo "== imaginea nginx:alpine"; docker pull -q nginx:alpine > /dev/null 2>&1; docker image inspect nginx:alpine --format 'imagine: {{.Id}} {{.Size}} octeti' | cut -c1-90
echo "-- preconditia retetei: nginx -V (OpenSSL)"; docker run --rm nginx:alpine nginx -V 2>&1 | grep -iE 'nginx version|openssl' | cut -c1-160
docker rm -f nginx-reteta > /dev/null 2>&1
docker run -d --name nginx-reteta --network host -v "$D/conf/default.conf:/etc/nginx/conf.d/default.conf:ro" -v "$D/certs:/etc/nginx/certs:ro" nginx:alpine > /dev/null; sleep 2
docker ps --filter name=nginx-reteta --format 'container: {{.Status}}'
echo "-- nginx -t in container"; docker exec nginx-reteta nginx -t 2>&1 | tail -1
rele=0
cere() { local nume="$1" ast="$2"; shift 2; out=$("$@" 2>&1); c=$?; if [ "$c" = "$ast" ]; then echo " OK $nume -> cod $c: $(printf '%s' "$out" | cut -c1-170)"; else echo " RAU $nume -> cod $c (asteptat $ast): $(printf '%s' "$out" | cut -c1-170)"; rele=$((rele + 1)); fi; }
cere "hibrid singur (X25519MLKEM768)" 0 $N /root/nginx-reteta-sonda.mjs 127.0.0.1 8446 X25519MLKEM768
cere "clasic singur (X25519, rezerva din reteta)" 0 $N /root/nginx-reteta-sonda.mjs 127.0.0.1 8446 X25519
cere "hibrid + clasic (preferinta)" 0 $N /root/nginx-reteta-sonda.mjs 127.0.0.1 8446 X25519MLKEM768:X25519
cere "client TLS 1.2 (ssl_protocols TLSv1.3: refuz)" 1 $N /root/nginx-reteta-sonda.mjs 127.0.0.1 8446 X25519 TLSv1.2
echo "-- HSTS (curl -k)"; curl -sk -m 10 -D - -o /dev/null https://127.0.0.1:8446/ | grep -iE '^(strict-transport-security|HTTP)' | tr -d '\r'
docker logs nginx-reteta 2>&1 | grep -iE 'emerg|error' | head -3
echo "== curatenie"; docker rm -f nginx-reteta > /dev/null 2>&1; docker rmi nginx:alpine > /dev/null 2>&1 && echo "imaginea stearsa"; cd /root && rm -rf "$D" /root/nginx-reteta-sonda.mjs; docker ps -a --format '{{.Names}}' | grep -c nginx-reteta | sed 's/^/containere ramase: /'
echo "== RPC dupa: $(rpc)"
echo "reteta nginx: $((4 - rele)) din 4 sonde cum trebuie"
[ "$rele" = 0 ] && exit 0 || exit 1
@@ -25,3 +25,6 @@ Doua capcane platite in aceeasi rulare, fara paguba: (1) randul `listening` a fo
OpenSSL a gateway-ului a lipsit din jurnalul adus si s-a masurat separat pe imaginea de baza; (2) serverul de proba pornit cu OpenSSL a gateway-ului a lipsit din jurnalul adus si s-a masurat separat pe imaginea de baza; (2) serverul de proba pornit cu
`nohup ... &` dintr-un subshell a ramas in viata dupa script (`$!` scris intr-un fisier relativ sters de curatenie), a tinut sesiunea `nohup ... &` dintr-un subshell a ramas in viata dupa script (`$!` scris intr-un fisier relativ sters de curatenie), a tinut sesiunea
ssh deschisa 10 minute dupa ce scriptul se terminase (aceeasi familie cu C5, 2026-10-11) si a fost oprit de mana; nimic nu a ramas armat. ssh deschisa 10 minute dupa ce scriptul se terminase (aceeasi familie cu C5, 2026-10-11) si a fost oprit de mana; nimic nu a ramas armat.
*Nota 2026-11-26:* scriptul `pqgw-imagine-rpc2.sh` nu e in copia publica: purta caile masinii pe care a rulat. Sonda `pqgw-sonda.mjs`,
jurnalul rularii si cifrele de mai sus raman cum au fost scrise.
-34
View File
@@ -1,34 +0,0 @@
#!/bin/bash
# pqgw-imagine-rpc2.sh (PE rpc2; fisierele vin in /root/pqgw-imagine: pqgw.tar din `git archive HEAD` + pqgw-sonda.mjs):
# masoara ce README-ul gateway-ului numeste NEMASURAT: imaginea Docker se construieste, PORNESTE, poarta OpenSSL >= 3.5, si un client
# care ofera NUMAI X25519MLKEM768 face handshake, iar unul clasic e REFUZAT in modul hybrid-only (controlul negativ). Totul pe 127.0.0.1,
# port 8444, container si imagine sterse la sfarsit (nimic ramane armat). RPC-ul local e cronometrat inainte si dupa.
set -u
D=/root/pqgw-imagine; cd "$D" || exit 2
N=/opt/node24/bin/node
rpc() { local t0=$(date +%s%N); curl -s -m 5 -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' http://127.0.0.1:8545 | grep -o '"result":"0x[0-9a-f]*"' | head -1; echo " ($(( ($(date +%s%N) - t0) / 1000000 )) ms)"; }
echo "== RPC inainte: $(rpc)"
rm -rf src && mkdir -p src certs && tar -xf pqgw.tar -C src && ls -la src/cloud-gateway/pq-gateway | sed -n '2,5p'
sha256sum src/cloud-gateway/pq-gateway/pq-gateway.mjs src/cloud-gateway/pq-gateway/Dockerfile | cut -c1-16,66-
echo "== docker build"; t0=$(date +%s); docker build -q -t aere-pq-gateway:proba src/cloud-gateway/pq-gateway > build.log 2>&1; c=$?; echo "build cod=$c in $(( $(date +%s) - t0 )) s; $(tail -1 build.log | cut -c1-100)"
[ $c -eq 0 ] || { tail -20 build.log; exit 1; }
docker image inspect aere-pq-gateway:proba --format 'imagine: {{.Id}} {{.Size}} octeti, {{.Os}}/{{.Architecture}}, user={{.Config.User}}'
echo "== certificat de proba (EC P-256, autosemnat, citibil de uid 1000)"
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes -keyout certs/privkey.pem -out certs/fullchain.pem -days 2 -subj '/CN=proba.local' > /dev/null 2>&1 && chmod 644 certs/privkey.pem certs/fullchain.pem && echo "cert ok"
echo "== upstream de proba (python http.server pe 127.0.0.1:8081)"; (cd certs && nohup python3 -m http.server 8081 --bind 127.0.0.1 > /dev/null 2>&1 & echo $! > ../upstream.pid); sleep 1
docker rm -f pqgw-proba > /dev/null 2>&1
echo "== pornire: hybrid-only"
docker run -d --name pqgw-proba --network host -e AERE_PQGW_LISTEN=127.0.0.1:8444 -e AERE_PQGW_MODE=hybrid-only -e AERE_PQGW_UPSTREAM=http://127.0.0.1:8081 -v "$D/certs:/etc/aere-pq-gateway:ro" aere-pq-gateway:proba > /dev/null; sleep 3
docker ps --filter name=pqgw-proba --format 'container: {{.Status}}'
echo "-- jurnal (randul listening cu OpenSSL)"; docker logs pqgw-proba 2>&1 | head -5 | cut -c1-220
echo "-- sonda hibrid singur (trebuie ok)"; $N pqgw-sonda.mjs 127.0.0.1 8444 X25519MLKEM768; echo "cod=$?"
echo "-- sonda clasic singur in hybrid-only (CONTROL NEGATIV: trebuie refuzat)"; $N pqgw-sonda.mjs 127.0.0.1 8444 X25519; echo "cod=$?"
echo "-- o cerere HTTP prin gateway (hibrid) spre upstream"; curl -sk -m 8 --curves X25519MLKEM768 --tlsv1.3 https://127.0.0.1:8444/ -o /dev/null -w 'http=%{http_code} ssl=%{ssl_verify_result} tls=%{tls_version}\n' 2>&1 | head -1 || true
echo "== repornire: hybrid-preferred (clasicul trebuie sa mearga, hibridul preferat)"
docker rm -f pqgw-proba > /dev/null 2>&1
docker run -d --name pqgw-proba --network host -e AERE_PQGW_LISTEN=127.0.0.1:8444 -e AERE_PQGW_MODE=hybrid-preferred -e AERE_PQGW_UPSTREAM=http://127.0.0.1:8081 -v "$D/certs:/etc/aere-pq-gateway:ro" aere-pq-gateway:proba > /dev/null; sleep 3
echo "-- sonda clasic singur in hybrid-preferred (trebuie ok)"; $N pqgw-sonda.mjs 127.0.0.1 8444 X25519; echo "cod=$?"
echo "-- sonda hibrid+clasic in hybrid-preferred (trebuie ok)"; $N pqgw-sonda.mjs 127.0.0.1 8444 X25519MLKEM768:X25519; echo "cod=$?"
docker logs pqgw-proba 2>&1 | tail -4 | cut -c1-220
echo "== curatenie"; docker rm -f pqgw-proba > /dev/null 2>&1; docker rmi aere-pq-gateway:proba > /dev/null 2>&1 && echo "imaginea stearsa"; kill "$(cat upstream.pid)" 2>/dev/null; rm -rf certs upstream.pid; docker ps --filter name=pqgw --format '{{.Names}}' | grep -c . | sed 's/^/containere pqgw ramase: /'
echo "== RPC dupa: $(rpc)"