tis-remote-repo-nginx
1.24.0-35
Package for installing nginx for remote repositories agents
4334 downloads
Download
See build result See VirusTotal scan

- package : tis-remote-repo-nginx
- name : Remote Repository NGINX
- version : 1.24.0-35
- categories : System and network
- maintainer : WAPT Team,Tranquil IT,Hubert TOUVET,Evan BLAUDY,Jimmy PELÉ
- editor :
- licence :
- locale : all
- target_os : windows
- impacted_process :
- architecture : x64
- signature_date : 2023-07-26 19:04
- size : 1.58 Mo
- homepage : https://www.wapt.fr/en/doc/wapt-replication/index.html
- depends :
package : tis-remote-repo-nginx
version : 1.24.0-35
architecture : x64
section : base
priority : optional
name : Remote Repository NGINX
categories : System and network
maintainer : WAPT Team,Tranquil IT,Hubert TOUVET,Evan BLAUDY,Jimmy PELÉ
description : Package for installing nginx for remote repositories agents
depends : tis-remote-repo-conf
conflicts :
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 2.4
sources : https://nginx.org/en/download.html
installed_size :
impacted_process :
description_fr : Paquet pour l'installation de nginx pour les agents de dépôts à distance
description_pl : Pakiet do instalacji nginx dla agentów zdalnych repozytoriów
description_de : Paket zur Installation von nginx für Agenten für entfernte Repositories
description_es : Paquete para instalar nginx para agentes de repositorios remotos
description_pt : Pacote para instalação de nginx para agentes de repositórios remotos
description_it : Pacchetto per l'installazione di nginx per gli agenti dei repository remoti
description_nl : Pakket voor het installeren van nginx voor remote repositories agents
description_ru : Пакет для установки nginx для агентов удаленных репозиториев
audit_schedule :
editor :
keywords :
licence :
homepage : https://www.wapt.fr/en/doc/wapt-replication/index.html
package_uuid : 7596ccd9-f1bd-432d-9280-02e35f5c3ef2
valid_from :
valid_until :
forced_install_on :
changelog : https://nginx.org/en/CHANGES
min_os_version :
max_os_version :
icon_sha256sum : cc84c091e5b69b2c2c902cba5f4e34ff5e71494f3f3d376fb640d5b68d242a56
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature : h1uzxfF4GoJ79hVOCnSexA6lUnMQ678r9vLDAEvUMge/P6k5Hosp2foFxEicIJmIC28AX9UJAroVAfjoEh0g+sN+9n7KlwoFK1X0VNrdZIoZkGdvJi397mRx/GQ7Fgu5alkzqVW12JaKNC1z5gGpoMLqddCG+4HJjFppuTMGgwz3JKHNleoVNMSlV14oVxFX0twEbANrG1ZeS2vFySw6sd/UqpPJmft0wkcgakjevHrZ3bdWwAPdBNeJ7qgg8SDqn8cZ6lD5HXUeu67Utb2G79wpLaIb7Aor+xeSwzW4tVZatR06NXfCxoZnV3yXgGDEHR+QrAkq51sgDDLrr2gHcA==
signature_date : 2023-07-26T19:04:33.780698
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
# -*- coding: utf-8 -*-
from setuphelpers import *
import time
import jinja2
from waptcrypto import SSLPrivateKey, SSLCertificate
import datetime
bin_name = "nginx.exe"
service_name = "WAPTRepoNginx"
def install():
global force
global service_name
def make_nginx_config(local_repo):
global force
ap_conf_dir = os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx", "conf")
ap_file_name = "nginx.conf"
ap_conf_file = os.path.join(ap_conf_dir, ap_file_name)
ap_ssl_dir = os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx", "ssl")
if os.path.isfile(ap_conf_file) and (not force):
if "waptservice" in open(ap_conf_file, "r").read():
return ap_conf_file
mkdirs(ap_ssl_dir)
key_fn = os.path.join(ap_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 = os.path.join(ap_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_code_signing=False)
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_code_signing=False)
print("Create X509 cert %s" % cert_fn)
crt.save_as_pem(cert_fn)
# write config file
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader("scripts"))
template = jinja_env.get_template("waptwindows.nginxconfig.j2")
template_variables = {
"wapt_repository_path": local_repo.replace("\\", "/"),
"ssl": True,
"force_https": False,
"wapt_ssl_key_file": key_fn.replace("\\", "/"),
"wapt_ssl_cert_file": cert_fn.replace("\\", "/"),
"log_dir": os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx", "logs").replace("\\", "/"),
"wapt_root_dir": WAPT.wapt_base_dir.replace("\\", "/"),
"nginx_http": 80,
"nginx_https": 443,
"server_tokens": "off",
}
config_string = template.render(template_variables)
print("Create nginx conf file %s" % ap_conf_file)
with open(ap_conf_file, "wt") as dst_file:
dst_file.write(config_string)
return ap_conf_file
def install_nginx_service(local_repo):
print("Register nginx frontend")
# rights
mkdirs(os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx", "temp"))
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)' % (os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx", "temp")))
run(r'icacls "%s" /grant "*S-1-5-20":(OI)(CI)(M)' % os.path.join(WAPT.wapt_base_dir, "waptservice", "nginx", "logs"))
run(r'icacls "%s" /grant "*S-1-5-20":(OI)(CI)(M)' % os.path.join(WAPT.wapt_base_dir, "log"))
make_nginx_config(local_repo)
filecopyto('waptnginx.service',os.path.join(WAPT.wapt_base_dir, "waptservice", "services",'waptnginx.service'))
#install_windows_nssm_service(service_binary, service_parameters, service_logfile)
print("installing %s" % control.asrequirement())
print("Install nginx 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")
print("Create WAPTService directories for nginx")
for dirname in ("nginx", "scripts"):
mkdirs(makepath(WAPT.wapt_base_dir, "waptservice", dirname))
for dirname in ("logs", "conf"):
mkdirs(makepath(WAPT.wapt_base_dir, "waptservice", "nginx", dirname))
print("Copy conf file for nginx")
if not isfile(makepath(WAPT.wapt_base_dir, "waptservice", "nginx", bin_name)):
filecopyto(bin_name, makepath(WAPT.wapt_base_dir, "waptservice", "nginx"))
if not isfile(makepath(WAPT.wapt_base_dir, "waptservice", "nginx", "conf", "mime.types")):
filecopyto("scripts/mime.types", makepath(WAPT.wapt_base_dir, "waptservice", "nginx", "conf"))
print("Install nginx")
install_nginx_service(local_repo)
print("Add firewall rule for nginx")
run(
'netsh advfirewall firewall add rule name="%s" dir=in action=allow program="%s" enable=yes'
% (service_name, makepath(WAPT.wapt_base_dir, "waptservice", "nginx", bin_name))
)
service_name = "WAPTRepoNginx"
if service_installed(service_name):
if service_is_running(service_name):
service_stop(service_name)
service_delete(service_name)
create_onetime_task('restart_waptservice','cmd.exe','/c net stop waptservice & net start waptservice')
def uninstall():
remove_file(os.path.join(WAPT.wapt_base_dir, "waptservice", "services",'waptnginx.service'))
print("Remove firewall rule")
run(
'netsh advfirewall firewall delete rule name="%s" program="%s"'
% (service_name, makepath(WAPT.wapt_base_dir, "waptservice", "nginx", bin_name))
)
print("Remove nginx files")
remove_tree(makepath(WAPT.wapt_base_dir, "waptservice", "nginx"))
remove_file(makepath(WAPT.wapt_base_dir, "waptservice", "scripts", "mime.types"))
# -*- coding: utf-8 -*-
from setuphelpers import *
import bs4 as BeautifulSoup
import zipfile
import requests
import platform
def update_package():
# Declaring local variables
package_updated = False
proxies = get_proxies()
if not proxies:
proxies = get_proxies_from_wapt_console()
app_name = control.name
url = "https://nginx.org"
bin_name = "nginx.exe"
# Getting latest version from official website
page = requests.get(url + "/en/download.html", headers={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64)"}, proxies=proxies).text
bs = BeautifulSoup.BeautifulSoup(page, "html.parser")
bs_title = bs.find("h4", text="Stable version")
url_dl = url + bs_title.findNext().findAll("a")[3]["href"]
latest_bin_zip = url_dl.split("/")[-1]
version = latest_bin_zip.replace(".zip", "").split("-")[-1]
print("Latest " + app_name + " version is: " + version)
print("Download url is: " + url_dl)
# Downloading latest binaries
if not isfile(latest_bin_zip):
print("Downloading: " + latest_bin_zip)
wget(url_dl, latest_bin_zip, proxies=proxies)
# Extracting
with zipfile.ZipFile(latest_bin_zip, "r") as zip_file:
for afile in zip_file.filelist:
if afile.filename.endswith(bin_name):
nginx_exe = zip_file.extract(afile)
filecopyto(nginx_exe, bin_name)
remove_tree(os.path.abspath(os.path.join(nginx_exe, os.pardir)))
remove_file(latest_bin_zip)
# Checking version from file
version_from_file = get_file_properties(bin_name)["ProductVersion"]
if Version(version_from_file) != Version(version) and version_from_file != "":
print("Changing version to the version number of the binary (from: %s to: %s)" % (version, version_from_file))
version = version_from_file
else:
print("Binary file version corresponds to online version")
# Changing version of the package
if Version(version) > Version(control.get_software_version()):
print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
package_updated = True
else:
print("Software version up-to-date (%s)" % Version(version))
control.set_software_version(version)
control.save_control_to_wapt()
# Validating or not update-package-sources
return package_updated
1a9c8aef984609dbb64b1465548ea5b77dfa60d23d26cea5dee8aaf7cbfb2ea5 : setup.py
: __pycache__
8ec3ad095aa3f3e47c8c49e46fa2bfdcabcb0dc83a2f8d0b949d549081a6faf0 : scripts/waptwindows.nginxconfig.j2
e96526d8332f25c4e11d4adcc983ab5c8139c58066a88809f918a4568dcd003c : scripts/mime.types
5230b7e549b923dd475535a1cde5a1545639ca74d94db0e701167715f6dae0d1 : update_package.py
25d893920bafc6f20defb5b586becbac2b39b0f7bead1f9dc9f0f0db88875ddc : nginx.exe
cc84c091e5b69b2c2c902cba5f4e34ff5e71494f3f3d376fb640d5b68d242a56 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
aa35f3b61b42165dfbb0280e13129fba9de64107919f0000c2e5d3b326160fe4 : WAPT/changelog.txt
a6122c659f68b3cfa0974984000adea3e0393248e2edb65cedd96c5e79c901cd : luti.json
35386a0d828fceb4a9d2b726427dd351523c4e212708136dd3a4c9d7755c0e99 : waptnginx.service
aaa4899f176745b237195ead800e647dd981ba74a762a6bd97410e1e04177f1b : WAPT/control
1.22.1-25
===
datetime import was missing
copy nssm to avoid unexpected kill
adding option server_tokens=off
handle nssm for win32