Skip to content

Enable specifying sshd subsystem to use via -Subsystem - #6603

Merged
Travis Plunk (TravisEz13) merged 3 commits into
PowerShell:masterfrom
SteveL-MSFT:psremoting-subsystem
Apr 24, 2018
Merged

Enable specifying sshd subsystem to use via -Subsystem#6603
Travis Plunk (TravisEz13) merged 3 commits into
PowerShell:masterfrom
SteveL-MSFT:psremoting-subsystem

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Apr 9, 2018

Copy link
Copy Markdown
Member

PR Summary

Current implementation of PSRP over SSH only enables remoting to one version of PowerShell Core 6.
sshd_config allows specifying multiple subsystems that can start different versions of PowerShell Core 6 (or same versions with different parameters).
Enable use of a new -Subsystem parameter to specify the subsystem to use with ssh.

PR Checklist

@TravisEz13

Copy link
Copy Markdown
Member

restarted mac job due to restore failure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I question whether we should use 'ConfigurationName' to specify the SSH PowerShell subsystem. I feel it will only confuse users where 'ConfigurationName' specifies a WinRM based PowerShell configuration. Also we would like to add session configuration to SSH in the future and should reserve the name for that. Instead we should have a new parameter name such as 'PSSubsystemName' or just 'PSSubsystem'.

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Paul Higinbotham (@PaulHigin) I'm ok with having it separate from -ConfigurationName, but perhaps it should be just -Subsystem.

cc Hemant Mahawar (@HemantMahawar) Joey Aiello (@joeyaiello)

private const string KeyFilePathParameter = "KeyFilePath";
private const string IdentityFilePathAlias = "IdentityFilePath";
private const string PortParameter = "Port";
private const string ConfigurationNameParameter = "ConfigurationName";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this parameter since we don't yet support it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, accidentally left behind

/// <summary>
/// This parameter specifies the SSH subsystem to use for the remote connection.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need this here. This property is picked up by the base class.

/// <summary>
/// This parameter specifies the SSH subsystem to use for the remote connection.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter definition should go in the PSRemotingBaseCmdlet, but this appears to be in the PSExecutionCmdlet class (which derives from PSRemotingBaseCmdlet). Please move it there under the SSHHostParameters section.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the only Subsystem parameter, other cmdlets should be inheriting from this one now.

this.KeyFilePath,
port);
port,
ConfigurationName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Subsystem.

ValidatePortInRange(port);

this.Port = (port != 0) ? port : DefaultPort;
this.Subsystem = (subsystem != null) ? subsystem : DefaultSubsystem;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should check for null or empty here (string.IsNullOrEmpty).

/// <summary>
/// This parameter specifies the SSH subsystem to use for the remote connection.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this in the "SSH Parameters" section. This should also include the FilePathSSHHostParameterSet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Travis Plunk (@TravisEz13) ok to merge?

@TravisEz13

Copy link
Copy Markdown
Member

Steve Lee (@SteveL-MSFT) I updated the title and summary are they correct?

@SteveL-MSFT Steve Lee (SteveL-MSFT) changed the title Enable specifying sshd subsystem to use via -ConfigurationName Enable specifying sshd subsystem to use via -Subsystem Apr 19, 2018
@SteveL-MSFT

Copy link
Copy Markdown
Member Author

Travis Plunk (@TravisEz13) summary and title are now correct

@TravisEz13
Travis Plunk (TravisEz13) merged commit c80cecf into PowerShell:master Apr 24, 2018
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the psremoting-subsystem branch April 24, 2018 23:44
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
The current implementation of PSRP over SSH only enables remoting to one version of PowerShell Core 6.
sshd_config allows specifying multiple subsystems that can start different versions of PowerShell Core 6 (or same versions with different parameters).
Enable use of a new -Subsystem parameter to specify the subsystem to use with ssh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants