Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions contrib/win32/install/client.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<!-- KeyPath is necessary for multi-file components to identify the key file - preferrably versioned. -->
<ComponentGroup Id="Client" Directory="INSTALLFOLDER">
<ComponentGroupRef Id="Shared" />
<Component>
<File Name="ssh.exe" KeyPath="yes" />
<File Name="ssh.pdb" />
</Component>
<Component>
<File Name="sftp.exe" KeyPath="yes" />
<File Name="sftp.pdb" />
</Component>
<Component>
<File Name="ssh-add.exe" KeyPath="yes" />
<File Name="ssh-add.pdb" />
</Component>
<Component>
<File Name="ssh-keyscan.exe" KeyPath="yes" />
<File Name="ssh-keyscan.pdb" />
</Component>
<Component Id="ClientPATH" Guid="F07FFA0C-B5CF-45A3-9013-A7420DDFD654">
<!-- Use same property condition as PowerShell. We can use a shared component GUID here because there should be only one installed on a system. -->
<Condition>ADD_PATH=1</Condition>
<Environment Id="ClientPATH" Name="PATH" Value="[INSTALLFOLDER]" Action="set" Part="first" System="yes" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
44 changes: 44 additions & 0 deletions contrib/win32/install/openssh.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<ProductVersion>1.1.0</ProductVersion>
<OutputName>openssh</OutputName>
<OutputType>package</OutputType>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>
$(DefineConstants);
ProductVersion=$(ProductVersion);
</DefineConstants>
<DefineSolutionProperties>false</DefineSolutionProperties>
<WixTargetsPath Condition="'$(WixTargetsPath)' == ''">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>
$(DefineConstants);
Debug;
</DefineConstants>
</PropertyGroup>

<ItemGroup>
<BindInputPaths Include="..\..\..\bin\$(Platform)\$(Configuration)" />
</ItemGroup>

<ItemGroup>
<Compile Include="product.wxs" />
<Compile Include="client.wxs" />
<Compile Include="server.wxs" />
<Compile Include="shared.wxs" />
</ItemGroup>

<ItemGroup>
<WixExtension Include="WixFirewallExtension" />
<WixExtension Include="WixUIExtension" />
<WixExtension Include="WixUtilExtension" />
</ItemGroup>

<Import Project="$(WixTargetsPath)" />
</Project>
39 changes: 39 additions & 0 deletions contrib/win32/install/product.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0"?>

<?ifndef ProductVersion?>
<?error ProductVersion must be defined?>
<?endif?>

<!-- Currently support x86, x64 builds. Assumes only previews are built as MSIs. -->
<?if $(var.Platform) = "x64"?>
<?define ProgramFilesFolder = "ProgramFiles64Folder"?>
<?define UpgradeCode = "9E9D0D93-E70D-4424-ADBD-AD3B226A226D"?>
<?elseif $(var.Platform) = "x86"?>
<?define ProgramFilesFolder = "ProgramFilesFolder"?>
<?define UpgradeCode = "2A1799F1-5B26-4DDC-A0C7-03F75C4C08D2"?>
<?else?>
<?error Platform $(var.Platform) is not supported?>
<?endif?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="OpenSSH" Version="$(var.ProductVersion)" Language="1033" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)">
<Package Compressed="yes" InstallerVersion="200" InstallScope="perMachine"/>
<MediaTemplate EmbedCab="yes" />

<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A newer version of !(bind.property.ProductName) is already installed." />
<Condition Message="OpenSSH is supported only on Windows 7 and newer."><![CDATA[VersionNT >= 601]]></Condition>

<Feature Id="Client" AllowAdvertise="no">
<ComponentGroupRef Id="Client" />
</Feature>
<Feature Id="Server" AllowAdvertise="no">
<ComponentGroupRef Id="Server" />
</Feature>

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.ProgramFilesFolder)" Name="Program Files">
<Directory Id="INSTALLFOLDER" Name="OpenSSH" />
</Directory>
</Directory>
</Product>
</Wix>
70 changes: 70 additions & 0 deletions contrib/win32/install/server.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<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">
<Fragment>
<!-- KeyPath is necessary for multi-file components to identify the key file - preferrably versioned. -->
<ComponentGroup Id="Server" Directory="INSTALLFOLDER">
<ComponentGroupRef Id="Shared" />
<Component>
<File Name="sftp-server.exe" KeyPath="yes" />
<File Name="sftp-server.pdb" />
</Component>
<Component>
<File Name="ssh-shellhost.exe" KeyPath="yes" />
<File Name="ssh-shellhost.pdb" />
</Component>
<Component>
<File Id="sshd.exe" Name="sshd.exe" KeyPath="yes" />
<File Name="sshd.pdb" />
<RegistryKey Root="HKLM" Key="SOFTWARE\OpenSSH" ForceCreateOnInstall="yes">
<PermissionEx Sddl="O:BAG:SYD:P(A;OICI;KR;;;AU)(A;OICI;KA;;;SY)(A;OICI;KA;;;BA)" />
<!-- ssh-agent-associated key should only be created if the Server feature is installed. -->
<RegistryKey Key="agent" ForceCreateOnInstall="yes">
<PermissionEx Sddl="O:BAG:SYD:P(A;OICI;KA;;;SY)(A;OICI;KA;;;BA)" />
</RegistryKey>
</RegistryKey>
<ServiceInstall
Name="sshd"
DisplayName="OpenSSH SSH Server"
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."
Start="auto"
Type="ownProcess"
Interactive="no"
ErrorControl="critical"
Vital="yes">
<util:ServiceConfig
ResetPeriodInDays="1"
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart"
/>
</ServiceInstall>
<ServiceControl
Id="ControlSshd"
Name="sshd"
Start="install"
Stop="both"
Remove="uninstall" />
<firewall:FirewallException
Id="sshd_allow"
Name="OpenSSH SSH Server Preview (sshd)"
Description="Inbound rule for OpenSSH SSH Server (sshd)"
Program="[#sshd.exe]"
Protocol="tcp"
Port="22"
Scope="any"
/>
</Component>
<Component>
<File Name="sshd_config_default">
<PermissionEx Sddl="O:BAG:SYD:PAI(A;;FA;;;SY)(A;;FA;;;BA)" />
Copy link

Choose a reason for hiding this comment

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

We can have read permissions to the authorized users.

Copy link
Author

Choose a reason for hiding this comment

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

This was copied from the scripts at the time of writing. Have they changed?

</File>
</Component>
</ComponentGroup>

<!-- Automatically add custom actions if referencing the Server component group. -->
<SetProperty Id="SetPrivilegesOnSshd" Value="&quot;[SystemFolder]sc.exe&quot; privs sshd SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege" Sequence="execute" Before="SetPrivilegesOnSshd" />
<CustomAction Id="SetPrivilegesOnSshd" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="SetPrivilegesOnSshd" After="InstallServices"><![CDATA[&Server = 3]]></Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
66 changes: 66 additions & 0 deletions contrib/win32/install/shared.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<!-- KeyPath is necessary for multi-file components to identify the key file - preferrably versioned. -->
<ComponentGroup Id="Shared" Directory="INSTALLFOLDER">
<Component>
<File Name="libcrypto.dll" KeyPath="yes" />
<File Name="libcrypto.pdb" />
</Component>
<Component>
<File Name="moduli">
<PermissionEx Sddl="D:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1200a9;;;WD)" />
</File>
</Component>
<Component>
<File Name="scp.exe" KeyPath="yes" />
<File Name="scp.pdb" />
</Component>
<Component>
<File Name="ssh-keygen.exe" KeyPath="yes" />
<File Name="ssh-keygen.pdb" />
</Component>

<!-- ssh-agent is useful in both client and server scenarios. -->
<Component>
<File Name="openssh-events.man">
<util:EventManifest ResourceFile="[#ssh_agent.exe]" />
</File>
</Component>
<Component>
<!-- Define the File/@Id to reference in util:EventManifest/@ResourceFile above. -->
<File Id="ssh_agent.exe" Name="ssh-agent.exe" KeyPath="yes" />
<File Name="ssh-agent.pdb" />
<ServiceInstall
Name="ssh-agent"
DisplayName="OpenSSH Authentication Agent"
Description="Agent to hold private keys used for public key authentication."
Start="auto"
Type="ownProcess"
Interactive="no"
ErrorControl="critical"
Vital="yes">
<util:ServiceConfig
ResetPeriodInDays="1"
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart"
/>
<PermissionEx Sddl="D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RP;;;AU)" />
</ServiceInstall>
<ServiceControl
Id="ControlSshAgent"
Name="ssh-agent"
Start="install"
Stop="both"
Remove="uninstall" />
</Component>
</ComponentGroup>

<!-- Automatically add custom actions if referencing the Shared component group. -->
<SetProperty Id="SetPrivilegesOnSshAgent" Value="&quot;[SystemFolder]sc.exe&quot; privs ssh-agent SeImpersonatePrivilege" Sequence="execute" Before="SetPrivilegesOnSshAgent" />
<CustomAction Id="SetPrivilegesOnSshAgent" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="SetPrivilegesOnSshAgent" After="InstallServices"><![CDATA[&Server = 3]]></Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
Loading