#!/usr/bin/env python # # This script requires the pytop module. # You can get it with "pip install pyotp" # Source: https://github.com/pyotp/pyotp # # This script generates a key for a user and stores the key in the Perforce server. import pyotp import os import re import sys import subprocess # This user should have at least admin access and an unlimited login p4admin = os.environ['P4USER'] # This is the Perforce server where user's password and keys are stored. authserver = "localhost:1667" domain = "company.com" user = sys.argv key = pyotp.random_base32() os.system("p4 -u %s -p %s key %s %s" % (p4admin, authserver, user, key)) totp = pyotp.TOTP(key) uri = totp.provisioning_uri("%s@%s" % (user, domain)) print("http://chart.apis.google.com/chart?cht=qr&chs=250x250&chl=%s" % uri) print("Key: %s" % key)
Released SDP 2020.1.27325 (2021/01/29).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
This is Tom's change:
Introduced new 'Unsupported' directory to clarify that some files
in the SDP are not officially supported. These files are samples for
illustration, to provide examples, or are deprecated but not yet
ready for removal from the package.
The Maintenance and many SDP triggers have been moved under here,
along with other SDP scripts and triggers.
Added comments to p4_vars indicating that it should not be edited
directly. Added reference to an optional site_global_vars file that,
if it exists, will be sourced to provide global user settings
without needing to edit p4_vars.
As an exception to the refactoring, the totalusers.py Maintenance
script will be moved to indicate that it is supported.
Removed settings to support long-sunset P4Web from supported structure.
Structure under new .../Unsupported folder is:
Samples/bin Sample scripts.
Samples/triggers Sample trigger scripts.
Samples/triggers/tests Sample trigger script tests.
Samples/broker Sample broker filter scripts.
Deprecated/triggers Deprecated triggers.
To Do in a subsequent change: Make corresponding doc changes.
Auth trigger and script to generate otp QR code for using Google Auth.
Looks good to me. Not sure how to test in our existing test suite?