Table of Contents

Class SshHostConfig

Namespace
SshSharp.Config
Assembly
SshSharp.dll

The effective settings for one host, resolved from an SshConfig.

public sealed class SshHostConfig
Inheritance
SshHostConfig
Inherited Members

Properties

AddKeysToAgent

AddKeysToAgent: when not null, a key loaded from an identity file that the server accepts is added to the agent with these constraints (yes; confirm asks for each use; a time interval sets the lifetime). Null for no (the default) and for ask, which AddKeysToAgentAsk reports.

AddKeysToAgentAsk

AddKeysToAgent ask: such a key goes to the agent (with no constraints) only once ConfirmAddKeyToAgent confirms it, as ssh asks through SSH_ASKPASS. Without that callback, or in BatchMode, the key is not added.

AddressFamily

The address family restriction.

Alias

The host name as given by the caller (the alias, %n).

BatchMode

Whether non-interactive mode is requested (BatchMode).

BindAddress

The local address to connect from (BindAddress, ssh -b), or null.

BindInterface

The network interface to connect from (BindInterface, ssh -B), or null; BindAddress wins.

CASignatureAlgorithms

Raw CASignatureAlgorithms specification, or null: the signature algorithms a certificate authority may have signed a host certificate with. It can only narrow SshSharp's set (see CASignatureAlgorithms).

CertificateFiles

Certificate files (CertificateFile).

ChannelTimeouts

ChannelTimeout type=interval ...: idle timeouts by channel type, in the order given (the first matching type applies). Empty for none or when unset. Entries that do not parse are left out.

Ciphers

Raw Ciphers specification, or null.

Compression

Compression: whether to offer zlib@openssh.com, which compresses everything after authentication (default false, as in ssh). See Compression.

ConnectTimeout

The connection timeout, or null.

ConnectionAttempts

ConnectionAttempts: how many times to try the TCP connection, one second apart (default 1). Only failures to reach the server are tried again (refused, unreachable, timed out), never a failed handshake or authentication; ConnectTimeout still bounds all the attempts together. Values below 1, which ssh refuses, are left out.

DynamicForwards

DynamicForward specifications, as written ([bind:]port).

ExitOnForwardFailure

Whether a forwarding that cannot be set up fails the connection (ExitOnForwardFailure).

ForwardAgent

Whether agent forwarding is requested.

GatewayPorts

Whether local forwardings may listen on every address, not only loopback, when the bind address says so (GatewayPorts).

GlobalKnownHostsFiles

System-wide known_hosts files.

GssapiAuthentication

Whether Kerberos authentication (gssapi-with-mic) is tried (GSSAPIAuthentication, off by default as in ssh).

GssapiDelegateCredentials

Whether the Kerberos ticket is forwarded to the server (GSSAPIDelegateCredentials, off by default).

HashKnownHosts

Whether new known_hosts entries are written hashed (HashKnownHosts).

HostKeyAlgorithms

Raw HostKeyAlgorithms specification (a list, or +, - or ^ applied to the defaults, as in OpenSSH), or null.

HostKeyAlias

The name to look up in known_hosts instead of the host (HostKeyAlias).

HostName

The real host name to connect to (HostName, or the alias).

IPQoSBulk

IPQoS: the type-of-service byte for non-interactive traffic (the second value, or the only one). This is the one ConnectAsync(string, SshConfigConnectOptions?, CancellationToken) sets on the socket: a connection is made before it is known what it will carry, and a library's connections are mostly commands, file transfers and tunnels. Null when unset, none, or not valid; the system's default then applies.

IPQoSInteractive

IPQoS: the type-of-service byte (DSCP in its upper six bits) for interactive sessions, from a name such as af21, cs1, ef, le, lowdelay, or a number from 0 to 255. Null when unset, none, or not valid.

IdentitiesOnly

Whether only the configured identities are offered (IdentitiesOnly).

IdentityAgent

The agent socket or pipe (IdentityAgent), or none/SSH_AUTH_SOCK as written.

IdentityFiles

Identity files, in order, with tokens and ~ expanded. Defaults to the standard id_* names when none are configured.

KbdInteractiveAuthentication

Whether keyboard-interactive authentication is allowed.

KexAlgorithms

Raw KexAlgorithms specification, or null.

KnownHostsCommand

The KnownHostsCommand, as written (its tokens, including %H %I %K %f %t, are expanded each time it runs), or null. Connecting by alias runs it only with AllowKnownHostsCommand; its output is read as known_hosts lines, in addition to the files.

LocalForwards

LocalForward specifications, as written: [bind:]port host:hostport, or with a Unix socket path on either side (/local/socket host:hostport, [bind:]port /remote/socket, /local/socket /remote/socket).

Macs

Raw MACs specification, or null.

NumberOfPasswordPrompts

NumberOfPasswordPrompts: how many times to ask for a password before giving up (see NumberOfPasswordPrompts). Default 3, as in ssh; a value that is not a number from 0 up also gives 3.

ObscureKeystrokeTiming

ObscureKeystrokeTiming yes|no|interval:milliseconds: the interval keystrokes are sent on in terminal sessions, or null for no. 20 ms for yes and when unset, as in ssh; a value that does not parse, or an interval outside 1 to 1000 ms, also gives 20 ms. See ObscureKeystrokeTiming.

Options

All directives that applied, by lower-case keyword, with the arguments of the first (or all, for accumulating ones) occurrence. Includes keywords this library has no typed property for.

PasswordAuthentication

Whether password authentication is allowed.

PermitRemoteOpen

PermitRemoteOpen: the destinations a remote dynamic forwarding (RemoteForward [bind:]port) may connect to, as host:port entries (an IPv6 address in brackets; * for any host or any port). Null when unset or any: every destination is allowed, as in ssh. Empty for none. Entries that do not parse are left out, so they allow nothing.

Port

The port (default 22).

PreferredAuthentications

Authentication methods in preference order (PreferredAuthentications), or empty for the default.

ProxyCommand

The ProxyCommand, with tokens expanded, or null.

ProxyJump

The ProxyJump hops, in order. Empty for none.

PubkeyAcceptedAlgorithms

Raw PubkeyAcceptedAlgorithms specification, or null.

PubkeyAuthentication

Whether public key authentication is allowed.

RefuseConnection

RefuseConnection yes: connecting to this host is refused outright, before any network activity (OpenSSH 10.0+; meant for Match blocks that rule out a situation).

RemoteForwards

RemoteForward specifications, as written.

RequestTty

The TTY request mode.

RequiredRsaSize

RequiredRSASize: the smallest RSA host key accepted, in bits, or null when unset (SshSharp's own minimum, 2048, applies; ssh's default is 1024). Values below 1024, which ssh refuses, are left out.

RevokedHostKeys

RevokedHostKeys: a file of host keys never to accept (an OpenSSH KRL, as ssh-keygen -k writes, or a list of public keys), with ~ and tokens expanded; null when not set (or none).

SendEnv

Environment variable name patterns to send (SendEnv).

ServerAliveCountMax

The number of unanswered keep-alives before disconnecting (default 3).

ServerAliveInterval

The interval for server keep-alive messages, or null for none.

SetEnv

Environment variables to set on the server (SetEnv); the first definition of a name wins.

StreamLocalBindMask

StreamLocalBindMask: the permission bits cleared from a Unix socket a LocalForward creates here, written in octal as a umask (0177, the default, gives mode 0600: only the owner can connect; 0117 lets the owner's group in too). On Windows the socket file is always restricted to the current user, whatever the mask. Values that do not parse as an octal number up to 0777 are left out.

StreamLocalBindUnlink

StreamLocalBindUnlink: whether an existing file where a LocalForward creates its Unix socket is removed first (typically a stale socket of an earlier run). Off by default, as in ssh: the forwarding then fails.

StrictHostKeyChecking

The host key checking policy.

TcpKeepAlive

TCPKeepAlive: whether the TCP connection has the operating system's keep-alive turned on (SO_KEEPALIVE), which notices a peer that has gone away after the system's idle time (about two hours by default on Linux and Windows). On by default, as in ssh. It is not the SSH-level keep-alive (ServerAliveInterval), which an attacker cannot spoof and which also keeps idle NAT and firewall state alive.

UpdateHostKeys

Whether known_hosts follows the host keys the server announces after login (UpdateHostKeys).

User

The remote user.

UserKnownHostsFiles

User known_hosts files, with ~ expanded.