All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvind <lists@duh-uh.com>
To: linux-admin@vger.kernel.org
Subject: Re: Sudo
Date: Sun, 22 Jun 2003 09:40:10 +0530	[thread overview]
Message-ID: <20030622041010.GA24271@localhost> (raw)
In-Reply-To: <20030619210801.298A0445D@sitemail.everyone.net>

[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]

Hi,

>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> But the problem is , say user1 wants to install abc.rpm and as
> he is restricted , he/she cannot install. But there is one way.
> If the user changes the name of the rpm, say "cp abc.rpm
> xyz.rpm" and then user1 can easily install xyz.rpm . And if you
> login as root and query for the package abc.rpm, it says
> abc.rpm is installed , even though the user has installed it
> with a different name. 

Here's one way to do it, using an external script, though:

1. Create a file (say reject.rpms) with a newline delimited list
   of rpm regexs to reject. This is a list of the real rpm names.
   Ex:

    $ cat reject.rpms
    abc.*
    pqr.*

2. Then, write a small shell script like the one attatched as a
   wrapper to rpm (say userrpm).

3. Give root permission to this script in /etc/sudoers, without
   password.

   user  ALL=(root) NOPASSWD:/usr/local/bin/userrpm

Your users will have to use this as:

$ sudo userrpm -Uvh abc-1.0.0.rpm

Well, as has been already been mentioned many times in this
thread, this is extremely insecure. It's not very difficult to
get past even this check. I wouldn't recommend using this.

Arvind
-- 
   .~.
   /V\
  // \\
 /(   )\
  ^`~'^




[-- Attachment #2: userrpm --]
[-- Type: text/plain, Size: 520 bytes --]

#!/bin/ksh

# Get a list of rpms from the command line. That is, ignore all rpm
# options and so on.
rpmlist="`echo $* | tr -s ' ' '\n' | grep '\.rpm$'`"

for each in $rpmlist
do
    # Get the actual rpm name.
    rpmname="`rpm -qp "$each" --qf '%{NAME}'`"
    # Check against given list of rpms to reject.
    retval="`echo $rpmname | grep -v -q -f reject.rpms; echo $?`"
    if [ "$retval" != 0 ]
    then
        echo "You don't have permission to install $each ($rpmname)."
        exit 1
    fi
done

exec rpm "$@"

  reply	other threads:[~2003-06-22  4:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-19 21:08 Sudo Pradeep Kumar Sadanapalli
2003-06-22  4:10 ` Arvind [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-03-03 17:56 sudo Clarkson, Mike R (US SSA)
2003-06-19 17:09 Sudo Subhash Bhushan
2003-06-18  3:16 Sudo Pradeep Kumar Sadanapalli
2003-06-18  4:50 ` Sudo Glynn Clements
2003-06-18 14:28 ` Sudo Brian Davidson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030622041010.GA24271@localhost \
    --to=lists@duh-uh.com \
    --cc=linux-admin@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.