Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is potentially dangerous module - it can execute any script from scripts directory you pass to it, so its important to run your HostBill php/php-fpm processes under a isolated system user (not root). Its also advised to use/enable HostBill queue module

System requirements & security precautions

...

  • Scripts should be placed in /home/hostbill/scripts 
  • Script should be made executable for hostbill user (chmod u+x)
  • If possible, use hashbang shebang in your custom scripts 
  • On success your script should return 0 exit code.
  • On failure return any other exit code
  • Any script output is logged in related account log on error/success 
  • Before executing any script, module changes working directory (cwd) to main HostBill scripts directory

...

  • As with any HostBill module, activate Script_Provisioning module in Settings→Modules section of adminarea. 
  • You will be redirected to Settings→Apps section to create connection, this module requires just adding name for its connection details
  • When configuring product in Settings→Products  & Services, select newly activated module & app:
    Image Removed. 
  • Proceed to "Settings" Tab, to configure your scripts:
    Image Added
    • Check which events should execute a script (ie. terminate/create etc.)
    • From dropdown list select which script to execute (you should create scripts first)
    • Provide arguments that script should be executed with, here you can use variables (up-to-date list is available in product configuration):
       Image Removedavailable in Available Variables tab
       
    • Note about arguments: 
      All arguments will be escaped before execution for additional security. 
       
  • Under Custom client-triggered actions you can define which script to execute when client will trigger custom action from Client Functions::Client UI
    Same rules/limitations/variables as in Settings tab apply
    Image Added
  • Under Available Variables you can check what variables can be used in your script arguments  (up-to-date list is available in product configuration)
    Image Added

Client functions

...

Next to standard client functions that HostBill offers, module comes with "Client UI" function (name can be changed) of which you can enable multiple instances.
Image Added


Once function is enabled, in its "Settings" tab you can define:

  • names of Allowed actions customer is allowed to trigger
  • HTML template rendered in client portal. In this code you can use variables.
    Once customer clicks on link with {$actlink}youraction URL, and youraction is within Allowed actions module will call script defined in Custom client-triggered actions tab (see above).
    Action customer clicks will be available as {$actname} variable in your custom script arguments

Image Added

Template defined above, results in following in client portal:

Image Added

Non-Enterise install

...

By default scripts should be located in /home/hostbill/scripts directory, to use custom dir on other installations, edit includes/config.php file and add lines:

...