On 07/19/2011 12:22 AM, Michael_Schilli via RT wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=69561 >
>
> On Mon Jul 18 22:55:06 2011, lightsey wrote:
>> The defaults for the pidfile and logfile and predictable filenames under
>> /tmp. These are trivial to exploit on a multiuser system to overwrite
>> arbitrary files, trick someone into killing arbitrary processes, prevent
>> a daemon from starting, etc.
>
> Thanks, yeah, I've always wanted to fix that ... here's a patch that
> puts them into the current directory (serious daemons will specify
> locations in /var/ explicitly, but it's good practice to use a
> reasonable default):
>
>
https://github.com/mschilli/app-daemon/tree/41babec7a67b7b7942058a2a3c180c1473b12c27
Looks reasonable. If you really want to avoid /var/log and /var/run as
defaults, I'd suggest using $HOME instead of ./ though. Having a pid
file doesn't make much sense if it's operation is dependent on the
current directory.
Show quoted text
I'd suggest using sysopen() for the pid file if you want to set the
permissions explicitly. Any subprocesses are going to inherit the umask
you're setting. It's odd IMHO for a module to change the umask globally
without any indication in the POD or ability to control it.
Thanks for the fast response.