Starting qmail from perl script 
Author Message
 Starting qmail from perl script

I need users in a certain group to be able to restart Qmail (after editing
files in /var/qmail/control). So far I have had a very frustrating time with
this.

It seems that the only way Qmail will start is with the exact syntax
provided in the documentation -

  csh -cf 'qmail-start ./Mailbox splogger qmail &'

Nothing else that I've tried will work, and I must admit I don't understand
why.

So anyway, I can't just stick that in a shell script and +s it because Linux
doesn't allow suid scripts. I can't put it in a Perl program because no
combination of permissions would please csh. The only way I managed to get
it to work at all was to write a C program that setuid(0) then called that
does this with system(). The problem with that is, when the Perl program
finishes, Qmail dies with it. If I run my C program from the command line,
Qmail is happy forever.

How would I detach Qmail from any dependency on the Perl script, OR, is
there a better way to do this whole thing?

Thanks very much for any ideas.

miguel



Wed, 24 Jan 2001 03:00:00 GMT  
 Starting qmail from perl script

Quote:
> I need users in a certain group to be able to restart Qmail (after
> editing files in /var/qmail/control).
> It seems that the only way Qmail will start is with the exact syntax
> provided in the documentation -

>   csh -cf 'qmail-start ./Mailbox splogger qmail &'

And why should you want to start it in an undocumented way? :-)

Quote:
> So anyway, I can't just stick that in a shell script and +s it because
> Linux doesn't allow suid scripts.

Good for Linux!

Quote:
> I can't put it in a Perl program because no
> combination of permissions would please csh.

Naaaaah. Perl can do it! If nothing else, you can pass those args to csh,
and let it start qmail.

Quote:
> The only way I managed to get it to work at all was to write a C
> program that setuid(0) then called that does this with system(). The
> problem with that is, when the Perl program finishes, Qmail dies with
> it.

Why not do is from a set-id Perl program? (Read perlsec, though.) You'll
probably want to use fork-and-exec, rather that system. Hope this helps!

--
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



Fri, 26 Jan 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Debug a forked/exec Perl script started from another Perl script

2. perl scripts hangs while starting httpd server within other script

3. Sending attachments with qmail and perl

4. qmail - perl

5. qmail trigger code ported to Perl

6. QMAIL AND PERL

7. Taint and regexps [was: How to start your Perl CGI script]

8. Perl for Win32: Starting and killing second script?

9. How to start a non-terminating program from a CGI perl script

10. Starting Perl script

11. makehomepage - Perl script to get a user started

12. starting/stopping batch scripts with Perl

 

 
Powered by phpBB® Forum Software