-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Enable specifying sshd subsystem to use via -Subsystem #6603
Conversation
restarted mac job due to restore failure |
There was a problem hiding this 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'.
@PaulHigin I'm ok with having it separate from |
@@ -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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@TravisEz13 ok to merge? |
@SteveL-MSFT I updated the title and summary are they correct? |
@TravisEz13 summary and title are now correct |
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
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
to the beginning of the title and remove the prefix when the PR is ready.[feature]
if the change is significant or affects feature tests