I have a suggested patch as I have a cluster of 3000 servers and putting 3000 IP addresses in the csf.conf file seems to be a really ugly solution.
My suggestion is to include the possibility of an include file as follows:
1.) If you have only a few servers in your cluster, configure the CLUSTER_SENDTO and CLUSTER_RECVFROM as normal.
2.) If you have many, start the config of CLUSTER_SENDTO and/or CLUSTER_RECVFROM with the word "Include" followed by a space and then the path to the include file with the IP's (one per line) e.g
CLUSTER_SENDTO = "Include /etc/csf/csf.cluster_tx"
CLUSTER_RECVFROM = "Include /etc/csf/csf.cluster_rx"
I have patched the csf executable (/usr/sbin/csf and /usr/sbin/lfd ) with the following:
####################################
#-------- csf ---------
#
*** csf.old 2018-11-06 11:43:27.000000000 +0200
--- csf 2018-11-06 12:39:51.000000000 +0200
***************
*** 182,187 ****
--- 182,189 ----
###############################################################################
# start load_config
sub load_config {
+ my @ClusterIncTo;
+ my @ClusterIncFrom;
my $config = ConfigServer::Config->loadconfig();
%config = $config->config;
my %configsetting = $config->configsetting;
***************
*** 198,203 ****
--- 200,214 ----
import IO::Socket::INET;
}
+ if ($config{CLUSTER_SENDTO} =~ /^Include\s*(.*)$/) {
+ @ClusterIncTo = slurp($1);
+ $config{CLUSTER_SENDTO} = join(',', @ClusterIncTo);
+ }
+ if ($config{CLUSTER_RECVFROM} =~ /^Include\s*(.*)$/) {
+ @ClusterIncFrom = slurp($1);
+ $config{CLUSTER_RECVFROM} = join(',', @ClusterIncFrom);
+ }
+
if ($config{CF_ENABLE}) {
require ConfigServer::CloudFlare;
import ConfigServer::CloudFlare;
#--------- lfd ---------
################################################
*** lfd.old 2018-11-06 16:19:17.000000000 +0200
--- lfd 2018-11-06 16:20:39.000000000 +0200
***************
*** 79,84 ****
--- 79,87 ----
$slurpreg = ConfigServer::Slurp->slurpreg;
$cleanreg = ConfigServer::Slurp->cleanreg;
+ my @ClusterIncTo;
+ my @ClusterIncFrom;
+ *** lfd.old 2018-11-06 16:19:17.000000000 +0200
--- lfd 2018-11-06 16:20:39.000000000 +0200
***************
*** 79,84 ****
--- 79,87 ----
$slurpreg = ConfigServer::Slurp->slurpreg;
$cleanreg = ConfigServer::Slurp->cleanreg;
+ my @ClusterIncTo;
+ my @ClusterIncFrom;
+
unless ($config{LF_DAEMON}) {&cleanup(__LINE__,"*Error* LF_DAEMON not enabled in /etc/csf/csf.conf")}
if ($config{TESTING}) {&cleanup(__LINE__,"*Error* lfd will not run with TESTING enabled in /etc/csf/csf.conf")}
***************
*** 119,124 ****
--- 122,137 ----
require IO::Socket::INET;
import IO::Socket::INET;
}
+
+ if ($config{CLUSTER_SENDTO} =~ /^Include\s*(.*)$/) {
+ @ClusterIncTo = slurp($1);
+ $config{CLUSTER_SENDTO} = join(',', @ClusterIncTo);
+ }
+
+ if ($config{CLUSTER_RECVFROM} =~ /^Include\s*(.*)$/) {
+ @ClusterIncFrom = slurp($1);
+ $config{CLUSTER_RECVFROM} = join(',', @ClusterIncFrom); }
+
if ($config{MESSENGER}) {
require ConfigServer::Messenger;
import ConfigServer::Messenger;
unless ($config{LF_DAEMON}) {&cleanup(__LINE__,"*Error* LF_DAEMON not enabled in /etc/csf/csf.conf")}
if ($config{TESTING}) {&cleanup(__LINE__,"*Error* lfd will not run with TESTING enabled in /etc/csf/csf.conf")}
***************
*** 119,124 ****
--- 122,137 ----
require IO::Socket::INET;
import IO::Socket::INET;
}
+
+ if ($config{CLUSTER_SENDTO} =~ /^Include\s*(.*)$/) {
+ @ClusterIncTo = slurp($1);
+ $config{CLUSTER_SENDTO} = join(',', @ClusterIncTo);
+ }
+
+ if ($config{CLUSTER_RECVFROM} =~ /^Include\s*(.*)$/) {
+ @ClusterIncFrom = slurp($1);
+ $config{CLUSTER_RECVFROM} = join(',', @ClusterIncFrom); }
+
if ($config{MESSENGER}) {
require ConfigServer::Messenger;
import ConfigServer::Messenger;
######## END ######
Large Clusters use external include file
Re: Large Clusters use external include file
Thanks to a brilliant team at csf for implementing this patch far better than my clumsy attempt in the new version 12.09.
Great job and thank you !!!!
Great job and thank you !!!!