[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A little daemon



> I need to have a little daemon wich runs as root and receaves commands wich
> it executes and then 
> sends back the reult code of the commands. It should be very simple - no
> fancy stuff. 

I know you don't want to hear this (you told me below) but...

DO NOT DO THIS!!!!!!

please read on for a better solution :)
  
> I firstly thought about a little perl script sich listens to a Socket... Is
> this a good idea (please 
> don't tell me that its not a good idea to run such things as root but i need
> it and i wont be a 
> security risk :-)) )? I never did such things in perl... Can you give me

It is a Bad Idea(tm) to start solving problems like this in a way which
only works in your current situation.

It is a Good Idea(tm) to do things The Right Way(tm) so that when this
problem arises in a more security sensitive situation, you won't have
any worries..

> some hints? e.g how do i 
> detach wich a perl script from the console. What is the best communication
> method to use? 

Why not use key-based ssh authentication (no prompt for password) and
run the commands over ssh?

Perhaps if you provide a little more detail about what exactly you are
doing it would help..

Even though it is a Bad Idea(tm), I will answer your basic questions:

you can detach a perl script, like any other process, by running it as
'script &'..

this should be doable by writing a script which listens on a socket,
accepts a single line, runs it with popen() or whatnot (havent done perl
ina w hile) and sends its' stdout to the socket..

Better yet - it can be done with Python!!!  I would only approve of this
if it were done with Python, just because it would earn an extra cool
point and make me smile enough to forget what a Bad Thing(tm) to do this
is :)

anyway.. bad bad bad!!! use ssh to connect to the program's stdin!! :)

Cheers,

Justin

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: