tis-remote-repo-http

2.6.0.17293-10
Package for installing WAPTHttpServer for remote repositories agents
1239 downloads
Download
See build result See VirusTotal scan
tis-remote-repo-http icon
  • package : tis-remote-repo-http
  • name : Remote Repository WAPTHttpServer
  • version : 2.6.0.17293-10
  • categories :
  • maintainer : WAPT Team,Tranquil IT
  • editor :
  • licence :
  • locale :
  • target_os : windows
  • impacted_process :
  • architecture : x64
  • signature_date : 2025-06-04 22:02
  • size : 1.05 Mo
  • depends :
  • conflicts :
package           : tis-remote-repo-http
version           : 2.6.0.17293-10
architecture      : x64
section           : base
priority          : optional
name              : Remote Repository WAPTHttpServer
categories        : 
maintainer        : WAPT Team,Tranquil IT
description       : Package for installing WAPTHttpServer for remote repositories agents
depends           : tis-remote-repo-conf
conflicts         : tis-remote-repo-nginx
maturity          : PROD
locale            : 
target_os         : windows
min_wapt_version  : 2.5.5
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : 
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : b1a952b1-0dbe-4618-a23d-0b37405aacbc
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-06-04T22:02:32.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature         : yItW0wEtnBe+AZJkfo1npR4L3SYXJvzI4j7sWvUi6la6M3VrcX5q2IikdDV1BqZ1CXa0I+Vfajz5ibIvGB8gMkc7pH6Dr9jDUgKwj4jFAi1NLZ7xNCb+mTuLRuaLwVV6QTK3OWD+Oy4zW5bdXMyqxK2iltpp399172cg+T4LLyTArT/1PcMvK+ktyGGfCYnXW0GGFVa+aRzc7pY8mymk5Sygb8pWy/yJifUOccCICKsxbNv4Rp+y+K2gvnK0uIYidPEtOrfQg0bvtnart/ffhlnPIGd2hj7QquKIU4dhFiUnJ05Wl+0FFTh7n9oABggW64T+WxstKA9PsQ9B4oUrmA==
# -*- coding: utf-8 -*-
from setuphelpers import *
import time
from waptcrypto import SSLPrivateKey, SSLCertificate
import datetime

bin_name = "wapthttpserver.exe"
service_name = "WAPTHttpServer"


def install():
    global service_name

    if installed_softwares('WAPT Server_is1'):
        error('Wapt server installed on this host. Aborting')

    def make_wapthttpserver_config(local_repo):
        #moving certificate if allready exists
        nginx_ssl_dir = makepath(WAPT.wapt_base_dir, "waptservice", "nginx", "ssl")
        wapthttpserver_ssl_dir = makepath(WAPT.wapt_base_dir, "wapthttpserver", "ssl")

        mkdirs(wapthttpserver_ssl_dir)

        #moving certificate if allready exists
        if os.path.isfile(nginx_ssl_dir) and not os.path.isfile(makepath(wapthttpserver_ssl_dir, "key.pem")):
            filecopyto(makepath(nginx_ssl_dir, "key.pem"), wapthttpserver_ssl_dir)

        #moving certificate if allready exists
        if os.path.isfile(nginx_ssl_dir) and not os.path.isfile(makepath(wapthttpserver_ssl_dir, "cert.pem")):
            filecopyto(makepath(nginx_ssl_dir, "cert.pem"), wapthttpserver_ssl_dir)

        key_fn = makepath(wapthttpserver_ssl_dir, "key.pem")
        key = SSLPrivateKey(key_fn)
        if not os.path.isfile(key_fn):
            print("Create SSL RSA Key %s" % key_fn)
            key.create()
            key.save_as_pem()

        cert_fn = makepath(wapthttpserver_ssl_dir, "cert.pem")
        if os.path.isfile(cert_fn):
            crt = SSLCertificate(cert_fn)
            if crt.cn != get_fqdn():
                os.rename(cert_fn, "%s-%s.old" % (cert_fn, "{:%Y%m%d-%Hh%Mm%Ss}".format(datetime.datetime.now())))
                crt = key.build_sign_certificate(cn=get_fqdn(), dnsname=get_fqdn(), is_server_auth=True, is_client_auth=False, is_code_signing=False, is_ca=False, key_usages=['digital_signature'])
                print("Create X509 cert %s" % cert_fn)
                crt.save_as_pem(cert_fn)
        else:
            crt = key.build_sign_certificate(cn=get_fqdn(), dnsname=get_fqdn(), is_server_auth=True, is_client_auth=False, is_code_signing=False, is_ca=False, key_usages=['digital_signature'])
            print("Create X509 cert %s" % cert_fn)
            crt.save_as_pem(cert_fn)

        #create config
        waptconf_file = makepath(WAPT.wapt_base_dir, "wapt-get.ini")
        if os.path.isfile(waptconf_file):
            inifile_writestring(waptconf_file, 'wapthttpserver', 'root_dir', local_repo)
            inifile_writestring(waptconf_file, 'wapthttpserver', 'http_port', '80')
            inifile_writestring(waptconf_file, 'wapthttpserver', 'https_port', '443')
            inifile_writestring(waptconf_file, 'wapthttpserver', 'cert_file', cert_fn)
            inifile_writestring(waptconf_file, 'wapthttpserver', 'private_key_file', key_fn)
            inifile_writestring(waptconf_file, 'wapthttpserver', 'enable_logging', '1')

        oldnginxbin = os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx",'nginx.exe')
        if isfile(oldnginxbin):
            killalltasks('nginx.exe')
            remove_file(oldnginxbin)

        oldnginxpath = os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx")
        if isdir(oldnginxpath):
            remove_tree(oldnginxpath)

        servicenginxfile = os.path.join(WAPT.wapt_base_dir, "waptservice", "services",'waptnginx.service')
        if isfile(servicenginxfile):
            remove_file(servicenginxfile)


        print("Checking if ports 80 and 443 are available")
        try:
            sortie_cmd=run(cmd="wapt-get checkport 0.0.0.0:80", timeout=10, accept_returncodes=[1003])
        except:
            print("Port 80 is not available")
            raise
        try:
            sortie_cmd=run(cmd="wapt-get checkport 0.0.0.0:443", timeout=10, accept_returncodes=[1003])
        except:
            print("Port 443 is not available")
            raise


    def install_wapthttpserver_service(local_repo):
        print("Register wapthttpserver frontend")

        # rights
        for repo_path in ("wapt", "wapt-host", "waptwua"):
            p = makepath(local_repo, repo_path)
            mkdirs(p)
            run(r'icacls "%s" /grant  "*S-1-5-20":(OI)(CI)(M)' % (p))

        run(r'icacls "%s" /grant  "*S-1-5-20":(OI)(CI)(M)' % makepath(WAPT.wapt_base_dir, "log"))

        run(r'"%s" /install' % makepath(WAPT.wapt_base_dir, bin_name))

        make_wapthttpserver_config(local_repo)


    print("installing %s" % control.asrequirement())

    print("Install wapthttpserver to permit WAPTAgent to become a repository")
    local_repo = inifile_readstring(WAPT.config_filename, "repo-sync", "local_repo_path") or makepath(WAPT.wapt_base_dir, "repository")

    mkdirs(makepath(WAPT.wapt_base_dir, "wapthttpserver", "ssl"))

    if service_installed(service_name):
        if service_is_running(service_name):
            service_stop(service_name)
            time.sleep(30)
        service_delete(service_name)

    print("Remove firewall rule")
    run_notfatal(
        'netsh advfirewall firewall delete rule name="%s" program="%s"'
        % (service_name, makepath(WAPT.wapt_base_dir, bin_name))
    )

    print("Copy binary file for wapthttpserver")
    if isfile(makepath(WAPT.wapt_base_dir, bin_name)):
        remove_file(makepath(WAPT.wapt_base_dir, bin_name))
    filecopyto(bin_name, makepath(WAPT.wapt_base_dir,bin_name))

    print("Install wapthttpserver")
    install_wapthttpserver_service(local_repo)

    service_start(service_name)

    print("Add firewall rule for wapthttpserver")
    run(
        'netsh advfirewall firewall add rule name="%s" dir=in profile=private,domain,public protocol=tcp localport=80,443 action=allow program="%s" enable=yes'
        % (service_name, makepath(WAPT.wapt_base_dir, bin_name))
    )

def uninstall():
    print("Remove wapthttpserver service")
    if service_installed(service_name):
        if service_is_running(service_name):
            service_stop(service_name)
            time.sleep(30)
        service_delete(service_name)

    print("Remove firewall rule")
    run(
        'netsh advfirewall firewall delete rule name="%s" program="%s"'
        % (service_name, makepath(WAPT.wapt_base_dir, bin_name))
    )

    print("Remove wapthttpserver files")
    killalltasks('wapthttpserver.exe')
    remove_tree(makepath(WAPT.wapt_base_dir, "wapthttpserver"))
    remove_file(makepath(WAPT.wapt_base_dir, bin_name))

# -*- coding: utf-8 -*-
from setuphelpers import *
import re


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()

    #todo wait new release
    wget('https://wapt.tranquil.it/wapt/releases/latest/bin/win64/wapthttpserver.exe','wapthttpserver.exe',proxies=proxies)

    version = get_version_from_binary('wapthttpserver.exe',property_name='FileVersion')

    control.set_software_version(version)
    control.save_control_to_wapt()
38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
404d822a82b9c387746eb677fe208f8663d599c14675b9d2f15ef308db2768ee : WAPT/control
7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2 : WAPT/icon.png
82d69be36b5b9e14d5e5f4ce517e66a3ebf61c991ab31085f33caa107db3773b : luti.json
cfb6795c3323926b8b21799c2b35a70e2288993365300bf1166387a325beb338 : setup.py
4a709c69d6232b3de4887a42d998369ae9c27cc71d45935d1d6493269574432b : update_package.py
266a4163aa29af891f23eee21f0052aa8838879c3f5ca556f01bf52ee3400091 : wapthttpserver.exe