Hi People,
The comodo CWAF cPanel plugin is not working completely i mean in the main tab there is some stuff that is left blank and the wizard whas not working there was an error trying to restart apache not a disaster but i hate half work so i took the time to dig through the source code here is what i found.
issue cause : Comodo is using outdated perl code this cPanel perl module Cpanel::AdvConfig::apache was removed ages ago as you can see here Fixed case CPANEL-28581: Remove the apache conf distiller system so how can we fix it ? it is possible but you have to feel comfortable digging through perl code.
First you have to add code to addon_swaf.cgi so you get a more helpfull error message then “internal server error” or worse no error message just a blank page.Todo this ssh to your server and goto this directory /usr/local/cpanel/whostmgr/docroot/cgi open addon_cwaf.cgi find this code
use CGI qw/:standard/;
below that add
use diagnostics;
use CGI::Carp qw(warningsToBrowser fatalsToBrowsr);
that’s it remember to remove that two lines of code when you are done as it poses a security risk it reveals real server paths next step goto this directory to check if your cPanel/whm installation has the required stuff to make the CWAF plugin work again /usr/local/cpanel/Cpanel/ConfigFiles/Apache in this directory should be several files but check if Config.pm and Syntax.pm are there if they are all good …
nows goto this directory /var/cpanel/cwaf/modules/CPAN/lib/Comodo/CWAF and open Cpanel.pm find this code
#use Cpanel::AdvConfig::apache;
underneath add this
use Cpanel::ConfigFiles::Apache::Syntax;
use Cpanel::ConfigFiles::Apache::Config;
find
sub cp_get_aliases($) {
#eval { require Cpanel::AdvConfig::apache; } or return 0;
#more blocks of code
#my $apache_conf = Cpanel::AdvConfig::apache::get_config();
}
first place a pound sign # infront of the my $apache_conf variable and the eval statement so perl ignores that lines next replace it with
eval { require Cpanel::ConfigFiles::Apache::Config; } or return 0;
my $apache_conf = Cpanel::ConfigFiles::Apache::Config::get_config_with_all_vhosts();
next find this code
sub get_apache_data($) {
and replace the lines just like in the previous step
eval { require Cpanel::ConfigFiles::Apache::Config; } or return 0;
$apache_conf = Cpanel::ConfigFiles::Apache::Config::get_config_with_all_vhosts();
next find this function sub create_vhost_include_user($$$;$) { and carefull look if the $path variable actually points to the correct path?
finally find this code
sub check_apache_syntax() {
replace the eval line and the @var with this code put a # infront of the old lines so you can easly revert in case things go wrong.
eval { require Cpanel::ConfigFiles::Apache::Syntax; } or return 0;
@var = Cpanel::ConfigFiles::Apache::Syntax::check_syntax();
save the changes and it should work.A word of disclaimer i am not responsibe if you try and use this “workaround” and bad things happen to your server like a crash for example also all the rights on CWAF belong to comodo all i did whas make it work that’s all.