Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Uhm, running a Ruby script as root? No...

If you're running it on Linux, use iptables to redirect the port to something you can use without root: http://www.cyberciti.biz/faq/linux-port-redirection-with-ipt...



I'm all for avoiding running things as root, but what does it being written in Ruby have to do with it?


It probably has a greater attack surface that can be exploited. The advantage of iptables is that it does the barest minimum at a high privilege level: http://en.wikipedia.org/wiki/Principle_of_least_privilege


Beware that there is no consensus that this is a good thing.

From Daniel Bernstein(qmail creator) at http://cr.yp.to/qmail/qmailsec-20071101.pdf

"I have become convinced that this “principle of least privilege” is fundamentally wrong. Minimizing privilege might reduce the damage done by some security holes but almost never fixes the holes. Minimizing privilege is not the same as minimizing the amount of trusted code, does not have the same benefits as minimizing the amount of trusted code, and does not move us any closer to a secure computer system."


I feel that fixing the security holes has little to do with reducing the damage done due to increased attack surface.

If you're a software developer who is not doing security research, and who is mainly interested in some functionality offered by a module, you'd be better off giving the module exactly the privileges it needs, not more and not less. If not, wouldn't OS's run all user-space programs in ring-0? (Maybe I am stretching it a bit)

If Bernstein meant that this principle has been misquoted/abused/understood in all wrong ways (like most of the "premature optimization" quotes), then perhaps it makes some sense. :)


There's no consensus that "reducing the damage done by some security holes" is a good thing? Bernstein mentions it as a distraction (which may be true), but it's better than doing nothing.


Nothing against Ruby specifically, 'though I guess I do have a prejudice (in terms of security) against interpreted languages in general compared to something written in C.


Dumb question: wouldn't it be more secure to use languages that are immune to C issues like buffer overflows?


That's actually a good question. The lack of buffer overflow vulnerabilities does make interpreted languages safer to a point. Still anything that listens on an open port shouldn't run as root, there are still plenty of vulnerabilities besides buffer overflows out there.


At least they didn't provide a one-line install from a non-https server, too.

Just use "curl http://www.example.com/install_this.sh | sudo sh"!


or start as root, bind to the port and then drop privileges, but it's easier said that done properly. i'm no ruby expert either.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: