Connect from libpq service files and match the real Secret layout
The maintainer's login Secrets carry pg_service.conf ([evolution]), pgpass and ca.crt. Add a strict read_pg_service (known keys only, verify-full unless a local socket, bounded size) behind --pg-service in evo-server and evo-world-clone, mount each login Secret whole in the store Jobs instead of reading aevolution-db, and fix the migrate Job's PGSERVICE to the [evolution] section. Record the store node choice, per-environment databases and the backup plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,21 @@ void check_store_qualifies_the_stores() {
|
||||
const auto other = fresh("store-check-full");
|
||||
auto full = check_store(other, runtime, {"--reserve-mib", "1048576"}, code);
|
||||
CHECK(code == 4 && has(full, "probe refused full"));
|
||||
// The same check through a libpq service file, as the cluster Jobs run it.
|
||||
const auto service = root / "pg_service.conf";
|
||||
{
|
||||
std::FILE* f = std::fopen(service.c_str(), "wb");
|
||||
CHECK(f != nullptr);
|
||||
const auto text = "[evolution]\nhost=" + env("PGHOST") + "\nport=" + env("PGPORT") +
|
||||
"\ndbname=" + env("PGDATABASE") + "\nuser=" + runtime +
|
||||
"\nsslmode=disable\nconnect_timeout=5\n";
|
||||
CHECK(std::fwrite(text.data(), 1, text.size(), f) == text.size());
|
||||
CHECK(std::fclose(f) == 0);
|
||||
}
|
||||
Child via_service{{env("EVO_WORLD_CLONE_BIN"), "check-store", "--world", "7", "--region", "84",
|
||||
"--pg-service", service.string(), "--objects", root.string()}};
|
||||
CHECK(via_service.wait_exit(30s) == 0 && via_service.printed("probe verified digest=") &&
|
||||
via_service.printed("database tables=denied functions=reachable"));
|
||||
// An owner login can read tables: not an acceptable runtime identity.
|
||||
auto owner_run = check_store(root, env("PGUSER"), {}, code);
|
||||
CHECK(code == 3 && has(owner_run, "database tables=READABLE"));
|
||||
|
||||
Reference in New Issue
Block a user