summaryrefslogtreecommitdiffstats
path: generated by cgit v1.2.1 (git 2.21.0) at 2024-08-17 12:00:48 +0000
#n28'>28 29 30 31 32 33 34 35 36 37 38 39
#!/usr/bin/perl

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

use standalone;     #- warning, standalone must be loaded very first, for 'explanations'

use common;
use interactive;
use any;
use c;

local $_ = join '', @ARGV;

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

$::expert = /-expert/ || cat_("/etc/sysconfig/system") =~ /^CLASS="?expert/m; #"
$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;

my $in = 'interactive'->vnew('su', 'security');

begin:
$::isEmbedded and kill USR2, $::CCPID;

my $security = any::get_secure_level('');
my $libsafe = any::config_libsafe('');

if (any::choose_security_level($in, \$security, \$libsafe)) {

    any::config_libsafe('', $libsafe);

    my $w = $in->wait_message('', _("Setting security level"));
    $in->suspend;
    $ENV{LILO_PASSWORD} = ''; # make it non interactive
    system "/usr/sbin/msec", $security;
    $in->resume;
}

!$::isEmbedded ? $in->exit(0) : kill(USR1, $::CCPID);
goto begin;