Needed to UAPI for work with NginX Manager

Operating System & Version
CLOUDLINUX 7.7
cPanel & WHM Version
96.0.15

NabiKAZ

Member
Jun 18, 2007
8
0
51
I use WHM v96.0.15 and new NginX manager option in WHM.

I tried this for clear cache of nginx, and used Token and no problem with this:

But now I need to clear cache in Cpanel for specific user, I working on a plugin for cpanel, but I need UAPI to do it.
But I can not find any UAPI for working with nginx manager and clear cache nginx.

Does there are any UAPI for this?, if not, Can we hope it will be released in future releases? Or does it contradict its structure and should not be waited for?
And finally what's your solution for this for now?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,810
895
313
cPanel Access Level
Root Administrator
Hey there! There isn't an API for this just yet. In a version that will be released soon, we plan to have the option directly in the cPanel interface that will allow a user to clear their cache, and the team is also working on API tools that will be released in the future as well!
 
  • Like
Reactions: NabiKAZ

NabiKAZ

Member
Jun 18, 2007
8
0
51
I tried to use WHM API with Token.

Sample code:
Code:
<?php
:
$rootuser = "root";
$token = file_get_contents('./token_file');
$query = "https://127.0.0.1:2087/json-api/nginxmanager_clear_cache?api.version=1&user=" . $user;
$curl = curl_init();
$header[0] = "Authorization: whm $rootuser:$token";
:
I saved the Token file in plugin directory (/usr/local/cpanel/base/frontend/paper_lantern/plugin_dir/token_file). with owner: root, perm: 644
But I see all users access read to it!

I set 600 permission for this file, But get this error in plugin page:
"Access denied. Child failed to make LIVEAPI connection to cPanel."

I checked it in the plugin file:
<?php echo shell_exec('whoami');
I get: the username that logined to cpanel.

For now, How can set correct permission for plugin files, to well works plugin, but users can not access it?
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,810
895
313
cPanel Access Level
Root Administrator
I heard back from our team and the best way to move forward at this time would be a privilege escalation as outlined here: