VB-firewall.pl BUG ???

Support forum for the ViciBox ISO Server Install and ISO LiveCD Demo

Moderators: enjay, williamconley, Staydog, mflorell, MJCoate, mcargile, Kumba

VB-firewall.pl BUG ???

Postby covarrubiasgg » Sat Feb 27, 2021 4:10 am

Hi there, I am using the VB-firewall script on a server with not that great specs, and for some reason, when i have more de 300 ips on my ipset it starts ignoring the firewall rules at all. I haven't dig too much on why this happening, but I tough a quick fix was to change the default 14 days of the dynamicage to 2 days, so it doesn't have to load so many IPs. But it looks like the --dynamicage parameter is being completely ignore by the script parameters.

For now i have hardcoded the script by doing

Code: Select all
my $clidynamicage=2;


But I decided to take a look to the code, please note that i have never used perl before, but i noticed this:

Code: Select all
sub getcliarg {
        debugxoutput("--- SUB getcliarg BEGIN ---");
        # Get a specific CLI argument
        my $ARGvalue='X';
        my $CLIarg='';
        if ( @_ ) {
                $CLIarg=shift;
                my $i=0;
                my $args='';
                while ($#ARGV >= $i) {
                        $args = "$args $ARGV[$i]";
                        $i++;
                }
                my @CLIargARY = split(/$CLIarg/,$args);
                my @CLIargARX = split(/ /,$CLIargARY[1]);
                if (length($CLIargARX[0])>2) {        < ------ RIGHT HERE  !!!!!
                        $ARGvalue = $CLIargARX[0];
                        $ARGvalue =~ s/\/$| |\r|\n|\t//gi;
                }
        } else {
                debugxoutput("   No CLI argument passed to find");
        }
        debugxoutput("--- SUB getcliarg END ---");
        return $ARGvalue;
}


Beep Boop Beep....

                # Vici Dynamic list
                if ($args =~ /--dynamicage=/i) {
                        my $ARGVALtemp = getcliarg('--dynamicage=');
                        print ($ARGVALtemp);
                        if ($ARGVALtemp ne 'X') {   <----- HERE IS IGNORED
                                $DYNAMICAGE = $ARGVALtemp;
                                #$clidynamicage=1;
                        }
                }


The value of the parameter MUST BE length > 3 otherwise it will default to 'X' that means any parameter that is less than 100 days is ignored. As I mentioned, i don't really have idea what am i doing on Perl, so not sure if this maybe a solution (remember that I want to use 2 days )


Code: Select all
BEFORE
if (length($CLIargARX[0])>2)

AFTER
if (length($CLIargARX[0])>=1)


I hope not be saying non-sense
covarrubiasgg
 
Posts: 420
Joined: Thu Jun 10, 2010 10:20 am
Location: Tijuana, Mexico

Re: VB-firewall.pl BUG ???

Postby Kumba » Thu Mar 18, 2021 8:50 am

Fix applied. Thanks for the catch.
Kumba
 
Posts: 939
Joined: Tue Oct 16, 2007 11:44 pm
Location: Florida


Return to ViciBox Server Install and Demo

Who is online

Users browsing this forum: No registered users and 19 guests