Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Oct 16, 2011 11:02 pm 
Offline
Junior Member

Joined: Sat Feb 21, 2009 6:25 pm
Posts: 26
I'm a new Linode customer.

I followed the LAMP install guide. I noticed that the "recommended setting" is to block Internet access for the root account.

How do I set things up so I can use the Windows mySQL GUI client, without opening up a potential security flaw?

Should I use phpmyadmin? Isn't that a potential security risk?


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 12:04 am 
Offline
Senior Member

Joined: Mon Aug 31, 2009 2:33 pm
Posts: 78
Location: The OC
MySQL Workbench is a great GUI tool for mysql. You'll want to tunnel the connection over ssh. That way you can keep access to mysql blocked from the internet.


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 1:42 am 
Offline
Junior Member

Joined: Sat Feb 21, 2009 6:25 pm
Posts: 26
I see now. I figured there was some trick.

Someone should update the LAMP install guide to make that bit clearer.


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 11:32 am 
Offline
Junior Member

Joined: Sat Feb 21, 2009 6:25 pm
Posts: 26
I have another question. Suppose I follow the instructions on this page.

Do I set up the new_user account so that it's only accessible on localhost? Or, do I set it up so that it's accessible anywhere? I assume localhost, because the connection goes through the tunnel?


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 12:39 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
If the computer you'll be accessing from has a static IP address (an IP that's always the same), you can create a new user that can only be used from that IP, e.g. on your Linode, log in to MySQL and do:
Code:
GRANT ALL PRIVILEGES ON database.* TO 'user_name'@'192.168.1.50' IDENTIFIED BY 'password';

Replace database, user_name (single-quote needed), and 192.168.1.50 (single quotes needed) as needed. The 'IDENTIFIED BY 'password'' bit is only needed if the database user you're using doesn't already exist (if he does, you don't need the 'IDENTIFIED BY' part since he already exists with a password, you're just giving the user permission to log in from IP address 192.168.1.50).

If your access computer's IP address is dynamic (it changes every so often), then doing this is a BAD idea.

Unfortunately, since I don't use Windows, I can't offer any other suggestions. phpMyAdmin can be a security risk, though it should be fine IF AND ONLY IF you use a very strong password for your databases root user and normal user, and you keep phpMyAdmin up to date, though if you're able to go through an ssh tunnel and you don't need to give database access to anybody else, the ssh tunnel would definitely be the best option.

_________________
Kris the Piki Geeker


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 1:16 pm 
Offline
Senior Member

Joined: Mon Aug 31, 2009 2:33 pm
Posts: 78
Location: The OC
Piki wrote:
If your access computer's IP address is dynamic (it changes every so often), then doing this is a BAD idea.


I think it's a bad idea to open direct connections to mysql at all. IIRC, by default connections to mysql are unencrypted - meaning it wouldn't be difficult for someone to eavesdrop on the connection.

@fsk, yes, only allow from localhost if you're going to be tunneling.

Also, if you choose to use phpMyAdmin... as Piki said, use strong passwords and keep it updated. Also limit where phpMyAdmin can be accessed from and use https otherwise your super secure password will be sent in the clear.


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 1:40 pm 
Offline
Junior Member

Joined: Sat Feb 21, 2009 6:25 pm
Posts: 26
I have a dynamic IP, so that's out. I'll go with tunneling.

I have another security question.

I'm confused about when I was configuring PuTTY. What prevents someone else from downloading PuTTY, and attempting to connect to my Linode as root?


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 2:16 pm 
Offline
Senior Member

Joined: Fri Jan 09, 2009 5:32 pm
Posts: 634
fsk wrote:
I have a dynamic IP, so that's out. I'll go with tunneling.

I have another security question.

I'm confused about when I was configuring PuTTY. What prevents someone else from downloading PuTTY, and attempting to connect to my Linode as root?


nothing. that's why you should not allow root to connect via ssh ever. you should also (if possible) only allow certificates via ssh, not passwords


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 2:22 pm 
Offline
Senior Member

Joined: Mon Dec 20, 2010 11:37 pm
Posts: 76
MySQL Workbench has already TCP over SSH config. You don't have to mess up with PuTTY.

http://dev.mysql.com/doc/workbench/en/wb-manage-db-connections-ssh.html


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 2:54 pm 
Offline
Junior Member

Joined: Sat Feb 21, 2009 6:25 pm
Posts: 26
What's the proper way to secure the root account? Where is the guide for this?


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 5:42 pm 
Offline
Senior Member

Joined: Fri Jan 09, 2009 5:32 pm
Posts: 634
fsk wrote:
What's the proper way to secure the root account? Where is the guide for this?


/etc/ssh/sshd_config

find PermitRootLogin and set to no


Top
   
 Post subject:
PostPosted: Mon Oct 17, 2011 10:01 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
An extra way to secure ssh is to use ssh keys. There's a program (I think it's called PuttyGen) to do this for Putty. It's not necessary so long as you use strong ssh passwords, but it can help keep people from trying to brute-force (guess) your ssh password. The downside is if you use your private key, you'll have to backdoor your Linode via Lish to upload a new public key.

_________________
Kris the Piki Geeker


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 9:45 am 
Offline
Senior Newbie

Joined: Sat Aug 07, 2010 12:57 pm
Posts: 16
These two guides may be of use to the original poster:

General SSH options:
https://help.ubuntu.com/community/SSH/O ... onfiguring

SSH Key Auth:
https://help.ubuntu.com/community/SSH/OpenSSH/Keys

If you set up SSH to only allow key authentication, only people with your specific SSH key file can connect, even if they know your password. On Windows, I personally run a VirtualBox VM of Debian locally to generate keys (so I don't have to bother with the Windows tools), and then use the Puttygen tool to convert my SSH key into something Putty can use.

It'll take you a little while to get set up, but once you have it figured out, you'll have rock-solid SSH security :)

And as other users have mentioned, there are zero good reasons to allow direct MySQL connections. It sounds like MySQL does have built-in SSH support, however if you learn how to tunnel manually over Putty, you can forward anything (such as testing Apache over SSH before allowing general connections, etc). Either option works.


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


Who is online

Users browsing this forum: No registered users and 1 guest


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