sudoers_preview.sh #1

  • //
  • guest/
  • russell_jackson/
  • sdp/
  • test/
  • containers/
  • sudoers_preview.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
# Generate and validate a preview only, inside the marked disposable container.
fail() { printf 'ERROR: %s\n' "$*" >&2; exit 1; }
[[ $(id -u) == 0 && -f /run/sdp-container-test && -d /p4/common ]] || fail 'Requires a provisioned disposable root container.'
mkdir -p /results || exit 1
python3 - <<'PY' > /results/sudoers-before.json
from pathlib import Path
import hashlib, json
print(json.dumps({str(p): hashlib.sha256(p.read_bytes()).hexdigest() for p in Path('/etc/sudoers.d').iterdir() if p.is_file()}, sort_keys=True))
PY
[[ $? == 0 ]] || exit 1
/p4/sdp/Server/Unix/setup/gen_sudoers.sh -limited -L /results/sudoers-preview.log || fail 'Sudoers preview generation failed.'
python3 - <<'PY'
from pathlib import Path
import hashlib, json
text = Path('/results/sudoers-preview.log').read_text()
start = text.index('Generated limited sudoers temp file:\n')
parts = text[start:].split('------------------------------------------------------------------------------\n')
assert len(parts) >= 3, 'Generated sudoers content missing'
Path('/results/generated-sudoers').write_text(parts[1])
before = json.loads(Path('/results/sudoers-before.json').read_text())
after = {str(p): hashlib.sha256(p.read_bytes()).hexdigest() for p in Path('/etc/sudoers.d').iterdir() if p.is_file()}
assert before == after, 'Preview changed installed sudoers'
PY
[[ $? == 0 ]] || fail 'Sudoers preview content or unchanged-install assertion failed.'
visudo -cf /results/generated-sudoers || fail 'Generated preview failed visudo validation.'
printf 'SDP sudoers preview validation passed\n' | tee -a /results/sudoers-preview.log
# Change User Description Committed
#1 34004 Russell C. Jackson (Rusty) Improve SDP backup/recovery, Maintenance, logging and cloud operation.

Add owned checkpoint locks, recovery-aware retention, preserved database switches,
bounded cleanup and coordinated AWS/Azure snapshots. Fix service-user password
initialization, edge staging, standby promotion state parsing, proxy cache setup,
typed depot verification and historical-server configuration/error handling.
Remove unused OTP programs; keep Windows removed, server.locks cleanup and the
journal-count condition unchanged. Add no global shell strict modes.

Update operational documentation and add reproducible mkdirs.sh/mkdirs.cfg
container assurance. Validate Ubuntu 26.04 and UBI 8.10/9.8/10.2 across both Python
runtimes: 44 stages; 428 offline tests per runtime/OS, zero offline skips;
19 deployed-archive comparisons per combination. Three six-node topology runs
pass all 30 recovery/failure scenarios. P4D 2023.1 through 2026.1 on UBI 8/9
pass all 14 cells and 98 scenarios. Static, documentation and provenance checks
pass. Containers do not certify every fleet kernel, patch build or integration.

Tested source manifest SHA-256:
e1a23e17b8ced8c1148d9a250589977c6f6e98606bf2a81dc3ff5d7c909e3695
Deployed comparison archive SHA-256:
1bd23217356ee3808e040d39aea5be9519bda7c8f2b4924656a70aff8ad7293a