sdp_service_user.sh #1

  • //
  • guest/
  • russell_jackson/
  • sdp/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • sdp_service_user.sh
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/bin/bash
# Checked initialization for a newly created native service user. Preserve the
# site's password-reset policy: when it requires a first-login reset, initialize
# a temporary password then perform that reset as the service user itself.
# Source after p4_vars. No passwords are passed in command arguments or files.
sdp_initialize_service_password () {
   local ServiceUser=${1:?Service user required} FinalPassword=${2:?Password required}
   local Config= Reset= InitialPassword=
   Config=$("$P4BIN" -ztag configure show dm.user.resetpassword) || return $?
   Reset=$(awk '$1 == "..." && $2 == "Value" {print $3}' <<< "$Config") || return $?
   if [[ "$Reset" != 0 && "$Reset" != 1 ]]; then
      echo 'Cannot determine dm.user.resetpassword; service password was not changed.' >&2
      return 1
   fi
   if [[ "$Reset" == 0 ]]; then
      printf '%s\n%s\n' "$FinalPassword" "$FinalPassword" | "$P4BIN" passwd "$ServiceUser"
      return $?
   fi
   InitialPassword=$(od -An -N24 -tx1 /dev/urandom | tr -d ' \n') || return $?
   [[ "$InitialPassword" =~ ^[0-9a-f]{48}$ ]] || {
      echo 'Cannot generate initial service password; service password was not changed.' >&2
      return 1
   }
   InitialPassword="SdpInit${InitialPassword}!"
   printf '%s\n%s\n' "$InitialPassword" "$InitialPassword" | "$P4BIN" passwd "$ServiceUser" || return $?
   printf '%s\n%s\n%s\n' "$InitialPassword" "$FinalPassword" "$FinalPassword" |
      "$P4BIN" -u "$ServiceUser" passwd || return $?
}
# 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