Commit Graph

2 Commits

Author SHA1 Message Date
29e2df60c5 feat: Complete DOS machine deployment verification and AD2-NAS sync infrastructure
This checkpoint establishes verified deployment infrastructure for the Dataforth
DOS Update System with proper file synchronization and documentation.

## Key Changes

### TS-4R Backup and Analysis
- Backed up complete TS-4R machine to D:\ClaudeTools\backups\TS-4R\
- Analyzed MENUX.EXE startup menu system (758-line QuickBasic program)
- Documented complete startup sequence: AUTOEXEC.BAT → STARTNET.BAT → MENUX.EXE
- Found MENUX.BAS source code (Feb 2008 version) from KEPCO ABC software archive

### AD2-NAS Sync Infrastructure Fixes
- Created junction: COMMON → _COMMON (single source of truth for software updates)
- Verified bidirectional sync logic prevents data backflow:
  * Test data: DOS → NAS → AD2 → Database (one-way, deleted from NAS)
  * Program updates: AD2 → NAS → DOS (one-way, files remain on AD2)
- Manually deployed correct BAT file versions to NAS after sync connection issues
- Verified all 9 BAT files deployed correctly (5.1KB-8.8KB each)

### Deployment Scripts Created
- check-junction.ps1: Verify COMMON/\_COMMON junction status
- compare-common-folders.ps1: Compare folder contents
- deploy-correct-bat-files.ps1: Deploy BAT files from local to AD2
- fix-common-junction.ps1: Create COMMON → _COMMON junction
- verify-bat-deployment.ps1: Verify file versions on AD2
- manual-push-to-nas.sh: Manual BAT file deployment to NAS
- read-sync-script.ps1: Read Sync-FromNAS.ps1 from AD2
- search-menux-ad2.ps1: Search for MENUX source files

### Documentation Updates
- Updated all deployment guides with MENUX startup sequence
- Added startup flow to credentials.md and session logs
- Documented junction requirement for COMMON/\_COMMON
- Added data flow verification confirming unidirectional sync

## Technical Details

**Files Deployed to NAS (2026-01-20 09:01-09:02):**
- UPDATE.BAT (5,181 bytes) - Machine backup utility
- DEPLOY.BAT (5,579 bytes) - One-time deployment installer
- NWTOC.BAT (6,305 bytes) - Network to Computer updates
- CTONW.BAT (7,831 bytes) - Computer to Network uploads
- CTONWTXT.BAT (1,504 bytes) - Text file version
- CHECKUPD.BAT (6,495 bytes) - Check for updates
- STAGE.BAT (8,794 bytes) - Stage system files
- REBOOT.BAT (5,099 bytes) - Apply staged updates
- AUTOEXEC.BAT (2,211 bytes) - DOS startup configuration

**Sync Logic Verified:**
- PULL: /data/test/TS-*/LOGS/*.DAT copied to AD2, then deleted from NAS
- PUSH: C:\Shares\test\_COMMON\ProdSW\* copied to /data/test/COMMON/ProdSW/
- No reverse flow in either direction (test data never returns to DOS)

**Junction Created:**
- Target: C:\Shares\test\COMMON → C:\Shares\test\_COMMON
- Eliminates duplicate file maintenance
- Backup saved to C:\Shares\test\COMMON.backup

## Files Modified
- DOS_DEPLOYMENT_GUIDE.md: Added automatic startup sequence
- docs/DEPLOYMENT_GUIDE.md: Updated post-reboot expectations
- docs/ENGINEER_HOWTO_GUIDE.md: Added MENUX menu loading step
- credentials.md: Documented startup sequence and MENUX interface
- session-logs/2026-01-19-session.md: Added startup documentation

## Files Added
- 8 PowerShell deployment/verification scripts
- 3 HTML documentation exports
- TS-4R complete backup (not committed to git)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-20 16:03:00 -07:00
ba2ed379f8 feat: Add AD2 WinRM automation and modernize sync infrastructure
Comprehensive infrastructure improvements for AD2 (Domain Controller) remote
management and NAS sync system modernization.

## AD2 Remote Access Enhancements

**WinRM Configuration:**
- Enabled PowerShell Remoting (port 5985) with full logging
- Configured TrustedHosts for LAN/VPN access (172.16.*, 192.168.*, 10.*)
- Created read-only service account (ClaudeTools-ReadOnly) for safe automation
- Set up transcript logging for all remote sessions
- Deployed 6 automation scripts to C:\ClaudeTools\Scripts\ (AD user/computer
  reports, GPO status, replication health, log rotation)

**SSH Access:**
- Installed OpenSSH Server (v10.0p2)
- Generated ED25519 key for passwordless authentication
- Configured SSH key authentication for sysadmin account

**Benefits:**
- Efficient remote operations via persistent WinRM sessions (vs individual SSH commands)
- Secure read-only access for queries (no admin rights needed)
- Comprehensive audit trail of all remote operations

## Sync System Modernization (AD2 <-> NAS)

**Replaced PuTTY with OpenSSH:**
- Migrated from pscp.exe/plink.exe to native OpenSSH scp/ssh tools
- Added verbose logging (-v flag) for detailed error diagnostics
- Implemented auto host-key acceptance (StrictHostKeyChecking=accept-new)
- Enhanced error logging to capture actual SCP failure reasons

**Problem Solved:**
- Original sync errors (738 failures) had no root cause details
- PuTTY's batch mode silently failed without error messages
- New OpenSSH implementation logs full error output to sync-from-nas.log

**Scripts Created:**
- setup-openssh-sync.ps1: SSH key generation and NAS configuration
- check-openssh-client.ps1: Verify OpenSSH availability
- restore-and-fix-sync.ps1: Update Sync-FromNAS.ps1 to use OpenSSH
- investigate-sync-errors.ps1: Analyze sync failures with context
- test-winrm.ps1: WinRM connection testing (admin + service accounts)
- demo-ad2-automation.ps1: WinRM automation examples (AD stats, sync status)

## DOS Batch File Line Ending Fixes

**Problem:** All DOS batch files had Unix (LF) line endings instead of DOS (CRLF),
causing parsing errors on DOS 6.22 machines.

**Fixed:**
- Local: 13 batch files converted to CRLF
- Remote (AD2): 492 batch files scanned, 10 converted to CRLF
- Affected files: DEPLOY.BAT, NWTOC.BAT, CTONW.BAT, UPDATE.BAT, STAGE.BAT,
  CHECKUPD.BAT, REBOOT.BAT, and station-specific batch files

**Scripts Created:**
- check-dos-line-endings.ps1: Scan and detect LF vs CRLF
- convert-to-dos.ps1: Bulk conversion to DOS format
- fix-ad2-dos-files.ps1: Remote conversion via WinRM

## Credentials & Documentation Updates

**credentials.md additions:**
- Peaceful Spirit VPN configuration (L2TP/IPSec)
- AD2 WinRM/SSH access details (both admin and service accounts)
- SSH keys and known_hosts configuration
- Complete WinRM connection examples

**Files Modified:**
- credentials.md: +91 lines (VPN, AD2 automation access)
- CTONW.BAT, NWTOC.BAT, REBOOT.BAT, STAGE.BAT: Line ending fixes
- Infrastructure configs: vpn-connect.bat, vpn-disconnect.bat (CRLF)

## Test Results

**WinRM Automation (demo-ad2-automation.ps1):**
- Retrieved 178 AD users (156 enabled, 22 disabled, 40 active)
- Retrieved 67 AD computers (67 Windows, 6 servers, 53 active)
- Checked Dataforth sync status (2,249 files pushed, 738 errors logged)
- All operations completed in single remote session (efficient!)

**Sync System:**
- OpenSSH tools confirmed available on AD2
- Backup created: Sync-FromNAS.ps1.backup-20260119-140918
- Script updated with error logging and verbose output
- Next sync run will reveal actual error causes

## Technical Decisions

1. **WinRM over SSH:** More efficient for PowerShell operations, better error
   handling, native Windows integration
2. **Service Account:** Follows least-privilege principle, safer for automated
   queries, easier audit trail
3. **OpenSSH over PuTTY:** Modern, maintained, native Windows tool, better error
   reporting, supports key authentication without external tools
4. **Verbose Logging:** Critical for debugging 738 sync errors - now we'll see
   actual SCP failure reasons (permissions, paths, network issues)

## Next Steps

1. Monitor next sync run (every 15 minutes) for detailed error messages
2. Analyze SCP error output to identify root cause of 738 failures
3. Implement SSH key authentication for NAS (passwordless)
4. Consider SFTP batch mode for more reliable transfers

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 14:28:24 -07:00