package Cpanel::Easy::Utils::ModSec;

# cpanel - Cpanel/Easy/Utils/ModSec.pm            Copyright(c) 2013 cPanel, Inc.
#                                                           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;

# If these modules are enabled, modsecurity should use concurrent,
# instead of serial logging.
our @ConcurrentLoggers = qw(
  Cpanel::Easy::ModRuid2
  Cpanel::Easy::Apache::MPMItk
);

# Looks through the list of enabled modules and determines if concurrent logging
# is needed.  Returns boolean value for "true" or "false"
sub modsec_concurrent_logging {
    my $self       = shift;
    my $concurrent = 0;

    for my $ns (@ConcurrentLoggers) {

        # NOTE: I'm not checking reverse boolean, because the two above don't need it
        if ( $self->get_ns_value_from_profile( $ns, $self->{'working_profile'} ) ) {
            $concurrent = 1;
            last;
        }
    }

    return $concurrent;
}

1;

