LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Accounts / security tips ?

Reply
 
Thread Tools Display Modes
  #1  
Old 09-25-2006, 04:06 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Default Accounts / security tips ?

Hi!

I'm willing to learn more about the recommended way(s) to setup the various accounts and rights etc on a LSWS+Rails deployment platform.

Here's my configuration:
- ubuntu 6.06 on a dedicated box
- capistrano 1.2.0 and rails 1.1.6
- the latest LSWS / free edition is up and running (I'm about to install the LSAPI gem), running as nobody (the default in the LSWS installation), on ports 8088 and 7080 (default)
- SSH and LSWS admin access is restricted by IP

I'm using an admin user (= one who sudoes on demand) under capistrano.

Should I create a custom user instead of nobody ? Should I use suExec ? Is there anything else recommended ?

Any tips / caveats are most welcome!

cheers

Thibaut

Last edited by thbar; 09-25-2006 at 04:07 AM.. Reason: typo
Reply With Quote
  #2  
Old 09-25-2006, 09:10 AM
xing xing is offline
LiteSpeed Staff
 
Join Date: Oct 2003
Location: Los Angeles, California
Posts: 380
1) Security through minimal configuration possible to reduce human/system errors.

Remove any and all unused external application, and listeners.

2) Instead of nobody use a custom user like "lsws" just for ease of management sake. There could be other processes on the system running as nobody.

3) Use suEXEC. Create a user just for ruby/rails.

http://www.litespeedtech.com/support...api_php_suexec

4) Block ANY and ALL administrative urls/links/paths to your general applicatioin via the public port/listener. For example, if your ruby app binds http://toast.com/admin/ to the admin interface, block access to it via context rules or remove /admin/ routing completedly from the rail app.

Just because the admin panel is password protected doesn't mean it's secure.

Security is different for everyone so mix and match your personal paranoia with practical solutions. Paranoia is not a bad word when it comes to security. =)
Reply With Quote
  #3  
Old 09-25-2006, 09:27 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Hi Xing

thanks a lot for the whole list, it's really appreciated!

One last question before I proceed: how would you recommend to setup the access rights of the rails code under that setup ? Should the files be owned by the dedicated rails user you describe ?

cheers

Thibaut
Reply With Quote
  #4  
Old 09-25-2006, 09:53 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
All files can be owned by the rails user or only let a few directories to be owned by rails user to give better security.

When LSWS start a Rails app in SuEXEC mode, it uses the owner of public folder, so, you can create a user for each of your rails application if you want, and you need to make 'public', 'log', 'tmp' owned by the user you created, other folder can be owned by root or other user as long as it is readable to the rails user. It will give you the best security.
Reply With Quote
  #5  
Old 09-25-2006, 09:55 AM
xing xing is offline
LiteSpeed Staff
 
Join Date: Oct 2003
Location: Los Angeles, California
Posts: 380
Yes. The easiest way is to create a new user each ruby app. For example, "rblog" if it's a ruby rails blog. Just do chown -R rblog:rblog on the root directory of the rails app. If suEXEC is properly configured, the ruby process will launch as "rblog".
Reply With Quote
  #6  
Old 09-26-2006, 02:30 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Perfect. Thanks!

Thibaut
Reply With Quote
  #7  
Old 09-26-2006, 08:35 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Quote:
Originally Posted by xing View Post
4) Block ANY and ALL administrative urls/links/paths to your general applicatioin via the public port/listener. For example, if your ruby app binds http://toast.com/admin/ to the admin interface, block access to it via context rules or remove /admin/ routing completedly from the rail app.
ons. Paranoia is not a bad word when it comes to security. =)
Is it fine if I have firewall rules to forbid access to the litespeed admin except for a few trusted IP addresses, and if I have IP restrictions as well under the litespeed admin context ?

cheers

Thibaut
Reply With Quote
  #8  
Old 09-26-2006, 09:01 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
I've also created a new Rails context (same values as the one created by EasyRailsWithSuEXEC, but with URI = '/admin' and IP restrictions, and placed it first in the chain).

Is that what you meant ?

thanks!

Thibaut
Reply With Quote
  #9  
Old 09-26-2006, 11:57 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Quote:
Is it fine if I have firewall rules to forbid access to the litespeed admin except for a few trusted IP addresses, and if I have IP restrictions as well under the litespeed admin context ?
That's fine.

Quote:
I've also created a new Rails context (same values as the one created by EasyRailsWithSuEXEC, but with URI = '/admin' and IP restrictions, and placed it first in the chain).
If you rails application is mounted at URI '/', URI '/admin' probably does not work if you just add it as "Rails" context, you need to add a "static" context with URI "/admin", add access rules, "ErrorDocument 404 /dispatch.lsapi" in "Apache style configruation".
Anyway, if '/admin' is password protected, you don't have to do that.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:33 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.