sync: Dataforth sync fixes, TestDataDB stability, and client scripts
Dataforth DOS: - TestDataDB: singleton DB connection fix (crash prevention), WAL mode, WinSW service config, backup script, uncaught exception handlers - Sync-FromNAS.ps1: Get-NASFileList temp file approach to avoid SSH stdout deadlock, *> $null output suppression, 8.3 filename filter for PUSH phase, backslash-escaped SCP paths, rename-to-.synced - import.js: INSERT OR REPLACE for re-tested devices - Full import run: 1,028,275 -> 1,632,793 records, indexes added - Deploy script for sync fixes to AD2 Client scripts (temp/): - BG Builders: Lesley account check, MFA phone update - Lonestar Electrical: Kyla/Russ Google Workspace setup, 2FA bypass - AD2 diagnostics and NAS connectivity tests PENDING: Investigate why newest test_date is Jan 19 despite daily tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
52
temp/lonestar-kyla-2fa-fix.py
Normal file
52
temp/lonestar-kyla-2fa-fix.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""Generate backup codes for office@lonestarelectrical.net so Kyla can bypass 2FA enrollment block"""
|
||||
from google.oauth2 import service_account
|
||||
from googleapiclient.discovery import build
|
||||
|
||||
SCOPES = [
|
||||
'https://www.googleapis.com/auth/admin.directory.user',
|
||||
'https://www.googleapis.com/auth/admin.directory.user.security',
|
||||
]
|
||||
|
||||
creds = service_account.Credentials.from_service_account_file(
|
||||
'temp/acg-msp-access-8f72339997e5.json', scopes=SCOPES
|
||||
)
|
||||
delegated = creds.with_subject('sysadmin@lonestarelectrical.net')
|
||||
service = build('admin', 'directory_v1', credentials=delegated)
|
||||
|
||||
user_email = 'office@lonestarelectrical.net'
|
||||
|
||||
# Check current 2SV status
|
||||
print(f"=== {user_email} 2SV Status ===")
|
||||
user = service.users().get(userKey=user_email).execute()
|
||||
print(f"2SV Enrolled: {user.get('isEnrolledIn2Sv', False)}")
|
||||
print(f"2SV Enforced: {user.get('isEnforcedIn2Sv', False)}")
|
||||
|
||||
# Generate backup verification codes
|
||||
print(f"\n=== Generating Backup Codes ===")
|
||||
try:
|
||||
codes = service.verificationCodes().generate(userKey=user_email).execute()
|
||||
print("[OK] Backup codes generated")
|
||||
except Exception as e:
|
||||
print(f"[INFO] Generate returned: {e}")
|
||||
|
||||
# List the codes
|
||||
try:
|
||||
result = service.verificationCodes().list(userKey=user_email).execute()
|
||||
backup_codes = result.get('items', [])
|
||||
if backup_codes:
|
||||
print(f"\nBackup codes for Kyla to use at login:")
|
||||
for code in backup_codes:
|
||||
status = code.get('etag', '')
|
||||
print(f" {code.get('verificationCode', 'N/A')}")
|
||||
print(f"\nInstructions for Kyla:")
|
||||
print(f" 1. Go to https://accounts.google.com")
|
||||
print(f" 2. Enter email: {user_email}")
|
||||
print(f" 3. Enter the temp password we set")
|
||||
print(f" 4. When prompted for 2FA, click 'Try another way'")
|
||||
print(f" 5. Select 'Enter a backup code'")
|
||||
print(f" 6. Use one of the codes above")
|
||||
print(f" 7. Once logged in, go to Security > 2-Step Verification to set up her phone")
|
||||
else:
|
||||
print("[WARNING] No codes returned")
|
||||
except Exception as e:
|
||||
print(f"[ERROR] Could not list codes: {e}")
|
||||
Reference in New Issue
Block a user