Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Aug 18, 2011 3:57 am 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
What is the best way to secure database server?


Top
   
 Post subject:
PostPosted: Thu Aug 18, 2011 10:22 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Sanitize all your inputs?


Top
   
 Post subject:
PostPosted: Thu Aug 18, 2011 1:26 pm 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
Quote:
Sanitize all your inputs?

I am not sure I understand what you mean...

via ufw, iptables, and SELinux

Should I close port 80 on it?


Top
   
 Post subject:
PostPosted: Thu Aug 18, 2011 3:15 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
For the server itself, don't expose it to the Internet. For MySQL, ensure bind-address is either 127.0.0.1 (for standalone use) or your private IP address (if other machines will be accessing it), and make sure you have firewall rules set up to only allow trusted things to reach it. (The Linode "private" network is private to you and thousands of other random Linodes, so don't trust everything from there, either!)

Ensure that all connections to the database server require a password (or some other secure credential, NOT just a username and an IP address). Also make sure that each application/user has their own username, and that they only have access to the stuff they need. (If a program runs only SELECT queries on one database, just give it SELECT privileges to that database, and no access to other databases.)

Also, read about, and understand how to recognize and avoid, SQL Injection Vulnerabilities, especially if you are writing your own code. NEVER do something like this with user input:

Code:
$offset = $argv[0]; // beware, no input validation!
$query  = "SELECT id, name FROM products ORDER BY name LIMIT 20 OFFSET $offset;";
$result = pg_query($conn, $query);

(example borrowed from here)

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group