[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ltib] LTIB sudo check fails with Sudo version 1.7.2

From: Stuart Hughes
Subject: Re: [Ltib] LTIB sudo check fails with Sudo version 1.7.2
Date: Thu, 09 Sep 2010 19:06:42 +0100
User-agent: Thunderbird (X11/20080707)

Hi Joe,

Please try the attached, I've changed the regex and now it works for me
with your data.  If it works, I'll check the same fix into CVS for ltib.

Regards, Stuart

Joe Hershberger wrote:
> On Mon, Sep 6, 2010 at 1:50 PM, Stuart Hughes <address@hidden> wrote:
>> I see the same format that you described on your email.  I'm guessing
>> that the newline was email client wrapping?
> Nope... that's being done by sudo.  It seems that it has been
> implemented in an unfortunate way.  Even when redirecting to a file,
> sudo wraps its output to the current console window width.
> Attached a file redirected from sudo -l
> -Joe
#!/usr/bin/perl -w

$cf = { rpm          => '/opt/ltib/usr/bin/rpm',
        path_std     => 
        username     => scalar(getpwuid($<)),


sub check_sudo_setup
    my ($hostrpm) = `PATH=$cf->{path_std} ; which rpm`;
    my $s = `yes "" 2>&1 | sudo -S -l 2>&1`;
    my $bre = '(?:\(root\)|\(ALL\))\s+(?:ROLE=\s+)?NOPASSWD:';
    my $hostrpm_ok = $s =~ /$bre.*[\s,]$hostrpm/ms;
    my $fsrpm_ok   = $s =~ /$bre.*[\s,]$cf->{rpm}/ms;
    my $all_ok     = $s =~ /$bre\s+ALL/ms,;
    return 1 if $all_ok;
    return 1 if $hostrpm_ok && $fsrpm_ok;

    die <<TXT;

I ran the command: sudo -S -l which returned:

This means you don't have sudo permission to execute rpm commands as root
without a password.  This is needed for this build script to operate correctly.

To configure this, as root using the command "/usr/sbin/visudo",
and add the following line in the User privilege section:

$cf->{username} ALL = NOPASSWD: $hostrpm, $cf->{rpm}

    return 1;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]