Skip to content

Commit

Permalink
Do not start a pfdetect queue worker if pfdetect is disabled
Browse files Browse the repository at this point in the history
Fixes #1593
  • Loading branch information
jrouzierinverse committed Jul 22, 2016
1 parent 6347fc8 commit 0ad27f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion html/pfappserver/root/config/pfdetect/index.tt
Expand Up @@ -17,7 +17,7 @@

<h2>[% l('Syslog Parsers') %]</h2>
<div class="alert alert-warning">
<strong>[% l('Warning!') %]</strong> [% l('Any change to the syslog parsers requires a restart of the pfdetect service.') %]
<strong>[% l('Warning!') %]</strong> [% l('Any change to the syslog parsers requires a restart of the pfdetect and pfqueue service.') %]
</div>

[% INCLUDE config/pfdetect/list.tt %]
Expand Down
21 changes: 21 additions & 0 deletions sbin/pfqueue
Expand Up @@ -34,6 +34,7 @@ BEGIN {

use pf::file_paths qw($var_dir);;
use pf::util;
use pf::constants qw($TRUE $FALSE);
use pf::config::pfqueue;
use pf::services::util;
use pf::db;
Expand All @@ -45,6 +46,8 @@ use pf::client;
pf::client::setClient("pf::api::can_fork");
use threads;
use pf::factory::task;
use pf::services::manager::pfdetect;



# initialization
Expand Down Expand Up @@ -116,6 +119,9 @@ Register all tasks
sub register_tasks {
foreach my $queue_config (@{$ConfigPfqueue{queues}} ) {
my $name = $queue_config->{name};
if (skip_queue($name)) {
next;
}
my $worker = $queue_config->{workers};
foreach (1 .. $worker) {
register_task("Queue:$name",\&process_queue, { queue_name => "Queue:$name"});
Expand Down Expand Up @@ -387,6 +393,21 @@ sub get_consumer {
return $consumer;
}

=head2 skip_queue
=cut

sub skip_queue {
my ($name) = @_;
if ($name eq 'pfdetect') {
my $manger = pf::services::manager::pfdetect->new;
return $manger->isManaged ? $FALSE : $TRUE;
}
return $FALSE;
}

=head1 AUTHOR
Inverse inc. <info@inverse.ca>
Expand Down

0 comments on commit 0ad27f8

Please sign in to comment.