Re: [SLUG] Apache execute a CGI as another user

2006-05-16 Thread Peter Rundle
Peter Chubb wrote: Ah. Posix semantics. Instead, do setreuid(geteuid(), -1); that should fix it. /home/prundle> ./suidexec id Executing Command 'id' uid=502(matlab) gid=501(prundle) groups=502(matlab) context=user_u:system_r:unconfined_t :-) /home/prundle> ./suidexec /home/matlab/p

Re: [SLUG] Apache execute a CGI as another user

2006-05-16 Thread Peter Chubb
> "Peter" == Peter Rundle <[EMAIL PROTECTED]> writes: Peter> Peter Chubb wrote: >> So do a setuid(geteuid()) in there... Peter> Que? I don't follow, do you mean the "C" should look like; Peter> setuid(geteuid()); execlp(argv[1],argv[2]); Yes, that's right. Peter> I tried the above, but

Re: [SLUG] Apache execute a CGI as another user

2006-05-16 Thread Matthew Hannigan
On Tue, May 16, 2006 at 01:46:30PM +1000, Peter Rundle wrote: > > in the source and now when it runs we see a different result > > $ ./suidexec id > Executing Command 'id' > uid=501(prundle) gid=501(prundle) euid=502(matlab) groups=502(matlab) > context=user_u:system_r:unconfined_t > > But it d

Re: [SLUG] Apache execute a CGI as another user

2006-05-15 Thread Peter Rundle
Peter Chubb wrote: So do a setuid(geteuid()) in there... Que? I don't follow, do you mean the "C" should look like; setuid(geteuid()); execlp(argv[1],argv[2]); ?? I tried the above, but no joy, "./suidexec id" still reports uid=501(prundle) gid=501(prundle) euid=502(matlab) P. -- SLUG -

Re: [SLUG] Apache execute a CGI as another user

2006-05-15 Thread Peter Chubb
> "Peter" == Peter Rundle <[EMAIL PROTECTED]> writes: Peter> Changed system(argv[1]); to execlp(argv[1],argv[2]); Peter> in the source and now when it runs we see a different result Peter> $ ./suidexec id Executing Command 'id' uid=501(prundle) Peter> gid=501(prundle) euid=502(matlab) groups

Re: [SLUG] Apache execute a CGI as another user

2006-05-15 Thread benjl
On Tue May 16, 2006 at 13:46:30 +1000, Peter Rundle wrote: > >Malcolm V wrote: > >>Read "man 3 system" as I suggested yesterday. > >Thanks Malcolm. > >>See "man 3 exec" for what you want. > >Changed > system(argv[1]); >to > execlp(argv[1],argv[2]); > >in the source and now when it runs we see a d

Re: [SLUG] Apache execute a CGI as another user

2006-05-15 Thread Peter Rundle
Malcolm V wrote: Read "man 3 system" as I suggested yesterday. Thanks Malcolm. See "man 3 exec" for what you want. Changed system(argv[1]); to execlp(argv[1],argv[2]); in the source and now when it runs we see a different result $ ./suidexec id Executing Command 'id' uid=501(prundle

Re: [SLUG] Apache execute a CGI as another user

2006-05-15 Thread Malcolm V
On Tuesday 16 May 2006 08:24, Peter Rundle allegedly wrote: > Can you explain to a mere mortal why the following doesn't work? > As a first step to your "trivial" challenge, I've written a simple C > routine to > > system ("do something"); Read "man 3 system" as I suggested yesterday. Of part

Re: [SLUG] Apache execute a CGI as another user

2006-05-15 Thread Peter Rundle
[EMAIL PROTECTED] wrote: > Gentlemen it should be absolutely trivial for the cgi to run a compiled program that is (a) suid to matlab (b) executes your script either as fork/exec or even system ("do something"); > James James, thanks for volunteering to solve this one ;-) . Can you explain to

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread jam
On Monday 15 May 2006 09:16, [EMAIL PROTECTED] wrote: > Dean Hamstead wrote: > > could you drop the command into a spool, then run it off a queue? > > Interesting idea. Can you point to any docs that describe how to set up a > batch queue in Linux al la VMS batch queue? > > > did you try setting th

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread Jamie Wilkinson
This one time, at band camp, Peter Rundle wrote: >Mike Lake scribed: >>What about if the apache script writes a small file in /tmp/matlab/ >>directory and the user process is looking at that directory every 30 >>seconds. If the user script sees the file, reads it, gets params from >>the file and

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread Jamie Wilkinson
This one time, at band camp, Peter Rundle wrote: >I'm looking for suggestions/recommendations for a way to run a command as a >specific user, but triggered from a web form submit button. The >corresponding action cgi runs as apache/apache, but I then need it to >trigger the running of a shell sc

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread Malcolm V
On Monday 15 May 2006 11:12, Peter Rundle allegedly wrote: > I vaguely recall that chmod +s is only valid for binaries as the command > being executed is bash, the script is just a data file to bash. I could be > wrong on this one though... This is correct. You can get around this by using a small

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread Peter Rundle
Mike Lake scribed: What about if the apache script writes a small file in /tmp/matlab/ directory and the user process is looking at that directory every 30 seconds. If the user script sees the file, reads it, gets params from the file and run. It drops the plot into a directory apache can read.

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread Michael Lake
Peter Rundle wrote: Sluggers, I'm looking for suggestions/recommendations for a way to run a command as a specific user, but triggered from a web form submit button. The corresponding action cgi runs as apache/apache, but I then need it to trigger the running of a shell script as another unpr

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread Michael Lake
Peter Rundle wrote: Sluggers, I'm looking for suggestions/recommendations for a way to run a command as a specific user, but triggered from a web form submit button. The corresponding action cgi runs as apache/apache, but I then need it to trigger the running of a shell script as another unpr

Re: [SLUG] Apache execute a CGI as another user

2006-05-14 Thread Peter Rundle
Dean Hamstead wrote: could you drop the command into a spool, then run it off a queue? Interesting idea. Can you point to any docs that describe how to set up a batch queue in Linux al la VMS batch queue? did you try setting the s(et)uid bit of the script? yeah didn't work. I placed the '

[SLUG] Apache execute a CGI as another user

2006-05-14 Thread Peter Rundle
Sluggers, I'm looking for suggestions/recommendations for a way to run a command as a specific user, but triggered from a web form submit button. The corresponding action cgi runs as apache/apache, but I then need it to trigger the running of a shell script as another unprivledged user. The