Re: access control.

From: Rich Gibbs (rgibbs_at_REMOVEhis.com)
Date: 05/13/04


Date: Thu, 13 May 2004 12:26:54 -0400

KIRAN MN said the following, on 05/13/04 02:16:
> Rich Gibbs <rgibbs@REMOVEhis.com> wrote in message news:<40a28abf@news101.his.com>...
>
>>KIRAN MN said the following, on 05/12/04 06:34:
>>
>>>Hi,
>>>
>>>
>>> My os is Aix-4.3.2. C compiler is 6.1.0.0.
>>> i have a commercial software sitting in directroy "dir".
>>> dir/a
>>> dir/b
>>> dir/c
>>>
>>> a,b and c are executables. In this say "a" is a GUI that in tern
>>>calls
>>> b and c
>>> while running. I don't want users to execute dir/a directly, I
>>>want then to use some program to access dir/a .This program
>>>while
>>> running it will create temporary files and output files.
>>>
>>> If i write a set-uid program to access control this, then
>>>temporary
>>> files
>>> that gets created will be in effective user id.
>>>
>>> What i want is users must execute dir/a through a purticular
>>>program,they are not allowed to run directly setting path,
>>>while
>>> running their effective uid must be equal to real uid(This is
>>>for
>>> temporary files that gets created).
>>>
>>> Is there any method to acheive this?
>>> Please help me
>>>
>>
>>In general, yes. Most Unix/Linux versions have the "Saved SetUID"
>>feature (_POSIX_SAVED_IDS is true). I don't have access to AIX docs,
>>but this has been around since SysVR4 and BSD4.3+, so I expect it's
>>there; my Debian Woody box has it. This allows you to drop a
>>privileged ID, and then to restore it later, if necessary.
>>
>>man 2 setuid
>>
>>for the details.
>
>
> yes "Saved setUID" exists in aix, but what is the use. If my setuid
> program is
> say "entry" and has setuid bit set to user admin. Software executables
> say dir/a dir/b and dir/c have execute permission only for "admin".
>
> On executing "entry" program a user becomes root and he will be able
> to execute
> "dir/a", at this point of time user will be having ruid as same as
> user, but euid as "admin". now when dir/a creates files it will be in
> owner ship of "admin". I don't want this.
>
> In this where can i use "Saved setUID" feature. If i change euid
> before invoking
> dir/a then i will be not able to invoke dir/a.
>

Well, if the 'entry' program needs to start off as 'admin', and you want
the temporary files to be created using the actual user ID, then you are
going to have to switch the effective user ID at some point. It seems
to me that you have two options:

   -- Open the files in the 'entry' program, then change EUID before
invoking 'a' and giving it the open file descriptor(s).

   -- Invoke 'a' (or 'b' or 'c'), then change the EUID. Obviously this
means each of the programs must be modified.

I really can't make any sensible suggestion about making the choice,
since I don't know what the applications do.

(Note that if 'entry' is suid 'root' then it could create the files,
then 'chown' them to the user. I do NOT recommend doing this unless
there is no other way: the casual proliferation of things that run as
'root' is a Very Bad Idea.)

-- 
Rich Gibbs
rgibbs@his.com


Relevant Pages

  • Re: Kernel Panic (using make-kpkg & dpkg)
    ... Kernel panic - not syncing: VFS: Unable to mount root fs on ... I see that the device entry for the defaultkernel is the same. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Protection from the dreaded "rm -fr /"
    ... >>John Beck, who works for Sun, has posted an entry in his blog yesterday ... The reason I liked this idea is that root has zillions of other ways to ... A single extra space can really wreak havoc in this case. ...
    (freebsd-hackers)
  • Re: [SLE] Postfix question
    ... Just looked in /var/spool/mail and the root entry in there is huge - ... instructions above - although on the incoming I left blank the bit about ... There was no 'root' entry in the aliases list, ...
    (SuSE)
  • Re: Skype on SUSE 10.0
    ... >> konqueror in adminstrator mode (menu entry somewhere under system), ... >> user instead of root ... numbers so you would know which one the usb phone is, ...
    (alt.os.linux.suse)
  • Re: write/read to windows drives
    ... I went to the web site about samba previously posted and I took a piece ... at your /etc/passwd entry, the 4th field is the numeric group-id, now ... users - allow anyone to mount/unmount (otherwise only root can do it) ... there are two other drives I was trying to do the same thing to and the ...
    (alt.os.linux.suse)