Operating System - HP-UX
1752472 Members
7064 Online
108788 Solutions
New Discussion юеВ

Re: normal user core dumping after calling setresuid

 
Laurent Menase
Honored Contributor

Re: normal user core dumping after calling setresuid

just a remark, this is to be done before the process core dump
Aviansh
Advisor

Re: normal user core dumping after calling setresuid

Thanks a lot laurent, it works..

But this can only be used temporarily for the debugging purpose, as it breaches the unix security...
Laurent Menase
Honored Contributor

Re: normal user core dumping after calling setresuid

you can try to do it with a launcher which has the setuid bit


promoter.c
main()
{
setreuid(0,0);
execl("/mypath/commandtopromote","commandtopromore","param1",....,0);
}

I am not sure that the commandtopromote will be pink too.

or the other way if you need promotion just temporarily:
1 simple process with promotion to perform restricted ops.
1 process as normal user which makes the main operations
and the 2 processes talk using unix domain sockets, pipes, or other

- or simply launching it if it is really occasionnally. - like grandpt() does for instance.



Else if you are happy, don't forget points.


Aviansh
Advisor

Re: normal user core dumping after calling setresuid

Hi Laurent,

Can you please tell me how hp-ux login/shell does the same thing.

Because the normal user sometimes are given root permission(like passwd file updation), yet they dump core..!!!

Regards
-Avinash
Aviansh
Advisor

Re: normal user core dumping after calling setresuid

I mean to say..

Normal users can generate core from his login shell..
Then why not Pink Processes.?
Laurent Menase
Honored Contributor

Re: normal user core dumping after calling setresuid

Hi Avinash,
no, passwd, login generate a core dump only if they are started by root user.

so a way to do it:
main(c,v)
int c;
char**v;
{
if(getuid()!=0)
{
printf("need to recall");
setreuid(0,0);
execvp(v[0],v); /* restart the process as really root user */
}
printf ("%d\n",getuid());
kill(getpid(),10);
sleep(10);
}

it will generate a core, but all the process is executed as root.
Laurent Menase
Honored Contributor

Re: normal user core dumping after calling setresuid

or
main(c,v)
int c;
char**v;
{
if(getuid()!=10)
{
printf("need to recall");
setreuid(10,10);
execvp("./r",v);
}
printf ("%d\n",getuid());
kill(getpid(),10);
sleep(10);
}

cc k.c -o k
cp k r
chmod 6555 k
chmod 555 r

./k setuid to 10 10 then exec r which is the same program but without setuid bit set.
so not pink
Aviansh
Advisor

Re: normal user core dumping after calling setresuid

my daemon is not having 6555 permission. It has 555 permissions.

when we connect to this server(daemon) using non-root id it forks a copy of itself to serve the request.

we are using setresuid in our code and inside the signal handler.
Aviansh
Advisor

Re: normal user core dumping after calling setresuid

Hi Laurent,

I have some confusion over the concept of Pink process..

a process is called a pink process when it becomes a privileged user or if it executes setresuid ..??

Please clarify on this..

Regards
-Avinash
Dennis Handly
Acclaimed Contributor

Re: normal user core dumping after calling setresuid

>I have some confusion over the concept of Pink process.

Don explained what it (pinko) meant in your other thread.
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1315932#tdIdName5

(This is why you shouldn't have created another related thread.)