瀏覽代碼

Don't use powershell scripts to install

AS it hangs when running on Win7/Win2088
master
Daniel Berteaud 1 年之前
父節點
當前提交
a85f709121
共有 3 個檔案被更改,包括 33 行新增12 行删除
  1. +1
    -1
      WAPT/control
  2. 二進制
      openssh-events.man
  3. +32
    -11
      setup.py

+ 1
- 1
WAPT/control 查看文件

@@ -1,5 +1,5 @@
package : fws-openssh
version : 7.7.2.0-5
version : 7.7.2.0-6
architecture : all
section : base
priority : optional


二進制
openssh-events.man 查看文件


+ 32
- 11
setup.py 查看文件

@@ -7,30 +7,51 @@ uninstallkey = []
def install():
print('Installing OpenSSH')
mkdirs(makepath(programfiles,'OpenSSH'))
print(' Stoping the service')
if service_installed('sshd') and service_is_running('sshd'):
service_stop('sshd')
killalltasks('sshd.exe')
for service in ['sshd','ssh-agent']:
if service_installed(service) and service_is_running(service):
service_stop(service)
killalltasks('%s.exe' % service)
print(' Extract OpenSSH archive')
run('"%s" e -y -o"%s" OpenSSH-Win%s.zip' % (makepath(programfiles,'7-Zip','7z.exe'),makepath(programfiles,'OpenSSH'),'64' if iswin64() else '32'))
print(' Installing the service')
run(r'powershell.exe -ExecutionPolicy Bypass -File "%s\install-sshd.ps1"' % makepath(programfiles,'OpenSSH'))
print(' Installing the services')
run(r'sc.exe create sshd binPath= "%s" DisplayName= "OpenSSH Server" start= auto' % makepath(programfiles,'OpenSSH','sshd.exe'), accept_returncodes=[0,1073])
run(r'sc.exe privs sshd SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege')
run(r'sc.exe create ssh-agent binPath= "%s" DisplayName= "OpenSSH Authentication Agent" start= auto' % makepath(programfiles,'OpenSSH','ssh-agent.exe'), accept_returncodes=[0,1073])
run(r'sc.exe sdset ssh-agent "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RP;;;AU)"')
run(r'sc.exe privs ssh-agent SeImpersonatePrivilege')
run(r'wevtutil.exe um "%s"' % makepath(programfiles,'OpenSSH','openssh-events.man'))
filecopyto('openssh-events.man',makepath(programfiles,'OpenSSH'))
run(r'wevtutil.exe im "%s"' % makepath(programfiles,'OpenSSH','openssh-events.man'))
print(' Opening port 22 in the firewall')
run_notfatal(r'netsh advfirewall firewall del rule name="OpenSSH Server"')
run(r'netsh advfirewall firewall add rule name="OpenSSH Server" dir=in action=allow protocol=TCP localport=22 enable=yes')
print(' Starting the service')
service_start('sshd')
print(r' Enabling sshd service on boot')
run('sc config sshd start= auto')
def uninstall():
print('Removing OpenSSH')
print(' Stoping the service')
if service_is_running('sshd'):
service_stop('sshd')
killalltasks('sshd.exe')
print(' Uninstalling the service')
run(r'powershell.exe -ExecutionPolicy Bypass -File "%s\uninstall-sshd.ps1"' % makepath(programfiles,'OpenSSH'))
for service in ['sshd','ssh-agent']:
print(' Stoping the services %s' % service)
if service_is_running(service):
service_stop(service)
killalltasks('%s.exe' % service)
print(' Uninstalling service %s' % service)
run(r'sc.exe delete %s' % service)
print(' Unregister events handler')
run(r'wevtutil um "%s"' % makepath(programfiles,'OpenSSH','openssh-events.man'))
print(' Removing files')
remove_tree(makepath(programfiles,'OpenSSH'))


Loading…
取消
儲存