summaryrefslogtreecommitdiffstats
path: root/perl-install/security
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/security')
-rw-r--r--perl-install/security/main.pm65
1 files changed, 31 insertions, 34 deletions
diff --git a/perl-install/security/main.pm b/perl-install/security/main.pm
index 3d413edbd..65e346b7b 100644
--- a/perl-install/security/main.pm
+++ b/perl-install/security/main.pm
@@ -9,42 +9,40 @@ use log;
use security::msec;
use security::libsafe;
-sub basic_page {
- my ($prefix, $in) = @_;
- my $security = security::msec::get_secure_level('');
- my $libsafe = security::libsafe::config_libsafe('');
- my $sec_user = security::msec::config_security_user('');
- my $signal = 9;
-
- if(security::msec::choose_security_level($in, \$security, \$libsafe, \$sec_user, \$signal)) {
- log::l("[draksec] Setting libsafe activation variable to $libsafe");
- security::libsafe::config_libsafe('', $libsafe);
-
- log::l("[draksec] Setting security administrator contact to $sec_user");
- security::msec::config_security_user('', $sec_user);
-
-# my $w = $in->wait_message('', _("Setting security level"));
-# $in->suspend;
- $ENV{LILO_PASSWORD} = ''; # make it non interactive
- log::l("[draksec] Setting security level to $security");
- system "/usr/sbin/msec", $security;
-# $in->resume;
- }
- $signal;
-}
-
-sub functions_page {
- my ($prefix, $in) = @_;
+sub show_page {
+ my ($prefix, $in, $page) = @_;
my $signal = 9;
my $security = security::msec::get_secure_level('');
- my %functions = security::msec::get_options('', $security);
my $key = '';
+ my %options = ();
+ my ($sec_user, $libsafe) = '';
- if(security::msec::choose_options($in, \%functions, \$signal, $security)) {
- foreach $key (keys %functions) {
- security::msec::set_option('', $key, $functions{$key});
- }
+ if($page == 0) {
+ $libsafe = security::libsafe::config_libsafe('');
+ $sec_user = security::msec::config_security_user('');
}
+ elsif($page == 1) { %options = security::msec::get_options('', "functions"); }
+ elsif($page == 2) { %options = security::msec::get_options('', "checks"); }
+
+ if ($page == 2) {
+ if(security::msec::choose_checks($in, \%options, \$signal, $security)) {
+ foreach $key (keys %options) {
+ security::msec::set_check('', $key, $options{$key});
+ } } }
+ elsif ($page == 1) {
+ if(security::msec::choose_options($in, \%options, \$signal, $security)) {
+ foreach $key (keys %options) {
+ security::msec::config_option('', $key, $options{$key});
+ } } }
+ elsif ($page == 0) {
+ if(security::msec::choose_security_level($in, \$security, \$libsafe, \$sec_user, \$signal)) {
+ security::libsafe::config_libsafe('', $libsafe);
+ security::msec::config_security_user('', $sec_user);
+ $ENV{LILO_PASSWORD} = ''; # make it non interactive
+ log::l("[draksec] Setting security level to $security");
+ system "/usr/sbin/msec", $security;
+ } }
+
$signal;
}
@@ -61,9 +59,8 @@ sub main {
# signal 5 = users page
# signal 9 = quit
- if ($signal == 0) { $signal = basic_page($prefix, $in); }
- elsif ($signal == 1) { $signal = functions_page($prefix, $in); }
- }
+ $signal = show_page($prefix, $in, $signal);
+ }
}
1;