summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2016-06-28 22:18:20 +0200
committerPapoteur <papoteur@mageialinux-online.org>2016-06-28 22:18:20 +0200
commit99f09ef37d3b2d6a6051958640d8c857b24db202 (patch)
treee7d2cbe18a68c66b6b01e0ab6547888b0d2800f8
parent2054c78f2010540f30690387db5223fd27233a16 (diff)
downloaddrakguard-99f09ef37d3b2d6a6051958640d8c857b24db202.tar
drakguard-99f09ef37d3b2d6a6051958640d8c857b24db202.tar.gz
drakguard-99f09ef37d3b2d6a6051958640d8c857b24db202.tar.bz2
drakguard-99f09ef37d3b2d6a6051958640d8c857b24db202.tar.xz
drakguard-99f09ef37d3b2d6a6051958640d8c857b24db202.zip
Switch from dansguardian to e2guardian
-rw-r--r--NEWS3
-rwxr-xr-xbin/drakguard72
2 files changed, 39 insertions, 36 deletions
diff --git a/NEWS b/NEWS
index a324d22..b68f24c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+1.5
+- moves from dansguardian to e2guardian
+
1.4
- new drakguard icon by Animtim (mga#18225)
- translations updates
diff --git a/bin/drakguard b/bin/drakguard
index 9bd9347..506a2e4 100755
--- a/bin/drakguard
+++ b/bin/drakguard
@@ -16,21 +16,21 @@ use network::squid;
use services;
use Encode;
-my $dansguardian_main_file = "/etc/e2guardian/e2guardian.conf";
-my $dansguardian_filter_file = "/etc/e2guardian/e2guardianf1.conf";
+my $e2guardian_main_file = "/etc/e2guardian/e2guardian.conf";
+my $e2guardian_filter_file = "/etc/e2guardian/e2guardianf1.conf";
my $time_control_file = "/etc/shorewall/time_control";
-my $dansguardian_bannedsitelist = "/etc/e2guardian/lists/bannedsitelist";
-my $dansguardian_exceptionsitelist = "/etc/e2guardian/lists/exceptionsitelist";
-my $dansguardian_protected_program_list = "/etc/e2guardian/lists/blacklists/drakguard/protected_list";
+my $e2guardian_bannedsitelist = "/etc/e2guardian/lists/bannedsitelist";
+my $e2guardian_exceptionsitelist = "/etc/e2guardian/lists/exceptionsitelist";
+my $e2guardian_protected_program_list = "/etc/e2guardian/lists/blacklists/drakguard/protected_list";
my $msec_conf = "/etc/security/msec/perms.conf";
my $perms_orig = "/etc/security/msec/perms.orig";
my $fstab_file = "/etc/fstab";
-my %dansguardian_levels = (
+my %e2guardian_levels = (
160 => N_("Low"),
100 => N_("Normal"),
50 => N_("High"),
);
-my %dansguardian_langs = (
+my %e2guardian_langs = (
arspanish => 'es_AR',
bulgarian => 'bg',
chinesebig5 => 'zh_TW',
@@ -113,7 +113,7 @@ my @url_lists = (
tab_title => N("Block programs"),
list_title => N("Programs with blocked execution"),
remove_text => N("Remove from blocked execution list"),
- file => $dansguardian_protected_program_list,
+ file => $e2guardian_protected_program_list,
apply => \&apply_block_program,
}
);
@@ -157,10 +157,10 @@ gtkadd($w->{window},
gtknew('Label', sensitive_ref => \$enable, text_markup => N("Obscenity sensibility"), #Sensitivity to bad words
alignment => [ 0, 0.5 ]),
gtknew('ComboBox',
- list => [ keys %dansguardian_levels ],
+ list => [ keys %e2guardian_levels ],
text_ref => \$level,
sensitive_ref => \$enable,
- format => sub { translate($dansguardian_levels{$_[0]}) }),
+ format => sub { translate($e2guardian_levels{$_[0]}) }),
]),
1, gtknew('Label'),
0, gtknew('Title2', label => N("User access")),
@@ -386,14 +386,14 @@ sub quit_gui {
}
sub load() {
- my $guardian = read_dansguardian();
- my $levelname = { %dansguardian_levels }->{$guardian->{naughtynesslimit}};
+ my $guardian = read_e2guardian();
+ my $levelname = { %e2guardian_levels }->{$guardian->{naughtynesslimit}};
$net_control = $guardian->{netblock};
$program_control = $guardian->{programblock};
gtkval_modify(\$not_net_control, $enable && !$net_control);
- $level = { reverse %dansguardian_levels }->{$levelname} if $levelname;
- $level ||= { reverse %dansguardian_levels }->{High};
- $enable = services::starts_on_boot('dansguardian');
+ $level = { reverse %e2guardian_levels }->{$levelname} if $levelname;
+ $level ||= { reverse %e2guardian_levels }->{High};
+ $enable = services::starts_on_boot('e2guardian');
$time_control = cat_($::prefix . "/etc/shorewall/start") =~ /^INCLUDE $time_control_file$/m;
my @time_control_settings = grep { /\bnet2fw\b/ } cat_($::prefix . $time_control_file);
@@ -454,7 +454,7 @@ sub save() {
or quit_gui(1);
$_->{apply}(list_get_entries($_->{list})) foreach @url_lists;
- write_dansguardian();
+ write_e2guardian();
enable_transparent_proxy($proxy_port);
#- reload shorewall config if it has just been installed
$shorewall ||= network::shorewall::read();
@@ -519,15 +519,15 @@ sub set_permissions {
chown "root", "root", $line;
#remove msec lines
#clean_config_line($msec_conf,"$line");
- subst_config_line($dansguardian_protected_program_list, "$line_info \n"); #adds the file to dansguardian_protected_program_list
+ subst_config_line($e2guardian_protected_program_list, "$line_info \n"); #adds the file to e2guardian_protected_program_list
subst_config_line($msec_conf, "$line\troot.root\t700\tforce\t\n"); #adds the file to msec
#`protect $line $_` foreach list_get_entries($users_program_list);
#add msec line or lines...
foreach my $user_msec (list_get_entries($users_program_list)) {
my @msec_line = grep { $_ && m/$line/g } chomp_(cat_($msec_conf));
- my @program_list_line = grep { $_ && m/^$line/g } chomp_(cat_($dansguardian_protected_program_list));
+ my @program_list_line = grep { $_ && m/^$line/g } chomp_(cat_($e2guardian_protected_program_list));
`setfacl -m u:$user_msec:r-x $line`;
- subst_config_line($dansguardian_protected_program_list, "$_$user_msec,\n") foreach @program_list_line; #adds the users to the programs blocked in msec
+ subst_config_line($e2guardian_protected_program_list, "$_$user_msec,\n") foreach @program_list_line; #adds the users to the programs blocked in msec
subst_config_line($msec_conf, "$_$user_msec:r-x,\n") foreach @msec_line; #adds the users to the programs blocked in msec
}
}
@@ -560,7 +560,7 @@ sub clean_config_line {
} $file;
}
-sub block_internet_dansguardian {
+sub block_internet_e2guardian {
my ($file) = @_;
my $key = "#";
substInFile {
@@ -568,7 +568,7 @@ sub block_internet_dansguardian {
} $file;
}
-sub unblock_internet_dansguardian {
+sub unblock_internet_e2guardian {
my ($file) = @_;
my $key = "#";
substInFile {
@@ -585,9 +585,9 @@ sub enable_transparent_proxy {
}
#- mostly duplicated for MDK::Common::System::getVarsFromSh
-sub read_dansguardian() {
+sub read_e2guardian() {
my $guardian = {};
- foreach (cat_($dansguardian_filter_file)) {
+ foreach (cat_($e2guardian_filter_file)) {
s/#.*//;
s/^\s*//;
my ($v, $val) = /^(\w+)\s*=\s*(.*)/ or next;
@@ -597,25 +597,25 @@ sub read_dansguardian() {
$guardian;
}
-sub write_dansguardian() {
+sub write_e2guardian() {
require lang;
my $locale = lang::read();
my $locale_lang = lang::getlocale_for_lang($locale->{lang}, $locale->{country});
- my %lang_to_dansguardian = reverse %dansguardian_langs;
- my $dansguardian_lang = $lang_to_dansguardian{$locale_lang} || $lang_to_dansguardian{$locale->{lang}};
+ my %lang_to_e2guardian = reverse %e2guardian_langs;
+ my $e2guardian_lang = $lang_to_e2guardian{$locale_lang} || $lang_to_e2guardian{$locale->{lang}};
- subst_config_line($dansguardian_main_file, "language = '$dansguardian_lang'\n") if $dansguardian_lang;
- subst_config_line($dansguardian_filter_file, "naughtynesslimit = '$level'\n");
- subst_config_line($dansguardian_filter_file, "netblock = '$net_control'\n");
- subst_config_line($dansguardian_filter_file, "programblock = '$program_control'\n");
+ subst_config_line($e2guardian_main_file, "language = '$e2guardian_lang'\n") if $e2guardian_lang;
+ subst_config_line($e2guardian_filter_file, "naughtynesslimit = '$level'\n");
+ subst_config_line($e2guardian_filter_file, "netblock = '$net_control'\n");
+ subst_config_line($e2guardian_filter_file, "programblock = '$program_control'\n");
if ($net_control) {
- block_internet_dansguardian($dansguardian_bannedsitelist);
+ block_internet_e2guardian($e2guardian_bannedsitelist);
}
else {
- unblock_internet_dansguardian($dansguardian_bannedsitelist);
+ unblock_internet_e2guardian($e2guardian_bannedsitelist);
}
}
@@ -624,7 +624,7 @@ sub include_guardian_file {
my $to_add = ".Include<$external_file>\n";
clean_config_line($guardian_file, $to_add);
my @all = cat_($guardian_file);
- if ($dansguardian_bannedsitelist eq $guardian_file && !$net_control || $dansguardian_exceptionsitelist eq $guardian_file && $net_control) {
+ if ($e2guardian_bannedsitelist eq $guardian_file && !$net_control || $e2guardian_exceptionsitelist eq $guardian_file && $net_control) {
if (!member($to_add, @all)) {
output_p($guardian_file, @all, $to_add);
}
@@ -703,14 +703,14 @@ sub apply_block_program() {
if ($val) {
#write back in the msec file and set original file permissions
#`unprotect $diff --remove`;
- remove_acl($dansguardian_protected_program_list, $diff);
+ remove_acl($e2guardian_protected_program_list, $diff);
subst_config_line($msec_conf, "$element\n");
restore_permissions($element);
}
else {
#only make the permissions wright
#`unprotect $diff --remove`;
- remove_acl($dansguardian_protected_program_list, $diff);
+ remove_acl($e2guardian_protected_program_list, $diff);
clean_config_line($msec_conf, $diff);
restore_permissions($element);
}
@@ -739,7 +739,7 @@ sub apply_block_program() {
}
#this is just the case to reactivate the parental control
#`unprotect $_ --remove` foreach @intersection;
- remove_acl($dansguardian_protected_program_list, $_) foreach @intersection;
+ remove_acl($e2guardian_protected_program_list, $_) foreach @intersection;
foreach my $intersec (@intersection) {
set_permissions($intersec, grep { $_ && m/$intersec/g } @orig_list);
}