Modern CLI tool for managing multiple port-forward connections with real-time monitoring and certificate support.
- ๐จ Simple TUI - Clean terminal interface with real-time status
- โก Fast & Reliable - Detects connection failures quickly
- ๐ Auto-Reconnection - Automatically reconnects on failure
- ๐งน Port Cleanup - Automatically kills conflicting processes
- ๐ Certificate Support - Built-in P12 certificate handling for kubectl
- ๐ Real-time Monitoring - Live status updates
- ๐ก๏ธ Graceful Shutdown - Proper cleanup on exit or Ctrl+C
- ๐ฆ Single Binary - No external dependencies
- ๐ Cross-Platform - Works on Windows, Linux, and macOS
go build -o pf.exe
# Optional: Move to a directory in PATHgo build -o pf
sudo mv pf /usr/local/bin/
sudo chmod +x /usr/local/bin/pfDownload pre-built binaries from Releases.
# Add a service
pf add db "kubectl port-forward service/postgres 5432:5432"
# Run the service
pf run db
# List all services
pf list| Command | Alias | Description |
|---|---|---|
add |
a |
Add new service |
list |
l |
List all services |
run |
r |
Run services with TUI |
delete |
d |
Delete service |
cleanup |
c |
Kill all kubectl/ssh processes |
cert |
Manage certificates (add/list/remove) | |
help |
h |
Show help |
Add P12 certificates for secure kubectl connections:
# Add certificate (used for all kubectl services)
pf cert add "/path/to/certificate.p12"
# View configured certificate
pf cert list
# Remove certificate
pf cert removeHow it works:
- Extracts certificate and private key from P12 file
- Stores them securely in
~/.pf/certs/ - Automatically injects
--client-certificateand--client-keyflags into kubectl commands - Password is only required during setup (not stored)
# Add services
pf add db "kubectl -n prod port-forward service/postgres 5432:5432"
pf add redis "kubectl port-forward service/redis 6379:6379"
pf add api "kubectl port-forward deployment/api 8080:8080"
# List all services
pf list
# Run single service
pf run db
# Run multiple services
pf run db,redis,api
# Delete a service
pf delete redis# 1. Add your P12 certificate
pf cert add company-vpn.p12
# Enter password when prompted
# 2. Add kubectl service (certificate will be auto-used)
pf add production "kubectl -n prod port-forward service/postgres 5432:5432"
# 3. Run the service
pf run production# Kill all kubectl/ssh processes
pf cleanupWhen running services:
- q or Ctrl+C - Quit and stop all services
- r - Manual refresh
~/.pf/
โโโ certificate.json โ Certificate configuration
โโโ certs/
โโโ client-cert.pem โ Extracted certificate
โโโ client-key.pem โ Private key
services.json โ Stored services (same directory as executable)
.
โโโ main.go โ CLI entry point and commands
โโโ manager.go โ Service lifecycle management
โโโ storage.go โ Service persistence
โโโ ui.go โ Terminal UI (Bubbletea)
โโโ cert/
โโโ p12.go โ P12 certificate extraction
โโโ manager.go โ Certificate management
- Port Management: Automatically detects and kills processes using target ports
- Service Storage: Services saved in
services.json - Auto-Reconnection: Automatically restarts failed connections
- Certificate Injection: For kubectl commands, automatically adds certificate flags
- Process Cleanup: Proper cleanup of all processes on exit
- P12 password is only used during extraction (never stored)
- Certificate and key files stored with
0600permissions (owner-only) - Files stored in user's home directory (
~/.pf/)
This tool executes system commands (kubectl, ssh) and manages network connections, which may trigger antivirus false positives.
Recommendations:
- Build from source to verify the code
- Add exception in antivirus software if needed
- Code is open source - audit anytime
Run pf cleanup to kill all kubectl/ssh processes.
- Verify the P12 file path is correct
- Ensure you entered the correct password
- Check certificate with:
pf cert list
- Check the command manually:
kubectl port-forward ... - Verify kubectl context and permissions
- Check if certificate is required
- Go 1.21+
- Dependencies:
github.com/charmbracelet/bubbletea- TUI frameworkgithub.com/charmbracelet/lipgloss- Stylingsoftware.sslmate.com/src/go-pkcs12- P12 handling
go build -o pf# Windows
GOOS=windows GOARCH=amd64 go build -o pf.exe
# Linux
GOOS=linux GOARCH=amd64 go build -o pf
# macOS
GOOS=darwin GOARCH=amd64 go build -o pfContributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
Open source - feel free to use and modify.
Simple. Secure. Reliable.