diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2002-11-19 13:37:21 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2002-11-19 13:37:21 +0000 |
commit | 7d9973538da0ffaf2c95412393f072c330bd2c5e (patch) | |
tree | 7932f10f636c0ea4b89e9b2968e62985136db3ee /perl-install/security/level.pm | |
parent | c77b3d5c4e8832b4bc3ca66c0ef23c1427b046bd (diff) | |
download | drakx-7d9973538da0ffaf2c95412393f072c330bd2c5e.tar drakx-7d9973538da0ffaf2c95412393f072c330bd2c5e.tar.gz drakx-7d9973538da0ffaf2c95412393f072c330bd2c5e.tar.bz2 drakx-7d9973538da0ffaf2c95412393f072c330bd2c5e.tar.xz drakx-7d9973538da0ffaf2c95412393f072c330bd2c5e.zip |
- fix duplication of sec level setting:
merge any::get_secure_level() with
secure::msec::get_secure_level()
- move security level functions from secure::msec
to secure::level
- uses secure::level in install_steps
- fix duplication of security level labels
- draksec: use same strings in drakx, got nice
translations
- get_default_checks(): make it more readable
Diffstat (limited to 'perl-install/security/level.pm')
-rw-r--r-- | perl-install/security/level.pm | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/perl-install/security/level.pm b/perl-install/security/level.pm new file mode 100644 index 000000000..7ea08a52c --- /dev/null +++ b/perl-install/security/level.pm @@ -0,0 +1,47 @@ +package security::level; + +use strict; +use common; + +my %level_list = ( + 0 => N("Welcome To Crackers"), + 1 => N("Poor"), + 2 => N("Standard"), + 3 => N("High"), + 4 => N("Higher"), + 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 get { + cat_("$::prefix/etc/profile") =~ /export SECURE_LEVEL=(\d+)/ && $1 || #- 8.0 msec + cat_("$::prefix/etc/profile.d/msec.sh") =~ /export SECURE_LEVEL=(\d+)/ && $1 || #- 8.1 msec + ${{ getVarsFromSh("$::prefix/etc/sysconfig/msec") }}{SECURE_LEVEL} || #- 8.2 msec + $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 ? $run_level : 3, "\n"; + require run_program; + run_program::rooted($::prefix, "/usr/sbin/msec", $run_level ? $run_level : 3); +} + +1; |