News for hackers. Stuff that matters.
Re:G-WAN - Web Application Server by ers35 on Thursday June 14, 2012 @02:17AM (#4110086)
> That this is termed "an optimization" terrifies the shit out of me.

What word do you suggest I use to describe configuring a program to have access to more sockets?

> Even moreso than the whole "hey, run it as root, broseph!" part.

In daemon mode, G-WAN drops privileges to the user and group of your choosing.

Re:G-WAN - Web Application Server by pjscott on Thursday June 14, 2012 @03:28AM (#4110247)
This is a little off-topic, but does it strike anybody else as weird that we're still writing this kind of code in our servers instead of using an external utility? Personally, I would probably just write something like:

    sudo chpst -u gwan:gwan -o 100000 ./gwan
This uses the chpst utility from runit to do pretty much exactly what you described: set uid/gid, change the file descriptor limit, drop privileges, and execute ./gwan. For similar reasons, it feels crazy that people still manually write code to handle daemonization and pidfile handling, when there are easy tools that will handle that for you, and generally do a really good job of it. Isn't that the Unix Way?
Re:G-WAN - Web Application Server by eropple on Thursday June 14, 2012 @01:28PM (#4112469)
It might be off-topic, but I'd never used chpst before. That one's going in the toolbox. Thank you. :-)
Re:G-WAN - Web Application Server by eropple on Thursday June 14, 2012 @09:20AM (#4111175)
> What word do you suggest I use to describe configuring a program to have access to more sockets?

Like I said, "terrifying" is a good one. Reserving blocks of sockets in that sort of size is notably odd and from a performance standpoint it's pretty hard to argue that it's necessary.

> In daemon mode, G-WAN drops privileges to the user and group of your choosing.

I would assume that it would setuid down to something sane, sure, but that's not the WTF part: it's that I'm supposed to run closed-source code by some guy as root on my server machines.

Re:G-WAN - Web Application Server by ers35 on Thursday June 14, 2012 @04:48PM (#4113443)
G-WAN is not reserving sockets, it is being given access to more file descriptors. Any application which uses a large amount of file descriptors requires this.
Re:G-WAN - Web Application Server by eropple on Friday June 15, 2012 @01:17PM (#4117528)
Okay, then maybe you should have said that in the first place.