summaryrefslogtreecommitdiffstats
path: root/perl-install/security/level.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-14 14:10:58 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-14 14:10:58 +0000
commit6cbb31b6b916dc7952da7ca05b9feac5b139707a (patch)
treea63ee5baad543e59aba828628973d6cf8db155a6 /perl-install/security/level.pm
parentc15a46344c522ee0726ee8855f98181c008cb414 (diff)
downloaddrakx-6cbb31b6b916dc7952da7ca05b9feac5b139707a.tar
drakx-6cbb31b6b916dc7952da7ca05b9feac5b139707a.tar.gz
drakx-6cbb31b6b916dc7952da7ca05b9feac5b139707a.tar.bz2
drakx-6cbb31b6b916dc7952da7ca05b9feac5b139707a.tar.xz
drakx-6cbb31b6b916dc7952da7ca05b9feac5b139707a.zip
cleanup security::level, hopefully the **** draksec still works
Diffstat (limited to 'perl-install/security/level.pm')
-rw-r--r--perl-install/security/level.pm43
1 files changed, 11 insertions, 32 deletions
diff --git a/perl-install/security/level.pm b/perl-install/security/level.pm
index 36d5d19cf..368ab4c5a 100644
--- a/perl-install/security/level.pm
+++ b/perl-install/security/level.pm
@@ -2,6 +2,8 @@ package security::level;
use strict;
use common;
+use run_program;
+
my %level_list = (
0 => N("Welcome To Crackers"),
@@ -12,16 +14,13 @@ my %level_list = (
5 => N("Paranoid"),
);
-my @sec_levels = map { $level_list{$_} } (0..5); # enforce order
-
-
-sub get_common_list {
- map { $level_list{$_} } (2, 3, 4);
-}
-
-sub get_full_list {
-
+sub to_string { $level_list{$_[0]} }
+sub from_string {
+ my %sec_levels = reverse %level_list;
+ $sec_levels{$_[0]} || 2;
}
+sub get_string { to_string(get() || 2) }
+sub get_common_list { map { to_string($_) } (2, 3, 4) }
sub get {
cat_("$::prefix/etc/profile") =~ /export SECURE_LEVEL=(\d+)/ && $1 || #- 8.0 msec
@@ -30,30 +29,9 @@ sub get {
$ENV{SECURE_LEVEL};
}
-
-sub get_string {
- return $sec_levels[get()] || 2
-}
-
sub set {
- my %sec_levels = reverse %level_list;
- my $run_level = $sec_levels{$_[0]};
- print "set level: $_[0] -> $run_level\n";
- print $::prefix, "/usr/sbin/msec ", $run_level || 3, "\n";
- require run_program;
- run_program::rooted($::prefix, "/usr/sbin/msec", $run_level || 3);
-}
-
-sub to_string {
- my %l = (
- 0 => N("Welcome To Crackers"),
- 1 => N("Poor"),
- 2 => N("Standard"),
- 3 => N("High"),
- 4 => N("Higher"),
- 5 => N("Paranoid"),
- );
- $l{$_[0]};
+ my ($security) = @_;
+ run_program::rooted($::prefix, 'msec', '-o', 'run_commands=0', '-o', 'log=stderr', $security || 3);
}
sub level_choose {
@@ -88,4 +66,5 @@ connections from many clients. Note: if your machine is only a client on the Int
);
}
+
1;