Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable specifying sshd subsystem to use via -Subsystem #6603

Merged
merged 3 commits into from
Apr 24, 2018

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Apr 9, 2018

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
Member

restarted mac job due to restore failure

Copy link
Contributor

@PaulHigin PaulHigin left a comment

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
Member Author

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

cc @HemantMahawar @joeyaiello

@@ -822,6 +823,8 @@ internal static void ValidateSpecifiedAuthentication(PSCredential credential, st
private const string KeyFilePathParameter = "KeyFilePath";
private const string IdentityFilePathAlias = "IdentityFilePath";
private const string PortParameter = "Port";
private const string ConfigurationNameParameter = "ConfigurationName";
Copy link
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
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
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
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
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.

@@ -1080,7 +1087,8 @@ private List<RemoteRunspace> CreateRunspacesForSSHHostParameterSet()
userName,
host,
this.KeyFilePath,
port);
port,
ConfigurationName);
Copy link
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
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
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
Contributor

@PaulHigin PaulHigin left a comment

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
Member Author

@TravisEz13 ok to merge?

@TravisEz13
Copy link
Member

@SteveL-MSFT I updated the title and summary are they correct?

@SteveL-MSFT 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
Member Author

@TravisEz13 summary and title are now correct

@TravisEz13 TravisEz13 merged commit c80cecf into PowerShell:master Apr 24, 2018
@SteveL-MSFT SteveL-MSFT deleted the psremoting-subsystem branch April 24, 2018 23:44
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.

None yet

3 participants