Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: mysql tunnel
PostPosted: Sun Jun 03, 2012 8:59 pm 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
followed instructions here
http://library.linode.com/databases/mys ... ssh-tunnel

When I start the script I get
ssh: connect to host domain.com port 22:Connection refused

since I am not using port 22 to ssh, the tunnel script gives me error. How can I fix this? Where and how can I add the port number I am using to the script?

I tried
$remote_host = "domain.com:2222";

that didnt work.

??

thank you


Top
   
 Post subject:
PostPosted: Sun Jun 03, 2012 9:07 pm 
Offline
Senior Member

Joined: Mon Sep 12, 2011 3:29 am
Posts: 63
ICQ: 1081190
Website: http://kyhwana.org
AOL: kyhwana
Location: New Zealand
Change
system "ssh -f -L $local_ip:$local_port:$remote_ip:$remote_port $remote_user\@$remote_host -N";

to system "ssh -p <yoursshport> -f -L $local_ip:$local_port:$remote_ip:$remote_port $remote_user\@$remote_host -N";

(Why'd you change the default ssh port, btw? It doesn't make you any more insecure. Infact, making it port >1024 makes you slightly less secure)


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 12:00 am 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
thank you. It did help. It connects.

However, I cant access it on localhost:3306, I wonder what I am missing.

When I go to localhost:3306 on the browser, on the terminal I get "channel 1: open failed: connect failed: Connection refused"

any ideas how I can resolve this issue ???

I am using a different port number, in order to make it more secure. I am not using 1024. I wonder why 1024 is less secure compare to other ports.

thank you.


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 12:38 am 
Offline
Senior Member
User avatar

Joined: Fri Oct 24, 2003 3:51 pm
Posts: 965
Location: Netherlands
superdupler wrote:
I wonder why 1024 is less secure compare to other ports.

Not just 1024, any port greater than 1024. Ports below 1024 require root privileges to access them, so are more difficult to screw around with.

_________________
/ Peter


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 12:50 am 
Offline
Senior Member
User avatar

Joined: Fri Oct 24, 2003 3:51 pm
Posts: 965
Location: Netherlands
superdupler wrote:
When I go to localhost:3306 on the browser, on the terminal I get "channel 1: open failed: connect failed: Connection refused"

Sound like you might still need to configure MySQL to listen on localhost. In the [mysqld] section of /etc/mysql/my.cnf, comment out the 'skip-networking' line and add a line that says bind-address = 127.0.0.1

_________________
/ Peter


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 12:58 am 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
I already have that....

cd /etc/mysql/my.cnf

bind-address = 127.0.01


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 6:01 am 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
Moving ssh from port 22 is just another layer in the security onion. Also, bots won't be able to try any zero day vulns on the ssh daemon (remember what happened to Debian).


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 5:52 pm 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
I reinstall mysql server on the local computer. Then, I installed mysql query browser, and mysql administrator.

I checked my local mysql on the firefox browser localhost:3306. The browser stated "Got Packets out of order". In any case, I launched mysql query browser. I was able to see the database, and tables without a problem.

Then, I used the mysql-tunnel.pl from the instructions.

On the terminal I got a message.
Quote:
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 3306
Could not request local forwarding.



Then, I tried again by changing the $local_port = "3306"; to $local_port = "3307"; on mysql-tunnel.pl. Then, I got

Quote:
channel 1: open failed: connect failed: Connection refused


???


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 6:11 pm 
Offline
Senior Member
User avatar

Joined: Thu Nov 24, 2011 12:46 pm
Posts: 139
Location: Mesa AZ
superdupler wrote:
On the terminal I got a message.
Quote:
bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 3306
Could not request local forwarding.

You have something already running. Kill it first.

_________________
Kevin a.k.a. Dweeber


Top
   
 Post subject:
PostPosted: Mon Jun 04, 2012 9:43 pm 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
on mysql query browser I get this error.

Quote:
Could not connect to host '127.0.0.1'.
MySQL Error Nr. 2013
Lost connection to MySQL server at 'reading initial communication packet', system error:0

Click the 'Ping' button to see if there is a networking problem


on the terminal
Quote:
channel 1: open failed: connect failed: Connection refused


???


Top
   
 Post subject:
PostPosted: Tue Jun 05, 2012 6:23 pm 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
I have been trying to set this Mysql Administrator - query browser without any luck.

On my remote server, the my.cnf bind address isnt 127.0.0.1, nor localhost. It is a local network address (192.168.166.9)

So, I decided to change my.cnf on my local computer bind address from 127.0.0.1 to the same local network address of the remote server. 192.168.166.9

then I did
ssh -p 2222 -v -f -N -L 3307:192.168.166.9:3306 user@serverip

Then, try to use mysql query browser, I get similar errors

MySQL Error Nr. 2003

I think my iptables are set correct.

I even tried to connect by using the connections here. I get the same errors.

http://www.debuntu.org/port-forwarding- ... on-refused

how can I solve this issue?


Top
   
 Post subject:
PostPosted: Tue Jun 05, 2012 6:42 pm 
Offline
Senior Member

Joined: Thu Aug 05, 2010 11:23 pm
Posts: 64
on the local computer /etc/mysql/my.cnf
changed bind address=0.0.0.0

some progress, but still get errors.

on the query browser...
Quote:
Could not connect to host '127.0.0.1'.
MySQL Error Nr. 1130
Host '192.168.166.9' is not allowed to connect to this MySQL server



on the terminal
Quote:
Connection to port 3307 forwarding to 192.168.166.9 port 3306 requested.
debug1: channel 2: new [direct-tcpip]
debug1: Connection to port 3307 forwarding to 192.168.166.9 port 3306 requested.
debug1: channel 3: new [direct-tcpip]
debug1: channel 2: free: direct-tcpip: listening port 3307 for 192.168.166.9 port 3306, connect from 127.0.0.1 port 58429, nchannels 4
debug1: channel 3: free: direct-tcpip: listening port 3307 for 192.168.166.9 port 3306, connect from 127.0.0.1 port 58430, nchannels 3


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


Who is online

Users browsing this forum: No registered users and 7 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