Fork GLPI Agent from fusioninventory agent
This commit is contained in:
parent
c126c6a4d3
commit
003062a217
|
@ -1 +1,2 @@
|
|||
*.exe filter=lfs diff=lfs merge=lfs -text
|
||||
*.msi filter=lfs diff=lfs merge=lfs -text
|
Binary file not shown.
Binary file not shown.
29
WAPT/control
29
WAPT/control
|
@ -1,24 +1,22 @@
|
|||
package : fws-fusioninventory
|
||||
version : 2.6-2
|
||||
package : eht-glpi-agent
|
||||
version : 1.4-3
|
||||
architecture : all
|
||||
section : base
|
||||
priority : optional
|
||||
name :
|
||||
categories :
|
||||
maintainer : Daniel Berteaud
|
||||
description : FusionInventory is a computer inventory agent
|
||||
maintainer : Daniel Berteaud <dbd@ehtrace.com>
|
||||
description : GLPI Agent is a computer inventory agent
|
||||
depends :
|
||||
conflicts :
|
||||
maturity : PROD
|
||||
locale : all
|
||||
target_os : windows
|
||||
min_os_version : 5.0
|
||||
max_os_version :
|
||||
min_wapt_version : 1.3.12
|
||||
sources :
|
||||
installed_size :
|
||||
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_de :
|
||||
description_es :
|
||||
|
@ -30,14 +28,17 @@ audit_schedule : 2d
|
|||
editor :
|
||||
keywords : inventory
|
||||
licence : GPLv2+
|
||||
homepage : http://fusioninventory.org/
|
||||
package_uuid : 1d2c53d4-ce75-4fb7-9f5c-3c4865f4512a
|
||||
homepage : http://glpi-project.org/
|
||||
package_uuid : 6248be43-0eca-41e8-8669-715b2a11a891
|
||||
valid_from :
|
||||
valid_until :
|
||||
forced_install_on :
|
||||
changelog :
|
||||
signer : Daniel Berteaud
|
||||
signer_fingerprint: 3c9415559e2dedbc4390e3faa2c28d3b67265baa5b35902d2764d9e41c3b3f0a
|
||||
signature : YUUCx8FJCS3xFabY6/YQll7w2tvKQ98QypnlTskLk2axmoNYpOgdnaqg2ZfDqVd9N0zfnHcPOv3tecF4KormYT4/wrRnV9m6sj5e85eOHaeao2vU+28xROoQnCrG25NI55aecVL1cPc3FMYsT2yh84zJrKedcRHEefglFhSS3aaOrYmDDJOkFPH+DMZAf3PAGc0nqmfhU2NF8Oqj+z2rIfAlUalDGxhzBhaV0Ox3KDVCu22ppL7fBsy2w7mxJqJyS1Rttxk8WouQyZYB7M2uo8GPmR2LiQZhb93vF1K+91wFJmTsB1Rpl7PaDPE3lqAbGzPNkC7kwzGEqPq5DCEzaQ==
|
||||
signature_date : 2020-11-26T18:38:06.089000
|
||||
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_os_version,max_os_version,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,signer,signer_fingerprint,signature_date,signed_attributes
|
||||
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.6.exe (Stored with Git LFS)
BIN
fusioninventory-agent_windows-x64_2.6.exe (Stored with Git LFS)
Binary file not shown.
BIN
fusioninventory-agent_windows-x86_2.6.exe (Stored with Git LFS)
BIN
fusioninventory-agent_windows-x86_2.6.exe (Stored with Git LFS)
Binary file not shown.
65
setup.py
65
setup.py
|
@ -4,7 +4,7 @@ from setuphelpers import *
|
|||
uninstallkey = []
|
||||
|
||||
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
|
||||
|
@ -12,40 +12,53 @@ if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(m
|
|||
print('Reading local encrypted variables file')
|
||||
from cryptography.fernet import Fernet
|
||||
import yaml
|
||||
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
|
||||
variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
|
||||
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():
|
||||
parameters = '/S /acceptlicense /server="%s" /execmode=service /runnow' % (','.join(variables['fusinv_servers']))
|
||||
if 'fusinv_user' in variables and 'fusinv_pass' in variables:
|
||||
parameters = parameters + ' /user="%s" /password="%s"' % (variables['fusinv_user'],variables['fusinv_pass'])
|
||||
props = {
|
||||
'ADDLOCAL': 'feat_AGENT',
|
||||
'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')
|
||||
versionpaquet = control['version'].split('-',1)[0]
|
||||
if 'glpi_inv_user' in variables and 'glpi_inv_pass' in variables:
|
||||
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():
|
||||
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:
|
||||
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():
|
||||
print('Updating FusionInventory Agent package')
|
||||
print('Updating GLPI Agent package')
|
||||
import requests,json
|
||||
|
||||
latest = json.loads(requests.get('https://api.github.com/repos/fusioninventory/fusioninventory-agent/releases/latest').text.encode('utf-8'))
|
||||
latest = json.loads(requests.get('https://api.github.com/repos/glpi-project/glpi-agent/releases/latest').text.encode('utf-8'))
|
||||
version = latest['tag_name']
|
||||
pe = PackageEntry();
|
||||
control = pe.load_control_from_wapt('.')
|
||||
bin_found = []
|
||||
for arch in ['86','64']:
|
||||
for asset in latest['assets']:
|
||||
if asset['name'] == 'fusioninventory-agent_windows-x%s_%s.exe' % (arch, version) and not isfile('fusioninventory-agent_windows-x%s_%s.exe' % (arch, version)):
|
||||
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']
|
||||
print('Downloading FusionInventory Agent %s for x%s from %s' % (version,arch,url))
|
||||
wget(url,'fusioninventory-agent_windows-x%s_%s.exe' % (arch, version))
|
||||
print('Downloading GLPI Agent %s for x%s from %s' % (version, arch ,url))
|
||||
wget(url,'GLPI-Agent-x%s-%s.msi' % (version, arch))
|
||||
bin_found.append(arch)
|
||||
for file in glob.glob('fusioninventory-agent_windows-%s_*.exe' % arch):
|
||||
if file != 'fusioninventory-agent_windows-x%s_%s.exe' % (arch, version):
|
||||
for file in glob.glob('GLPI-Agent-x*-%s.msi' % arch):
|
||||
if file != 'GLPI-Agent-x%s-%s.msi' % (version, arch):
|
||||
print('Removing %s' % file)
|
||||
remove_file(file)
|
||||
if Version(version) > Version(control['version'].split('-',1)[0]) and '86' in bin_found and '64' in bin_found:
|
||||
|
@ -56,25 +69,25 @@ def update_package():
|
|||
|
||||
|
||||
def audit():
|
||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'server'):
|
||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\server doesn't exist")
|
||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'server'):
|
||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\GLPI-Agent\server doesn't exist")
|
||||
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']) :
|
||||
print("server config is not %, it's % instead" % (','.join(variables['fusinv_servers']), val_server) )
|
||||
return "WARNING"
|
||||
if 'fusinv_user' in variables and 'fusinv_pass' in variables:
|
||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'user'):
|
||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\user doesn't exist")
|
||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'user'):
|
||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\GLPI-Agent\user doesn't exist")
|
||||
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'] :
|
||||
print("user config is not %s, it's %s instead" % (variables['fusinv_user'],val_user) )
|
||||
return "WARNING"
|
||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'password'):
|
||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\password doesn't exist")
|
||||
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','GLPI-Agent'),'password'):
|
||||
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\GLPI-Agent\password doesn't exist")
|
||||
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'] :
|
||||
print("password doesn't match what's set")
|
||||
return "WARNING"
|
||||
|
|
Loading…
Reference in New Issue