|
| 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=""[SystemFolder]sc.exe" 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> |
0 commit comments