GIF89a=( �' 7IAXKgNgYvYx\%wh&h}t�h%�s%x�}9�R��&�0%� (�.��5�SD��&�a)�x5��;ͣ*ȡ&ղ)ׯ7׵<ѻ4�3�H֧KͯT��Y�aq��q��F� !� ' !� NETSCAPE2.0 , =( ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g���E�������R���E����B�� ��ȸ��D���"�Ů� �H��L��D٫D�B�����D���T���H �G��A R�ڐ |�� ٭&��E8�S�kG�A�px�a��� R2XB��E8I���6X�:vT)�~��q�賥��"F~%x� � 4#Z�0O|-4Bs�X:= Q� Sal��yXJ`GȦ|s h��K3l7�B|�$'7Jީܪ0!��D�n=�P� ����0`�R�lj����v>���5 �.69�ϸd�����nlv�9��f{���Pbx �l5}�p� ��� �3a���I�O����!ܾ���i��9��#��)p�a ޽ �{�)vm��%D~ 6f��s}Œ�D�W E�`!� �&L8x� �ܝ{)x`X/>�}m��R�*|`D�=�_ ^�5 !_&'a�O�7�c��`DCx`�¥�9�Y�F���`?��"� �n@`�} lď��@4>�d S �v�xN��"@~d��=�g�s~G��� ���ud &p8Q�)ƫlXD����A~H�ySun�j���k*D�LH�] ��C"J��Xb~ʪwSt}6K,��q�S:9ت:���l�@�`�� �.۬�t9�S�[:��=`9N����{¿�A !R�:���6��x�0�_ �;������^���#����!����U���;0L1�����p% A��U̬ݵ��%�S��!���~`�G���� ���=4�np�3���������u�u�ٮ|%2�I��r�#0��J``8�@S@5� ���^`8E�]�.�S���7 � �0�j S�D� z���i�S�����!���l��w9*�D�I�nEX��� &A�Go�Qf��F��;���}�J����F5��Q|���X��T��y���]� o ��C=��:���PB@ D׽S�(>�C�x}`��xJЬ�۠��p+eE0`�}`A �/NE�� �9@��� H�7�!%B0`�l*��!8 2�%� �:�1�0E��ux%nP1�!�C)�P81l�ɸF#Ƭ{����B0>�� �b�`��O3��()yRpb��E.ZD8�H@% �Rx+%���c� ���f��b�d�`F�"8�XH"��-�|1�6iI, 2�$+](A*j� QT�o0.�U�`�R�}`�SN����yae�����b��o~ S)�y�@��3 �tT�0�&�+~L�f"�-|�~��>!�v��~�\Q1)}@�}h#aP72�"�$ !� " , =( &7IAXG]KgNgYvYxR"k\%w]'}h}t�h%�g+�s%r.m3ax3�x�}9��&��+�!7�0%� (�.�SD��&��;�"&ײ)׻4��6�K� �@pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E �� �������E �´��C���ǶR��D��"Ʒ�ʱH��M��GڬD�B����D��T����G���C�C� l&�~:'�tU�6ɹ#��)�'�.6�&��Ȼ K(8p0N�?!�2"��NIJX>R��OM '��2�*x�>#n� �@<[:�I�f ��T���Cdb��[�}E�5MBo��@�`@��tW-3 �x�B���jI�&E�9[T&$��ﯧ&"s��ȳ����dc�UUρ#���ldj?����`\}���u|3'�R]�6 �S#�!�FKL�*N E���`$�:e�YD�q�.�촁�s \-�jA 9�����-��M[�x(�s��x�|���p��}k�T�DpE@W� ��]k`1� ���Yb ��0l��*n0��"~zBd�~u�7�0Bl��0-�x~|U�U0 �h�*HS�|��e"#"?vp�i`e6^�+q��`m8 #V�� ��VS|`��"m"сSn|@:U���~`pb�G�ED����2F�I�? >�x� R� ��%~jx��<�a�9ij�2�D��&: Z`�]w���:�6��B�7eFJ|�ҧ�,���FǮcS�ʶ+B�,�ܺN���>PAD�HD��~���n��}�#�� Q��S���2�X�{�k�lQ�2�����w�|2� h9��G�,m���3��6-��E�L��I�³*K���q�`DwV�QXS��peS��� qܧTS����R�u �<�a�*At�lmE� � ��N[P1�ۦ��$��@`��Dpy�yXvCAy�B`}D� 0QwG#� �a[^�� $���Ǧ{L�"[��K�g�;�S~��GX.�goT.��ư��x���?1z��x~:�g�|�L� ��S`��0S]P�^p F<""�?!,�!N4&P� ����:T�@h�9%t��:�-~�I<`�9p I&.)^ 40D#p@�j4�ج:�01��rܼF2oW�#Z ;$Q q  �K��Nl#29 !F@�Bh�ᏬL!XF�LHKh�.�hE&J�G��<"WN!�����Y@� >R~19J"�2,/ &.GXB%�R�9B6�W]���W�I�$��9�RE8Y� ��"�A5�Q.axB�&ة�J�! �t)K%tS-�JF b�NMxL��)�R��"���6O!TH�H� 0 !� ) , =( &AXKgNgYvYxR"k\%wh&h}h%�g+�s%r.x3�x�}9��&��+�R,�!7�0%� (�.��5��&�a)��;�"&ף*Ȳ)ׯ7׻4�3��6�H֧KͻH�T��Y��q��h� ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E$����� � ����$E$��"��D� � ������R��C��� E ��H�M��G�D� �B��ϾD��a��`1r��Ӑ�� �o~�zU!L�C'�yW�UGt����ll�0���uG�)A�s[��x� �xO%��X2�  P�n:R/��aHae+�Dm?# ǣ6�8�J�x�Di�M���j���5oQ7�- <! *�l��R2r/a!l)d� A"�E���� &� ;��c �%����b��pe~C"B���H�eF2��`8qb�t_`ur`e� w�u3��Pv�h""�`�Íx�LĹ��3� �~ֺ�:���MDfJ� �۵�W�%�S�X �؁)�@��:E��w�u�Sxb8y\m�zS��Zb�E�L��w!y(>�"w�=�|��s�d �C�W)H�cC$�L �7r.�\{)@�`@ �X�$PD `aaG:���O�72E�amn]�"Rc�x�R� &dR8`g��i�xLR!�P &d����T���i�|�_ � Qi�#�`g:��:noM� :V �)p����W&a=�e�k� j���1߲s�x�W�jal|0��B0�, \j۴:6���C ��W��|��9���zĸV {�;��n��V�m�I��.��PN� ����C��+��By�ѾHŸ:��� 7�Y�FTk�SaoaY$D�S���29R�kt� ��f� ��:��Sp�3�I��DZ� �9���g��u�*3)O��[_hv ,���Et x�BH� �[��64M@�S�M7d�l�ܶ5-��U܍��z�R3Ԭ3~ ��P��5�g: ���kN�&0�j4���#{��3S�2�K�'ợl���2K{� {۶?~m𸧠�I�nE�='����^���_�=��~�#O���'���o..�Y�n��CSO��a��K��o,���b�����{�C�� "�{�K ��w��Ozdը�:$ ���v�] A#� ���a�z)Rx׿ƥ�d``�w-�y�f�K!����|��P��=�`�(f��'Pa ��BJa%��f�%`�}F����6>��`G"�}�=�!o`�^FP�ةQ�C���`(�}\�ݮ ��$<��n@dĠE#��U�I�!� #l��9`k���'Rr��Z�NB�MF �[�+9���-�wj���8�r� ,V�h"�|�S=�G_��"E� 0i*%̲��da0mVk�):;&6p>�jK ��# �D�:�c?:R Ӭf��I-�"�<�="��7�3S��c2RW ,�8(T"P0F¡Jh�" ; 403WebShell
403Webshell
Server IP : 173.249.157.85  /  Your IP : 18.222.116.64
Web Server : Apache
System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : econtech ( 1005)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /scripts/update_spamassassin_config
#!/usr/local/cpanel/3rdparty/bin/perl

package scripts::update_spamassassin_config;

# cpanel - scripts/update_spamassassin_config        Copyright 2022 cPanel L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;
use Cpanel::Daemonizer::Tiny    ();
use Cpanel::StringFunc::Replace ();
use Cpanel::StringFunc::File    ();
use Cpanel::FileUtils::Write    ();
use Cpanel::SafeRun::Errors     ();
use Cpanel::LoadFile            ();
use Cpanel::Logger              ();
use Cpanel::Rand                ();
use Cpanel::SafeDir::RM         ();
use Cpanel::Binaries            ();
use Cpanel::Unix::PID::Tiny     ();
use Getopt::Long;
eval { require Mail::SpamAssassin; };
use Cpanel::SpamAssassin::Rules  ();
use Cpanel::Exim::RemoteMX::Read ();

our $STATE_ENABLED  = 1;
our $STATE_DISABLED = 0;

our $SPAMASSASSIN_CONFIG_DIR = "/etc/mail/spamassassin";

my $made_changes_to_config = 0;
my $pidfile                = '/var/run/update_spamassassin_config.pid';
my $help                   = 0;
my $verbose                = 0;
my $background             = 0;

if ( !caller() ) {
    GetOptions( 'background' => \$background, 'help' => \$help, 'verbose' => \$verbose );
    usage() if $help;
    if ( $ENV{CPANEL_BASE_INSTALL} ) {
        print STDERR "“$0” refuses to run during a cPanel installation.\n";
        exit(0);
    }

    if ($background) {

        my $pid = Cpanel::Daemonizer::Tiny::run_as_daemon(
            sub {
                open( STDERR, '>>', '/usr/local/cpanel/logs/error_log' ) || die "Could not redirect STDERR to /usr/local/cpanel/logs/error_log: $!";

                __PACKAGE__->script() && exit(0);
                exit(1);
            }
        );
    }
    else {
        __PACKAGE__->script();
    }
}

sub compile_rules {
    print "Compiling SpamAssassin rules\n" if $verbose;
    my $saxsok = compile_sa_rules_if_needed();

    if ($saxsok) {
        Cpanel::FileUtils::Write::overwrite( '/var/cpanel/sa-compile-time', $Mail::SpamAssassin::VERSION, 0644 );
        if ( set_plugin_state( 'v320.pre', 'Rule2XSBody', $STATE_ENABLED ) ) {
            print "Mail::SpamAssassin::Plugin::Rule2XSBody test passed: enabled\n" if $verbose;
        }
    }
    else {
        if ( set_plugin_state( 'v320.pre', 'Rule2XSBody', $STATE_DISABLED ) ) {
            print "Mail::SpamAssassin::Plugin::Rule2XSBody is not available: disabled\n" if $verbose;
        }
    }
    return;
}

sub enable_pyzor {
    print "Enabling the Pyzor plugin\n" if $verbose;
    if ( eval { require Mail::Pyzor; } ) {
        if ( set_plugin_state( 'v310.pre', 'Pyzor', $STATE_ENABLED ) ) {
            print "pyzor is installed, enabled in SpamAssassin!\n" if $verbose;
        }
    }
    else {
        if ( set_plugin_state( 'v310.pre', 'Pyzor', $STATE_DISABLED ) ) {
            print "pyzor is not installed, disabling it in SpamAssassin to save memory\n" if $verbose;
        }

    }
    return;
}

sub enable_razor {
    print "Enabling the Razor2 plugin\n" if $verbose;
    if ( eval { require Razor2::Client::Agent; } ) {
        if ( set_plugin_state( 'v310.pre', 'Razor2', $STATE_ENABLED ) ) {
            print "razor2 is installed, enabled in SpamAssassin!\n" if $verbose;
        }
    }
    else {
        if ( set_plugin_state( 'v310.pre', 'Razor2', $STATE_DISABLED ) ) {
            print "razor2 is not installed, disabling it in SpamAssassin to save memory\n" if $verbose;
        }
    }
    return;
}

sub script {
    my ($class) = @_;
    my $upid = Cpanel::Unix::PID::Tiny->new();

    if ( !$upid->pid_file($pidfile) ) {
        my $pid = $upid->get_pid_from_pidfile($pidfile);
        print "$0: already running with pid: $pid\n";
        return 0;
    }

    my $logger    = Cpanel::Logger->new();
    my $spamd_bin = Cpanel::Binaries::path('spamd');
    if ( !-x $spamd_bin ) {
        print "Spamd binary not found.  Is Apache SpamAssassin™ installed?\nTry: /usr/local/cpanel/scripts/upcp --force" if $verbose;
        return 1;
    }

    my $has_rules = Cpanel::SpamAssassin::Rules::has_rules_installed();

    if ( !$has_rules ) {
        print "The Apache SpamAssassin™ rule update has not yet run.\n" if $verbose;
        require Cpanel::SafeRun::Object;

        warn if !eval {
            my $run = Cpanel::SafeRun::Object->new_or_die(
                program => '/usr/local/cpanel/scripts/sa-update_wrapper',
                stdout  => \*STDOUT,
                stderr  => \*STDERR,
            );
        };

        $made_changes_to_config = 1;
    }

    # This module can give us up to 20% more cpu time free on a loaded mail server
    print "Enabling the Shortcircuit plugin\n" if $verbose;
    set_plugin_state( 'v320.pre', 'Shortcircuit', $STATE_ENABLED );

    enable_pyzor();
    enable_razor();

    my $envtype = Cpanel::LoadFile::loadfile('/var/cpanel/envtype');
    if ( $envtype && $envtype ne 'standard' ) {
        print "Enabling the SpamCop plugin\n" if $verbose;
        set_plugin_state( 'v310.pre', 'SpamCop', $STATE_ENABLED );
    }

    my $local_cf = Cpanel::LoadFile::loadfile("$SPAMASSASSIN_CONFIG_DIR/local.cf");

    # Configure missing trusted networks
    if ( $local_cf !~ m{\n[ \t]*trusted_networks}s || $local_cf =~ m{\n[ \t]*trusted_networks[^\n]+# Autoconfigured by cPanel}s ) {
        print "Autoconfiguring trusted networks\n" if $verbose;
        require Cpanel::IP::Neighbors;
        require Cpanel::SocketIP;
        require Cpanel::Net::Whois::IP::Cached;
        Cpanel::IP::Neighbors::update_neighbor_netblocks_or_log();
        my %ranges        = map { $_ => 1 } Cpanel::IP::Neighbors::get_netblocks();
        my @trueaddresses = Cpanel::SocketIP::_resolveIpAddress('mail.cpanel.net');
        foreach my $public_ip (@trueaddresses) {
            my $whois_response = Cpanel::Net::Whois::IP::Cached->new()->lookup_address($public_ip) or next;

            # The cidr attribute is an array
            my $cidr_ar = $whois_response->get('cidr');

            next if !$cidr_ar || 'ARRAY' ne ref $cidr_ar || !scalar @{$cidr_ar};

            foreach ( @{$cidr_ar} ) { $ranges{$_} = 1; }
        }

        my @remote_mx_ips = Cpanel::Exim::RemoteMX::Read::all_ips();
        @ranges{@remote_mx_ips} = (1) x @remote_mx_ips;

        my $range_list = join( ' ', sort keys %ranges );
        if ( $local_cf !~ m{\n[ \t]*#?[ \t]*trusted_networks[ \t]*\Q$range_list\E}s ) {
            print "Autoconfigured trusted_networks setting.\n" if $verbose;
            Cpanel::StringFunc::Replace::regsrep( "$SPAMASSASSIN_CONFIG_DIR/local.cf", '^\s*#?\s*trusted_networks', 'trusted_networks ' . $range_list . " # Autoconfigured by cPanel - Remove this end of line comment to avoid future updates" );
            $made_changes_to_config = 1;
        }
    }

    if ( $local_cf !~ m{\n[ \t]*#?[ \t]*dns_available}s ) {
        print "Setting dns_available = yes\n" if $verbose;

        # spamassassin takes about 5 times longer if dns_available is not set
        Cpanel::StringFunc::File::addlinefile( "$SPAMASSASSIN_CONFIG_DIR/local.cf", "\n" . 'dns_available yes # Autoconfigured by cPanel - comment out this line or set to no to avoid future updates' );
        $made_changes_to_config = 1;
    }

    compile_rules();

    if ($made_changes_to_config) {
        require Cpanel::ServerTasks;
        print "Queued spamd restart in the background.\n" if $verbose;
        Cpanel::ServerTasks::schedule_task( ['CpServicesTasks'], 1, "restartsrv spamd" );
    }

    return 0;
}

sub system_verbose_aware {
    my (@args) = @_;
    if ($verbose) {
        return system(@args);
    }
    else {
        return Cpanel::SafeRun::Errors::saferunnoerror(@args);
    }
}

sub usage {
    return print q{
update_spamassassin_config [options]

    Options:
      --help       Brief help message
      --verbose    Display verbose output from each test performed

};
}

sub compile_sa_rules_if_needed {
    my ($perl_version) = ( $] =~ /^(\d\.\d\d\d)/ );

    my $dir_sa_compiled = (
        -e "/var/lib/spamassassin/compiled/$perl_version/$Mail::SpamAssassin::VERSION"
        ? "/var/lib/spamassassin/compiled/$perl_version/$Mail::SpamAssassin::VERSION"
        : "/var/lib/spamassassin/compiled/$Mail::SpamAssassin::VERSION"
    );

    my $saxtest = Cpanel::SafeRun::Errors::saferunnoerror( '/usr/local/cpanel/scripts/test_sa_compiled', $dir_sa_compiled );
    my $saxsok  = ( $saxtest =~ /ok/ ? 1 : 0 );

    my $lastver       = Cpanel::LoadFile::loadfile('/var/cpanel/sa-compile-time');
    my $compile_mtime = ( stat('/var/cpanel/sa-compile-time') )[9] || 0;
    my $sa_rule_mtime = Cpanel::SpamAssassin::Rules::get_mtime_of_newest_rule();

    if ( !$saxsok || $sa_rule_mtime >= $compile_mtime || $lastver != $Mail::SpamAssassin::VERSION ) {
        my $sa_compile_bin = Cpanel::Binaries::path('sa-compile');
        if ( -x $sa_compile_bin ) {
            my $tmpdir = Cpanel::Rand::gettmpdir();    # audit case 46806 ok
            if ($tmpdir) {
                local $ENV{'TMP'}    = $tmpdir;
                local $ENV{'TMPDIR'} = $tmpdir;
                system_verbose_aware($sa_compile_bin);
                $made_changes_to_config = 1;
                Cpanel::SafeDir::RM::safermdir($tmpdir);
            }
            else {
                system_verbose_aware($sa_compile_bin);
            }
        }

        system_verbose_aware( '/usr/local/cpanel/scripts/patch_mail_spamassassin_compiledregexps_body_0', $dir_sa_compiled );

        $saxtest = Cpanel::SafeRun::Errors::saferunnoerror( '/usr/local/cpanel/scripts/test_sa_compiled', $dir_sa_compiled );
    }
    return ( $saxtest =~ /ok/ ? 1 : 0 );
}

sub set_plugin_state {
    my ( $conf_file, $plugin, $state ) = @_;
    my $conf_path      = "$SPAMASSASSIN_CONFIG_DIR/$conf_file";
    my $current_config = Cpanel::LoadFile::loadfile($conf_path);
    my $current_state  = ( $current_config =~ m{\n[ \t]*loadplugin[ \t]+Mail::SpamAssassin::Plugin::\Q$plugin\E}s ) ? $STATE_ENABLED : $STATE_DISABLED;
    if ( $current_state != $state ) {
        Cpanel::StringFunc::Replace::regsrep( $conf_path, '^\s*#?\s*loadplugin[ \t]*Mail::SpamAssassin::Plugin::' . $plugin, ( $state == $STATE_DISABLED ? '#' : '' ) . 'loadplugin Mail::SpamAssassin::Plugin::' . $plugin );
        print "Updated plugin “$plugin” state in “$conf_file” to " . ( $state == $STATE_ENABLED ? 'enabled' : 'disabled' ) . "\n" if $verbose;
        $made_changes_to_config = 1;
        return 1;
    }
    return 0;
}

1;

__END__

=encoding utf-8

=head1 NAME

update_spamassassin_config - Optimize Apache SpamAssassin™ if possible and update compiled rulesets

=head1 SYNOPSIS

update_spamassassin_config [options]

    Options:
      --help       Brief help message
      --verbose    Display verbose output from each test preformed

=cut

Youez - 2016 - github.com/yon3zu
LinuXploit