Skip to content

emilwojcik93/corporate-ssl-manager

Repository files navigation

Corporate SSL Certificate Manager

A comprehensive PowerShell solution for automatically identifying, testing, and installing corporate certificates in WSL and Node.js environments to resolve SSL inspection issues.

🎯 Purpose

This tool solves the common problem where corporate networks use SSL inspection, causing SSL certificate verification failures in development environments. It automatically:

  1. Discovers corporate certificates from Windows certificate stores
  2. Tests each certificate systematically against real domains
  3. Installs only effective certificates in target environments
  4. Validates complete SSL functionality

πŸš€ Quick Start

WSL Environment

# Basic usage - auto-detect everything
.\Install-CorporateSSL-WSL.ps1 -Verbose

# Target specific corporate certificates
.\Install-CorporateSSL-WSL.ps1 -SearchPatterns @("YourCompany", "CA") -Verbose

# Dry run to see what would be done
.\Install-CorporateSSL-WSL.ps1 -DryRun -Verbose

Node.js Environment

# Install certificates and configure environment variables
.\Install-CorporateSSL-Node.ps1 -SearchPatterns @("YourCompany") -BundleAllCerts -Verbose

# Test SSL connectivity
node tests\test-ssl-connectivity.js

Docker Environment

# Complete Docker setup with automatic certificate injection
.\Install-CorporateSSL-Docker.ps1 -SearchPatterns @("YourCompany") -CleanInstall -Verbose

# Test Docker HTTPS connectivity
docker-corp run --rm curlimages/curl:latest curl https://google.com
docker-corp run --rm curlimages/curl:latest curl https://github.com

πŸ“ Repository Structure

corporate-ssl-manager/
β”œβ”€β”€ Install-CorporateSSL-WSL.ps1      # WSL certificate installer
β”œβ”€β”€ Install-CorporateSSL-Node.ps1     # Node.js certificate installer
β”œβ”€β”€ Install-CorporateSSL-Docker.ps1   # Docker certificate installer
β”œβ”€β”€ docker-corp.sh                    # Docker wrapper script
β”œβ”€β”€ docker-corporate-env.sh           # Docker environment setup
β”œβ”€β”€ README.md                         # This file
β”œβ”€β”€ .gitignore                        # Git ignore rules
β”œβ”€β”€ CORPORATE-CERTIFICATE-ANALYSIS.md # General analysis guide
β”œβ”€β”€ docs/                             # Documentation
β”‚   β”œβ”€β”€ INSTALLATION.md               # Step-by-step installation guide
β”‚   β”œβ”€β”€ USAGE.md                      # Detailed usage guide
β”‚   └── TROUBLESHOOTING.md            # Troubleshooting guide
β”œβ”€β”€ tests/                            # Test scripts
β”‚   └── test-ssl-connectivity.js      # Node.js SSL test
└── logs/                             # Generated log files (ignored)

πŸ”§ Key Features

Intelligent Certificate Discovery

  • Pattern-based search for corporate certificates
  • Excludes common public CAs (DigiCert, Let's Encrypt, etc.)
  • Multi-store scanning (LocalMachine, CurrentUser)
  • Duplicate detection and filtering

Systematic Testing

  • Pre-installation baseline testing
  • Individual certificate effectiveness testing
  • Multi-domain validation against popular sites
  • Success rate calculation and reporting

Environment Integration

  • WSL: Support for 25+ Linux distributions with auto-detection
  • Node.js: Environment variable configuration and bundle creation
  • Smart detection of target environments
  • Prerequisite installation (curl, ca-certificates)

Comprehensive Logging

  • Detailed timestamped logs with color coding
  • Export to CSV/JSON formats
  • Test result tracking and analysis
  • Error handling and recovery

πŸ“Š Supported Environments

WSL Distributions

  • Ubuntu Family: Ubuntu, Ubuntu-18.04/20.04/22.04/24.04, Debian, Kali Linux
  • RHEL Family: Fedora, CentOS, RHEL, AlmaLinux, Rocky Linux
  • SUSE Family: openSUSE Leap/Tumbleweed, SUSE Linux Enterprise
  • Arch Family: Arch Linux, Manjaro
  • Other: Alpine Linux

Node.js Versions

  • Supported: Node.js 14+ (tested with latest LTS)
  • Platforms: Windows 10/11, Windows Server 2019/2022

Docker Environments

  • Docker Engine: 20.10+ in WSL 2
  • Container Support: All Linux-based containers
  • Registry Support: Docker Hub, NPM, PyPI, and custom registries

πŸ“‹ Parameters

WSL Script Parameters

Parameter Description Default
SearchPatterns Patterns to search for in certificates Corporate, CA, SSL patterns
ExcludeIssuers Public CAs to exclude Common public CAs
WSLDistro Target WSL distribution Auto-detected
TestDomains Domains for SSL testing Popular test domains
RequireAllCerts Install all effective certificates $false
DryRun Analyze without installing $false

Node.js Script Parameters

Parameter Description Default
SearchPatterns Patterns to search for in certificates Corporate, CA, SSL patterns
BundleAllCerts Create certificate bundle $false
TestTimeout Timeout for tests (ms) 10000

πŸ” How It Works

1. Discovery Phase

πŸ” Scanning certificate stores...
   β”œβ”€β”€ LocalMachine\Root (Trusted Root CAs)
   β”œβ”€β”€ LocalMachine\CA (Intermediate CAs)
   β”œβ”€β”€ CurrentUser\Root (User Trusted Root CAs)
   └── Pattern matching and filtering

2. Analysis Phase

πŸ“Š Analyzing certificates...
   β”œβ”€β”€ Pattern matching (CA, Corporate, SSL...)
   β”œβ”€β”€ Public CA exclusion
   β”œβ”€β”€ Duplicate removal
   └── Validity checking

3. Testing Phase

πŸ§ͺ Testing certificate effectiveness...
   β”œβ”€β”€ Baseline connectivity test
   β”œβ”€β”€ Individual certificate installation
   β”œβ”€β”€ Multi-domain SSL testing
   └── Success rate calculation

4. Installation Phase

βš™οΈ Installing effective certificates...
   β”œβ”€β”€ WSL: Copy to certificate directory
   β”œβ”€β”€ Node.js: Create bundle and set env vars
   β”œβ”€β”€ Validation testing
   └── Cleanup of ineffective certificates

πŸ“ˆ Example Output

[2025-09-04 01:23:45] [TITLE] Processing certificate: Corporate Root CA
[2025-09-04 01:23:46] [SUCCESS] Certificate exported: Corporate_Root_CA_D72F47.crt
[2025-09-04 01:23:47] [SUCCESS] Certificate installed successfully
[2025-09-04 01:23:48] [PROGRESS] Testing certificate effectiveness...
[2025-09-04 01:23:49] [SUCCESS] [OK] https://google.com - Success (HTTP 200)
[2025-09-04 01:23:50] [SUCCESS] [OK] https://github.com - Success (HTTP 200)
[2025-09-04 01:23:51] [SUCCESS] Certificate effectiveness: 6/6 domains (100%)
[2025-09-04 01:23:52] [SUCCESS] All SSL connectivity tests passed!

πŸ› οΈ Common Usage Patterns

Search for Specific Corporate Certificates

# Search for your company's certificates
.\Install-CorporateSSL-WSL.ps1 -SearchPatterns @("YourCompany", "Internal CA") -Verbose

# Search for common SSL inspection vendors
.\Install-CorporateSSL-WSL.ps1 -SearchPatterns @("BlueCoat", "Forcepoint", "McAfee") -Verbose

Test Specific Domains

# Test against internal corporate domains
.\Install-CorporateSSL-WSL.ps1 -TestDomains @("https://internal.company.com", "https://app.company.com") -Verbose

# Test against problematic external domains
.\Install-CorporateSSL-WSL.ps1 -TestDomains @("https://api.github.com", "https://registry.npmjs.org") -Verbose

Advanced Configuration

# Install all effective certificates (comprehensive approach)
.\Install-CorporateSSL-WSL.ps1 -RequireAllCerts -Verbose

# Clean installation (remove existing certificates first)
.\Install-CorporateSSL-WSL.ps1 -CleanInstall -Verbose

# Analysis only (no installation)
.\Install-CorporateSSL-WSL.ps1 -DryRun -ExportFormat Both -Verbose

πŸ”’ Security Considerations

  • Administrator privileges required for certificate store access
  • Root access in WSL required for certificate installation
  • Corporate compliance - only installs certificates already trusted by Windows
  • Audit trail - comprehensive logging of all operations
  • No security bypass - maintains proper SSL validation

πŸ“š Documentation

πŸ§ͺ Testing

WSL Testing

# Verify installed certificates
ls -la /usr/local/share/ca-certificates/
sudo update-ca-certificates --verbose

# Test SSL connectivity
curl -I https://google.com
curl -I https://github.com

Node.js Testing

// Check environment variables
console.log('NODE_EXTRA_CA_CERTS:', process.env.NODE_EXTRA_CA_CERTS);

// Test SSL connectivity
node tests/test-ssl-connectivity.js

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“œ License

This project is licensed under the MIT License.

πŸ™ Acknowledgments

  • Original WSL certificate installation concept by emilwojcik93
  • WSL distribution support patterns from community contributions
  • Corporate SSL inspection best practices from enterprise environments

Note: This repository contains generic scripts suitable for any corporate environment. Company-specific analysis and implementation details are maintained separately in confidential documentation.

About

Corporate SSL Certificate Manager for WSL and Node.js - Automatically identifies, tests, and installs corporate SSL certificates to resolve SSL inspection issues in development environments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors