Connecting to the SSH Server Through a Proxy
An outbound HTTP or SOCKS proxy changes only how SshTunnel reaches the SSH server. It does not choose the final forwarded destination and it is different from dynamic SOCKS port forwarding.
The proxy is a separate network process. Chilkat's proxy negotiation and SSH protocol handling occur inside the application process.
Chilkat object or managed thread
Separate process or application code
SSH server or remote network component
Destination service
Local-computer boundary
HTTP proxy configuration
| Property | Purpose |
|---|---|
HttpProxyHostname, HttpProxyPort | Identify the proxy used for the outbound connection to the SSH server. |
HttpProxyAuthMethod | Select proxy authentication such as Basic or NTLM. |
HttpProxyUsername, HttpProxyPassword | Credentials for the HTTP proxy, not for the SSH server. |
HttpProxyDomain | Optional NTLM domain when NTLM proxy authentication is used. |
Outbound SOCKS proxy configuration
| Property | Purpose |
|---|---|
SocksVersion | 0 for no proxy, 4 for SOCKS4, or 5 for SOCKS5. |
SocksHostname, SocksPort | Identify the existing SOCKS proxy used to reach the SSH server. |
SocksUsername, SocksPassword | Credentials for the outbound SOCKS proxy. SOCKS4 does not use a password. |
Three independent authentication layers
- Proxy authentication allows
SshTunnelto pass through the HTTP or SOCKS proxy. - SSH authentication authenticates to the SSH server using
AuthenticatePw,AuthenticatePk, or another SSH authentication method. - Destination-service authentication is performed by the local client protocol, such as a database login.
Do not combine the two SOCKS concepts:
InboundSocks* properties configure a SOCKS server provided by SshTunnel to local clients. Socks* properties configure an existing SOCKS proxy that SshTunnel uses for its outbound connection to the SSH server.Example sequence
// Configure before Connect.
tunnel.HttpProxyHostname = "proxy.corp.example"
tunnel.HttpProxyPort = 8080
tunnel.HttpProxyAuthMethod = "NTLM"
tunnel.HttpProxyUsername = "proxy-user"
tunnel.HttpProxyPassword = "proxy-password"
tunnel.HttpProxyDomain = "CORP"
success = tunnel.Connect("ssh.example.com", 22)
// Now verify the SSH host key and authenticate to the SSH server.
Configure either the HTTP proxy family or the outbound SOCKS proxy family for a connection path unless the network design explicitly requires something more unusual.