HEX
Server: Apache/2
System: Linux nexus-01 4.18.0-553.120.1.el8_10.x86_64 #1 SMP Mon Apr 20 18:04:27 EDT 2026 x86_64
User: aglcoke (1118)
PHP: 8.2.31
Disabled: mail,exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/cwaf/scripts/fix_exclude_cache.pl
#!/bin/sh
eval 'if [ -x /usr/local/cpanel/3rdparty/bin/perl ]; then exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"$@"}; else exec /usr/bin/perl -x $0 ${1+"$@"}; fi;'
  if 0;

#!/usr/bin/perl
#SVN
use strict qw(refs subs);
use warnings;
no warnings 'redefine';

BEGIN { require '/etc/cwaf/use_lib.pl' if -f '/etc/cwaf/use_lib.pl'; }
use Comodo::CWAF::Main;# qw(%conf is_cpanel);
require Comodo::CWAF::Cpanel;


print("script to fix exclude cache for SSL hosts on cPanel\n");
unless (&is_cpanel()) {
    print("no installed cPanel found\n");
    exit;
}



print("fixing exclude cache for SSL hosts\n");
my($domains, $newfile, $oldfile, $name, $sslport, $oldcfile, $newcfile);
$domains = Comodo::CWAF::Cpanel::cp_get_domainlist();

foreach my $domain (@$domains) {
   print("   attempting to fix exclude cache for $domain \n");
   if(index($domain, '|') != -1) {
       ($name, $sslport) = split('\|', $domain);
       $oldfile = $conf{'cwaf_path'}.'/etc/yml/'.$name.'_exclude.yml';
       $newfile = $conf{'cwaf_path'}.'/etc/yml/'.$domain.'_exclude.yml';
       $oldcfile = "$conf{'cwaf_path'}/etc/httpd/domains/000_exclude_$name.conf";
       $newcfile = "$conf{'cwaf_path'}/etc/httpd/domains/000_exclude_$domain.conf";
       if( (-e $oldfile) && (-e $newfile) ) {
           print("      creating backup of old files\n");
           rename $newfile, $newfile.'.backup';
           rename $newcfile, $newcfile.'.backup';
           print("      renaming $oldfile to $newfile\n");
           rename $oldfile, $newfile;
           print("      renaming config $oldcfile to $newcfile\n");
           rename $oldcfile, $newcfile;
       }
   }
}
print("fixing exclude cache done\n");