3000
  "   ˆl–Ðz¾”Jj"TÒ�zàœ¸”Å£ÁƒZÀ¿ ]    #!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/clean_dead_mailman_locks        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

package scripts::clean_dead_mailman_locks;

use strict;
use warnings;

use parent qw( Cpanel::HelpfulScript );

use Cpanel::ConfigFiles    ();
use Cpanel::FileUtils::Dir ();
use Cpanel::LoadFile       ();
use Cpanel::Autodie        ();

our $LOCK_DIR = "$Cpanel::ConfigFiles::MAILMAN_ROOT/locks";

use constant _OPTIONS => ();

__PACKAGE__->new(@ARGV)->run() unless caller();

=encoding utf-8

=head1 NAME

clean_dead_mailman_locks

=head1 USAGE

    clean_dead_mailman_locks [--help]

=head1 DESCRIPTION

This script removes and dead lock files in the mailman locks directory
Since cPanel does not run mailman across multiple hosts, we can safely
check for dead lock files even if mailman cannot.

=cut

sub run {
    my $lock_nodes = Cpanel::FileUtils::Dir::get_directory_nodes($LOCK_DIR);

    # Our mailman installs are not running cross servers
    # so we don't have the host boundary problem that
    # mailman things we do.  This allow us to clean up
    # dead pid files.
    foreach my $lock_node (@$lock_nodes) {
        my $lock_string = Cpanel::LoadFile::load_if_exists("$LOCK_DIR/$lock_node");
        my ($lock_pid) = $lock_string =~ m{\.([0-9]+)$};
        next if !$lock_pid || $lock_pid < 10;
        if ( !_pid_is_alive($lock_pid) ) {
            print "Removed stale lock file â€œ$lock_nodeâ€� for pid â€œ$lock_pidâ€�.\n";
            Cpanel::Autodie::unlink_if_exists("$LOCK_DIR/$lock_node");
        }
    }
    return 1;
}

sub _pid_is_alive {
    my ($pid) = @_;

    local $!;

    if ( kill( 0, $pid ) ) {
        return 1;
    }
    elsif ($!) {
        require Errno;

        #kill() often fails when done as an unprivileged user
        if ( $! == Errno::EPERM() ) {
            return !!( stat "/proc/$pid" )[0];
        }
    }

    return 0;
}
     ˆ¾Áƒeñ=À¿ X    #!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/ssl_crt_status                  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

package scripts::ssl_crt_status;

use strict;
use warnings;

use Cpanel::SSLPath                 ();
use Cpanel::SSLInfo                 ();
use Getopt::Param                   ();
use Cpanel::StringFunc              ();
use Cpanel::ArrayFunc               ();
use Term::ANSIColor                 ();
use Cpanel::Config::LoadUserDomains ();
use Cpanel::Hostname                ();

__PACKAGE__->run() unless caller();

sub run {
    my $param = Getopt::Param->new(
        {
            'quiet'        => 0,
            'help_coderef' => sub {
                print <<"END_HELP";
$0 - give a status report of the server's SSL certificates

    --help          this screen
    --verbose       show more than just errors
    --verbose=long  include verification result of valid crts

By default it will check every domain, you can specify one or more specific
domains to check by passing one or more --domain flags:

    --domain=your.domain.here --domain=other.domain.here

END_HELP
                exit;
            },
        }
    );

    my $debug   = $param->get_param('debug');
    my $verbose = $param->get_param('verbose');

    my @domains = Cpanel::ArrayFunc::uniq_from_arrayrefs( [ $param->exists_param('domain') ? $param->get_param('domain') : ( Cpanel::Hostname::gethostname(), grep( !/^\*/, sort keys %{ Cpanel::Config::LoadUserDomains::loaduserdomains( undef, 1 ) } ) ) ] );

    if ( grep /^--domain$/, @domains ) {
        print "Domain must be unambiguously specified in this format --dom