The Docker SFTP/SSH Gateway is designed as a secure bridge between users and Kubernetes pods, using GitHub for authentication and authorization. The system consists of several interconnected components that work together to provide secure access.
- Process Management: Runs under PM2 for reliability
- Authentication: Uses GitHub SSH keys
- Configuration: Custom
sshd_config
with ForceCommand - SFTP Support: Internal SFTP subsystem enabled
/etc/ssh/sshd_config
: SSH daemon configuration/bin/controller.ssh.entrypoint.sh
: Connection handler/etc/ssh/authorized_keys.d/
: Dynamic key storage
The API server provides internal services for pod management and authentication.
/_cat/connection-string/:user
: Get pod connection details/users
: List available users/apps
: List available applications/v1/pods
: Kubernetes pod management/flushFirebaseContainers
: Maintenance endpoint
/bin/server.js
: Main API implementation/lib/utility.js
: Helper functions
Handles SSH key synchronization and access control.
- GitHub collaborator synchronization
- Role-based access control
- Key rotation and updates
- Slack notifications
/bin/controller.keys.js
: Key management logic/static/templates/*.mustache
: Password file templates
Uses Firebase for maintaining container state and configuration.
- Real-time container tracking
- State persistence
- Automatic cleanup
- Event handling
- User connects with SSH key
- System validates key against GitHub
- Checks user's repository permissions
- Grants appropriate access level
-
Production Access
- Limited to admin roles
- Stricter security controls
- Additional validation
-
Development Access
- Available to write, maintain, admin roles
- Standard security controls
- SSH connection received
- User authenticated via GitHub
- Pod identified from connection string
- kubectl exec establishes connection
- Session handed over to user
- SFTP subsystem activated
- Path resolution in container
- File operations proxied to pod
- Access controls enforced
- API server status
- Pod connectivity
- Firebase state
- SSH daemon health
- Key updates
- Access attempts
- System events
- Error conditions
- Alpine Linux base
- Node.js runtime
- PM2 process manager
- OpenSSH server
- Service account configuration
- RBAC policies
- Network policies
- Security contexts