summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/draksec
blob: 8e17f8c548e1937339eb501977c240608b88265d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);

use common qw(:system :file);
use interactive;
use mouse;
use c;

local $_ = join '', @ARGV;

/-h/ and die "usage: draksec [--expert]\n";

$::expert = /-expert/ || cat_("/etc/sysconfig/system") =~ /^TYPE="?expert/m; #"
$::isStandalone = 1;

my $in = vnew interactive('su');

my %m = reverse (my %l = (
  0 => _("Windows(TM)"),
  1 => _("Poor"),
  2 => _("Low"),
  3 => _("Medium"),
  4 => _("High"),
  5 => _("Paranoid"),
));
delete @l{0,1,5} unless $::expert;

if (my $level = $in->ask_from_list('', 
_("Choose security level"), 
				   [ values %l ], $l{$ENV{SECURE_LEVEL}})) {
    my $w = $in->wait_message('', _("Setting security level"));
    $in->suspend;

    $ENV{LILO_PASSWORD} = ''; # make it non interactive
    system("/etc/security/msec/init.sh ". $m{$level});

    $in->resume;
}

$in->exit(0);