Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

StreamSec.SSH.Options

Feature notes: SSH implementation notes

Classes, interfaces and records

classtCustomSSHOption

inherits from tCustomOption

(no public members)

interfaceiSSHOptionList

The common negotiation contract implemented by every SSH algorithm/option list (cipher, MAC, KEX, host-key, compression, user-auth). Applications do not usually call these methods; they configure the enabled/preferred set via SelectedOptionNames on the corresponding published option-list property of a client or server component, and the SSH transport layer drives the RFC 4253 algorithm negotiation through this interface during KEXINIT.

function GetSelOptionNames: string;
Getter for SelectedOptionNames.
function SelectAsClient(const aServerPrefs : string; out aCorrectGuess: Boolean) : iCustomOption;
Client-side name-list negotiation: given the server's ordered preference list (aServerPrefs, from the peer KEXINIT), returns the option this side selects - the first locally-enabled name the server also offers, following the client's own preference order (RFC 4253). Full description »
function SelectAsServer(const aClientPrefs : string; out aCorrectGuess: Boolean) : iCustomOption;
Server-side counterpart of SelectAsClient: given the client's ordered preference list (aClientPrefs), returns the first client-preferred name this server also has enabled (RFC 4253 puts the client's order in charge). aCorrectGuess reports whether the mutual first choice matched. Driven by the transport layer during negotiation.
property SelectedOptionNames: string read GetSelOptionNames;
The comma-separated, preference-ordered list of currently enabled option names. This is exactly the name-list this side advertises in its KEXINIT packet. Read it to inspect, or (via the published option-list property) set it to choose which algorithms are offered and in what order.

classtCustomSSHOptionList

inherits from tCustomOptionList

implements iSSHOptionList

function SelectAsClient(const aServerPrefs : string; out aCorrectGuess: Boolean) : iCustomOption;
Concrete implementation of iSSHOptionList.SelectAsClient shared by all SSH option lists: scans this list's enabled options in preference order and returns the first one that also appears in the server's list aServerPrefs. Application code rarely calls this directly - the transport negotiation does. See iSSHOptionList.SelectAsClient.
function SelectAsServer(const aClientPrefs : string; out aCorrectGuess: Boolean) : iCustomOption;
Concrete implementation of iSSHOptionList.SelectAsServer shared by all SSH option lists: walks the client's preference list aClientPrefs and returns the first name this list also has enabled. Called by the transport layer, not by applications. See iSSHOptionList.SelectAsServer.
destructor Destroy; override;
Number of currently enabled (selected) options in this list. Handy in application code that iterates EnabledOptions, and used internally as the loop bound and the empty-list test (e.g. the user-auth list falls back to the "none" method when this is zero).
procedure SuggestRequiredUnits(aProc: tGetStringMethod); override; property EnabledOptionCount: Integer read GetEnabledOptionCount;

interfaceiSSHCipherOption

inherits from iCustomOption

function GetCipherClass: tCipherClass; function GetKeyLength: Integer; property CipherClass: tCipherClass read GetCipherClass; property KeyLength: Integer read GetKeyLength;

classtSSHCipherOptionList

inherits from tCustomSSHOptionList

procedure AddOption(const aIdentifier: string; aCipherAlg : tCipherAlg; aCipherMode: tCipherMode; aKeyLength : Integer); property EnabledOptions[aIndex: Integer]: iSSHCipherOption read GetEnabledOptions;

classtSSHCipherOption

inherits from tCustomSSHOption

implements iSSHCipherOption

constructor Create(const aIdentifier: string; aCipherAlg : tCipherAlg; aCipherMode: tCipherMode; aKeyLength : Integer); procedure SuggestRequiredUnits(aProc: tGetStringMethod); override;

interfaceiSSHMacOption

inherits from iCustomOption

function GetHashClass: tHashClass; function GetMacLength: Integer; function GetKeyLength: Integer; property HashClass: tHashClass read GetHashClass; property MacLength: Integer read GetMacLength; property KeyLength: Integer read GetKeyLength;

classtSSHMacOptionList

inherits from tCustomSSHOptionList

procedure AddOption(const aIdentifier: string; aHashAlg : tHashAlgorithm; aMacLength, aKeyLength : Integer); property EnabledOptions[aIndex: Integer]: iSSHMacOption read GetEnabledOptions;

classtSSHMacOption

inherits from tCustomSSHOption

implements iSSHMacOption

constructor Create(const aIdentifier: string; aHashAlg : tHashAlgorithm; aMacLength : Integer; aKeyLength : Integer); procedure SuggestRequiredUnits(aProc: tGetStringMethod); override;

interfaceiSSHCompressionOption

inherits from iCustomOption

function GetCompressionClass: tSSHCompressionClass; function GetDecompressionClass: tSSHCompressionClass; property CompressionClass: tSSHCompressionClass read GetCompressionClass; property DecompressionClass: tSSHCompressionClass read GetDecompressionClass;

classtSSHCompressionOptionList

inherits from tCustomSSHOptionList

procedure AddOption(const aIdentifier: string); property EnabledOptions[aIndex: Integer]: iSSHCompressionOption read GetEnabledOptions;

classtSSHCompressionOption

inherits from tCustomSSHOption

implements iSSHCompressionOption

constructor Create(const aIdentifier: string);

interfaceiSSHKexOption

inherits from iCustomOption

function GetKexClientClass: tDSIKeyExchangeClass; function GetKexServerClass: tDSIKeyExchangeClass; function GetHashAlgorithm: tHashAlgorithm; function GetKeyDerivation: tKeyDerivation; property KexClientClass: tDSIKeyExchangeClass read GetKexClientClass; property KexServerClass: tDSIKeyExchangeClass read GetKexServerClass; property HashAlgorithm: tHashAlgorithm read GetHashAlgorithm; property KeyDerivation: tKeyDerivation read GetKeyDerivation;

classtSSHKexOptionList

inherits from tCustomSSHOptionList

procedure AddOption(const aIdentifier: string; const aKexClassName : string; aHashAlgorithm: tHashAlgorithm; aKeyDerivation: tKeyDerivation); property EnabledOptions[aIndex: Integer]: iSSHKexOption read GetEnabledOptions;

classtSSHKexOption

inherits from tCustomSSHOption

implements iSSHKexOption

constructor Create(const aIdentifier : string; const aKexClassName : string; aHashAlgorithm: tHashAlgorithm; aKeyDerivation: tKeyDerivation); procedure SuggestRequiredUnits(aProc: tGetStringMethod); override;

interfaceiSSHKeyOption

inherits from iCustomOption

function GetKey: iUnknown; function GetHashAlgorithm: tHashAlgorithm; function GetPublicKeyFormat: iCustomDSIKeyFormat; function SetKey(const aKey : iUnknown; const aTransport: iTransport) : Boolean; property Key: iUnknown read GetKey; property PublicKeyFormat: iCustomDSIKeyFormat read GetPublicKeyFormat;

classtSSHKeyOptionList

inherits from tCustomSSHOptionList

procedure AddOption(const aIdentifier: string; const aKey : iUnknown; aHashAlg : tHashAlgorithm; const aFormat : iCustomDSIKeyFormat); procedure RemoveOption(const aIdentifier: string);
Removes the option named aIdentifier from the list. The selection keeps the name, so an option added again under the same name takes its place in the selection (this is how assigning a ServerXxxKey property replaces its entries). Full description »
procedure RemoveKeylessOptions;
Removes, as RemoveOption does, every option that holds no key. A keyless option is a verification-only entry: it names a host-key algorithm and the format to read the key with, and accepts whatever key of that algorithm the server presents. Full description »
procedure ResolveSelection;
Resolves the selection against the options the list now holds: once the owning component has loaded, a selected name whose option has been removed is dropped, and every other selected name is attached to its current option. AddOption does this as part of adding; call it when options were only removed, so that the names that went with them are no longer offered to the peer.
procedure SetSelectedOptionNames(const aNames: array of string); override; procedure SuggestRequiredUnits(aProc: tGetStringMethod); override; property EnabledOptions[aIndex: Integer]: iSSHKeyOption read GetEnabledOptions; property OnSetKey: tSetKeyEvent read fOnSetKey write SetOnSetKey;

classtSSHKeyOption

inherits from tCustomSSHOption

implements iSSHKeyOption

constructor Create(const aIdentifier: string; const aKey : iUnknown; aHashAlg : tHashAlgorithm; const aFormat : iCustomDSIKeyFormat); procedure SuggestRequiredUnits(aProc: tGetStringMethod); override; property OnSetKey: tSetKeyEvent read fOnSetKey write SetOnSetKey;

interfaceiSSHUserSubSystemOption

inherits from iCustomOption

TODO One entry in a user's allowed-subsystem list: it names an SSH connection subsystem (e.g. "sftp") that the user is permitted to request. Applications populate the owning tSSHUserSubSystemOptionList (per user) rather than creating these directly; the option's identifier is the subsystem name.

function GetSubSystemName: string;
Getter for SubSystemName; returns this option's identifier.
property SubSystemName: string read GetSubSystemName;
The subsystem name this entry authorizes (the same string used as the option identifier). Read it when matching an incoming subsystem request against the user's allowed set.

classtSSHUserSubSystemOptionList

inherits from tCustomSSHOptionList

procedure AddOption(const aIdentifier: string);
Grants this user permission to request the named SSH connection subsystem (aIdentifier is the subsystem name, e.g. "sftp"). Full description »
procedure RemoveOption(const aIdentifier: string);
Revokes the named subsystem for this user, removing it from both the master and the selected lists so subsequent requests for it are refused. Server-side counterpart to AddOption; used when reconfiguring a user's permitted subsystems.
property EnabledOptions[aIndex: Integer]: iSSHUserSubSystemOption read GetEnabledOptions;
Indexed access to the subsystems currently enabled (selected) for this user. Iterate it (server-side) to enumerate which subsystems a user may request; unlike AllOptionNames this yields only the selected entries.
property AllOptionNames: string read GetAllOptionNames write SetAllOptionNames;
Comma-separated bulk accessor for this user's subsystem entries. Writing does not clear the list first; it only adds each comma-listed name via AddOption (assigning an empty string is therefore a no-op), so it is the convenient way to seed several allowed subsystems at once. Full description »

classtSSHUserSubSystemOption

inherits from tCustomSSHOption

implements iSSHUserSubSystemOption

constructor Create(const aIdentifier: string);

interfaceiSSHClientUserAuthOption

inherits from iCustomOption

TODO

One client-side user-authentication method entry (e.g. "password" or "publickey"). It maps a method name to the tSSHClientAuthentication class that performs it. Applications enable/order the methods via the owning tSSHClientUserAuthOptionList (the client component's UserAuthOptions), not by handling these entries directly.

function GetClientAuthClass: tSSHClientAuthenticationClass;
Returns the client authentication class registered for this method, which the option list instantiates to actually run the method during login. Internal wiring; applications seldom call it.

classtSSHClientUserAuthOptionList

procedure AddOption(const aIdentifier: string; const aClassName : string);
Registers an additional client-side auth method: aIdentifier is the SSH method name advertised (e.g. "keyboard-interactive") and aClassName is the registered tSSHClientAuthentication mapped-class name that implements it. The defaults "password" and "publickey" are added automatically; call this only to add a custom method.
function Execute(const aTransport : iTransport; const aAuthData : iSSHGetAuthData; var aMustCont : Boolean; var aAuthThatCanCont: string) : Boolean;
Runs the client authentication conversation over aTransport, trying the enabled methods in order until one succeeds; aAuthData supplies passwords, keys, etc. via callbacks. Full description »
property EnabledOptions[aIndex: Integer]: iSSHClientUserAuthOption read GetEnabledOptions;
Indexed access to the enabled auth-method entries, in the configured preference order. Iterate up to EnabledOptionCount to inspect which methods this client will attempt.
property Username: string read GetUsername write SetUsername;
The login user name sent in the SSH_MSG_USERAUTH_REQUEST. The client component sets this from the user name passed to its Login call before Execute runs; set it directly only when driving the list yourself.
property Service: string read GetService write SetService;
The SSH service the client is authenticating for (normally "ssh-connection"). Set by the client component before Execute; override only for custom services.

classtSSHClientUserAuthOption

inherits from tCustomSSHOption

implements iSSHClientUserAuthOption

constructor Create(const aIdentifier : string; const aClassName : string);

interfaceiSSHServerUserAuthOption

inherits from iCustomOption

One server-side user-authentication method entry (e.g. "password" or "publickey"): it maps an accepted method name to the server-side tSSHClientAuthenticationServer class that verifies it. Applications enable the methods a server accepts via the owning tSSHServerUserAuthOptionList (the server component's UserAuthOptions), not through these entries.

function GetServerAuthClass: tSSHClientAuthenticationServerClass;
Returns the server authentication class registered for this method, which the option list instantiates to verify an incoming request of this type. Internal wiring; applications seldom call it.

classtSSHServerUserAuthOptionList

inherits from tCustomSSHOptionList

procedure AddOption(const aIdentifier: string; const aClassName : string);
Registers an additional server-accepted auth method: aIdentifier is the accepted SSH method name and aClassName is the registered tSSHClientAuthenticationServer mapped-class name that verifies it. The defaults "password" and "publickey" are added automatically; call this only to accept a custom method.
function Execute(const aTransport: iTransport; const aAuthData : iSSHGetAuthDataServer; var aUsername : string; var aService : string) : Boolean;
Drives the server side of the SSH user-auth protocol on aTransport: reads SSH_MSG_USERAUTH_REQUEST messages, dispatches each to the matching enabled method's verifier (or the built-in "none" probe), and loops until a method succeeds or the connection is closed, sending USERAUTH_SUCCESS/FAILURE it... Full description »
property EnabledOptions[aIndex: Integer]: iSSHServerUserAuthOption read GetEnabledOptions;
Indexed access to the enabled server-accepted auth methods. Iterate up to EnabledOptionCount to inspect which methods this server will accept.

classtSSHServerUserAuthOption

inherits from tCustomSSHOption

implements iSSHServerUserAuthOption

constructor Create(const aIdentifier : string; const aClassName : string);