Compare commits
10 Commits
a95690d862
...
003062a217
Author | SHA1 | Date | |
---|---|---|---|
003062a217 | |||
|
c126c6a4d3 | ||
|
6df0fd134e | ||
|
40e5a5fe87 | ||
|
6469634aac | ||
|
296b36bbb8 | ||
|
68f376c681 | ||
|
29d1eecdc7 | ||
|
9a9aeb6b7e | ||
|
6efc37b8e2 |
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1 +1,2 @@
|
||||||
*.exe filter=lfs diff=lfs merge=lfs -text
|
*.exe filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msi filter=lfs diff=lfs merge=lfs -text
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -94,3 +94,6 @@ ENV/
|
||||||
# Rope project settings
|
# Rope project settings
|
||||||
.ropeproject
|
.ropeproject
|
||||||
|
|
||||||
|
WAPT/certificate.crt
|
||||||
|
WAPT/manifest.sha256
|
||||||
|
WAPT/signature.sha256
|
BIN
GLPI-Agent-1.4-x64.msi
(Stored with Git LFS)
Normal file
BIN
GLPI-Agent-1.4-x64.msi
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
GLPI-Agent-1.4-x86.msi
(Stored with Git LFS)
Normal file
BIN
GLPI-Agent-1.4-x86.msi
(Stored with Git LFS)
Normal file
Binary file not shown.
38
WAPT/control
38
WAPT/control
|
@ -1,32 +1,44 @@
|
||||||
package : fws-fusioninventory
|
package : eht-glpi-agent
|
||||||
version : 2.4.2-11
|
version : 1.4-3
|
||||||
architecture : all
|
architecture : all
|
||||||
section : base
|
section : base
|
||||||
priority : optional
|
priority : optional
|
||||||
maintainer : Daniel Berteaud
|
name :
|
||||||
description : FusionInventory is a computer inventory agent
|
categories :
|
||||||
|
maintainer : Daniel Berteaud <dbd@ehtrace.com>
|
||||||
|
description : GLPI Agent is a computer inventory agent
|
||||||
depends :
|
depends :
|
||||||
conflicts :
|
conflicts :
|
||||||
maturity : PROD
|
maturity : PROD
|
||||||
locale : all
|
locale : all
|
||||||
target_os : windows
|
target_os : windows
|
||||||
min_os_version : 5.0
|
|
||||||
max_os_version :
|
|
||||||
min_wapt_version : 1.3.12
|
min_wapt_version : 1.3.12
|
||||||
sources :
|
sources :
|
||||||
installed_size :
|
installed_size :
|
||||||
impacted_process :
|
impacted_process :
|
||||||
description_fr : FusionInventory est un agent d'inventaire d'ordinateurs
|
description_fr : L'agent GLPI est un agent d'inventaire d'ordinateurs
|
||||||
description_pl :
|
description_pl :
|
||||||
description_de :
|
description_de :
|
||||||
description_es :
|
description_es :
|
||||||
|
description_pt :
|
||||||
|
description_it :
|
||||||
|
description_nl :
|
||||||
|
description_ru :
|
||||||
audit_schedule : 2d
|
audit_schedule : 2d
|
||||||
editor :
|
editor :
|
||||||
keywords : inventory
|
keywords : inventory
|
||||||
licence : GPLv2+
|
licence : GPLv2+
|
||||||
homepage : http://fusioninventory.org/
|
homepage : http://glpi-project.org/
|
||||||
package_uuid :
|
package_uuid : 6248be43-0eca-41e8-8669-715b2a11a891
|
||||||
signer :
|
valid_from :
|
||||||
signer_fingerprint:
|
valid_until :
|
||||||
signature_date :
|
forced_install_on :
|
||||||
signed_attributes :
|
changelog :
|
||||||
|
min_os_version : 5.0
|
||||||
|
max_os_version :
|
||||||
|
icon_sha256sum : fba3af4f79be43de12a5f9438a98831edc7a08c5761e5f216eb9d9ca5d98b3ff
|
||||||
|
signer : dbd
|
||||||
|
signer_fingerprint: e9156ec73f1ea6b50f33e0d9f580e8ae56db147100894bb5d2d4648a46f07ed1
|
||||||
|
signature : tFm2L6g17bG0buZW6ZeKFk0tJrBbx5R+rPNoxyEip1QTtbaV3ulI3OLyoOZdeK16f+9W4w2hDYNghV4Hd5KnEXL7DpW/JELwaomyoJr2Jq8j4mIKVmEok48rApssOm/iwtPs+kseRtv3Yi6sEHlYg7yqzndIgIWxtQq48GkYwephCsdZEV/RH0uixE1XDf36d6Z4PlxHILZ68o1JOxbCE/rKa6S1kunxnLNsV3eg3YF1ALVj65Wovr3raJsLFOoqRp87a6uxnHViNtIjscR5DlhXGCQqqEpMWcGY6KNBsU86aOG3GqnlcNjvKKvwOgyYNLxZvO4fiNVNXmqR5tLVKg==
|
||||||
|
signature_date : 2023-03-27T12:54:25.342941
|
||||||
|
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
|
BIN
fusioninventory-agent_windows-x64_2.4.2.exe
(Stored with Git LFS)
BIN
fusioninventory-agent_windows-x64_2.4.2.exe
(Stored with Git LFS)
Binary file not shown.
BIN
fusioninventory-agent_windows-x86_2.4.2.exe
(Stored with Git LFS)
BIN
fusioninventory-agent_windows-x86_2.4.2.exe
(Stored with Git LFS)
Binary file not shown.
125
setup.py
125
setup.py
|
@ -1,104 +1,93 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from setuphelpers import *
|
from setuphelpers import *
|
||||||
from cryptography.fernet import Fernet
|
|
||||||
import json
|
|
||||||
|
|
||||||
uninstallkey = []
|
uninstallkey = []
|
||||||
|
|
||||||
variables = {
|
variables = {
|
||||||
'fusinv_servers': [ 'https://glpi.lan.local/plugins/fusioninventory' ]
|
'glpi_inv_servers': [ 'https://glpi.lan.local/front/inventory.php' ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read local variables file if available
|
# Read local variables file if available
|
||||||
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
|
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
|
||||||
print('Reading local encrypted variables file')
|
print('Reading local encrypted variables file')
|
||||||
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
|
from cryptography.fernet import Fernet
|
||||||
variables.update(json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
|
import yaml
|
||||||
|
f = Fernet(bytes(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read(), 'utf-8'))
|
||||||
|
variables.update(yaml.safe_load(f.decrypt(bytes(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read(), 'utf-8'))))
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
parameters = '/S /acceptlicense /server="%s" /execmode=service /runnow' % (','.join(variables['fusinv_servers']))
|
props = {
|
||||||
if 'fusinv_user' in variables and 'fusinv_pass' in variables:
|
'ADDLOCAL': 'feat_AGENT',
|
||||||
parameters = parameters + ' /user="%s" /password="%s"' % (variables['fusinv_user'],variables['fusinv_pass'])
|
'HTTPD_IP': '127.0.0.1',
|
||||||
|
'NO_P2P': '1',
|
||||||
|
'RUNNOW': '1'
|
||||||
|
}
|
||||||
|
if 'glpi_inv_servers' in variables:
|
||||||
|
print('Found servers %s in settings' % (','.join(variables['glpi_inv_servers']))
|
||||||
|
props['SERVER'] = ','.join(variables['glpi_inv_servers'])
|
||||||
|
|
||||||
print('Installing FusionInventory Agent')
|
if 'glpi_inv_user' in variables and 'glpi_inv_pass' in variables:
|
||||||
versionpaquet = control['version'].split('-',1)[0]
|
print('Found user % in settings' % variables['glpi_inv_user'])
|
||||||
|
props['USER'] = variables['glpi_inv_user']
|
||||||
|
props['PASSWORD'] = variables['glpi_inv_pass']
|
||||||
|
|
||||||
|
print('Installing GLPI Agent')
|
||||||
|
version = control['version'].split('-',1)[0]
|
||||||
if iswin64():
|
if iswin64():
|
||||||
install_exe_if_needed("fusioninventory-agent_windows-x64_%s.exe" % versionpaquet,parameters,key='FusionInventory-Agent',min_version=versionpaquet)
|
msi = 'GLPI-Agent-1.4-x64.msi'
|
||||||
else:
|
else:
|
||||||
install_exe_if_needed("fusioninventory-agent_windows-x86_%s.exe" % versionpaquet,parameters,key='FusionInventory-Agent',min_version=versionpaquet)
|
msi = 'GLPI-Agent-1.4-x86.msi'
|
||||||
|
|
||||||
|
install_msi_if_needed(msi,min_version=version,properties=props)
|
||||||
|
|
||||||
|
|
||||||
def update_package():
|
def update_package():
|
||||||
import BeautifulSoup,requests,re
|
print('Updating GLPI Agent package')
|
||||||
|
import requests,json
|
||||||
|
|
||||||
from waptpackage import PackageEntry
|
latest = json.loads(requests.get('https://api.github.com/repos/glpi-project/glpi-agent/releases/latest').text.encode('utf-8'))
|
||||||
verify=True
|
version = latest['tag_name']
|
||||||
pe = PackageEntry()
|
pe = PackageEntry();
|
||||||
pe.load_control_from_wapt(os.getcwd())
|
control = pe.load_control_from_wapt('.')
|
||||||
current_version = pe['version'].split('-',1)[0]
|
bin_found = []
|
||||||
verify=True
|
for arch in ['86','64']:
|
||||||
|
for asset in latest['assets']:
|
||||||
url = 'https://github.com/fusioninventory/fusioninventory-agent/releases'
|
if asset['name'] == 'GLPI-Agent-x%s-%s.msi' % (version, arch) and not isfile('GLPI-Agent-x%s-%s.msi' % (version, arch)):
|
||||||
|
url = asset['browser_download_url']
|
||||||
import requests,BeautifulSoup
|
print('Downloading GLPI Agent %s for x%s from %s' % (version, arch ,url))
|
||||||
page = requests.get(url + '/latest',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'},verify=verify).text
|
wget(url,'GLPI-Agent-x%s-%s.msi' % (version, arch))
|
||||||
bs = BeautifulSoup.BeautifulSoup(page)
|
bin_found.append(arch)
|
||||||
|
for file in glob.glob('GLPI-Agent-x*-%s.msi' % arch):
|
||||||
bs_raw_string = str(bs.find('span',{'class':'css-truncate-target'}).text)
|
if file != 'GLPI-Agent-x%s-%s.msi' % (version, arch):
|
||||||
|
print('Removing %s' % file)
|
||||||
version = bs_raw_string
|
remove_file(file)
|
||||||
|
if Version(version) > Version(control['version'].split('-',1)[0]) and '86' in bin_found and '64' in bin_found:
|
||||||
url64 = url + "/download/" + version + "/fusioninventory-agent_windows-x64_%s.exe" % version
|
print('Updating control file with new version %s' % version)
|
||||||
url86 = url + "/download/" + version + "/fusioninventory-agent_windows-x86_%s.exe" % version
|
pe.version = version + '-0'
|
||||||
|
pe.maturity = 'PREPROD'
|
||||||
filenamex86 = "fusioninventory-agent_windows-x86_%s.exe" % version
|
pe.save_control_to_wapt('.')
|
||||||
filenamex64 = "fusioninventory-agent_windows-x64_%s.exe" % version
|
|
||||||
|
|
||||||
if not isfile( filenamex64 ) :
|
|
||||||
wget( url64 )
|
|
||||||
if not isfile( filenamex86 ) :
|
|
||||||
wget( url86 )
|
|
||||||
|
|
||||||
|
|
||||||
for fileexe in glob.glob('fusioninventory-agent_windows-x64*.exe'):
|
|
||||||
if fileexe != filenamex64 :
|
|
||||||
print('Delete ' + fileexe)
|
|
||||||
remove_file(fileexe)
|
|
||||||
|
|
||||||
for fileexe in glob.glob('fusioninventory-agent_windows-x86*.exe'):
|
|
||||||
if fileexe != filenamex86 :
|
|
||||||
print('Delete ' + fileexe)
|
|
||||||
remove_file(fileexe)
|
|
||||||
|
|
||||||
if not isfile(filenamex64):
|
|
||||||
print('Download ' + url64)
|
|
||||||
wget(url64,filenamex64)
|
|
||||||
|
|
||||||
if not isfile(filenamex86):
|
|
||||||
print('Download ' + url86)
|
|
||||||
wget(url86,filenamex86)
|
|
||||||
|
|
||||||
|
|
||||||
def audit():
|
def audit():
|
||||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'server'):
|
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'server'):
|
||||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\server doesn't exist")
|
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\GLPI-Agent\server doesn't exist")
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
val_server = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'server')
|
val_server = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'server')
|
||||||
if val_server != ','.join(variables['fusinv_servers']) :
|
if val_server != ','.join(variables['fusinv_servers']) :
|
||||||
print("server config is not %, it's % instead" % (','.join(variables['fusinv_servers']), val_server) )
|
print("server config is not %, it's % instead" % (','.join(variables['fusinv_servers']), val_server) )
|
||||||
return "WARNING"
|
return "WARNING"
|
||||||
if 'fusinv_user' in variables and 'fusinv_pass' in variables:
|
if 'fusinv_user' in variables and 'fusinv_pass' in variables:
|
||||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'user'):
|
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'user'):
|
||||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\user doesn't exist")
|
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\GLPI-Agent\user doesn't exist")
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
val_user = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'user')
|
val_user = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'user')
|
||||||
if val_user != variables['fusinv_user'] :
|
if val_user != variables['fusinv_user'] :
|
||||||
print("user config is not %s, it's %s instead" % (variables['fusinv_user'],val_user) )
|
print("user config is not %s, it's %s instead" % (variables['fusinv_user'],val_user) )
|
||||||
return "WARNING"
|
return "WARNING"
|
||||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'password'):
|
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'password'):
|
||||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\password doesn't exist")
|
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\GLPI-Agent\password doesn't exist")
|
||||||
return "ERROR"
|
return "ERROR"
|
||||||
val_pass = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'password')
|
val_pass = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'password')
|
||||||
if val_pass != variables['fusinv_pass'] :
|
if val_pass != variables['fusinv_pass'] :
|
||||||
print("password doesn't match what's set")
|
print("password doesn't match what's set")
|
||||||
return "WARNING"
|
return "WARNING"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user