tis-upsync-waptserver icon

tis-upsync-waptserver

Silent install package for tis-upsync-waptserver

3-15

  • package: tis-upsync-waptserver
  • version: 3-15
  • maintainer: sfonteneau
  • target_os: windows,debian
  • architecture: x64
  • signature_date:
  • size: 8.85 Ko
  • depends:

package           : tis-upsync-waptserver
version           : 3-15
architecture      : x64
section           : base
priority          : optional
name              : 
categories        : 
maintainer        : sfonteneau
description       : Package for tis-upsync-service
depends           : tis-upsync-metadata
conflicts         : 
maturity          : PROD
locale            : 
target_os         : windows,debian
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    : 1d
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : 2d12833d-840e-4386-94c4-5f0d484befc4
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 10
max_os_version    : 
icon_sha256sum    : 84ea7df1dddebfac1a4fa0cd25703d6229d0c4728ea10a14f3fdea7976765c7f
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-03-02T22:04:08.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         : SBivkgj+awgV3doqkt16+nmud2N6uDzTeTmxdmTTntwodZ99kLXFsBNORi8JDFT1uJmI4UWXSBqBJoIXFMrXapODdI1anxV+3S8au7gAc840WIcCM9I+y0yd/uVANiEO2jZmwSmYAEldVbDz4aBDN48Be59DBrwY1tuGSDkWOOtD65NQRgnzk+iAO0vTWOTNilzHufgZ65q7I4Mq3+S8Joz3SNPY8rnLaS47nae9Cb9p4p4fFem1t+dnCQL9aB7yDp9OCR1vHi3/Ej45Tn+Z0dvXT0R4Fdq0qyeZtVc9jLXjUK9X17R8EpXI562hy6fj+e/iHvS9AR9NrubkubK9Rw==

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


if platform.system() == 'Windows':
    binary = 'upsync.exe'
    bin_folder = makepath(programfiles(),'upsync')
    full_bin_path = makepath(bin_folder,binary)
else:
    bin_folder = '/opt/upsync'
    full_bin_path = makepath(bin_folder,'upsync')

store_path = makepath(bin_folder,'store')


def install():

    if not isdir(makepath( WAPT.wapt_base_dir,'waptserver')):
        if not params.get("install_with_luti", False):
            error('please install this package on waptserver')

    filecopyto("update-server-config.json",makepath(bin_folder,"update-server-config.json"))

    if platform.system() == 'Windows':
        nginxconf = makepath(install_location('WAPT Server_is1'),"waptserver""nginx","conf","nginx.conf")

        waptserver_ini = makepath(install_location('WAPT Server_is1'),"conf","waptserver.ini")
        config_service =  { 'Name': 'upsync',
                            'Description': 'upsync',
                            'Level': 10,
                            'StartWorkDir': bin_folder,
                            'Start': ['start:"%s" --metadata-store-path "%s"  --endpoint 127.0.0.1 --port 40080' % (full_bin_path,store_path)],
                            'StopRunAbortTimeoutSec': 0,
                            'RetryStableSec': 60,
                            'WatchDelaySec': 60,
                            'RedirectLogRotateFiles': 2,
                            'RedirectLogRotateBytes': 104857600,
                            'ConfigFilename': "%agl.base%conf\\waptserver.ini"}

        conf_service = makepath(install_location('WAPT Server_is1'),"waptserver","services","upsync.service")
        with open(conf_service,'w') as f:
            f.write(json.dumps(config_service))


    else:
        nginxconf = "/etc/nginx/sites-enabled/wapt.conf"
        filecopyto('upsync.service','/usr/lib/systemd/system/upsync.service')
        waptserver_ini = '/opt/wapt/conf/waptserver.ini'
        run("systemctl daemon-reload")
        run("systemctl enable upsync")
        systemd_restart_service('upsync')


    inifile_writestring(waptserver_ini,"options","wuserver","http://127.0.0.1:40080")

    data_nginx_migration = """
    location /wuserver/ {
        include "/opt/wapt/conf/forward_ssl_auth.conf";

        include "/opt/wapt/conf/require_ssl_auth.conf";

        proxy_pass http://127.0.0.1:40080/;
    }


    location ^~ /.well-known/acme-challenge/ {"""


    with open(nginxconf,'r') as f:
         data = f.read()

    if not "/wuserver/" in data:
        newdata = data.replace("location ^~ /.well-known/acme-challenge/ {",data_nginx_migration)

        with open(nginxconf,'w') as f:
             f.write(newdata)

    if platform.system() == 'Windows':
        run('net stop waptserver')
        run('net start waptserver')
    else:
        run('systemctl reload nginx')

def audit():

    data = run('"%s" pre-fetch --store-path "%s"' % (full_bin_path,store_path),timeout=86400)

    list_cassification = {
        #"5c9376ab-8ce6-464a-b136-22113dd69801": "Application",
        #"434de588-ed14-48f5-8eed-a15e09a991f6": "Connectors",
        "e6cf1350-c01b-414d-a61f-263d14d133b4": "CriticalUpdates",
        "e0789628-ce08-4437-be74-2495b842f43b": "DefinitionUpdates",
        #"e140075d-8433-45c3-ad87-e72345b36078": "DeveloperKits",
        "b54e7d24-7add-428f-8b75-90a396fa584f": "FeaturePacks",
        #"9511d615-35b2-47bb-927f-f73d8e9260bb": "Guidance",
        "0fa1201d-4330-4fa8-8ae9-b877473b6441": "SecurityUpdates",
        "68c5b0a3-d1a6-4553-ae49-01d3a7827828": "ServicePacks",
        "b4832bd8-e735-4761-8daf-37f882276dab": "Tools",
        "28bc880e-0592-4cbf-8f95-c79b17911d5f": "UpdateRollups",
        "cd5ffd1e-e932-4e3a-bf74-18bf0b1bbd83": "Updates",
        "3689bdc8-b205-4af4-8d4a-a63924c5e9d5": "Upgrades",
        "e0789628-ce08-4437-be74-2495b842f43b": "UpdateClassification"
    }


    for u in list_cassification:
        run('"%s" fetch --store-path "%s" --classification-filter %s' % (full_bin_path,store_path,u),timeout=86400)

    data = run('"%s" status --store-path "%s"' % (full_bin_path,store_path))
    dict_status = {}
    for u in data.split('\n'):
        if not ':' in u:
            continue
        dict_status[u.split(':')[0].strip()] = u.split(':')[1].strip()

    WAPT.write_audit_data_if_changed("upsync", "status", dict_status, keep_days=365)

    return "OK"

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
602bee1e1856ad6313cb32c675143facebc7b77be13dfecd05fa1b197c1a4fe7 : WAPT/control
84ea7df1dddebfac1a4fa0cd25703d6229d0c4728ea10a14f3fdea7976765c7f : WAPT/icon.png
19f0cb8d7ed4b2de5857abc05e8806de8b9aa22b83c76d97359300f65ac89420 : luti.json
c08dcab0b1e86ead34d2e472e790fc5b644c0a2648a775ab121649ff0b7fa5e3 : setup.py
2afaaa61ce54f0a3e2487f4994656152a740fad3b24d7f41ad25c8ee9629d97b : update-server-config.json
f3f411f77ae22357dc2c82d1e9c2b5458834aab523ea9522811412643f967b53 : upsync.service