FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit a2a72b2c authored by Mr Chris B Mortimer's avatar Mr Chris B Mortimer
Browse files

changed xml filename and id to match

parent 2d2b49da
No related branches found
No related tags found
1 merge request!21Openssh srv
<?xml version="1.0" encoding="UTF-8"?>
<packages:packages xmlns:packages="http://www.wpkg.org/packages">
<!-- http://www.kpym.com/2/kpym/index.htm
Installs a SSH server onto Windows pcs. If it's the first time this program has been installed on this pc then a copy of the
SSH keys are made to a directory on the win-info share. If this program has been installed before then the SSH keys that were
saved are copied back, saves any warning people may get if the keys have changed.
Download the manual zip package instead of using the Windows Feature - https://github.com/PowerShell/Win32-OpenSSH/releases
-->
<package id="openssh_srv" name="Openssh" revision="%version%" reboot="false" priority="51">
<variable name="version" value="8.1.0.0" />
<variable name="svc_name" value="sshd" />
<variable name="svc_name_agent" value="ssh-agent" />
<check type="file" condition="versionequalto" path="%ProgramFiles%\openssh\sshd.exe" value="%version%"/>
<install cmd='%COMSPEC% /c mkdir "%ProgramFiles%\OpenSSH"' />
<install cmd='%COMSPEC% /c xcopy /sechky "%WPKGSOFTWARE%\openssh\%version%\*" "%ProgramFiles%\OpenSSH\"' />
<install cmd='%COMSPEC% /c powershell.exe -ExecutionPolicy Bypass -File "%ProgramFiles%\OpenSSH\install-sshd.ps1"' />
<install cmd='%COMSPEC% /c netsh AdvFirewall firewall delete rule name="%svc_name%"' >
<exit code="1" />
</install>
<install cmd='%COMSPEC% /c netsh advfirewall firewall add rule name=%svc_name% dir=in action=allow protocol=TCP localport=22' />
<install cmd='%COMSPEC% /c net stop "%svc_name%"'> <!-- net waits for the service to start/stop, sc does not -->
<exit code="any" />
</install>
<install cmd='%COMSPEC% /c sc config "%svc_name%" start= delayed-auto' />
<install cmd='%COMSPEC% /c net start "%svc_name%" &amp; net stop "%svc_name%"' /> <!-- needs to run before we can copy old ssh key files back -->
<!-- if existing ssh keys are on \win-info then copy them back to local machine -->
<install cmd='%COMSPEC% /c xcopy /sechky "%WPKGWININFO%\locks\%COMPUTERNAME%\s*" "%Programdata%\ssh\"'>
<condition>
<check type="file" condition="exists" path="%WPKGWININFO%\locks\%COMPUTERNAME%\" />
</condition>
</install>
<install cmd='%COMSPEC% /c net start "%svc_name%"' />
<!--<install cmd='%COMSPEC% /c %WPKGSOFTWARE%\wpkg\tools\sleep 5' /> allow the service to start so it can create all of the files before copying them to \win-info -->
<!-- if there are no ssh key files on \win-info then start the sshd service to create the files and copy them to \win-info -->
<install cmd='%COMSPEC% /c xcopy /sechky "%Programdata%\ssh\*" "%WPKGWININFO%\locks\%COMPUTERNAME%\"'>
<condition>
<check type="logical" condition="not">
<check type="file" condition="exists" path="%WPKGWININFO%\locks\%COMPUTERNAME%\" />
</check>
</condition>
</install>
<upgrade include='remove' />
<upgrade include='install' />
<remove cmd='%COMSPEC% /c net stop "%svc_name%"' >
<exit code="any" />
</remove>
<remove cmd='%COMSPEC% /c net stop "%svc_name_agent%"' >
<exit code="any" />
</remove>
<remove cmd='%COMSPEC% /c rmdir /s /q "%ProgramFiles%\OpenSSH"' />
<remove cmd='%COMSPEC% /c netsh AdvFirewall firewall delete rule name="%svc_name%"' >
<exit code="1" />
</remove>
<remove cmd='%COMSPEC% /c sc delete "%svc_name%"' >
<exit code="any" />
</remove>
<remove cmd='%COMSPEC% /c sc delete "%svc_name_agent%"' >
<exit code="any" />
</remove>
<remove cmd='%COMSPEC% /c del /q %programdata%\ssh\s*' />
</package>
</packages:packages>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment