Hello,
Thank you for update. Indeed, this tool requires more stuff to be added to CageFS, so using proxyexec method (suggested by Michael) is actually better here.
Announcement
Collapse
No announcement yet.
Enable cpapi2 in CageFS
Collapse
X
-
@Aleksei Faians I tried your suggestion, but it didnt work unfortunately. As a test, I ran cpapi2 Ftp listftp which returned: [code type="markup"] [2018-08-29 18:07:00 +0200] warn [cpapi2] Failed to execute /usr/local/cpanel/cpanel: No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 114. Cpanel::XML::cpanel_exec_fast(HASH(0x8975b0), HASH(0xfa38e0)) called at bin/apitool.pl line 206 bin::apitool::_run_cpanel_function("yaml", HASH(0x8975b0), HASH(0xf45b50)) called at bin/apitool.pl line 146 bin::apitool::_cpanel_api_handler(__CPANEL_HIDDEN_ _, HASH(0xf45b50), __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, ARRAY(0x897b20)) called at bin/apitool.pl line 108 bin::apitool::run("Ftp", "listftp") called at bin/apitool.pl line 37 warn [cpapi2] Failed to execute /usr/local/cpanel/cpanel: No such file or directory Failed to execute /usr/local/cpanel/cpanel: No such file or directory at bin/apitool.pl line 209. [/code] Thanks for replying though! @Michael Your solution worked great! Cheers!
Leave a comment:
-
Hello,
Yes, you can do as Michael suggested. Or you can just add /usr/local/cpanel/Cpanel.pm to paths in cpapi2.cfg, like this:
Code:# cat /etc/cagefs/conf.d/cpapi2.cfg [cpapi2] comment=cPanel API v2 paths=/usr/bin/cpapi2,/usr/local/cpanel/Cpanel.pm
Leave a comment:
-
Hello @Ibra,
You can grant access to the cpapi2 binary for caged users by adding the full path to the /etc/cagefs/custom.proxy.commands file per the instructions in the following document:
For example:
Code:# cat /etc/cagefs/custom.proxy.commands CPAPI2=/usr/local/cpanel/bin/cpapi2 # cagefsctl --force-update
Code:# cpapi2 Ftp listftp --- cpanelresult: apiversion: 2 data: - homedir: /home/username type: main user: username - homedir: /usr/local/apache/domlogs/username type: logaccess user: username_logs event: result: 1 func: listftp
Thanks!
Leave a comment:
-
Enable cpapi2 in CageFS
Hi!
Im trying to enable the cpapi2 command, but I cant get it to work fully.
I created a file, cpapi2.cfg, in /etc/cagefs/conf.d containing the following:
Code:[cpapi2] comment=cPanel API v2 paths=/usr/bin/cpapi2
Code:cagefsctl --force-update
Code:Utility to execute cPanel API calls cpapi2 [options] [module] [uri-key=uri-value] [uri-key=uri-value] .... Additional documentation is available at [URL]https://go.cpanel.net/api2docs[/URL] IMPORTANT: “uri-key†and “uri-value†represent URI-escaped strings.[*] OPTIONS: --output=[json|jsonpretty|xml|yaml] The serialization format to use for output. --input=[json|key-value] The serialization format to use for input. - key-value (default) - uri-key=uri-value pairs as arguments - json - Read JSON from stdin (currently only supported for WHM API 1) --user=USER The user to run the API call as. REQUIRED when running “bin/apitool.pl†as root. --help Prints this help text. Cant locate Cpanel.pm in @INC (you may need to install the Cpanel module) (@INC contains: /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/cpanel_lib /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/5.26.0/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/526/lib64/perl5/5.26.0 /opt/cpanel/perl5/526/site_lib/x86_64-linux-64int /opt/cpanel/perl5/526/site_lib) at /usr/local/cpanel/Cpanel/ApiInfo/UAPI.pm line 13. BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/ApiInfo/UAPI.pm line 13. Compilation failed in require at /usr/local/cpanel/Cpanel/Template/Plugin/API_Shell.pm line 12. BEGIN failed--compilation aborted at /usr/local/cpanel/Cpanel/Template/Plugin/API_Shell.pm line 12. Compilation failed in require at bin/apitool.pl line 462.
Id appreciate some help! : )Tags: None
Leave a comment: