$ show moul/sshportal
sshportal is a transparent SSH bastion/jump host implemented in Go. It allows users to connect to remote hosts through a single point of entry, managing users, hosts, keys, and ACLs. The system features session logging, an interactive administrative shell, support for multi-hop connections, and various SSH features (port forwarding, X11, etc.). It uses a database (SQLite3 by default, MySQL/PostgreSQL supported) for persistence and provides a health check endpoint. The architecture is monolithic with clear separation of concerns: core bastion logic in pkg/bastion/, database models in pkg/dbmodels/, cryptographic utilities in pkg/crypto/, and utilities in pkg/utils/. The code demonstrates good use of interfaces and modular design, though some internal coupling exists between components.
The LLM identified 2 files worth highlighting for reuse:
Implements a reusable SSH health check that verifies server availability by connecting and expecting an 'OK' response. Self-contained with no internal dependencies, using only standard library and golang.org/x/crypto/ssh. Demonstrates a pattern for lightweight service health monitoring in SSH-based applications.
Provides a reusable tunnel logging mechanism that prefixes each written byte stream with a header containing a timestamp and host name. Used for logging direct-tcpip (port forwarding) sessions. Self-contained with no internal dependencies, showcasing a non-obvious pattern for auditing tunneled network traffic in proxy applications.