From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: where to chmod socket file?
Date: Thu, 12 Nov 2009 18:03:52 -0800 [thread overview]
Message-ID: <20091113020351.GA5577@dcvr.yhbt.net> (raw)
In-Reply-To: <cfbcd2f00911121536rd0582b8u961f7f2a8c6e546a@mail.gmail.com>
Suraj Kurapati <sunaku@gmail.com> wrote:
> Hello,
>
> I set the socket for my app to reside in /tmp/ because my app's
> Capistrano deploy directory is NFS-mounted:
>
> listen '/tmp/my_app.sock'
>
> That socket file is being created with mode 0777 + sticky bit. I
> don't want others to accidentally delete or write to this socket file,
> so I added the following line to my before_fork() block:
>
> before_fork do |server, worker|
> File.chmod 0600, '/tmp/my_app.sock'
> # ...
> end
>
> Is there a better place to put this chmod? Or maybe tell unicorn to
> create the socket with mode 0600?
Hi Suraj,
That's probably the best place to put chmod for now... I could be
persuaded to add a :umask option for listen. E.g.:
listen '/tmp/my_app.sock', :umask => 0077
On the other hand, I don't think it's even possible for others to
accidentally delete the socket if it's in /tmp (the directory itself
should be sticky, not the socket file).
I don't think world-read/writability is a problem for deployed apps.
Making sockets world-read/writable fits the model of localhost-bound TCP
sockets better: it's one step easier for people to port/change existing
testing/monitoring tools from the TCP ones.
Also, in my experience with FastCGI deployments, a less permissive umask
was often a source of breakage/confusion for FastCGI apps. TCP sockets
don't have this problem, and I've seen people prefer it for that reason
alone.
--
Eric Wong
next prev parent reply other threads:[~2009-11-13 2:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-12 23:36 where to chmod socket file? Suraj Kurapati
2009-11-13 2:03 ` Eric Wong [this message]
2009-11-15 0:24 ` Eric Wong
2009-11-15 1:52 ` Suraj Kurapati
2009-11-30 22:34 ` Suraj Kurapati
2009-12-01 0:41 ` Eric Wong
2009-12-01 1:36 ` Suraj Kurapati
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091113020351.GA5577@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=mongrel-unicorn@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).