Changeset 1715


Ignore:
Timestamp:
Mar 10, 2013, 6:44:20 PM (5 years ago)
Author:
bruno
Message:
  • Adds a parameter for the mode of the sudoers file instead of hard-coding
Location:
devel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1714 r1715  
    683683# Distros may have different modes for /etc/sudoers
    684684ossudoersmode default = 440
    685 ossudoersmode suse-10.2 = 640
     685ossudoersmode suse-10.0 = 640
     686ossudoersmode suse-10.1 = 640
     687ossudoersmode opensuse-10.2 = 640
     688ossudoersmode sles-9 = 640
     689ossudoersmode sles-10 = 640
    686690
    687691
  • devel/pb/bin/pb

    r1714 r1715  
    24102410    # For VE we need to change the owner manually
    24112411    if ($cmt =~ /^VE/) {
     2412        my $sudomode = pb_distro_get_param($pbos,pb_conf_get("ossudoersmode"));
    24122413        my $res = pb_system("$shcmdroot sed -i '/requiretty/d' /etc/sudoers","Removing potential requiretty in sudoers","quiet");
    2413         pb_system("$shcmdroot sed '/requiretty/d' /etc/sudoers > /tmp/sudoers.new ; mv /tmp/sudoers.new $tpdir/tmp/sudoers.new ; $shcmdroot mv /tmp/sudoers.new /etc/sudoers ; $shcmdroot chown root:root /etc/sudoers ; $shcmdroot chmod 440 /etc/sudoers","Removing again potential requiretty in sudoers as sed -i failed") if (($res ne 0) && (-f "$tpdir/etc/sudoers"));
     2414        pb_system("$shcmdroot sed '/requiretty/d' /etc/sudoers > /tmp/sudoers.new ; mv /tmp/sudoers.new $tpdir/tmp/sudoers.new ; $shcmdroot mv /tmp/sudoers.new /etc/sudoers ; $shcmdroot chown root:root /etc/sudoers ; $shcmdroot chmod $sudomode /etc/sudoers","Removing again potential requiretty in sudoers as sed -i failed") if (($res ne 0) && (-f "$tpdir/etc/sudoers"));
    24142415        pb_system("$shcmd \"sudo $chowncommand -R $mac $tdir\"","Adapt owner in $tdir to $mac");
    24152416    }
     
    34153416EOF
    34163417    }
     3418    my $sudomode = pb_distro_get_param($pbos,pb_conf_get("ossudoersmode"));
    34173419    print SCRIPT << 'EOF';
    34183420close(PBOUT);
    34193421rename("$file.new",$file);
    3420 chmod 0440,$file;
     3422EOF
     3423    print SCRIPT << "EOF";
     3424chmod 0$sudomode,\$file;
    34213425
    34223426EOF
     
    34373441# We may need a proxy configuration. Get it from the local env
    34383442pb_apply_conf_proxy($pbos);
    3439 
    3440 # Suse wants sudoers as 640
    3441 if ((($pbos->{'name'} eq "sles") && (($pbos->{'version'} =~ /10/) || ($pbos->{'version'} =~ /9/))) || (($pbos->{'name'} eq "opensuse") && ($pbos->{'version'} =~ /10.[012]/))) {
    3442     chmod 0640,$file;
    3443 }
    34443443
    34453444# First install all required packages
Note: See TracChangeset for help on using the changeset viewer.