diff --git a/createlinks b/createlinks index d7d3257..63621fd 100644 --- a/createlinks +++ b/createlinks @@ -7,7 +7,7 @@ use esmith::Build::CreateLinks qw(:all); #-------------------------------------------------- # links to add -panel_link("xt_geoip","manager"); +panel_link("xtgeoip","manager"); # templates to expand for my $event (qw(xt_geoip-modify xt_geoip-update xt_geoip-service diff --git a/root/etc/e-smith/templates/etc/rc.d/init.d/masq/90adjustXt_Geoip b/root/etc/e-smith/templates/etc/rc.d/init.d/masq/90adjustXt_Geoip index d5b0484..844f7f1 100644 --- a/root/etc/e-smith/templates/etc/rc.d/init.d/masq/90adjustXt_Geoip +++ b/root/etc/e-smith/templates/etc/rc.d/init.d/masq/90adjustXt_Geoip @@ -61,6 +61,16 @@ EOF } } + # [SME: 12445] do not block Remote authorized access + # TO DO : allow pin point per service eg this UK ip/network even if UK is filtered + + (($masq{XTAcceptValidRemoteHosts} || 'enabled') eq 'enabled'){ + foreach (split /[,;]/, (${'httpd-admin'}{'ValidFrom'} || '')){ + my ($ip,$bits) = Net::IPv4Addr::ipv4_parse("$_"); + $OUT .= " /sbin/iptables -A \$NEW_XTGeoIP -s $ip/$bits -j RETURN\n" unless "$ip" eq '0.0.0.0'; + } + } + my @services = split(/,/, $masq{'XtServices'}); foreach my $servName (@services) diff --git a/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm b/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm index 8e1f680..3af9467 100644 --- a/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm +++ b/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm @@ -4,7 +4,7 @@ # Copyright (c) Michel Begue 2017 # Xt_GeoIP Administration panel #------------------------------------------- -package esmith::FormMagick::Panel::xt_geoip; +package esmith::FormMagick::Panel::xt_geoip; use strict; #use warnings; @@ -95,8 +95,8 @@ sub new my $self = esmith::FormMagick->new(); $self->{calling_package} = (caller)[0]; bless $self; -# $self->debug(1); - return $self; +# $self->debug(1); + return $self; } =head2 get_prop @@ -105,17 +105,17 @@ sub new sub get_prop { - my $fm = shift if (ref($_[0]) ); - my $item = shift; - my $prop = shift; - - my $record = $db->get($item); - if ($record) { - return $record->prop($prop); - } - else { - return ''; - } + my $fm = shift if (ref($_[0]) ); + my $item = shift; + my $prop = shift; + + my $record = $db->get($item); + if ($record) { + return $record->prop($prop); + } + else { + return ''; + } } =head2 get_value @@ -124,16 +124,16 @@ sub get_prop sub get_value { - my $fm = shift; - my $item = shift; - my $record = $db->get($item); - #return ($db->get("masq")->prop($item)); - if ($record) { - return $record->value(); - } - else { - return ''; - } + my $fm = shift; + my $item = shift; + my $record = $db->get($item); + #return ($db->get("masq")->prop($item)); + if ($record) { + return $record->value(); + } + else { + return ''; + } } =head2 get_badcountries @@ -171,7 +171,7 @@ sub get_reverse my $fm = shift; my $item = shift; my $prop = shift; - $item = ($item eq 'masq') ? $item : $fm->cgi->param('name'); + $item = ($item eq 'masq') ? $item : $fm->cgi->param('name'); return $db->get_prop("$item", "$prop") || "disabled"; } @@ -183,16 +183,16 @@ method to retrieve the status of geoip (module and filtering) for the form sub get_stat_geoip { - my $fm = shift; - if ( system ( "/bin/test -f /lib/modules/`/bin/uname -r`/weak-updates/xtables-addons/xt_geoip.ko") != 0 ) { - return $fm->localise('ERROR_MISSING_MODULE'); - } elsif ( system ( "/sbin/lsmod | grep 'xt_geoip' > /dev/null") != 0 ) { - return $fm->localise('ERROR_UNLOADED_MODULE'); - } elsif ( get_geoip() eq 'enabled' && system ( "/sbin/iptables -L -n | grep 'XTGeoIP' > /dev/null") != 0 ) { - return $fm->localise('ERROR_FILTER_CHAIN_MISSING'); - } else { - return ''; - } + my $fm = shift; + if ( system ( "/bin/test -f /lib/modules/`/bin/uname -r`/weak-updates/xtables-addons/xt_geoip.ko") != 0 ) { + return $fm->localise('ERROR_MISSING_MODULE'); + } elsif ( system ( "/sbin/lsmod | grep 'xt_geoip' > /dev/null") != 0 ) { + return $fm->localise('ERROR_UNLOADED_MODULE'); + } elsif ( get_geoip() eq 'enabled' && system ( "/sbin/iptables -L -n | grep 'XTGeoIP' > /dev/null") != 0 ) { + return $fm->localise('ERROR_FILTER_CHAIN_MISSING'); + } else { + return ''; + } } @@ -205,9 +205,9 @@ sub get_stat_license_key { my $fm = shift; if ((get_prop( 'geoip','status' ) || 'disabled') eq 'enabled' ) { - if ( (get_prop( 'geoip','LicenseKey' ) || '') ne '' ) { - return ''; - } + if ( (get_prop( 'geoip','LicenseKey' ) || '') ne '' ) { + return ''; + } } return $fm->localise('ERROR_LICENSE_KEY'); @@ -231,38 +231,38 @@ Sub to change settings as per user input in the panel sub change_settings { - my $self = shift; - my $q = $self->{'cgi'}; - - my $mq_bc = get_badcountries(); - my $mq_gp = get_geoip(); - my $masq = $db->get('masq') || "disabled"; - my $mq_rv = $masq->prop('XTGeoipRev') || 'disabled'; - my $mq_ot = $masq->prop('XTGeoipOther') || 'disabled'; + my $self = shift; + my $q = $self->{'cgi'}; + + my $mq_bc = get_badcountries(); + my $mq_gp = get_geoip(); + my $masq = $db->get('masq') || "disabled"; + my $mq_rv = $masq->prop('XTGeoipRev') || 'disabled'; + my $mq_ot = $masq->prop('XTGeoipOther') || 'disabled'; - my $n_mq_bc = $q->param("masq_badcountries"); - my $n_mq_gp = $q->param("masq_geoip") || $mq_gp; - my $n_upd_gp = $q->param("update_geoip") || ''; + my $n_mq_bc = $q->param("masq_badcountries"); + my $n_mq_gp = $q->param("masq_geoip") || $mq_gp; + my $n_upd_gp = $q->param("update_geoip") || ''; my $n_mq_rv = $q->param("masq_reverse") || $mq_rv ; - my $n_mq_ot = $q->param("masq_others") || $mq_ot ; + my $n_mq_ot = $q->param("masq_others") || $mq_ot ; - if (($n_mq_bc eq $mq_bc) && ($n_mq_gp eq $mq_gp) && ($n_upd_gp eq 'NO') && ($n_mq_rv eq $mq_rv) && ($n_mq_ot eq $mq_ot)) { - return $self->success("NO_CHANGE") - } - $db->set_prop("masq", "BadCountries", $n_mq_bc); - $db->set_prop("masq", "GeoIP", $n_mq_gp); - $db->set_prop("masq", "XTGeoipRev", $n_mq_rv); - $db->set_prop("masq", "XTGeoipOther", $n_mq_ot); + if (($n_mq_bc eq $mq_bc) && ($n_mq_gp eq $mq_gp) && ($n_upd_gp eq 'NO') && ($n_mq_rv eq $mq_rv) && ($n_mq_ot eq $mq_ot)) { + return $self->success("NO_CHANGE") + } + $db->set_prop("masq", "BadCountries", $n_mq_bc); + $db->set_prop("masq", "GeoIP", $n_mq_gp); + $db->set_prop("masq", "XTGeoipRev", $n_mq_rv); + $db->set_prop("masq", "XTGeoipOther", $n_mq_ot); - my $eventloc = "xt_geoip-modify"; - $eventloc = "xt_geoip-update" if $n_upd_gp eq 'YES'; - + my $eventloc = "xt_geoip-modify"; + $eventloc = "xt_geoip-update" if $n_upd_gp eq 'YES'; + unless ( system ( "/sbin/e-smith/signal-event", $eventloc ) == 0 ) - { - $self->error("ERROR_UPDATING"); - return undef; + { + $self->error("ERROR_UPDATING"); + return undef; } - return $self->success("SUCCESS"); + return $self->success("SUCCESS"); } @@ -278,14 +278,14 @@ sub must_exist my $listerr = ""; my @mq_bcs = split /[,:]/, $q->param("masq_badcountries"); if (@mq_bcs) { - my $ctr = @mq_bcs; - return $self->localise('ERROR_COUNTRY_MAX: {$ctr}', {ctr=> "$ctr"}) if ($ctr > 50); + my $ctr = @mq_bcs; + return $self->localise('ERROR_COUNTRY_MAX: {$ctr}', {ctr=> "$ctr"}) if ($ctr > 50); - foreach my $bcs (@mq_bcs) { - my $file = "/usr/share/xt_geoip/LE/" . $bcs . ".iv4"; - if (! -f $file) { $listerr .= $bcs . ","; } - } - return $self->localise('ERR_COUNTRY_NOT_EXIST: {$listerr}', {listerr=> "$listerr"}) if $listerr; + foreach my $bcs (@mq_bcs) { + my $file = "/usr/share/xt_geoip/LE/" . $bcs . ".iv4"; + if (! -f $file) { $listerr .= $bcs . ","; } + } + return $self->localise('ERR_COUNTRY_NOT_EXIST: {$listerr}', {listerr=> "$listerr"}) if $listerr; } return 'OK'; } @@ -305,41 +305,41 @@ sub print_custom_button #Subroutine to list statistics sub generateStats { - my $self = shift; - my $q = $self->{cgi}; + my $self = shift; + my $q = $self->{cgi}; - $self->turn_off_buttons(); + $self->turn_off_buttons(); # Untaint $name before use in system() - my $stats_type = $q->param ('type'); + my $stats_type = $q->param ('type'); $stats_type =~ /(.+)/; $stats_type = $1; - if ($stats_type ne "ipt" && $stats_type ne "ssh" && $stats_type ne "f2b") - { - print $q->p($q->b($self->localise('INVALID_STATS_TYPE')." ". - $stats_type)); - return ''; - } else { - # my $now_string = $self->gen_locale_date_string(); - my $file = "/var/lib/xt_geoip/extA_" . $stats_type . "_country.lst"; - my $filetime = ( -e $file ) ? (stat($file))[9] : 0; - my $date_string = strftime("%Y/%m/%d %H:%M", localtime( $filetime )) || ''; - print $q->h3($self->localise('STATS_GENERATED'), "[", $stats_type, "]", $date_string); + if ($stats_type ne "ipt" && $stats_type ne "ssh" && $stats_type ne "f2b") + { + print $q->p($q->b($self->localise('INVALID_STATS_TYPE')." ". + $stats_type)); + return ''; + } else { + # my $now_string = $self->gen_locale_date_string(); + my $file = "/var/lib/xt_geoip/extA_" . $stats_type . "_country.lst"; + my $filetime = ( -e $file ) ? (stat($file))[9] : 0; + my $date_string = strftime("%Y/%m/%d %H:%M", localtime( $filetime )) || ''; + print $q->h3($self->localise('STATS_GENERATED'), "[", $stats_type, "]", $date_string); - open( XTGEOIPSTATS, $file ); - print "
\n";
+    open( XTGEOIPSTATS, $file );
+    print "
\n";
 
-	while ()
-	{
-		print;
-	}
+    while ()
+    {
+        print;
+    }
 
-	close XTGEOIPSTATS;
-	print "
\n"; + close XTGEOIPSTATS; + print "
\n"; - print $q->h3($self->localise('END_OF_STATS')); - #$self->wherenext('First'); - return ''; - } + print $q->h3($self->localise('END_OF_STATS')); + #$self->wherenext('First'); + return ''; + } } sub get_srv_name @@ -363,10 +363,10 @@ sub print_service_table { my $self = shift; my $q = $self->{cgi}; my $servname = $self->localise('NAME'); - my $port = $self->localise('PORT'); - my $status = $self->localise('STATUS'); - my $access = $self->localise('ACCESS'); - my $servBC = $self->localise('BADCOUNTRIES'); + my $port = $self->localise('PORT'); + my $status = $self->localise('STATUS'); + my $access = $self->localise('ACCESS'); + my $servBC = $self->localise('BADCOUNTRIES'); my $modify = $self->localise('MODIFY'); my $remove = $self->localise('REMOVE'); my $action_h = $self->localise('ACTION'); @@ -393,30 +393,30 @@ sub print_service_table { foreach my $servname (@services) { - my $i = $db->get($servname); - next if not defined $i; + my $i = $db->get($servname); + next if not defined $i; my $port = $i->prop('TCPPort'); my $status = $i->prop('status'); my $access = $i->prop('access'); my $servBC = $i->prop('BadCountries') || ' '; - my $servRev = (( $i->prop('XTGeoipRev')|| 'disabled') eq 'disabled' )? '==': '!='; + my $servRev = (( $i->prop('XTGeoipRev')|| 'disabled') eq 'disabled' )? '==': '!='; my $params = $self->build_serv_cgi_params($servname, $i->props()); my $href = "$scriptname?$params&action=modify&wherenext="; my $actionModify = ' '; - $actionModify .= $q->a({href => "${href}SrvModify"},$modify) - . ' '; + $actionModify .= $q->a({href => "${href}SrvModify"},$modify) + . ' '; my $actionRemove = ' '; $actionRemove .= $q->a({href => "${href}SrvRemove"}, $remove) . ' '; - my $color = 'red'; - my $deco= "none"; - if ($servRev eq '!=' ) { $color = 'green'; } + my $color = 'red'; + my $deco= "none"; + if ($servRev eq '!=' ) { $color = 'green'; } if ($status eq 'disabled' || $access ne 'public') { $color = 'grey'; $deco= "line-through"; } print $q->Tr ( esmith::cgi::genSmallCell($q, $servname,"normal"), @@ -449,9 +449,9 @@ sub remove_serv { my ($self) = @_; my $name = $self->cgi->param('name'); if (my $serv = $db->get($name)) { - my $servBC = $serv->prop('BadCountries') || ''; + my $servBC = $serv->prop('BadCountries') || ''; if ($servBC ne '') { - my $tps = $db->set_prop_and_delete($name, "BadCountries"); + my $tps = $db->set_prop_and_delete($name, "BadCountries"); $tps = $db->get_prop_and_delete($name, "XTGeoipRev"); # Untaint $name before use in system() # $name =~ /(.+)/; $name = $1; @@ -475,24 +475,24 @@ sub modify_serv { my ($self) = @_; my $name = $self->cgi->param('name'); if (my $serv = $db->get($name)) { - my $servBC = $serv->prop('BadCountries') || ''; + my $servBC = $serv->prop('BadCountries') || ''; my $servRev = $serv->prop('XTGeoipRev') || 'disabled'; - my $q = $self->{'cgi'}; - my $n_servBC = $q->param("masq_srv_badcountries"); - my $n_servRev = $q->param("masq_srv_reverse") || $servRev; + my $q = $self->{'cgi'}; + my $n_servBC = $q->param("masq_srv_badcountries"); + my $n_servRev = $q->param("masq_srv_reverse") || $servRev; - if ($n_servBC eq $servBC && $n_servRev eq $servRev ) { - return $self->success("NO_CHANGE") - } - $db->set_prop($name, "BadCountries", $n_servBC); - $db->set_prop($name, "XTGeoipRev", $n_servRev); + if ($n_servBC eq $servBC && $n_servRev eq $servRev ) { + return $self->success("NO_CHANGE") + } + $db->set_prop($name, "BadCountries", $n_servBC); + $db->set_prop($name, "XTGeoipRev", $n_servRev); if (system ( "/sbin/e-smith/signal-event", "xt_geoip-service" ) == 0 ) - { - return $self->success("SUCCESS"); + { + return $self->success("SUCCESS"); } else { - return $self->error("ERROR_UPDATING"); + return $self->error("ERROR_UPDATING"); } } else { $self->error('CANT_FIND_SERV'); @@ -507,14 +507,14 @@ sub srv_must_exist my $listerr = ""; my @mq_bcs = split /[,:]/, $q->param("masq_srv_badcountries"); if (@mq_bcs) { - my $ctr = @mq_bcs; - return $self->localise('ERROR_COUNTRY_MAX: {$ctr}', {ctr=> "$ctr"}) if ($ctr > 50); + my $ctr = @mq_bcs; + return $self->localise('ERROR_COUNTRY_MAX: {$ctr}', {ctr=> "$ctr"}) if ($ctr > 50); - foreach my $bcs (@mq_bcs) { - my $file = "/usr/share/xt_geoip/LE/" . $bcs . ".iv4"; - if (! -f $file) { $listerr .= $bcs . ","; } - } - return $self->localise('ERR_COUNTRY_NOT_EXIST: {$listerr}', {listerr=> "$listerr"}) if $listerr; + foreach my $bcs (@mq_bcs) { + my $file = "/usr/share/xt_geoip/LE/" . $bcs . ".iv4"; + if (! -f $file) { $listerr .= $bcs . ","; } + } + return $self->localise('ERR_COUNTRY_NOT_EXIST: {$listerr}', {listerr=> "$listerr"}) if $listerr; } return 'OK'; } @@ -523,32 +523,32 @@ sub srv_must_exist #Subroutine to list counries codes sub generateCodes { - my $self = shift; - my $q = $self->{cgi}; + my $self = shift; + my $q = $self->{cgi}; - $self->turn_off_buttons(); + $self->turn_off_buttons(); - my $file = "/usr/share/xt_geoip/geoip_countries_list.txt"; - unless ( -e $file ) { - print $q->p($q->b($self->localise('INVALID_CODES_LIST'))); - return ''; - } + my $file = "/usr/share/xt_geoip/geoip_countries_list.txt"; + unless ( -e $file ) { + print $q->p($q->b($self->localise('INVALID_CODES_LIST'))); + return ''; + } - print $q->h3($self->localise('COUNTRY_LIST')); + print $q->h3($self->localise('COUNTRY_LIST')); - open( XTGEOIPCODES, $file ); - print "
\n";
+    open( XTGEOIPCODES, $file );
+    print "
\n";
 
-	while ()
-	{
-		print;
-	}
+    while ()
+    {
+        print;
+    }
 
-	close XTGEOIPCODES;
-	print "
\n"; + close XTGEOIPCODES; + print "
\n"; - print $q->h3($self->localise('END_OF_CODES')); - return ''; + print $q->h3($self->localise('END_OF_CODES')); + return ''; } @@ -556,24 +556,24 @@ sub generateCodes #Subroutine to list other services codes sub otherServices { - my ($self, $choice) = @_; + my ($self, $choice) = @_; - my %serv_ok = map { $_ => 1} split(/,/, $db->get_prop("masq", "XtServices")); - # unless $choice eq 'all'; + my %serv_ok = map { $_ => 1} split(/,/, $db->get_prop("masq", "XtServices")); + # unless $choice eq 'all'; - my @serv_others = (); - + my @serv_others = (); + for ($db->get_all_by_prop(type => 'service')) { - next unless $_->prop('TCPPort'); - # if ( $_->prop('TCPPort')) { + next unless $_->prop('TCPPort'); + # if ( $_->prop('TCPPort')) { - # push @serv_others, $_->key unless exists( $serv_ok{$_->key}); - push @serv_others, $_->key unless $choice eq 'sel' and not exists( $serv_ok{$_->key}); - # } - } + # push @serv_others, $_->key unless exists( $serv_ok{$_->key}); + push @serv_others, $_->key unless $choice eq 'sel' and not exists( $serv_ok{$_->key}); + # } + } - return \@serv_others; + return \@serv_others; } diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Xt_geoip.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Xt_geoip.pm deleted file mode 100644 index b68fd83..0000000 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Xt_geoip.pm +++ /dev/null @@ -1,494 +0,0 @@ -package SrvMngr::Controller::Xt_geoip; - -#---------------------------------------------------------------------- -# heading : Network -# description : GeoIP IP filtering -# navigation : 6000 610 -# name : xt_geoip, method : get, url : /xt_geoip, ctlact : Xt_geoip#main -# name : xt_geoipd, method : post, url : /xt_geoip, ctlact : Xt_geoip#do_display -# name : xt_geoipc, method : get, url : /xt_geoipb, ctlact : Xt_geoip#do_display -# name : xt_geoipu, method : post, url : /xt_geoipb, ctlact : Xt_geoip#do_action -# -# routes : end -#---------------------------------------------------------------------- -use strict; -use warnings; -use Mojo::Base 'Mojolicious::Controller'; -use POSIX qw(strftime); -use Locale::gettext; -use SrvMngr::I18N; -use SrvMngr qw( theme_list init_session ); - -# our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; -my ($cdb); - -sub main { - my $c = shift; - $c->app->log->info($c->log_req); - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $title = $c->render_to_string(inline => ($c->l('xtg_FORM_TITLE'))); - my %xtg_datas = (); - $xtg_datas{'choice'} = ''; - $c->stash(title => $title, xtg_datas => \%xtg_datas); - $c->render('xt_geoip'); -} ## end sub main - -sub do_display { - my $c = shift; - $c->app->log->info($c->log_req); - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $title = $c->render_to_string(inline => ($c->l('xtg_FORM_TITLE'))); - my $choice = $c->param('Choice'); - my $result; - my %xtg_datas = (); - $xtg_datas{'choice'} = $choice; - - if ($choice eq 'LCOD') { - $result = $c->generateCodes(); - - # $c->stash( title => $title, modul => $result, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_lst'); - } ## end if ($choice eq 'LCOD') - - if ($choice eq 'LF2B') { - $result = $c->generateStats('f2b'); - - # $result = $c->render_to_string(inline => generateStats($c, 'f2b')); - # $c->stash( title => $title, modul => $result, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_lst'); - } ## end if ($choice eq 'LF2B') - - if ($choice eq 'LSSH') { - $result = $c->generateStats('ssh'); - - # $result = $c->render_to_string(inline => generateStats($c, 'ssh')); - # $c->stash( title => $title, modul => $result, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_lst'); - } ## end if ($choice eq 'LSSH') - - if ($choice eq 'LIPT') { - $result = $c->generateStats('ipt'); - - # $c->stash( title => $title, modul => $result, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_lst'); - } ## end if ($choice eq 'LIPT') - - if ($choice eq 'LSRV') { - - # $c->stash( title => $title, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_lsrv'); - } ## end if ($choice eq 'LSRV') - - if ($choice eq 'UPDT') { - - # $c->stash( title => $title, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_updt'); - } ## end if ($choice eq 'UPDT') - - if ($choice eq 'UPDS') { - $xtg_datas{name} = $c->param('Name'); - - # $c->stash( title => $title, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_upds'); - } ## end if ($choice eq 'UPDS') - - if ($choice eq 'REMS') { - $xtg_datas{name} = $c->param('Name'); - - # $c->stash( title => $title, xtg_datas => \%xtg_datas ); - # return $c->render('xt_geoip_rems'); - } ## end if ($choice eq 'REMS') - $c->stash(title => $title, modul => $result, xtg_datas => \%xtg_datas); - return $c->render('xt_geoip_lst') if ($choice ~~ [ 'LCOD', 'LF2B', 'LSSH', 'LIPT' ]); - return $c->render('xt_geoip' . '_' . lc($choice)) if ($choice ~~ [ 'UPDT', 'UPDS', 'REMS', 'LSRV' ]); - $c->redirect_to('/xt_geoip'); -} ## end sub do_display - -sub do_action { - my $c = shift; - $c->app->log->info($c->log_req); - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $rt = $c->current_route; - my $title = $c->render_to_string(inline => ($c->l('xtg_FORM_TITLE'))); - my %xtg_datas = (); - my $choice = $c->param('Choice'); - $xtg_datas{'choice'} = $choice; - my ($res, $result) = ''; - - if ($choice eq 'LSRV') { - - #$result .= 'Blocked for testing ! Avoid updates for now '; - $res = ''; - - if (!$result) { - $res = $c->do_otherServices(); - $result .= $res unless $res eq 'OK'; - - if (!$result) { - $result = $c->l('xtg_SERVICE_SUCCESS'); - } - } ## end if (!$result) - } ## end if ($choice eq 'LSRV') - - if ($choice eq 'UPDT') { - $res = $c->must_exist(); - $result .= $res unless $res eq 'OK'; - - #$result .= 'Blocked for testing ! Avoid updates for now '; - $res = ''; - - if (!$result) { - $res = $c->change_settings(); - $result .= $res unless $res eq 'OK'; - - if (!$result) { - $result = $c->l('xtg_SUCCESS'); - } - } ## end if (!$result) - } ## end if ($choice eq 'UPDT') - - if ($choice eq 'REMS') { - - #$result .= 'Blocked for testing ! Avoid updates for now '; - my $name = $c->param('Name'); - $xtg_datas{name} = $name; - $res = ''; - - if (!$result) { - $res = $c->remove_serv(); - $result .= $res unless $res eq 'OK'; - - if (!$result) { - $result = $c->l('xtg_SUCCESSFULLY_DELETED_SERVICE'); - } - } ## end if (!$result) - } ## end if ($choice eq 'REMS') - - if ($choice eq 'UPDS') { - - #$result .= 'Blocked for testing ! Avoid updates for now '; - my $name = $c->param('Name'); - $xtg_datas{name} = $name; - $res = ''; - - if (!$result) { - $res = $c->modify_serv(); - $result .= $res unless $res eq 'OK'; - - if (!$result) { - $result = $c->l('xtg_SERVICE_SUCCESS'); - } - } ## end if (!$result) - } ## end if ($choice eq 'UPDS') - - # common parts - if ($res ne 'OK') { - $c->stash(error => $result); - $c->stash(title => $title, xtg_datas => \%xtg_datas); - return $c->render('xt_geoip' . '_' . lc($choice)); - } - my $message = "xt_geoip updates $choice DONE"; - $c->app->log->info($message); - $c->flash(success => $result); -## $c->flash( error => 'No changes applied !!' ); - #return to 'xt_geoip' route !!! - $c->redirect_to('/xt_geoip'); -} ## end sub do_action - -sub get_badcountries { - my $c = shift; - my $full = shift; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $badc = $cdb->get_prop("masq", "BadCountries") || ""; - return $badc unless $full; - my $rev = (($cdb->get_prop("masq", "XTGeoipRev") || "disabled") eq "enabled") ? "!=" : "=="; - return "$rev $badc "; -} ## end sub get_badcountries - -sub get_geoip { - return $cdb->get_prop("masq", "GeoIP") || 'disabled'; -} - -sub get_reverse { - my $c = shift; - my $item = shift; - my $prop = shift; - $item = ($item eq 'masq') ? $item : $c->param('Name'); - return $cdb->get_prop("$item", "$prop") || "disabled"; -} ## end sub get_reverse - -sub get_stat_geoip { - my $c = shift; - - if (system("/bin/test -f /lib/modules/`/bin/uname -r`/weak-updates/xtables-addons/xt_geoip.ko") != 0) { - return $c->l('xtg_ERROR_MISSING_MODULE'); - } elsif (system("/sbin/lsmod | grep 'xt_geoip' > /dev/null") != 0) { - return $c->l('xtg_ERROR_UNLOADED_MODULE'); - } elsif (get_geoip() eq 'enabled' && system("/sbin/iptables -L -n | grep 'XTGeoIP' > /dev/null") != 0) { - return $c->l('xtg_ERROR_FILTER_CHAIN_MISSING'); - } else { - return ''; - } -} ## end sub get_stat_geoip - -sub get_stat_license_key { - my $c = shift; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - - if (($cdb->get_prop('geoip', 'status') || 'disabled') eq 'enabled') { - if (($cdb->get_prop('geoip', 'LicenseKey') || '') ne '') { - return ''; - } - } ## end if (($cdb->get_prop('geoip'...))) - return $c->l('xtg_ERROR_LICENSE_KEY'); -} ## end sub get_stat_license_key - -sub get_date_update { - #my $file = "/usr/share/xt_geoip/LE/A1.iv4"; - my $file = "/usr/share/xt_geoip/A1.iv4"; - my $filetime = (-e $file) ? (stat($file))[9] : 0; - return strftime("%Y/%m/%d %H:%M", localtime($filetime)) || ''; -} ## end sub get_date_update - -sub get_srv_name { - my ($c) = @_; - return $c->param('Name'); -} - -sub get_services_table { - my $c = shift; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $choice = shift || 'sel'; - my @services; - my @serv_rec; - - if ($choice ne 'all') { - @services = split(/,/, $cdb->get_prop("masq", "XtServices")); - - for (@services) { - my $rec = $cdb->get($_); - push @serv_rec, $rec if ($rec && $rec->prop('TCPPort')); - } - } else { - - for ($cdb->get_all_by_prop(type => 'service')) { - push @serv_rec, $_ if ($_->prop('TCPPort')); - } - } ## end else [ if ($choice ne 'all') ] - return \@serv_rec; -} ## end sub get_services_table - -sub get_srv_badcountries { - my ($c, $name, $full) = @_; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $badc = $cdb->get_prop($name, "BadCountries") || ""; - return $badc unless $full; - my $rev = (($cdb->get_prop($name, "XTGeoipRev") || "disabled") eq "enabled") ? "!=" : "=="; - return "$rev $badc "; -} ## end sub get_srv_badcountries - -#Subroutine to list statistics -sub generateStats { - my $c = shift; - my $stats_type = shift; - my $out = ''; - - # Untaint $name before use in system() - $stats_type =~ /(.+)/; - $stats_type = $1; - - if ($stats_type ne "ipt" and $stats_type ne "ssh" and $stats_type ne "f2b") { - $out .= sprintf("

%s %s

", $c->l('xtg_INVALID_STATS_TYPE'), $stats_type); - return $out; - } - - # my $now_string = $c->gen_locale_date_string(); - my $file = "/var/lib/xt_geoip/extA_" . $stats_type . "_country.lst"; - my $filetime = (-e $file) ? (stat($file))[9] : 0; - my $date_string = strftime("%Y/%m/%d %H:%M", localtime($filetime)) || ''; - $out .= sprintf("

%s %s %s

", $c->l('xtg_STATS_GENERATED'), $stats_type, $date_string); - open(Xt_GEOIPSTATS, $file); - $out .= sprintf "
";
-
-    while () {
-        $out .= sprintf("%s", $_);
-    }
-    close Xt_GEOIPSTATS;
-    $out .= sprintf "
"; - $out .= sprintf("

%s

", $c->l('xtg_END_OF_STATS')); - return $out; -} ## end sub generateStats - -#Subroutine to list countries codes -sub generateCodes { - my $c = shift; - my $out = ''; - - # my $now_string = $c->gen_locale_date_string(); - my $file = "/usr/share/xt_geoip/geoip_countries_list.txt"; - - unless (-e $file) { - $out .= "
" . $c->l('xtg_INVALID_CODES_LIST'); - return $out; - } - my $filetime = (-e $file) ? (stat($file))[9] : 0; - my $date_string = strftime("%Y/%m/%d %H:%M", localtime($filetime)) || ''; - $out .= sprintf("

%s %s

", $c->l('xtg_COUNTRY_LIST'), $date_string); - open(Xt_GEOIPCODES, $file); - $out .= sprintf "
";
-
-    while () {
-        $out .= sprintf("%s", $_);
-    }
-    close Xt_GEOIPCODES;
-    $out .= sprintf "
"; - $out .= sprintf("

%s

", $c->l('xtg_END_OF_CODES')); - return $out; -} ## end sub generateCodes - -#Subroutine to list other services codes -sub otherServices { - my ($c, $choice) = @_; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my %serv_ok = map { $_ => 1 } split(/,/, $cdb->get_prop("masq", "XtServices")); - - # unless $choice eq 'all'; - my @serv_others = (); - - for ($cdb->get_all_by_prop(type => 'service')) { - next unless $_->prop('TCPPort'); - - # if ( $_->prop('TCPPort')) { - # push @serv_others, $_->key unless exists( $serv_ok{$_->key}); - push @serv_others, $_->key unless $choice eq 'sel' and not exists($serv_ok{ $_->key }); - - # } - } ## end for ($cdb->get_all_by_prop...) - return \@serv_others; -} ## end sub otherServices - -#Subroutine to update list services codes -sub do_otherServices { - my $c = shift; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $serv1 = ($cdb->get_prop("masq", "XtServices")) || ''; - my $serv2 = join(',', @{ $c->every_param('Selectedservices') }); - $cdb->set_prop("masq", "XtServices", $serv2) if ($serv1 ne $serv2); - return 'OK'; -} ## end sub do_otherServices - -sub change_settings { - my $c = shift; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $mq_bc = get_badcountries(); - my $mq_gp = get_geoip(); - my $masq = $cdb->get('masq') || "disabled"; - my $mq_rv = $masq->prop('XTGeoipRev') || 'disabled'; - my $mq_ot = $masq->prop('XTGeoipOther') || 'disabled'; - my $n_mq_bc = $c->param("Masq_badcountries"); - my $n_mq_gp = $c->param("Masq_geoip") || $mq_gp; - my $n_upd_gp = $c->param("Update_geoip") || ''; - my $n_mq_rv = $c->param("Masq_reverse") || $mq_rv; - my $n_mq_ot = $c->param("Masq_others") || $mq_ot; - - if ( ($n_mq_bc eq $mq_bc) - && ($n_mq_gp eq $mq_gp) - && ($n_upd_gp eq 'NO') - && ($n_mq_rv eq $mq_rv) - && ($n_mq_ot eq $mq_ot)) - { - return 'OK'; - } ## end if (($n_mq_bc eq $mq_bc...)) - $cdb->set_prop("masq", "BadCountries", $n_mq_bc); - $cdb->set_prop("masq", "GeoIP", $n_mq_gp); - $cdb->set_prop("masq", "XTGeoipRev", $n_mq_rv); - $cdb->set_prop("masq", "XTGeoipOther", $n_mq_ot); - my $eventloc = "xt_geoip-modify"; - $eventloc = "xt_geoip-update" if $n_upd_gp eq 'YES'; - - unless (system("/sbin/e-smith/signal-event", $eventloc) == 0) { - return $c->l("xtg_ERROR_UPDATING"); - } - return 'OK'; -} ## end sub change_settings - -=head2 valid_badcountries - -subroutine to validate countries. -=cut - -sub must_exist { - my $c = shift; - my $listerr = ""; - my @mq_bcs = split /[,:]/, $c->param("Masq_badcountries"); - - if (@mq_bcs) { - my $ctr = @mq_bcs; - return $c->l('xtg_ERROR_COUNTRY_MAX', $ctr) if ($ctr > 50); - - foreach my $bcs (@mq_bcs) { - #my $file = "/usr/share/xt_geoip/LE/" . $bcs . ".iv4"; - my $file = "/usr/share/xt_geoip/" . $bcs . ".iv4"; - if (!-f $file) { $listerr .= $bcs . ","; } - } - return $c->l('xtg_ERROR_COUNTRY_NOT_EXIST', $listerr) if $listerr; - } ## end if (@mq_bcs) - return 'OK'; -} ## end sub must_exist - -sub remove_serv { - my ($c) = @_; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $name = $c->param('Name'); - - # Untaint $name before use in system() - $name =~ /(.+)/; - $name = $1; - - if (my $serv = $cdb->get($name)) { - my $servBC = $serv->prop('BadCountries') || ''; - - if ($servBC ne '') { - my $tps = $cdb->get_prop_and_delete($name, "BadCountries"); - $tps = $cdb->get_prop_and_delete($name, "XTGeoipRev"); - - unless (system("/sbin/e-smith/signal-event", "xt_geoip-service") == 0) { - return $c->l("xtg_ERROR_WHILE_DELETING_SERVICE") . ' ' . $name; - } - return 'OK'; - } ## end if ($servBC ne '') - } else { - return $c->l('xtg_CANT_FIND_SERV'); - } -} ## end sub remove_serv - -sub modify_serv { - my ($c) = @_; - our $cdb = esmith::ConfigDB::UTF8->open() or die "Couldn't open ConfigDB::UTF8\n"; - my $name = $c->param('Name'); - - # Untaint $name before use in system() - $name =~ /(.+)/; - $name = $1; - - if (my $serv = $cdb->get($name)) { - my $servBC = $serv->prop('BadCountries') || ''; - my $servRev = $serv->prop('XTGeoipRev') || 'disabled'; - my $n_servBC = $c->param("Masq_srv_badcountries"); - my $n_servRev = $c->param("Masq_srv_reverse") || $servRev; - - if ($n_servBC eq $servBC && $n_servRev eq $servRev) { - return 'OK'; - } - $cdb->set_prop($name, "BadCountries", $n_servBC); - $cdb->set_prop($name, "XTGeoipRev", $n_servRev); - - unless (system("/sbin/e-smith/signal-event", "xt_geoip-service") == 0) { - return $c->l("xtg_ERROR_UPDATING") . ' ' . $name; - } - return 'OK'; - } else { - return $c->l('xtg_CANT_FIND_SERV'); - } -} ## end sub modify_serv -1; diff --git a/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Xt_geoip/xt_geoip_en.lex b/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Xt_geoip/xt_geoip_en.lex deleted file mode 100644 index 9155c7c..0000000 --- a/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Xt_geoip/xt_geoip_en.lex +++ /dev/null @@ -1,69 +0,0 @@ -'xtg_FORM_TITLE' => 'XTABLES-ADDONS Administration
GeoIP', -'xtg_ERROR_UPDATING' => 'There was an error while updating xt_geoip.', -'xtg_SUCCESS' => 'Successful change... Now IP filtering takes into account the countries entered.', -'xtg_SERVICE_SUCCESS' => 'Successful change... Now IP filtering takes into account the new services list.', -'xtg_XT_GEOIP_STATUS_DESCRIPTION' => ' -

Be careful not to ban the IP addresses needed to run your server !

', -'xtg_NO_CHANGE' => 'No change... no update !', -'xtg_LABEL_GEOIP_STATUS' => 'Current GEOIP filtering : ', -'xtg_LABEL_GEOIP' => 'GEOIP filtering desired : ', -'xtg_DESC_GEOIP' => 'Should filtering by country of origin be activated ?', -'xtg_ERROR_STATUS_GEOIP' => ' GEOIP filtering is inactive (iptables) ', -'xtg_LABEL_BADCOUNTRIES_STATUS' => 'Current list of banished country codes : ', -'xtg_ERROR_COUNTRY_NOT_EXIST' => 'Country code(s) does not exist on the server: [_1]', -'xtg_LABEL_BADCOUNTRIES' => 'New country codes to be used :', -'xtg_DESC_BADCOUNTRIES' => 'List of country codes (uppercase et comma-separated).', -'xtg_LABEL_DATE_UPDATE_STATUS' => 'Last update of GeoIP table :', -'xtg_LABEL_UPDATE' => 'Force the update of GeoIP table :', -'xtg_DESC_UPDATE' => 'GeoIP table is updated every week, but you can ...', -'xtg_IPT_LIST_DESCRIPTION' => ' ', -'xtg_IPT_LIST' => 'Filtered', -'xtg_SSH_LIST_DESCRIPTION' => ' ', -'xtg_SSH_LIST' => 'SSH errors', -'xtg_F2B_LIST_DESCRIPTION' => ' ', -'xtg_F2B_LIST' => 'F2b banned', -'xtg_STATS_GENERATED' => 'Statistics generated', -'xtg_END_OF_STATS' => 'End of Statistics', -'xtg_INVALID_STATS_TYPE' => 'Invalid type of statistics', -'xtg_STATS_DESCRIPTION' => '

Statistics for Xt_GeoIP

XX means Country not found !

', -'xtg_COUNTRY_LIST_DESCRIPTION' => ' ', -'xtg_LABEL_COUNTRY_LIST' => 'Country codes : ', -'xtg_COUNTRY_LIST' => 'Country codes', -'xtg_CNTRY_LIST' => 'List', -'xtg_END_OF_CODES' => 'End of code list', -'xtg_SERVICE_DESCRIPTION' => 'Per service filtering for Xtables GeoIP', -'xtg_SERVICE_DESCRIPTION2' => '', -'xtg_LABEL_SERVICE' => 'Service name : ', -'xtg_PER_SERVICE_GEOIP' => 'Services', -'xtg_ADD_SERVICE' => 'Add or modify a per service filtering', -'xtg_ADD_DESC' => 'You are choosing a particular country filtering for this service', -'xtg_REMOVE_SERVICE' => 'Delete a per service filtering', -'xtg_REMOVE_DESC' => 'You are deleting a filtering by service. The general filtering will then apply.', -'xtg_SERV_NOT_BAN' => 'Unfiltered service.', -'xtg_NO_SERVICES' => 'No services.', -'xtg_LABEL_SERV_BADCOUNTRIES_STATUS' => 'List of rejected country codes for the service : ', -'xtg_SUCCESSFULLY_DELETED_SERVICE' => 'Per service filtering successfully deleted... New filtering taken into account.', -'xtg_BADCOUNTRIES' => 'Blacklist', -'xtg_ERROR_COUNTRY_MAX' => 'Too many countries chosen: [_1]', -'xtg_LABEL_REVERSE_MATCH' => 'Reject if', -'xtg_DESC_REVERSE_MATCH' => 'The following option allow to chose if you want reject visitors from the country list (==) which is the default behaviour, or if you want to only let them in (!=).', -'xtg_LABEL_OTHERS' => 'General filter only for services without rules', -'xtg_DESC_OTHERS' => 'Choose if you want to have the general filter to apply to all incoming connections or if you do not want to filter ports already defined with a specific service rule. This would allow you to have a service less restricted than the general rule if you enable this.', -'xtg_SERVICE_LIST_DESCRIPTION' => ' ', -'xtg_LABEL_SERVICE_LIST' => 'Service codes : ', -'xtg_SERV_LIST' => 'List', -'xtg_DESC_AVAILABLE_SERVICES' => '

New Services selection

- ', -'xtg_LABEL_AVAILABLE_SERVICES' => 'Available Services', -'xtg_ERROR_LICENSE_KEY' => 'GEOIP license key unavailable. Downloading is inactive', -'xtg_ERROR_MISSING_MODULE' => 'Module xt_geoip is missing. GeoIP based filtering is inactive', -'xtg_ERROR_UNLOADED_MODULE' => 'Module xt_geoip not loaded. GeoIP based filtering is inactive', -'xtg_ERROR_FILTER_CHAIN_MISSING' => 'Filtering chain XTGeoIP is not in use. GeoIP based filtering is inactive', diff --git a/root/usr/share/smanager/themes/default/templates/partials/_xtg_lcodes.html.ep b/root/usr/share/smanager/themes/default/templates/partials/_xtg_lcodes.html.ep index e28b6fc..9a3f10a 100644 --- a/root/usr/share/smanager/themes/default/templates/partials/_xtg_lcodes.html.ep +++ b/root/usr/share/smanager/themes/default/templates/partials/_xtg_lcodes.html.ep @@ -2,7 +2,7 @@
- %= form_for '/xt_geoip' => (method => 'POST') => begin + %= form_for '/xtgeoip' => (method => 'POST') => begin %= $c->render_to_string(inline => l('xtg_COUNTRY_LIST_DESCRIPTION')); %= submit_button l 'xtg_CNTRY_LIST', class => 'action' @@ -11,4 +11,4 @@ % end - + diff --git a/root/usr/share/smanager/themes/default/templates/partials/_xtg_services.html.ep b/root/usr/share/smanager/themes/default/templates/partials/_xtg_services.html.ep index 8092125..1497af6 100644 --- a/root/usr/share/smanager/themes/default/templates/partials/_xtg_services.html.ep +++ b/root/usr/share/smanager/themes/default/templates/partials/_xtg_services.html.ep @@ -2,41 +2,41 @@
-%= form_for '/xt_geoip' => (method => 'POST') => begin +%= form_for '/xtgeoip' => (method => 'POST') => begin

%= l('xtg_SERVICE_DESCRIPTION')

%= $c->render_to_string(inline => l('xtg_SERVICE_DESCRIPTION2')); -% my @services = @{$c->get_services_table('sel')}; -% if (scalar @services == 0) { - %=l 'xtg_NO_SERVICES' -% } else { - - - +% my @services = @{$c->get_services_table('sel')}; +% if (scalar @services == 0) { + %=l 'xtg_NO_SERVICES' +% } else { +
- %=l 'NAME' - - %=l 'PORT' - - %=l 'STATUS' - - %=l 'ACCESS' - - %=l 'xtg_BADCOUNTRIES' - - %=l 'ACTION' -
+ + -% foreach my $sv (@services) { -% my $svBC = $sv->prop('BadCountries') || ' '; -% my $svRev = (( $sv->prop('XTGeoipRev')|| 'disabled') eq 'disabled' )? '==': '!='; -% my $color = 'red'; -% my $deco= "none"; -% if ($svRev eq '!=' ) { $color = 'green'; } -% if ($sv->prop('status') eq 'disabled' || $sv->prop('access') ne 'public') { $color = 'grey'; $deco= "line-through"; } -% my $BC = ""."$svRev $svBC".""; +% foreach my $sv (@services) { +% my $svBC = $sv->prop('BadCountries') || ' '; +% my $svRev = (( $sv->prop('XTGeoipRev')|| 'disabled') eq 'disabled' )? '==': '!='; +% my $color = 'red'; +% my $deco= "none"; +% if ($svRev eq '!=' ) { $color = 'green'; } +% if ($sv->prop('status') eq 'disabled' || $sv->prop('access') ne 'public') { $color = 'grey'; $deco= "line-through"; } +% my $BC = ""."$svRev $svBC".""; %= t td => (class => 'sme-border') => $sv->key @@ -45,15 +45,15 @@ %= t td => (class => 'sme-border') => $sv->prop('access') %= t td => (class => 'sme-border') => $c->render_to_string(inline => $BC) -% my $actionModify = "" . l('MODIFY') . ""; -% my $actionRemove = "" . l('REMOVE') . ""; +% my $actionModify = "" . l('MODIFY') . ""; +% my $actionRemove = "" . l('REMOVE') . ""; - - - -% } -
+ %=l 'NAME' + + %=l 'PORT' + + %=l 'STATUS' + + %=l 'ACCESS' + + %=l 'xtg_BADCOUNTRIES' + + %=l 'ACTION' +
<%= $c->render_to_string(inline => $actionModify) %><%= $c->render_to_string(inline => $actionRemove) %>
-% } + <%= $c->render_to_string(inline => $actionModify) %> + <%= $c->render_to_string(inline => $actionRemove) %> + +% } + +% } %= $c->render_to_string(inline => l('xtg_SERVICE_LIST_DESCRIPTION')); diff --git a/root/usr/share/smanager/themes/default/templates/partials/_xtg_stats.html.ep b/root/usr/share/smanager/themes/default/templates/partials/_xtg_stats.html.ep index 7aabe89..fb6e714 100644 --- a/root/usr/share/smanager/themes/default/templates/partials/_xtg_stats.html.ep +++ b/root/usr/share/smanager/themes/default/templates/partials/_xtg_stats.html.ep @@ -4,7 +4,7 @@ %= $c->render_to_string(inline => l('xtg_STATS_DESCRIPTION')); - %= form_for '/xt_geoip' => (method => 'POST') => begin + %= form_for '/xtgeoip' => (method => 'POST') => begin %= $c->render_to_string(inline => l('xtg_IPT_LIST_DESCRIPTION')); %= submit_button l 'xtg_IPT_LIST', class => 'action' @@ -12,7 +12,7 @@ % end - %= form_for '/xt_geoip' => (method => 'POST') => begin + %= form_for '/xtgeoip' => (method => 'POST') => begin %= $c->render_to_string(inline => l('xtg_SSH_LIST_DESCRIPTION')); @@ -21,7 +21,7 @@ % end - %= form_for '/xt_geoip' => (method => 'POST') => begin + %= form_for '/xtgeoip' => (method => 'POST') => begin %= $c->render_to_string(inline => l('xtg_F2B_LIST_DESCRIPTION')); diff --git a/root/usr/share/smanager/themes/default/templates/xt_geoip.html.ep b/root/usr/share/smanager/themes/default/templates/xt_geoip.html.ep deleted file mode 100644 index 0d3ec19..0000000 --- a/root/usr/share/smanager/themes/default/templates/xt_geoip.html.ep +++ /dev/null @@ -1,74 +0,0 @@ -% layout 'default', title => "Smanager - xt_geoip"; - -% content_for 'module' => begin - -
- - %if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $xtg_datas -

- %} - - % if ( stash 'error' ) { -
- %= $c->render_to_string(inline => stash 'error') -
- %} - -

<%= $title %>

- -
- %= $c->render_to_string(inline => l('xtg_XT_GEOIP_STATUS_DESCRIPTION')); -
- - %= form_for '/xt_geoip' => (method => 'POST') => begin - -

- %=l 'xtg_LABEL_GEOIP_STATUS' - - %= $c->get_geoip() -

- -

- %=l 'xtg_LABEL_BADCOUNTRIES_STATUS' - - %= $c->get_badcountries(1) -

- -

- %=l 'xtg_LABEL_DATE_UPDATE_STATUS' - - %= $c->get_date_update() -

- - % if ( my $st_geoip = $c->get_stat_geoip() ) { -
- %= $c->render_to_string(inline => $st_geoip); -
- %} - - % if ( my $st_lice_k = $c->get_stat_license_key() ) { -
- %= $c->render_to_string(inline => $st_lice_k); -
- %} - - %= hidden_field 'Choice' => 'UPDT' - -
- %= submit_button l('NEXT'), class => 'action' -
- - %end - - %= include 'partials/_xtg_lcodes' - - %= include 'partials/_xtg_services' - - %= include 'partials/_xtg_stats' - -
- -%end diff --git a/root/usr/share/smanager/themes/default/templates/xt_geoip_lsrv.html.ep b/root/usr/share/smanager/themes/default/templates/xt_geoip_lsrv.html.ep deleted file mode 100644 index 2fb4573..0000000 --- a/root/usr/share/smanager/themes/default/templates/xt_geoip_lsrv.html.ep +++ /dev/null @@ -1,44 +0,0 @@ -% layout 'default', title => "Smanager - xt_geoip"; - -% content_for 'module' => begin - -
- - %if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $xtg_datas -

- %} - - % if ( stash 'error' ) { -
- %= $c->render_to_string(inline => stash 'error') -
- %} - -

<%= $title %>

- -
- %= $c->render_to_string(inline => l('xtg_DESC_AVAILABLE_SERVICES')); -
- - %= form_for '/xt_geoipb' => (method => 'POST') => begin - -

- %=l 'xtg_LABEL_AVAILABLE_SERVICES' - - % param 'Selectedservices' => $c->otherServices('sel') unless param 'Selectedservices'; - %= select_field 'Selectedservices' => $c->otherServices('all'), class => 'input', multiple => "1" -

- - %= hidden_field 'Choice' => 'LSRV' -
- %= submit_button l('NEXT'), class => 'action' -
- - %end - -
- -%end diff --git a/root/usr/share/smanager/themes/default/templates/xt_geoip_lst.html.ep b/root/usr/share/smanager/themes/default/templates/xt_geoip_lst.html.ep deleted file mode 100644 index 02ec9c6..0000000 --- a/root/usr/share/smanager/themes/default/templates/xt_geoip_lst.html.ep +++ /dev/null @@ -1,36 +0,0 @@ -% layout 'default', title => "Smanager - xt_geoip - List"; - -% content_for 'module' => begin - -
- - %if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $xtg_datas -

- %} - - % if ( stash 'error' ) { -
- %= $c->render_to_string(inline => stash 'error') -
- %} - -

<%= $title %>

- - %= form_for '/xt_geoip' => (method => 'GET') => begin - -
- %= $c->render_to_string(inline => stash 'modul'); -
- -
- %= submit_button l('NEXT'), class => 'action' -
- - %end - -
- -%end diff --git a/root/usr/share/smanager/themes/default/templates/xt_geoip_rems.html.ep b/root/usr/share/smanager/themes/default/templates/xt_geoip_rems.html.ep deleted file mode 100644 index 5e65d3e..0000000 --- a/root/usr/share/smanager/themes/default/templates/xt_geoip_rems.html.ep +++ /dev/null @@ -1,53 +0,0 @@ -% layout 'default', title => "Smanager - xt_geoip"; - -% content_for 'module' => begin - -
- - %if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $xtg_datas -

- %} - - % if ( stash 'error' ) { -
- %= $c->render_to_string(inline => stash 'error') -
- %} - -

<%= $title %>

- -

- %= l 'xtg_REMOVE_SERVICE' -


- - %= $c->render_to_string(inline => l('xtg_REMOVE_DESC')); - - %= form_for '/xt_geoipb' => (method => 'POST') => begin - -

- %=l 'xtg_LABEL_SERVICE' - - %= $xtg_datas->{name} -

- -

- %=l 'xtg_LABEL_SERV_BADCOUNTRIES_STATUS' - - %= $c->get_srv_badcountries( $xtg_datas->{name}, 0 ) -

- -
- %= submit_button l('REMOVE'), class => 'action' -
- - %= hidden_field 'Choice' => 'REMS' - %= hidden_field 'Name' => $xtg_datas->{name} - - %end - -
- -%end diff --git a/root/usr/share/smanager/themes/default/templates/xt_geoip_upds.html.ep b/root/usr/share/smanager/themes/default/templates/xt_geoip_upds.html.ep deleted file mode 100644 index 2d6e4e6..0000000 --- a/root/usr/share/smanager/themes/default/templates/xt_geoip_upds.html.ep +++ /dev/null @@ -1,77 +0,0 @@ -% layout 'default', title => "Smanager - xt_geoip"; - -% content_for 'module' => begin - -
- - %if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $xtg_datas -

- %} - - % if ( stash 'error' ) { -
- %= $c->render_to_string(inline => stash 'error') -
- %} - -

<%= $title %>

- -

- %= l 'xtg_ADD_SERVICE' -


- - %= $c->render_to_string(inline => l('xtg_ADD_DESC')); - - %= form_for '/xt_geoipb' => (method => 'POST') => begin - -

- %=l 'xtg_LABEL_SERVICE' - - %= $xtg_datas->{name} -

- -

- %=l 'xtg_LABEL_BADCOUNTRIES_STATUS' - - %= $c->get_badcountries( 0 ) -

- -

- %=l 'xtg_DESC_REVERSE_MATCH' -
- %=l 'xtg_LABEL_REVERSE_MATCH' - - % param 'Masq_srv_reverse' => $c->get_reverse('masq','XTGeoipRev') unless param 'Masq_srv_reverse'; - %= select_field 'Masq_srv_reverse' => [['!=' => 'enabled'], ['==' => 'disabled']], class => 'input' -

- -

- %=l 'xtg_DESC_BADCOUNTRIES' -
- %=l 'xtg_LABEL_BADCOUNTRIES' - - % param 'Masq_srv_badcountries' => $c->get_srv_badcountries($xtg_datas->{name}, 0) unless param 'Masq_srv_badcountries'; - %= text_field 'Masq_srv_badcountries', size => '64', class => 'input' -

- -

- %=l 'xtg_LABEL_SERV_BADCOUNTRIES_STATUS' - - %= $c->get_srv_badcountries( $xtg_datas->{name}, 1 ) -

- -
- %= submit_button l('SAVE'), class => 'action' -
- - %= hidden_field 'Choice' => 'UPDS' - %= hidden_field 'Name' => $xtg_datas->{name} - - %end - -
- -%end diff --git a/root/usr/share/smanager/themes/default/templates/xt_geoip_updt.html.ep b/root/usr/share/smanager/themes/default/templates/xt_geoip_updt.html.ep deleted file mode 100644 index eff3869..0000000 --- a/root/usr/share/smanager/themes/default/templates/xt_geoip_updt.html.ep +++ /dev/null @@ -1,83 +0,0 @@ -% layout 'default', title => "Smanager - xt_geoip"; - -% content_for 'module' => begin - -
- - %if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $xtg_datas -

- %} - - % if ( stash 'error' ) { -
- %= $c->render_to_string(inline => stash 'error') -
- %} - -

<%= $title %>

- - %= form_for '/xt_geoipb' => (method => 'POST') => begin - -

- %=l 'xtg_DESC_GEOIP' -
- %=l 'xtg_LABEL_GEOIP' - - % param 'Masq_geoip' => $c->get_geoip() unless param 'Masq_geoip'; - %= select_field 'Masq_geoip' => [[ (l 'YES') => 'enabled'], [ (l 'NO') => 'disabled']], class => 'input' -

- -

- %=l 'xtg_DESC_REVERSE_MATCH' -
- %=l 'xtg_LABEL_REVERSE_MATCH' - - % param 'Masq_reverse' => $c->get_reverse('masq','XTGeoipRev') unless param 'Masq_reverse'; - %= select_field 'Masq_reverse' => [[ '!=' => 'enabled'], [ '==' => 'disabled']], class => 'input' -

- -

- %=l 'xtg_DESC_BADCOUNTRIES' -
- %=l 'xtg_LABEL_BADCOUNTRIES' - - % param 'Masq_badcountries' => $c->get_badcountries() unless param 'Masq_badcountries'; - %= text_field 'Masq_badcountries', class => 'input' -

- -

- %=l 'xtg_LABEL_BADCOUNTRIES_STATUS' - - %= $c->get_badcountries(); -

- -

- %=l 'xtg_DESC_OTHERS' -
- %=l 'xtg_LABEL_OTHERS' - - % param 'Masq_others' => $c->get_reverse('masq','XT_GeoipOther') unless param 'Masq_others'; - %= select_field 'Masq_others' => [[(l 'DISABLED') => 'disabled'], [(l 'ENABLED') => 'enabled']], class => 'input' -

- -

- %=l 'xtg_DESC_UPDATE' -
- %=l 'xtg_LABEL_UPDATE' - - %= select_field 'Update_geoip' => [[ (l 'NO') => 'NO'], [ (l 'YES') => 'YES']], class => 'input' -

- - %= hidden_field 'Choice' => 'UPDT' -
- %= submit_button l('SAVE'), class => 'action' -
- - %end - -
- -%end diff --git a/smeserver-xt_geoip.spec b/smeserver-xt_geoip.spec index c8223b7..6d8f71e 100644 --- a/smeserver-xt_geoip.spec +++ b/smeserver-xt_geoip.spec @@ -1,6 +1,6 @@ %define name smeserver-xt_geoip %define version 1.3.1 -%define release 28 +%define release 29 Summary: smserver rpm to setup database, update and configuration for xt_geoip module with a panel. Name: %{name} @@ -78,6 +78,11 @@ rm -rf %{name}-%{version} %changelog +* Tue Oct 21 2025 John Crisp 1.3.1-29.sme +- Fix SmartMatch errors [SME: 13240] +- Fix panel errors [SME: 13173] +- Do not block remote access authorized [SME: 12445] + * Tue Oct 07 2025 Brian Read 1.3.1-28.sme - Add UTF8 and avoid potential DB caching problems [SME: 13209]