Hello, good evening.
Here's my problem: I'm currently creating a custom web interface for WAPT. This interface is intended for trainers in a training center, and I want to allow them to access a menu displaying the rooms they manage. This menu should lead to information about each room, as well as all the computers available in that room.
My problem is that, lacking documentation, I'm having trouble understanding how the API works, and I wanted to know if it's possible to assign packages to a group via the API. And if so, how? Is it possible to do the same for individual computers?
WAPT version: 1.5
Server OS: CentOS 7
Client OS: Windows 7
Wapt API for web interface
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
- sfonteneau
- WAPT Expert
- Messages: 2318
- Registered: July 10, 2014 - 11:52 PM
- Contact :
Hello,
the WAPT API communicates in JSON and allows you to retrieve the same information as the console.
Here are a few examples:
https://admin:password@srvwapt.mydomain ... imit=10000
https://admin:password@srvwapt.mydomain ... /v1/groups
https://admin:password@srvwapt.mydomain ... imit=10000
With the API, you can retrieve information, upload a package, delete a package, launch Wake-on-LAN commands, etc.
However, you cannot create packages with the API, and therefore, to answer your question, you cannot assign packages to a group or a computer using the API.
Currently, when you assign packages to a group or a computer, the console builds the package locally on the machine and then sends it to the WAPT server with a POST request:
https://admin:password@srvwapt.mydomain ... d_packages.
This approach was chosen to prevent the WAPT repository from becoming a sensitive asset.
Indeed, the WAPT server does not possess the private key; it only acts as a relay. Only the holder of the private key can perform actions on the workstations.
the WAPT API communicates in JSON and allows you to retrieve the same information as the console.
Here are a few examples:
https://admin:password@srvwapt.mydomain ... imit=10000
https://admin:password@srvwapt.mydomain ... /v1/groups
https://admin:password@srvwapt.mydomain ... imit=10000
With the API, you can retrieve information, upload a package, delete a package, launch Wake-on-LAN commands, etc.
However, you cannot create packages with the API, and therefore, to answer your question, you cannot assign packages to a group or a computer using the API.
Currently, when you assign packages to a group or a computer, the console builds the package locally on the machine and then sends it to the WAPT server with a POST request:
https://admin:password@srvwapt.mydomain ... d_packages.
This approach was chosen to prevent the WAPT repository from becoming a sensitive asset.
Indeed, the WAPT server does not possess the private key; it only acts as a relay. Only the holder of the private key can perform actions on the workstations.
Hello again, my problem is still ongoing. I considered directly modifying the database with PHP or executing Linux commands from within it. The problem is that the changes to the database are apparently not being applied on the client side. And I can't find any server-side commands. Is there a possible solution? Could I use a script already present on the server? Or a procedure?
- JEANTET Joey, development student
- sfonteneau
- WAPT Expert
- Messages: 2318
- Registered: July 10, 2014 - 11:52 PM
- Contact :
As I already said, it's not in the database, no need to modify it! ...
These are flat files located in /var/www/wapt/
https://doc.ad.tranquil.it/fr/doc/wapt- ... positories
These are flat files located in /var/www/wapt/
https://doc.ad.tranquil.it/fr/doc/wapt- ... positories
I understood the concept, but my problem is:
Is there a server command that allows adding a package to a user for installation?
For example :
wapt-add-usrpackage sta5803693 test-java8
and thus obtain it here This function would be used on a web panel with a user system
Sorry for asking so many odd questions
Is there a server command that allows adding a package to a user for installation?
For example :
wapt-add-usrpackage sta5803693 test-java8
and thus obtain it here This function would be used on a web panel with a user system
Sorry for asking so many odd questions
- JEANTET Joey, development student
- sfonteneau
- WAPT Expert
- Messages: 2318
- Registered: July 10, 2014 - 11:52 PM
- Contact :
Here's a sample code for free:
I obviously advise against this technique since it requires the key to be on the server...
Code: Select all
from waptpackage import PackageEntry,WaptLocalRepo
from waptcrypto import SSLCABundle,SSLPrivateKey,SSLCertificate
uuid_machine = 'BEDBD700-7277-11E3-AAA8-F44D30629A99'
removedepend=["toto"]
adddepend=["test","test2"]
certpub="/root/mykey.crt"
privatekey="/root/mykey.pem"
passwordkey='password'
ca_bundle = SSLCABundle()
signers_bundle = SSLCABundle()
signers_bundle.add_certificates_from_pem(pem_filename=certpub)
key = SSLPrivateKey(privatekey)
pe = PackageEntry(waptfile = "/var/www/wapt-host/%s.wapt" % uuid_machine)
depends = pe.depends.split(',')
for dep in adddepend:
if not dep in depends:
depends.append(dep)
for dep in removedepend:
if dep in depends:
depends.remove(dep)
pe.depends = ','.join(depends)
pe.inc_build()
pe.sign_package(private_key=key,certificate = signers_bundle.certificates(),private_key_password=passwordkey)
Code: Select all
sudo -u wapt PYTHONPATH=/opt/wapt PYTHONHOME=/opt/wapt /opt/wapt/bin/python /opt/wapt/test.py
I obviously advise against this technique since it requires the key to be on the server...
Hello, hello! It's me again. I've finished the web panel I intended to make (it's available on the forum) but I'm having a problem with the Python script.
despite the (private_key_password=passwordkey) option in sign_package() the script systematically asks for the password. which jeopardizes everything.
I took a look at waptpackage.py to find the method and I noticed password_callback=passwordkey which also does not work.
Did I miss something? (The Python code is the same as above.).
Have a good rest of the day!
despite the (private_key_password=passwordkey) option in sign_package() the script systematically asks for the password. which jeopardizes everything.
I took a look at waptpackage.py to find the method and I noticed password_callback=passwordkey which also does not work.
Did I miss something? (The Python code is the same as above.).
Have a good rest of the day!
- JEANTET Joey, development student
- sfonteneau
- WAPT Expert
- Messages: 2318
- Registered: July 10, 2014 - 11:52 PM
- Contact :
I admit I haven't tried using a password on the key.
I'll have to test it more thoroughly; there might be a problem.
I'll have to test it more thoroughly; there might be a problem.
