Custom Anti-Spam plugin planning
OK, so I am creating a plugin for internal use that will be used by cpanel users to create their email whitelists and also set a minimum score for spam. I used the cpanel plugin generator to create the basic installer for the icon, etc, but I am not sure about how to then actually handle the creation of the actual contents of the plugin. The installer doesnt really mention anything about that. So if I am using the live API, how am I supposed to automate the creation of x3/mypluginname/branded.live.php, etc?
Secondly, I am storing these settings encoded in a JSON structure and stored in a text file in the users home directory. I then have a script that runs as root and pretty much creates a master json object that includes all the users settings. Now, I am not sure what the best method is for allowing that json data to be available externally to my anti-spam gateways. Id really rather pull it from the gateway instead of push it to it. Any suggestions on the simplest method? Id rather not go through the pain of having to setup ssh accounts and scp the data. I can create a simple api that I could access through curl and simply use a hash for auth and ssl, but where should i make it accessible? Should I just use the servers hostname and use its normal /usr/local/apache/htdocs?
I am open to suggestions and I really appreciate your help brainstorming this. I am sure I am overcomplicating the process, so figured another view on this would help.
-
What you can do (and this is what I had originally done when I worked on the x4 installer) is this: Create an install script with Perl From the install script call register_plugin similar to this: sub register_x4_plugin { if ( -x "/usr/local/cpanel/bin/register_cpanelplugin" ) { print "\nRegistering plugin with cPanel...\n"; `/usr/local/cpanel/bin/register_cpanelplugin x4.cpanelplugin`; #Replace this with your .cpanelplugin file } else { print "\nFailed to register plugin with cPanel\n"; } }
If your plugin registers, copy files over ...and you're done! Now you should also have an uninstall script, since that's the best practice. For that.... Write a Perl script From there call unregister_plugin (make sure to specify your plugin)sub unregister_x4_plugin { if ( -x "/usr/local/cpanel/bin/unregister_cpanelplugin" ) { print "Unregister plugin with cPanel...\n"; `/usr/local/cpanel/bin/unregister_cpanelplugin /var/cpanel/registered_cpanelplugins/x4theme`; } else { print "Failed to unregister plugin with cPanel.\n"; } }
Remove files as needed ..and that's it! edit: Oh! To install just run from the command line. edit2: Docs link!0 -
Where should i be storing my plugin? /usr/local/cpanel/3rdparty/ just doesnt seem right. Also, what method should I use to automatically make my plugin available for all cpanel themes? Important note, I am only using php and a little bash. I don't know perl and won't be using it. 0
Please sign in to leave a comment.
Comments
2 comments