shell bypass 403

UnknownSec Shell

: /usr/sbin/ [ dr-xr-xr-x ]

name : dovecot_cpshutdown
#!/usr/local/cpanel/3rdparty/bin/perl

use strict;
use warnings;

use Time::HiRes ();

use constant DOVECOT_PROCESS_NAMES => qw(
  dovecot
  dovecot-auth
  dovecot/pop3-login
  dovecot/imap-login
  dovecot/anvil
  dovecot/log
  dovecot/config
  dovecot/auth
  dovecot-wrap
);

my $MAX_WAIT       = 30;    #seconds
my $SLEEP_INTERVAL = 0.1;

my $pidfile = '/var/run/dovecot/master.pid';

#----------------------------------------------------------------------

if ( "@ARGV" =~ m<--help> ) {
    print <<END;
This script shuts down Dovecot safely: gracefully at first,
then forcefully if Dovecot’s processes don’t go away.
END
    exit;
}

my $master_pid;
if ( open my $pfh, '<', $pidfile ) {
    print "Opened “$pidfile” …\n";

    $master_pid = readline($pfh);
    if ( !defined $master_pid ) {
        die "read($pidfile): $!" if $!;
    }

    chomp $master_pid;

    if ( $master_pid =~ m<\A[0-9]+\z> ) {
        print "Master Dovecot process = $master_pid\n";
    }
    else {
        warn "Invalid contents in “$pidfile”: [$master_pid]\n";
        undef $master_pid;
    }
}
elsif ( $!{'ENOENT'} ) {
    print "“$pidfile” doesn’t exist!\n";
}
else {
    die "open($pidfile): $!";
}

my @CMD = qw( /usr/sbin/dovecot stop );

print "Executing “@CMD” …\n";

my $pid = fork();
die "Failed to fork child process for “@CMD”" if !defined $pid;

if ( $pid ) {

    print "Waiting $MAX_WAIT seconds for process $pid to end …\n";
    my $start = time();

    my $killed;
    while ( !waitpid( $pid, 1 ) ) {

        if ( time > ( $start + $MAX_WAIT ) ) {
            print "Process $pid has taken over $MAX_WAIT seconds to shut down.\n";
            kill 'KILL', $pid;
            waitpid($pid, 0);
            $killed = 1;
            last;
        }

        Time::HiRes::sleep($SLEEP_INTERVAL);
    }

    # If we killed the dovecot stop command we want to fallthrough to the rest of the shutdown
    # but not if it terminated with a legitimate error.
    exit 1 if $? && !$killed;
}
else {
    exec(@CMD) or die "Failed to run “@CMD”: $!";
}

print "Done! Waiting $MAX_WAIT seconds for process $master_pid to end …\n";

if ( length $master_pid ) {
    my $start = time();

    my $end;

    while ( !$end ) {
        if ( kill 'ZERO', $master_pid ) {
            if ( time > ( $start + $MAX_WAIT ) ) {
                print "Process $master_pid has taken over $MAX_WAIT seconds to shut down.\n";
                _safekill_any_remaining_dovecot_processes();
                $end = 1;
            }

            Time::HiRes::sleep($SLEEP_INTERVAL);
        }
        else {
            print "Dovecot is now shut down.\n";

            # We may have some stragglers so we
            # do a safekill just in case in order to handle:
            #
            # Case 187449: /etc/init.d/dovecot does not stop
            # properly dovecot
            #
            # When stopping dovecot we are killing some processes
            # but a few of them might survive when dovecot-wrap is
            # stalled.
            _safekill_any_remaining_dovecot_processes();
            $end = 1;
        }
    }
}

sub _safekill_any_remaining_dovecot_processes {
    print "Any remaining Dovecot processes will now be terminated.\n";
    system( '/usr/local/cpanel/etc/init/safekill', DOVECOT_PROCESS_NAMES );
}

1;

© 2025 UnknownSec
Web Design for Beginners | Anyleson - Learning Platform
INR (₹)
India Rupee
$
United States Dollar
Web Design for Beginners

Web Design for Beginners

in Design
Created by Linda Anderson
+2
5 Users are following this upcoming course
Course Published
This course was published already and you can check the main course
Course
Web Design for Beginners
in Design
4.25
1:45 Hours
8 Jul 2021
₹11.80

What you will learn?

Create any website layout you can imagine

Support any device size with Responsive (mobile-friendly) Design

Add tasteful animations and effects with CSS3

Course description

You can launch a new career in web development today by learning HTML & CSS. You don't need a computer science degree or expensive software. All you need is a computer, a bit of time, a lot of determination, and a teacher you trust. I've taught HTML and CSS to countless coworkers and held training sessions for fortune 100 companies. I am that teacher you can trust. 


Don't limit yourself by creating websites with some cheesy “site-builder" tool. This course teaches you how to take 100% control over your webpages by using the same concepts that every professional website is created with.


This course does not assume any prior experience. We start at square one and learn together bit by bit. By the end of the course you will have created (by hand) a website that looks great on phones, tablets, laptops, and desktops alike.


In the summer of 2020 the course has received a new section where we push our website live up onto the web using the free GitHub Pages service; this means you'll be able to share a link to what you've created with your friends, family, colleagues and the world!

Requirements

No prerequisite knowledge required

No special software required

Comments (0)

Report course

Please describe about the report short and clearly.

Share

Share course with your friends