|
| 1 | +# Sentrius SSH Proxy Server |
| 2 | + |
| 3 | +The SSH Proxy Server provides an SSH server that applies the same safeguards seen in Sentrius UI to any SSH client. Commands are intercepted and processed through Sentrius's trigger-based security system, with responses provided inline in the terminal. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **SSH Server**: Standard SSH server accepting connections from any SSH client |
| 8 | +- **Inline Security Responses**: Security policy responses shown directly in the terminal |
| 9 | +- **Trigger Integration**: Applies the same trigger-based safeguards as the Sentrius UI |
| 10 | +- **Command Filtering**: Basic command filtering with DENY, WARN, and other actions |
| 11 | +- **Terminal-Friendly Messages**: Colored, formatted responses optimized for terminal display |
| 12 | + |
| 13 | +## Configuration |
| 14 | + |
| 15 | +The SSH proxy can be configured via application properties: |
| 16 | + |
| 17 | +```properties |
| 18 | +# SSH Proxy Configuration |
| 19 | +sentrius.ssh-proxy.enabled=true |
| 20 | +sentrius.ssh-proxy.port=2222 |
| 21 | +sentrius.ssh-proxy.host-key-path=/tmp/ssh-proxy-hostkey.ser |
| 22 | +sentrius.ssh-proxy.max-concurrent-sessions=100 |
| 23 | + |
| 24 | +# Target SSH Configuration |
| 25 | +sentrius.ssh-proxy.target-ssh.default-host=localhost |
| 26 | +sentrius.ssh-proxy.target-ssh.default-port=22 |
| 27 | +sentrius.ssh-proxy.target-ssh.connection-timeout=30000 |
| 28 | +sentrius.ssh-proxy.target-ssh.keep-alive-interval=60000 |
| 29 | +``` |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +1. **Start the SSH Proxy Server**: |
| 34 | + ```bash |
| 35 | + mvn spring-boot:run -pl ssh-proxy |
| 36 | + ``` |
| 37 | + |
| 38 | +2. **Connect with any SSH client**: |
| 39 | + ```bash |
| 40 | + ssh -p 2222 username@localhost |
| 41 | + ``` |
| 42 | + |
| 43 | +3. **Commands are processed through Sentrius safeguards**: |
| 44 | + - Dangerous commands like `rm -rf` are blocked with red error messages |
| 45 | + - Warning commands like `sudo` show yellow warning messages |
| 46 | + - All responses appear inline in your terminal |
| 47 | + |
| 48 | +## Security Responses |
| 49 | + |
| 50 | +The SSH proxy translates Sentrius trigger actions into terminal-friendly responses: |
| 51 | + |
| 52 | +- **DENY_ACTION**: Red "COMMAND BLOCKED" message |
| 53 | +- **WARN_ACTION**: Yellow "WARNING" message |
| 54 | +- **RECORD_ACTION**: Green "RECORDING" notification |
| 55 | +- **PROMPT_ACTION**: Blue interactive prompt |
| 56 | +- **JIT_ACTION**: Yellow "JUST-IN-TIME ACCESS" message |
| 57 | + |
| 58 | +## Built-in Commands |
| 59 | + |
| 60 | +- `help` - Show available commands |
| 61 | +- `status` - Show session status |
| 62 | +- `exit` - Close SSH session |
| 63 | + |
| 64 | +## Helm Deployment |
| 65 | + |
| 66 | +The SSH proxy is included in the Sentrius Helm chart: |
| 67 | + |
| 68 | +```yaml |
| 69 | +sshproxy: |
| 70 | + enabled: true |
| 71 | + port: 2222 |
| 72 | + serviceType: ClusterIP |
| 73 | + targetSsh: |
| 74 | + defaultHost: "target-ssh-server" |
| 75 | + defaultPort: 22 |
| 76 | +``` |
| 77 | +
|
| 78 | +## Architecture |
| 79 | +
|
| 80 | +- **SshProxyServerService**: Main SSH server using Apache SSHD |
| 81 | +- **SshProxyShellHandler**: Manages individual SSH sessions |
| 82 | +- **InlineTerminalResponseService**: Formats security responses for terminal |
| 83 | +- **SshCommandProcessor**: Applies trigger-based command filtering |
| 84 | +
|
| 85 | +## Future Enhancements |
| 86 | +
|
| 87 | +- Integration with full Sentrius session management |
| 88 | +- Command forwarding to actual target SSH servers |
| 89 | +- Interactive prompt handling for complex security decisions |
| 90 | +- Integration with Sentrius user authentication system |
| 91 | +- Enhanced trigger rule configuration |
0 commit comments