Skip to content

Commit 59b033b

Browse files
Andrew Menagarishvilibagajjal
Andrew Menagarishvili
authored andcommitted
Merged PR 19035: Merged Nickel into git_ps_latestw_all
Related work items: PowerShell#513, PowerShell#520, PowerShell#528, PowerShell#529, PowerShell#545
1 parent 43c6481 commit 59b033b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2260
-78
lines changed

GitCheckin.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"Branch": [
3+
{
4+
"collection": "microsoft",
5+
"project": "OS",
6+
"repo": "OS.2020",
7+
"name": "official/rs_onecore_base2_has3",
8+
"completePR":"False",
9+
"pullRequestTitle":"OpenSSH new VPack version",
10+
"workitem":31596001,
11+
"CheckinFiles":
12+
[
13+
{
14+
"source": "openssh.man",
15+
"path": "/onecore/admin/openssh/vpack",
16+
"type": "File",
17+
}
18+
]
19+
}
20+
],
21+
"Email": [
22+
{
23+
24+
}
25+
]
26+
}

auth2.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
#endif
5959
#include "monitor_wrap.h"
6060
#include "digest.h"
61+
#ifdef WINDOWS
62+
#include "sshTelemetry.h"
63+
#endif
6164

6265
/* import */
6366
extern ServerOptions options;
@@ -432,6 +435,9 @@ userauth_finish(struct ssh *ssh, int authenticated, const char *method,
432435
methods = authmethods_get(authctxt);
433436
debug3_f("failure partial=%d next methods=\"%s\"",
434437
partial, methods);
438+
#ifdef WINDOWS
439+
send_auth_method_telemetry(methods);
440+
#endif
435441
if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_FAILURE)) != 0 ||
436442
(r = sshpkt_put_cstring(ssh, methods)) != 0 ||
437443
(r = sshpkt_put_u8(ssh, partial)) != 0 ||

contrib/win32/install/client.wxs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
2+
<Fragment>
3+
<!-- KeyPath is necessary for multi-file components to identify the key file - preferrably versioned. -->
4+
<ComponentGroup Id="Client" Directory="INSTALLFOLDER">
5+
<ComponentGroupRef Id="Shared" />
6+
<Component>
7+
<File Name="ssh.exe" KeyPath="yes" />
8+
<File Name="ssh.pdb" />
9+
</Component>
10+
<Component>
11+
<File Name="sftp.exe" KeyPath="yes" />
12+
<File Name="sftp.pdb" />
13+
</Component>
14+
<Component>
15+
<File Name="ssh-add.exe" KeyPath="yes" />
16+
<File Name="ssh-add.pdb" />
17+
</Component>
18+
<Component>
19+
<File Name="ssh-keyscan.exe" KeyPath="yes" />
20+
<File Name="ssh-keyscan.pdb" />
21+
</Component>
22+
<Component Id="ClientPATH" Guid="F07FFA0C-B5CF-45A3-9013-A7420DDFD654">
23+
<!-- Use same property condition as PowerShell. We can use a shared component GUID here because there should be only one installed on a system. -->
24+
<Condition>ADD_PATH=1</Condition>
25+
<Environment Id="ClientPATH" Name="PATH" Value="[INSTALLFOLDER]" Action="set" Part="first" System="yes" />
26+
</Component>
27+
</ComponentGroup>
28+
</Fragment>
29+
</Wix>

contrib/win32/install/openssh.wixproj

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
5+
<Platform Condition="'$(Platform)' == ''">x64</Platform>
6+
<ProductVersion>1.1.0</ProductVersion>
7+
<OutputName>openssh</OutputName>
8+
<OutputType>package</OutputType>
9+
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
10+
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
11+
<DefineConstants>
12+
$(DefineConstants);
13+
ProductVersion=$(ProductVersion);
14+
</DefineConstants>
15+
<DefineSolutionProperties>false</DefineSolutionProperties>
16+
<WixTargetsPath Condition="'$(WixTargetsPath)' == ''">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
17+
</PropertyGroup>
18+
19+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
20+
<DefineConstants>
21+
$(DefineConstants);
22+
Debug;
23+
</DefineConstants>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<BindInputPaths Include="..\..\..\bin\$(Platform)\$(Configuration)" />
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<Compile Include="product.wxs" />
32+
<Compile Include="client.wxs" />
33+
<Compile Include="server.wxs" />
34+
<Compile Include="shared.wxs" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<WixExtension Include="WixFirewallExtension" />
39+
<WixExtension Include="WixUIExtension" />
40+
<WixExtension Include="WixUtilExtension" />
41+
</ItemGroup>
42+
43+
<Import Project="$(WixTargetsPath)" />
44+
</Project>

contrib/win32/install/product.wxs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0"?>
2+
3+
<?ifndef ProductVersion?>
4+
<?error ProductVersion must be defined?>
5+
<?endif?>
6+
7+
<!-- Currently support x86, x64 builds. Assumes only previews are built as MSIs. -->
8+
<?if $(var.Platform) = "x64"?>
9+
<?define ProgramFilesFolder = "ProgramFiles64Folder"?>
10+
<?define UpgradeCode = "9E9D0D93-E70D-4424-ADBD-AD3B226A226D"?>
11+
<?elseif $(var.Platform) = "x86"?>
12+
<?define ProgramFilesFolder = "ProgramFilesFolder"?>
13+
<?define UpgradeCode = "2A1799F1-5B26-4DDC-A0C7-03F75C4C08D2"?>
14+
<?else?>
15+
<?error Platform $(var.Platform) is not supported?>
16+
<?endif?>
17+
18+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
19+
<Product Id="*" Name="OpenSSH" Version="$(var.ProductVersion)" Language="1033" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)">
20+
<Package Compressed="yes" InstallerVersion="200" InstallScope="perMachine"/>
21+
<MediaTemplate EmbedCab="yes" />
22+
23+
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A newer version of !(bind.property.ProductName) is already installed." />
24+
<Condition Message="OpenSSH is supported only on Windows 7 and newer."><![CDATA[VersionNT >= 601]]></Condition>
25+
26+
<Feature Id="Client" AllowAdvertise="no">
27+
<ComponentGroupRef Id="Client" />
28+
</Feature>
29+
<Feature Id="Server" AllowAdvertise="no">
30+
<ComponentGroupRef Id="Server" />
31+
</Feature>
32+
33+
<Directory Id="TARGETDIR" Name="SourceDir">
34+
<Directory Id="$(var.ProgramFilesFolder)" Name="Program Files">
35+
<Directory Id="INSTALLFOLDER" Name="OpenSSH" />
36+
</Directory>
37+
</Directory>
38+
</Product>
39+
</Wix>

contrib/win32/install/server.wxs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:firewall="http://schemas.microsoft.com/wix/FirewallExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
2+
<Fragment>
3+
<!-- KeyPath is necessary for multi-file components to identify the key file - preferrably versioned. -->
4+
<ComponentGroup Id="Server" Directory="INSTALLFOLDER">
5+
<ComponentGroupRef Id="Shared" />
6+
<Component>
7+
<File Name="sftp-server.exe" KeyPath="yes" />
8+
<File Name="sftp-server.pdb" />
9+
</Component>
10+
<Component>
11+
<File Name="ssh-shellhost.exe" KeyPath="yes" />
12+
<File Name="ssh-shellhost.pdb" />
13+
</Component>
14+
<Component>
15+
<File Id="sshd.exe" Name="sshd.exe" KeyPath="yes" />
16+
<File Name="sshd.pdb" />
17+
<RegistryKey Root="HKLM" Key="SOFTWARE\OpenSSH" ForceCreateOnInstall="yes">
18+
<PermissionEx Sddl="O:BAG:SYD:P(A;OICI;KR;;;AU)(A;OICI;KA;;;SY)(A;OICI;KA;;;BA)" />
19+
<!-- ssh-agent-associated key should only be created if the Server feature is installed. -->
20+
<RegistryKey Key="agent" ForceCreateOnInstall="yes">
21+
<PermissionEx Sddl="O:BAG:SYD:P(A;OICI;KA;;;SY)(A;OICI;KA;;;BA)" />
22+
</RegistryKey>
23+
</RegistryKey>
24+
<ServiceInstall
25+
Name="sshd"
26+
DisplayName="OpenSSH SSH Server"
27+
Description="OpenSSH is a connectivity tool for remote login that uses the SSH protocol. It encrypts all traffic between client and server to eliminate eavesdropping, connection hijacking, and other attacks."
28+
Start="auto"
29+
Type="ownProcess"
30+
Interactive="no"
31+
ErrorControl="critical"
32+
Vital="yes">
33+
<util:ServiceConfig
34+
ResetPeriodInDays="1"
35+
FirstFailureActionType="restart"
36+
SecondFailureActionType="restart"
37+
ThirdFailureActionType="restart"
38+
/>
39+
</ServiceInstall>
40+
<ServiceControl
41+
Id="ControlSshd"
42+
Name="sshd"
43+
Start="install"
44+
Stop="both"
45+
Remove="uninstall" />
46+
<firewall:FirewallException
47+
Id="sshd_allow"
48+
Name="OpenSSH SSH Server Preview (sshd)"
49+
Description="Inbound rule for OpenSSH SSH Server (sshd)"
50+
Program="[#sshd.exe]"
51+
Protocol="tcp"
52+
Port="22"
53+
Scope="any"
54+
/>
55+
</Component>
56+
<Component>
57+
<File Name="sshd_config_default">
58+
<PermissionEx Sddl="O:BAG:SYD:PAI(A;;FA;;;SY)(A;;FA;;;BA)" />
59+
</File>
60+
</Component>
61+
</ComponentGroup>
62+
63+
<!-- Automatically add custom actions if referencing the Server component group. -->
64+
<SetProperty Id="SetPrivilegesOnSshd" Value="&quot;[SystemFolder]sc.exe&quot; privs sshd SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege" Sequence="execute" Before="SetPrivilegesOnSshd" />
65+
<CustomAction Id="SetPrivilegesOnSshd" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />
66+
<InstallExecuteSequence>
67+
<Custom Action="SetPrivilegesOnSshd" After="InstallServices"><![CDATA[&Server = 3]]></Custom>
68+
</InstallExecuteSequence>
69+
</Fragment>
70+
</Wix>

contrib/win32/install/shared.wxs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
2+
<Fragment>
3+
<!-- KeyPath is necessary for multi-file components to identify the key file - preferrably versioned. -->
4+
<ComponentGroup Id="Shared" Directory="INSTALLFOLDER">
5+
<Component>
6+
<File Name="libcrypto.dll" KeyPath="yes" />
7+
<File Name="libcrypto.pdb" />
8+
</Component>
9+
<Component>
10+
<File Name="moduli">
11+
<PermissionEx Sddl="D:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;WD)" />
12+
</File>
13+
</Component>
14+
<Component>
15+
<File Name="scp.exe" KeyPath="yes" />
16+
<File Name="scp.pdb" />
17+
</Component>
18+
<Component>
19+
<File Name="ssh-keygen.exe" KeyPath="yes" />
20+
<File Name="ssh-keygen.pdb" />
21+
</Component>
22+
23+
<!-- ssh-agent is useful in both client and server scenarios. -->
24+
<Component>
25+
<File Name="openssh-events.man">
26+
<util:EventManifest ResourceFile="[#ssh_agent.exe]" />
27+
</File>
28+
</Component>
29+
<Component>
30+
<!-- Define the File/@Id to reference in util:EventManifest/@ResourceFile above. -->
31+
<File Id="ssh_agent.exe" Name="ssh-agent.exe" KeyPath="yes" />
32+
<File Name="ssh-agent.pdb" />
33+
<ServiceInstall
34+
Name="ssh-agent"
35+
DisplayName="OpenSSH Authentication Agent"
36+
Description="Agent to hold private keys used for public key authentication."
37+
Start="auto"
38+
Type="ownProcess"
39+
Interactive="no"
40+
ErrorControl="critical"
41+
Vital="yes">
42+
<util:ServiceConfig
43+
ResetPeriodInDays="1"
44+
FirstFailureActionType="restart"
45+
SecondFailureActionType="restart"
46+
ThirdFailureActionType="restart"
47+
/>
48+
<PermissionEx Sddl="D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RP;;;AU)" />
49+
</ServiceInstall>
50+
<ServiceControl
51+
Id="ControlSshAgent"
52+
Name="ssh-agent"
53+
Start="install"
54+
Stop="both"
55+
Remove="uninstall" />
56+
</Component>
57+
</ComponentGroup>
58+
59+
<!-- Automatically add custom actions if referencing the Shared component group. -->
60+
<SetProperty Id="SetPrivilegesOnSshAgent" Value="&quot;[SystemFolder]sc.exe&quot; privs ssh-agent SeImpersonatePrivilege" Sequence="execute" Before="SetPrivilegesOnSshAgent" />
61+
<CustomAction Id="SetPrivilegesOnSshAgent" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />
62+
<InstallExecuteSequence>
63+
<Custom Action="SetPrivilegesOnSshAgent" After="InstallServices"><![CDATA[&Server = 3]]></Custom>
64+
</InstallExecuteSequence>
65+
</Fragment>
66+
</Wix>

contrib/win32/openssh/CredScanSuppress.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@
88
{
99
"file": "\\contrib\\win32\\openssh\\OpenSSHTestHelper.psm1",
1010
"_justification": "password for testing purpose"
11+
},
12+
{
13+
"file": "\\regress\\pesterTests\\PlatformAbstractLayer.psm1",
14+
"_justification": "password for testing purpose"
15+
},
16+
{
17+
"file": "auth.c",
18+
"_justification": "upstream code uses fake password"
19+
},
20+
{
21+
"file": "\\regress\\pesterTests\\data\\sshtest_hostkey_dsa",
22+
"_justification": "ssh key for testing purpose"
23+
},
24+
{
25+
"file": "\\regress\\pesterTests\\data\\sshtest_hostkey_ecdsa",
26+
"_justification": "ssh key for testing purpose"
27+
},
28+
{
29+
"file": "\\regress\\pesterTests\\data\\sshtest_hostkey_rsa",
30+
"_justification": "ssh key for testing purpose"
1131
}
1232
]
1333
}

0 commit comments

Comments
 (0)