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:
2026-03-11 20:16:24 -07:00
parent 1a26eb051a
commit 470638ff86
24 changed files with 2498 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
"""Reset password and generate backup codes for russ@lonestarelectrical.net"""
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 = 'russ@lonestarelectrical.net'
# Check user
print(f"=== {user_email} ===")
user = service.users().get(userKey=user_email).execute()
print(f"Name: {user.get('name', {}).get('fullName', 'N/A')}")
print(f"2SV Enrolled: {user.get('isEnrolledIn2Sv', False)}")
print(f"2SV Enforced: {user.get('isEnforcedIn2Sv', False)}")
print(f"Last Login: {user.get('lastLoginTime', 'N/A')}")
# Reset password
new_pass = 'LoneStar2026!!'
service.users().update(
userKey=user_email,
body={'password': new_pass, 'changePasswordAtNextLogin': False, 'suspended': False}
).execute()
print(f"\n[OK] Password reset: {new_pass}")
# Generate backup codes
service.verificationCodes().generate(userKey=user_email).execute()
result = service.verificationCodes().list(userKey=user_email).execute()
codes = result.get('items', [])
if codes:
print(f"\nBackup codes:")
for c in codes:
print(f" {c.get('verificationCode')}")