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
|
*.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
|
package : eht-glpi-agent
|
||||||
version : 2.6-2
|
version : 1.4-3
|
||||||
architecture : all
|
architecture : all
|
||||||
section : base
|
section : base
|
||||||
priority : optional
|
priority : optional
|
||||||
name :
|
name :
|
||||||
categories :
|
categories :
|
||||||
maintainer : Daniel Berteaud
|
maintainer : Daniel Berteaud <dbd@ehtrace.com>
|
||||||
description : FusionInventory is a computer inventory agent
|
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 :
|
||||||
|
@ -30,14 +28,17 @@ audit_schedule : 2d
|
||||||
editor :
|
editor :
|
||||||
keywords : inventory
|
keywords : inventory
|
||||||
licence : GPLv2+
|
licence : GPLv2+
|
||||||
homepage : http://fusioninventory.org/
|
homepage : http://glpi-project.org/
|
||||||
package_uuid : 1d2c53d4-ce75-4fb7-9f5c-3c4865f4512a
|
package_uuid : 6248be43-0eca-41e8-8669-715b2a11a891
|
||||||
valid_from :
|
valid_from :
|
||||||
valid_until :
|
valid_until :
|
||||||
forced_install_on :
|
forced_install_on :
|
||||||
changelog :
|
changelog :
|
||||||
signer : Daniel Berteaud
|
min_os_version : 5.0
|
||||||
signer_fingerprint: 3c9415559e2dedbc4390e3faa2c28d3b67265baa5b35902d2764d9e41c3b3f0a
|
max_os_version :
|
||||||
signature : YUUCx8FJCS3xFabY6/YQll7w2tvKQ98QypnlTskLk2axmoNYpOgdnaqg2ZfDqVd9N0zfnHcPOv3tecF4KormYT4/wrRnV9m6sj5e85eOHaeao2vU+28xROoQnCrG25NI55aecVL1cPc3FMYsT2yh84zJrKedcRHEefglFhSS3aaOrYmDDJOkFPH+DMZAf3PAGc0nqmfhU2NF8Oqj+z2rIfAlUalDGxhzBhaV0Ox3KDVCu22ppL7fBsy2w7mxJqJyS1Rttxk8WouQyZYB7M2uo8GPmR2LiQZhb93vF1K+91wFJmTsB1Rpl7PaDPE3lqAbGzPNkC7kwzGEqPq5DCEzaQ==
|
icon_sha256sum : fba3af4f79be43de12a5f9438a98831edc7a08c5761e5f216eb9d9ca5d98b3ff
|
||||||
signature_date : 2020-11-26T18:38:06.089000
|
signer : dbd
|
||||||
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
|
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 = []
|
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
|
||||||
|
@ -12,40 +12,53 @@ if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(m
|
||||||
print('Reading local encrypted variables file')
|
print('Reading local encrypted variables file')
|
||||||
from cryptography.fernet import Fernet
|
from cryptography.fernet import Fernet
|
||||||
import yaml
|
import yaml
|
||||||
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
|
f = Fernet(bytes(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read(), 'utf-8'))
|
||||||
variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
|
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():
|
||||||
print('Updating FusionInventory Agent package')
|
print('Updating GLPI Agent package')
|
||||||
import requests,json
|
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']
|
version = latest['tag_name']
|
||||||
pe = PackageEntry();
|
pe = PackageEntry();
|
||||||
control = pe.load_control_from_wapt('.')
|
control = pe.load_control_from_wapt('.')
|
||||||
bin_found = []
|
bin_found = []
|
||||||
for arch in ['86','64']:
|
for arch in ['86','64']:
|
||||||
for asset in latest['assets']:
|
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']
|
url = asset['browser_download_url']
|
||||||
print('Downloading FusionInventory Agent %s for x%s from %s' % (version,arch,url))
|
print('Downloading GLPI Agent %s for x%s from %s' % (version, arch ,url))
|
||||||
wget(url,'fusioninventory-agent_windows-x%s_%s.exe' % (arch, version))
|
wget(url,'GLPI-Agent-x%s-%s.msi' % (version, arch))
|
||||||
bin_found.append(arch)
|
bin_found.append(arch)
|
||||||
for file in glob.glob('fusioninventory-agent_windows-%s_*.exe' % arch):
|
for file in glob.glob('GLPI-Agent-x*-%s.msi' % arch):
|
||||||
if file != 'fusioninventory-agent_windows-x%s_%s.exe' % (arch, version):
|
if file != 'GLPI-Agent-x%s-%s.msi' % (version, arch):
|
||||||
print('Removing %s' % file)
|
print('Removing %s' % file)
|
||||||
remove_file(file)
|
remove_file(file)
|
||||||
if Version(version) > Version(control['version'].split('-',1)[0]) and '86' in bin_found and '64' in bin_found:
|
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():
|
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