Skip to content

Commit

Permalink
clusterd: Accept commands only from trusted hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Jan 29, 2025
1 parent 6a7bf6f commit 66c314e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clusterd/clusterd
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ package main;
use warnings;
use strict;
use IO::File;
use IO::Pipe;
use Sys::Syslog;
use IO::Socket::INET;
use Data::Dumper;
Expand Down Expand Up @@ -953,6 +954,12 @@ sub clp_rx_LSOF {

sub clp_rx_CMD {
my ($socket,@cmd)=@_;

unless (is_trusted_ip($socket->peerhost())) {
warn "reveived command from untrusted host ". $socket->peerhost(). "\n";
return;
}

my $pid=fork;
unless (defined $pid) {
warn"$!\n";
Expand Down

0 comments on commit 66c314e

Please sign in to comment.