p4login_master #3

  • //
  • guest/
  • russell_jackson/
  • sdp/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • p4login_master
  • View
  • Commits
  • Open Download .zip Download (614 B)
#!/bin/bash
if [[ "${SDP_SKIP_LOGIN:-0}" -eq 1 ]]; then
   TicketExpiration=$($P4BIN -ztag -F %TicketExpiration% -p $P4MASTERPORT -u $P4USER login -s 2>/dev/null)
   if [[ "$TicketExpiration" =~ [0-9]+ ]]; then
      exit 0
   fi
   echo "Error: User $P4USER is not logged into $P4MASTERPORT, and SDP_SKIP_LOGIN is set (password-based login is disabled). Log in manually, e.g.: $P4BIN -p $P4MASTERPORT -u $P4USER login" > /p4/${SDP_INSTANCE}/logs/p4login.log 2>&1
   exit 1
fi

$P4BIN -p $P4MASTERPORT -u $P4USER login -a < /p4/common/config/.p4passwd.${P4SERVER}.admin > /p4/${SDP_INSTANCE}/logs/p4login.log 2>&1
# Change User Description Committed
#3 33185 Russell C. Jackson (Rusty) sudoers systemctl path fix, p4login SDP_SKIP_LOGIN, plain p4/p4d bin links, custom journalPrefix support

sudoers: P4_SVC (sdp) and P4_SYSTEMCTL (ansible-sdp) Cmnd_Aliases now grant both
/usr/bin/systemctl and /bin/systemctl for every command, since the two templates
disagreed on which path is real; backup_functions.sh and load_checkpoint.sh now
resolve systemctl once via 'command -v' and invoke that resolved path with sudo
instead of a bare 'sudo systemctl', so the invoked path always matches what's
granted regardless of which one is real on a given box.
p4login/p4login_master: add SDP_SKIP_LOGIN (p4_vars), for sites that keep no
P4USER password on the server and log in manually via a long-lived ticket.
When set, p4login still runs its existing ticket check and fails fast with an
actionable message if no valid ticket is found, but never reads the password
file.
upgrade.sh/mkdirs.sh: add plain 'p4'/'p4d' entry points in /p4/<instance>/bin,
symlinked directly to p4_<instance> and p4d_<instance>_bin (the raw binaries,
not the -vtrack=0/-C1 wrapper), refreshed on every upgrade.
journalPrefix: decouple checkpoint/journal filename construction from the
hardcoded assumption that it always equals $P4SERVER ("p4_<instance>").
p4_vars now derives P4JOURNALPREFIX (full path) and P4CKP_PREFIX (basename) as
a single source of truth -- preferring an explicit override, then the live
value from 'p4 configure show journalPrefix' if a server is reachable
(auto-setting it to the SDP default if unset), falling back to the SDP
default otherwise. backup_functions.sh, load_checkpoint.sh, and
recover_edge.sh now build every checkpoint/journal filename from
P4CKP_PREFIX (or P4JOURNALPREFIX for the few front-door/no -J rotation
paths) instead of $P4SERVER. configurables.cfg's ccheck.sh rule for
journalPrefix is loosened from Exact to Set, so a custom journalPrefix is no
longer fought back to the p4_<instance> convention by 'ccheck.sh -FIX'.
#2 22981 Russell C. Jackson (Rusty) Made files writeable so they are easier to update once on the server.
#1 22757 Russell C. Jackson (Rusty) Added P4SVRPORT to use to make the server listen on just the port number.

Changed P4PORT to include the hostname to eliminate a bug where the ticket is not
issued by the master as it should be when rpl.forward.login is set up.

Created a p4login_master and updated appropriate scripts to use it. This actually
isn't necessary with the change to include the hostname in P4PORT since the ticket
will be valid on all servers in the group, but this covers configurations that aren't
using rpl.forward.login.