summaryrefslogtreecommitdiffstats
path: root/perl-install/security/level.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/security/level.pm')
-rw-r--r--perl-install/security/level.pm47
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;