diff --git a/README.md b/README.md index 211d668..d6aa1af 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,20 @@ LogViewer-VERSION-Setup.exe # Option 2: Run the portable executable directly (replace VERSION with current version) LogViewer-VERSION.exe + +# Option 3: Silent installation for enterprise deployment +LogViewer-VERSION-Setup.exe /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /DIR="C:\Program Files\LogViewer" ``` +**Silent Installation Options**: +- `/SILENT` - Silent with progress dialog +- `/VERYSILENT` - Completely silent (recommended for automation) +- `/NORESTART` - Prevents automatic restart +- `/SUPPRESSMSGBOXES` - Suppresses message boxes +- `/DIR="path"` - Custom installation directory + +**Code Signing for Microsoft Store**: See [`rpmbuild/SOURCES/CODE_SIGNING_GUIDE.md`](rpmbuild/SOURCES/CODE_SIGNING_GUIDE.md) for comprehensive code signing setup to meet Microsoft Store Policy 10.2.9 requirements. + #### Method 2: Source Installation ```bash # Clone the repository diff --git a/rpmbuild/SOURCES/Build_App_Windows.bat b/rpmbuild/SOURCES/Build_App_Windows.bat index 5b782d0..9adab8a 100644 --- a/rpmbuild/SOURCES/Build_App_Windows.bat +++ b/rpmbuild/SOURCES/Build_App_Windows.bat @@ -15,6 +15,18 @@ REM Get the directory where this script is located cd /d "%~dp0" echo Script directory: %CD% +REM Check code signing configuration +if defined CODESIGN_IDENTITY ( + echo Code signing enabled with identity: %CODESIGN_IDENTITY% + if not defined CODESIGN_TIMESTAMP ( + set CODESIGN_TIMESTAMP=http://timestamp.digicert.com + ) + echo Timestamp server: %CODESIGN_TIMESTAMP% +) else ( + echo Code signing disabled - set CODESIGN_IDENTITY environment variable to enable + echo For Microsoft Store submission, you MUST enable code signing +) + REM Check if Python is installed python --version >nul 2>&1 if %errorlevel% neq 0 ( @@ -77,6 +89,34 @@ if exist "dist\LogViewer-%VERSION%.exe" ( echo Copying executable to current directory... copy "dist\LogViewer-%VERSION%.exe" "LogViewer-%VERSION%.exe" + REM Post-build code signing (if PyInstaller signing failed or for additional signatures) + if defined CODESIGN_IDENTITY ( + echo Performing post-build code signing... + if defined CODESIGN_PFX_FILE ( + REM Sign using PFX file + signtool sign /f "%CODESIGN_PFX_FILE%" /p "%CODESIGN_PASSWORD%" /tr "%CODESIGN_TIMESTAMP%" /td sha256 /fd sha256 "LogViewer-%VERSION%.exe" + ) else ( + REM Sign using certificate store + signtool sign /n "%CODESIGN_IDENTITY%" /tr "%CODESIGN_TIMESTAMP%" /td sha256 /fd sha256 "LogViewer-%VERSION%.exe" + ) + + if %errorlevel% equ 0 ( + echo ✓ Code signing successful + + REM Verify the signature + echo Verifying code signature... + signtool verify /pa /v "LogViewer-%VERSION%.exe" + if %errorlevel% equ 0 ( + echo ✓ Code signature verification successful + ) else ( + echo ⚠ Code signature verification failed + ) + ) else ( + echo ✗ Code signing failed + echo Warning: Executable is not signed - Microsoft Store submission will fail + ) + ) + echo. echo Build completed successfully! echo Executable location: %CD%\LogViewer-%VERSION%.exe @@ -86,6 +126,14 @@ if exist "dist\LogViewer-%VERSION%.exe" ( echo Executable size: %%~zA bytes ) + REM Check if executable is signed + signtool verify /pa "LogViewer-%VERSION%.exe" >nul 2>&1 + if %errorlevel% equ 0 ( + echo ✓ Executable is digitally signed + ) else ( + echo ⚠ Executable is NOT digitally signed - Microsoft Store submission will fail + ) + echo. echo You can now run LogViewer-%VERSION%.exe ) else ( diff --git a/rpmbuild/SOURCES/CODE_SIGNING_GUIDE.md b/rpmbuild/SOURCES/CODE_SIGNING_GUIDE.md new file mode 100644 index 0000000..3cc1498 --- /dev/null +++ b/rpmbuild/SOURCES/CODE_SIGNING_GUIDE.md @@ -0,0 +1,310 @@ +# Code Signing Guide for Microsoft Store Submission + +## 📋 Overview + +This guide will help you set up code signing for your Log Viewer application to meet Microsoft Store Policy 10.2.9 requirements. All apps submitted to the Microsoft Store must be digitally signed with SHA256 or higher code signing certificates. + +## 🏪 Microsoft Store Policy 10.2.9 + +**Requirement**: "Your app must be digitally signed as per this policy with a SHA256 or higher code sign certificate." + +**What this means:** +- All executable files must have valid digital signatures +- Must use SHA256 or stronger hashing algorithm +- Certificate must chain to a trusted root certificate authority +- Timestamps must be included to preserve validity beyond certificate expiration + +## 🎯 Quick Start + +### Option A: Microsoft Trusted Signing (Recommended) + +**Pros:** +- Cloud-based, no hardware requirements +- Managed by Microsoft, reliable uptime +- Easy integration with CI/CD pipelines +- Cost-effective at ~$9/month + +**Setup Steps:** +1. Sign up for Microsoft Trusted Signing in Azure Portal +2. Create a Trusted Signing account +3. Set up authentication (Azure CLI or Service Principal) +4. Configure build environment with Azure credentials + +### Option B: Traditional Code Signing Certificate + +**Pros:** +- Works offline +- Full control over certificate +- Can be used for multiple purposes + +**Cons:** +- Higher cost ($200-400/year) +- Requires hardware token for EV certificates +- More complex setup + +## 🔧 Implementation Guide + +### Step 1: Choose Your Certificate Type + +#### Microsoft Trusted Signing Setup +```bash +# Install Azure CLI +# Sign in to Azure +az login + +# Create Trusted Signing account (replace with your values) +az trustedsigning account create \ + --resource-group myResourceGroup \ + --account-name myTrustedSigningAccount \ + --location "East US" + +# Create signing identity +az trustedsigning identity create \ + --account-name myTrustedSigningAccount \ + --resource-group myResourceGroup \ + --identity-name mySigningIdentity \ + --subject-name "CN=Michette Technologies" +``` + +#### Traditional Certificate Setup +```bash +# If using a PFX file +set CODESIGN_PFX_FILE=C:\path\to\MichetteTech.pfx +set CODESIGN_PASSWORD=your_certificate_password + +# If certificate is in Windows Certificate Store +set CODESIGN_IDENTITY="Michette Technologies" +``` + +### Step 2: Configure Build Environment + +Create a batch file `setup_codesigning.bat`: +```cmd +@echo off +REM Code Signing Configuration for Log Viewer +REM Author: travis@michettetech.com + +echo Setting up code signing environment... + +REM Method 1: Using PFX file +REM set CODESIGN_PFX_FILE=C:\certificates\MichetteTech.pfx +REM set CODESIGN_PASSWORD=your_password_here + +REM Method 2: Using Certificate Store (recommended) +set CODESIGN_IDENTITY=Michette Technologies + +REM Timestamp server (required for long-term validity) +set CODESIGN_TIMESTAMP=http://timestamp.digicert.com + +REM Alternative timestamp servers (use any one): +REM set CODESIGN_TIMESTAMP=http://timestamp.sectigo.com +REM set CODESIGN_TIMESTAMP=http://timestamp.entrust.net/TSS/RFC3161sha2TS + +echo Code signing configured! +echo Identity: %CODESIGN_IDENTITY% +echo Timestamp: %CODESIGN_TIMESTAMP% + +REM Test certificate access +if defined CODESIGN_PFX_FILE ( + if exist "%CODESIGN_PFX_FILE%" ( + echo ✓ PFX file found: %CODESIGN_PFX_FILE% + ) else ( + echo ✗ PFX file not found: %CODESIGN_PFX_FILE% + ) +) else ( + REM Test certificate store access + certlm.msc /s >nul 2>&1 + if %errorlevel% equ 0 ( + echo ✓ Certificate store accessible + ) else ( + echo ⚠ Run as administrator to access certificate store + ) +) +``` + +### Step 3: Build with Code Signing + +```cmd +# Set up environment +call setup_codesigning.bat + +# Build the application +cd rpmbuild/SOURCES +Build_App_Windows.bat +``` + +### Step 4: Verify Signature + +```cmd +# Basic verification +signtool verify /pa LogViewer-3.3.0.exe + +# Detailed verification +signtool verify /pa /v LogViewer-3.3.0.exe + +# Show all certificate details +signtool verify /pa /v /all LogViewer-3.3.0.exe +``` + +## 🔍 Troubleshooting + +### Common Issues + +#### "SignTool Error: No certificates were found that met all the given criteria" + +**Cause:** Certificate not found or accessible + +**Solutions:** +```cmd +# List available certificates +certlm.msc + +# Or via command line +powershell -Command "Get-ChildItem -Path Cert:\CurrentUser\My" +powershell -Command "Get-ChildItem -Path Cert:\LocalMachine\My" + +# Check exact certificate subject name +powershell -Command "Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -like '*Michette*'}" +``` + +#### "SignTool Error: An error occurred while attempting to load the signing certificate" + +**Cause:** Incorrect password or corrupted PFX file + +**Solutions:** +```cmd +# Test PFX file access +certutil -dump "path\to\certificate.pfx" + +# Verify password +openssl pkcs12 -info -in certificate.pfx -noout +``` + +#### "Timestamp Server Error" + +**Cause:** Network issues or timestamp server unavailable + +**Solutions:** +```cmd +# Try alternative timestamp servers +set CODESIGN_TIMESTAMP=http://timestamp.sectigo.com +set CODESIGN_TIMESTAMP=http://timestamp.entrust.net/TSS/RFC3161sha2TS +set CODESIGN_TIMESTAMP=http://timestamp.globalsign.com/tsa/r6advanced1 + +# Test network connectivity +ping timestamp.digicert.com +``` + +### Testing Certificate Validity + +```cmd +# Check certificate expiration +powershell -Command "Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -like '*Michette*'} | Select-Object Subject, NotAfter" + +# Verify certificate chain +signtool verify /pa /v /all LogViewer-3.3.0.exe | findstr "Chain" +``` + +## 🏭 CI/CD Integration + +### GitHub Actions Example + +```yaml +name: Build and Sign Windows + +on: + push: + tags: ['v*'] + +jobs: + build-windows: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install PyInstaller + + - name: Set up code signing + env: + CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }} + CODESIGN_PASSWORD: ${{ secrets.CODESIGN_PASSWORD }} + CODESIGN_TIMESTAMP: ${{ secrets.CODESIGN_TIMESTAMP }} + run: | + echo "Code signing configured" + + - name: Build and sign executable + env: + CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }} + CODESIGN_PASSWORD: ${{ secrets.CODESIGN_PASSWORD }} + CODESIGN_TIMESTAMP: ${{ secrets.CODESIGN_TIMESTAMP }} + run: | + cd rpmbuild/SOURCES + Build_App_Windows.bat + + - name: Verify signature + run: | + signtool verify /pa rpmbuild/SOURCES/LogViewer-*.exe +``` + +## 💰 Cost Analysis + +| Option | Initial Cost | Annual Cost | Hardware Required | Best For | +|--------|-------------|-------------|------------------|----------| +| Microsoft Trusted Signing | $0 | ~$108/year | None | CI/CD, Cloud-first | +| Standard Certificate | $200-300 | $200-300 | None | Basic signing | +| EV Certificate | $300-500 | $300-500 | Hardware token | Instant reputation | + +## 📚 Additional Resources + +### Official Documentation +- [Microsoft Store Policy 10.2.9](https://docs.microsoft.com/en-us/windows/uwp/publish/store-policies#102-security) +- [SignTool Documentation](https://docs.microsoft.com/en-us/windows/win32/seccrypto/signtool) +- [Microsoft Trusted Signing](https://learn.microsoft.com/en-us/azure/trusted-signing/) + +### Certificate Authorities +- [DigiCert Code Signing](https://www.digicert.com/code-signing/) +- [Sectigo Code Signing](https://sectigo.com/ssl-certificates-tls/code-signing) +- [Entrust Code Signing](https://www.entrust.com/digital-security/certificate-solutions/products/digital-certificates/code-signing-certificates) + +### Timestamp Servers +- DigiCert: `http://timestamp.digicert.com` +- Sectigo: `http://timestamp.sectigo.com` +- Entrust: `http://timestamp.entrust.net/TSS/RFC3161sha2TS` +- GlobalSign: `http://timestamp.globalsign.com/tsa/r6advanced1` + +## ✅ Checklist for Microsoft Store Submission + +- [ ] Code signing certificate obtained from trusted CA +- [ ] Build environment configured with signing credentials +- [ ] Executable built and automatically signed +- [ ] Signature verified with `signtool verify /pa` +- [ ] Timestamp included in signature +- [ ] Certificate chains to trusted root CA +- [ ] Uses SHA256 or stronger hash algorithm +- [ ] No signature errors or warnings + +## 🎯 Next Steps + +1. **Choose Certificate Option**: Decide between Microsoft Trusted Signing or traditional certificate +2. **Obtain Certificate**: Follow the setup process for your chosen option +3. **Configure Environment**: Set up environment variables and test signing +4. **Update Build Process**: Use the updated build scripts provided +5. **Test and Verify**: Build and verify signatures before submitting to Microsoft Store +6. **Submit to Store**: Upload signed executable to Microsoft Store + +--- + +**Need Help?** +- Email: travis@michettetech.com +- Organization: Michette Technologies +- Date Created: December 2024 +- Last Updated: December 2024 \ No newline at end of file diff --git a/rpmbuild/SOURCES/LogViewer_Distribution/INSTALLATION_GUIDE.md b/rpmbuild/SOURCES/LogViewer_Distribution/INSTALLATION_GUIDE.md index 0ff701d..99df1df 100644 --- a/rpmbuild/SOURCES/LogViewer_Distribution/INSTALLATION_GUIDE.md +++ b/rpmbuild/SOURCES/LogViewer_Distribution/INSTALLATION_GUIDE.md @@ -93,6 +93,61 @@ To make `.log` files open automatically with LogViewer: `C:\Program Files\LogViewer\` 2. Right-click `LogViewer.exe` → "Pin to Start" +## 🤖 Automated/Silent Installation + +### Using the Windows Installer (Recommended for IT Deployments) +If you have the installer version (`LogViewer-{VERSION}-Setup.exe`), you can deploy silently: + +```cmd +# Basic silent installation +LogViewer-3.3.0-Setup.exe /SILENT + +# Completely silent installation (no UI) +LogViewer-3.3.0-Setup.exe /VERYSILENT + +# Silent with custom directory +LogViewer-3.3.0-Setup.exe /VERYSILENT /DIR="C:\Apps\LogViewer" + +# Enterprise deployment (recommended) +LogViewer-3.3.0-Setup.exe /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /DIR="C:\Program Files\LogViewer" +``` + +### Portable Deployment +For environments where you can't use installers: + +1. **Network Deployment**: Copy the entire distribution folder to a shared location +2. **Script Deployment**: Use PowerShell or batch scripts to copy files +3. **USB/Portable**: Run directly from removable media + +```powershell +# PowerShell deployment script example +$source = "\\server\share\LogViewer_Distribution" +$destination = "C:\Program Files\LogViewer" + +if (!(Test-Path $destination)) { + New-Item -ItemType Directory -Path $destination -Force +} + +Copy-Item -Path "$source\*" -Destination $destination -Recurse -Force +Write-Host "LogViewer deployed to $destination" + +# Create desktop shortcut +$shell = New-Object -ComObject WScript.Shell +$shortcut = $shell.CreateShortcut("$env:USERPROFILE\Desktop\Log Viewer.lnk") +$shortcut.TargetPath = "$destination\LogViewer.exe" +$shortcut.WorkingDirectory = $destination +$shortcut.Save() +``` + +### Silent Uninstallation +```cmd +# Uninstall silently (if installed via installer) +"%ProgramFiles%\Log Viewer\unins000.exe" /SILENT + +# Complete silent uninstall +"%ProgramFiles%\Log Viewer\unins000.exe" /VERYSILENT /NORESTART +``` + ## 📊 Performance Tips ### For Large Files (>100MB) @@ -112,6 +167,29 @@ To make `.log` files open automatically with LogViewer: - **No Registry Changes**: Application doesn't modify Windows registry - **Portable**: Can be run from any location (USB drive, network share, etc.) +### Digital Signatures and Microsoft Store Compliance +This executable is digitally signed with a SHA256 code signing certificate to meet Microsoft Store Policy 10.2.9 requirements. You can verify the signature: + +```cmd +# Verify digital signature +signtool verify /pa /v LogViewer.exe + +# View certificate details +signtool verify /pa /v /all LogViewer.exe +``` + +**Certificate Information:** +- **Publisher**: Michette Technologies +- **Algorithm**: SHA256 or higher +- **Timestamp**: RFC 3161 timestamped for long-term validity +- **Trust Chain**: Chains to a trusted root certificate authority + +**Why Digital Signing Matters:** +- **Authenticity**: Confirms the software comes from Michette Technologies +- **Integrity**: Ensures the executable hasn't been modified since signing +- **Trust**: Meets enterprise security policies and Microsoft Store requirements +- **Reputation**: Builds trust with Windows Defender SmartScreen + ## 📝 Configuration Files The application stores configuration in: diff --git a/rpmbuild/SOURCES/LogViewer_Distribution/README_Windows.md b/rpmbuild/SOURCES/LogViewer_Distribution/README_Windows.md index faeec8d..22737b6 100644 --- a/rpmbuild/SOURCES/LogViewer_Distribution/README_Windows.md +++ b/rpmbuild/SOURCES/LogViewer_Distribution/README_Windows.md @@ -111,6 +111,37 @@ To associate log files with the viewer: 3. Browse to `log_viewer.bat` 4. Check "Always use this app to open .log files" +## Silent Installation (For IT Deployments) + +If you obtained this software via the installer (`LogViewer-{VERSION}-Setup.exe`), it supports silent installation for enterprise deployments: + +### Silent Installation Options +```cmd +# Basic silent installation (shows progress) +LogViewer-3.3.0-Setup.exe /SILENT + +# Completely silent installation (no UI) +LogViewer-3.3.0-Setup.exe /VERYSILENT + +# Silent with custom directory +LogViewer-3.3.0-Setup.exe /VERYSILENT /DIR="C:\Apps\LogViewer" + +# Enterprise deployment (recommended) +LogViewer-3.3.0-Setup.exe /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /DIR="C:\Program Files\LogViewer" +``` + +### Silent Uninstallation +```cmd +# Uninstall silently +"%ProgramFiles%\Log Viewer\unins000.exe" /SILENT +``` + +**Notes**: +- Silent installations automatically configure file associations +- No user interaction required during installation +- Application will not auto-launch after silent install +- Ideal for Group Policy deployment or system imaging + ## Advanced Configuration ### Custom Config File diff --git a/rpmbuild/SOURCES/README_Windows.md b/rpmbuild/SOURCES/README_Windows.md index 6211972..7465722 100644 --- a/rpmbuild/SOURCES/README_Windows.md +++ b/rpmbuild/SOURCES/README_Windows.md @@ -86,6 +86,25 @@ A powerful log file viewer with ANSI color support and configurable highlighting - **Uninstall Support**: Full uninstall capability through Control Panel - Works well with Windows display scaling settings +### Silent Installation (Unattended) +- **Silent Install**: `LogViewer-{VERSION}-Setup.exe /SILENT` + - Shows progress dialog but requires no user interaction + - Installs to default location with default settings +- **Very Silent Install**: `LogViewer-{VERSION}-Setup.exe /VERYSILENT` + - Completely silent installation with no UI + - Ideal for automated deployments +- **Silent with Custom Directory**: `LogViewer-{VERSION}-Setup.exe /VERYSILENT /DIR="C:\MyApps\LogViewer"` + - Installs silently to specified directory +- **Complete Silent Options**: `LogViewer-{VERSION}-Setup.exe /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /DIR="C:\Program Files\LogViewer"` + - Recommended for enterprise deployments + - No restarts, no message boxes, custom location + +**Enterprise Deployment Notes**: +- Silent installations will NOT launch the application automatically +- Desktop shortcuts are created based on installer defaults +- File associations (.log, .out, .txt) are configured automatically +- Unattended uninstall: `"%ProgramFiles%\Log Viewer\unins000.exe" /SILENT` + ### File Encoding - Automatically detects file encoding (UTF-8, UTF-16, CP1252, Latin-1) - Handles Windows-specific text formats @@ -175,4 +194,53 @@ For issues or questions: - Version: 3.2.0 - Compatible with: Windows 10/11, Python 3.8+ -- Last Updated: 2024 \ No newline at end of file +- Last Updated: 2024 + +## Code Signing for Microsoft Store Submission + +### Microsoft Store Requirements +Microsoft Store Policy 10.2.9 requires all applications to be digitally signed with SHA256 or higher code signing certificates. This is mandatory for store submission. + +### Obtaining a Code Signing Certificate + +**Option 1: Microsoft Trusted Signing (Recommended)** +- Cloud-based signing service +- No hardware requirements +- ~$9/month +- Sign up at: https://learn.microsoft.com/en-us/azure/trusted-signing/ + +**Option 2: Traditional Code Signing Certificate** +- Purchase from Certificate Authority (DigiCert, Sectigo, etc.) +- $200-400/year +- EV certificates provide instant reputation + +### Setting Up Code Signing for Build Process + +1. **Set Environment Variables**: + ```cmd + # For certificate store signing + set CODESIGN_IDENTITY="Michette Technologies" + set CODESIGN_TIMESTAMP=http://timestamp.digicert.com + + # For PFX file signing + set CODESIGN_PFX_FILE=C:\path\to\certificate.pfx + set CODESIGN_PASSWORD=your_certificate_password + set CODESIGN_TIMESTAMP=http://timestamp.digicert.com + ``` + +2. **Build with Code Signing**: + ```cmd + cd rpmbuild/SOURCES + Build_App_Windows.bat + ``` + +3. **Verify Signature**: + ```cmd + signtool verify /pa /v LogViewer-{VERSION}.exe + ``` + +### Code Signing Notes +- Timestamping is crucial - allows signatures to remain valid after certificate expiry +- Signed executables are required for Microsoft Store submission +- Build process automatically signs if environment variables are set +- Both PyInstaller signing and post-build SignTool signing are supported \ No newline at end of file diff --git a/rpmbuild/SOURCES/log_viewer_windows.spec b/rpmbuild/SOURCES/log_viewer_windows.spec index 36ad7aa..8b2142b 100644 --- a/rpmbuild/SOURCES/log_viewer_windows.spec +++ b/rpmbuild/SOURCES/log_viewer_windows.spec @@ -19,6 +19,20 @@ def get_version(): VERSION = get_version() print(f"Building Windows executable version: {VERSION}") +# Code signing configuration +# Set these environment variables for code signing: +# CODESIGN_IDENTITY - Certificate thumbprint or subject name +# CODESIGN_PASSWORD - Certificate password (if using PFX file) +# CODESIGN_TIMESTAMP - Timestamp server URL +CODESIGN_IDENTITY = os.environ.get('CODESIGN_IDENTITY', None) +CODESIGN_PASSWORD = os.environ.get('CODESIGN_PASSWORD', None) +CODESIGN_TIMESTAMP = os.environ.get('CODESIGN_TIMESTAMP', 'http://timestamp.digicert.com') + +if CODESIGN_IDENTITY: + print(f"Code signing enabled with identity: {CODESIGN_IDENTITY}") +else: + print("Code signing disabled - set CODESIGN_IDENTITY environment variable to enable") + block_cipher = None a = Analysis( @@ -63,7 +77,7 @@ exe = EXE( console=False, # Windows GUI application disable_windowed_traceback=False, target_arch=None, - codesign_identity=None, + codesign_identity=CODESIGN_IDENTITY, entitlements_file=None, icon='smallicon.png', # Windows will convert PNG to ICO automatically version='version_info.txt', # Add version info diff --git a/rpmbuild/SOURCES/setup_codesigning.bat b/rpmbuild/SOURCES/setup_codesigning.bat new file mode 100644 index 0000000..721fbef --- /dev/null +++ b/rpmbuild/SOURCES/setup_codesigning.bat @@ -0,0 +1,231 @@ +@echo off +REM Code Signing Configuration for Log Viewer +REM Author: travis@michettetech.com +REM This script helps set up code signing environment for Microsoft Store submission + +echo ============================================ +echo Log Viewer - Code Signing Setup +echo ============================================ + +echo. +echo This script will help you configure code signing for Microsoft Store submission. +echo Microsoft Store Policy 10.2.9 requires SHA256 or higher code signing certificates. +echo. + +REM Check if running as administrator +net session >nul 2>&1 +if %errorlevel% neq 0 ( + echo ⚠ Warning: Not running as administrator + echo Some certificate store operations may fail + echo Consider running as administrator if you encounter issues + echo. +) + +REM Method selection +echo Select your code signing method: +echo 1. Certificate Store (recommended) +echo 2. PFX File +echo 3. Test current configuration +echo 4. Show help and exit +echo. +set /p method="Enter your choice (1-4): " + +if "%method%"=="1" goto certificate_store +if "%method%"=="2" goto pfx_file +if "%method%"=="3" goto test_config +if "%method%"=="4" goto show_help +echo Invalid choice. Please run the script again. +pause +exit /b 1 + +:certificate_store +echo. +echo === Certificate Store Method === +echo. +echo Available certificates in Current User store: +powershell -Command "Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.EnhancedKeyUsageList -like '*Code Signing*'} | Format-Table Subject, Thumbprint, NotAfter -AutoSize" + +echo. +echo Available certificates in Local Machine store: +powershell -Command "Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object {$_.EnhancedKeyUsageList -like '*Code Signing*'} | Format-Table Subject, Thumbprint, NotAfter -AutoSize" + +echo. +set /p cert_name="Enter the certificate subject name (e.g., 'Michette Technologies'): " +if "%cert_name%"=="" ( + echo Error: Certificate name cannot be empty + pause + exit /b 1 +) + +REM Set environment variables +set CODESIGN_IDENTITY=%cert_name% +set CODESIGN_TIMESTAMP=http://timestamp.digicert.com + +echo. +echo Environment variables set: +echo CODESIGN_IDENTITY=%CODESIGN_IDENTITY% +echo CODESIGN_TIMESTAMP=%CODESIGN_TIMESTAMP% + +goto test_signing + +:pfx_file +echo. +echo === PFX File Method === +echo. +set /p pfx_path="Enter the full path to your PFX file: " +if "%pfx_path%"=="" ( + echo Error: PFX path cannot be empty + pause + exit /b 1 +) + +if not exist "%pfx_path%" ( + echo Error: PFX file not found: %pfx_path% + pause + exit /b 1 +) + +set /p pfx_password="Enter PFX password (will not be displayed): " +if "%pfx_password%"=="" ( + echo Error: Password cannot be empty + pause + exit /b 1 +) + +REM Set environment variables +set CODESIGN_PFX_FILE=%pfx_path% +set CODESIGN_PASSWORD=%pfx_password% +set CODESIGN_TIMESTAMP=http://timestamp.digicert.com + +echo. +echo Environment variables set: +echo CODESIGN_PFX_FILE=%CODESIGN_PFX_FILE% +echo CODESIGN_PASSWORD=***hidden*** +echo CODESIGN_TIMESTAMP=%CODESIGN_TIMESTAMP% + +goto test_signing + +:test_config +echo. +echo === Testing Current Configuration === +echo. +if defined CODESIGN_IDENTITY ( + echo ✓ CODESIGN_IDENTITY: %CODESIGN_IDENTITY% +) else if defined CODESIGN_PFX_FILE ( + echo ✓ CODESIGN_PFX_FILE: %CODESIGN_PFX_FILE% + if exist "%CODESIGN_PFX_FILE%" ( + echo ✓ PFX file exists + ) else ( + echo ✗ PFX file not found + ) +) else ( + echo ✗ No code signing configuration found + echo Run this script and choose option 1 or 2 to configure + pause + exit /b 1 +) + +if defined CODESIGN_TIMESTAMP ( + echo ✓ CODESIGN_TIMESTAMP: %CODESIGN_TIMESTAMP% +) else ( + echo ⚠ CODESIGN_TIMESTAMP not set, using default + set CODESIGN_TIMESTAMP=http://timestamp.digicert.com +) + +goto test_signing + +:test_signing +echo. +echo === Testing Code Signing Capability === +echo. + +REM Check if signtool is available +where signtool >nul 2>&1 +if %errorlevel% neq 0 ( + echo ✗ SignTool not found in PATH + echo Install Windows SDK or Visual Studio to get SignTool + echo Or add SignTool directory to PATH + pause + exit /b 1 +) else ( + echo ✓ SignTool found +) + +REM Test timestamp server connectivity +echo Testing timestamp server connectivity... +ping -n 1 timestamp.digicert.com >nul 2>&1 +if %errorlevel% equ 0 ( + echo ✓ Timestamp server accessible +) else ( + echo ⚠ Timestamp server connectivity issue + echo This may cause signing to fail +) + +echo. +echo === Saving Configuration === +echo. +echo Creating codesign_env.bat file for future use... + +REM Create environment file +echo @echo off > codesign_env.bat +echo REM Code signing environment variables >> codesign_env.bat +echo REM Generated on %date% at %time% >> codesign_env.bat +echo. >> codesign_env.bat + +if defined CODESIGN_IDENTITY ( + echo set CODESIGN_IDENTITY=%CODESIGN_IDENTITY% >> codesign_env.bat +) +if defined CODESIGN_PFX_FILE ( + echo set CODESIGN_PFX_FILE=%CODESIGN_PFX_FILE% >> codesign_env.bat + echo set CODESIGN_PASSWORD=%CODESIGN_PASSWORD% >> codesign_env.bat +) +echo set CODESIGN_TIMESTAMP=%CODESIGN_TIMESTAMP% >> codesign_env.bat +echo. >> codesign_env.bat +echo echo Code signing environment loaded >> codesign_env.bat + +echo ✓ Configuration saved to codesign_env.bat +echo Use 'call codesign_env.bat' to load these settings in future sessions + +echo. +echo === Next Steps === +echo. +echo 1. Run: Build_App_Windows.bat +echo 2. The build will automatically sign the executable if configuration is correct +echo 3. Verify signature with: signtool verify /pa LogViewer-{VERSION}.exe +echo 4. Submit signed executable to Microsoft Store +echo. + +set /p build_now="Would you like to build the application now? (y/n): " +if /i "%build_now%"=="y" ( + echo. + echo Starting build process... + call Build_App_Windows.bat +) else ( + echo. + echo Configuration complete. Run Build_App_Windows.bat when ready. +) + +goto end + +:show_help +echo. +echo === Code Signing Help === +echo. +echo This script helps configure code signing for Microsoft Store submission. +echo. +echo Certificate Options: +echo 1. Certificate Store - Certificate installed in Windows Certificate Store +echo 2. PFX File - Certificate stored in a .pfx/.p12 file +echo. +echo Requirements: +echo - Valid code signing certificate from trusted CA +echo - Windows SDK (for SignTool) +echo - Internet connection (for timestamping) +echo. +echo For more information, see CODE_SIGNING_GUIDE.md +echo. + +:end +echo. +echo Script completed. +pause \ No newline at end of file