Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED Update script for WHM plugin

Discussion in 'cPanel Developers' started by jimlongo, Oct 25, 2018.

Tags:
  1. jimlongo

    jimlongo Well-Known Member

    Joined:
    Mar 20, 2008
    Messages:
    236
    Likes Received:
    15
    Trophy Points:
    68
    I have a bash install script, and uninstall script.

    I want to know if there's a recommended way to write an update script.

    In addition can anyone share any strategies for auto-update of a plugin?

    Thanks for any info you might have.
     
  2. jimlongo

    jimlongo Well-Known Member

    Joined:
    Mar 20, 2008
    Messages:
    236
    Likes Received:
    15
    Trophy Points:
    68
    OK. I've got a working update script, it's really the install script using cp -u to update new components, and that works by updating files without overwriting configuration files.

    Next question: (in app update).

    I'd like to offer both auto-update (by installing a cron command to run my installer) and a manual update button.
    The update button calls a php file that tries to run my install script (called from a remote location), and this is proving problematic. When I click the button I get a 403 error.

    How do I deal with this?


    HTTP error 403
    cgi/ToplineVentures/update.php
    WHM is configured to disallow execution of unregistered applications when logged in as root or a reseller with the "all" ACL. To enable this functionality you must do one of the following: Register this addon with the /usr/local/cpanel/bin/register_appconfig script (Guide to WHM Plugins - The AppConfig System - Developer Documentation - cPanel Documentation), Enable the "Allow apps that have not registered with AppConfig to be run when logged in as root or a reseller with the "all" ACL in WHM" option in "Tweak Settings", or add permit_unregistered_apps_as_root=1 to the /var/cpanel/cpanel.config file, and run the /usr/local/cpanel/etc/init/startcpsrvd script.



    Top recap, the link calls a php file, which contains
    Code:
    <?php
    exec ("cd ~ && curl -s -o installcpanel https://myresources.com/resources/installcpanel-R.sh > /dev/null && bash installcpanel");[code]
     
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,325
    Likes Received:
    2,157
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @jimlongo,

    You'd need to first follow the instructions found in the output of the error message above. To apply this to only this plugin, you can follow the instructions at:

    Guide to WHM Plugins - AppConfig Registration - Developer Documentation - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. jimlongo

    jimlongo Well-Known Member

    Joined:
    Mar 20, 2008
    Messages:
    236
    Likes Received:
    15
    Trophy Points:
    68
    Thanks Michael, it sounds like the instructions would apply if I (the admin) manually set those items.

    But this is a plugin which should just work from the admin's perspective, not have to manually intervene.
    The plugin is registered with AppConfig.
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,325
    Likes Received:
    2,157
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @jimlongo,

    Can you confirm the plugin created its own .conf file in the /var/cpanel/apps/ directory when it was registered?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. jimlongo

    jimlongo Well-Known Member

    Joined:
    Mar 20, 2008
    Messages:
    236
    Likes Received:
    15
    Trophy Points:
    68
    Yes there is a conf file in /var/cpanel/apps/
     
  7. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,325
    Likes Received:
    2,157
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @jimlongo,

    If the application is registered, then the following two options under the Security tab in WHM >> Tweak Settings could be leading to that error message:

    This setting allows WHM applications and addons to execute even if an ACL list has not been defined
    This setting allows cPanel and Webmail applications and addons to execute even if a feature list has not been defined


    Do you have an ACL list and feature list defined for this application in it's configuration file? If not, we document how to configure this for the application at:

    Guide to WHM Plugins - AppConfig Configuration File - Developer Documentation - cPanel Documentation

    Let me know if this helps.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. jimlongo

    jimlongo Well-Known Member

    Joined:
    Mar 20, 2008
    Messages:
    236
    Likes Received:
    15
    Trophy Points:
    68
    Thank you.
     
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice