How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

This is a discussion on How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box? within the Linux Security forums, part of the System Security and Security Related category; I am trying to connect from a windoze client on my LAN to MySQL database on my linux box (also ...


Go Back   Usenet Forums > System Security and Security Related > Linux Security

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-04-2005
MLH
 
Posts: n/a
Default How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

I am trying to connect from a windoze client on my LAN to MySQL
database on my linux box (also on my LAN). It is failing. Testing
telnet 192.168.1.106 3306 from my windoze box to the linux box
fails to connect. I can ping the linux server successfully.

I want to allow 192.168.1.100 access to the linux box over port
3306. But I don't want to cause security concerns. The one and
only windoze box needing to talk to the linux box is 192.168.1.100.

How do I configure linux to allow the connection? And, are there
any gotchas I ought-a-know about?
Reply With Quote
  #2 (permalink)  
Old 04-04-2005
Michael Pelletier
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

MLH wrote:

> I am trying to connect from a windoze client on my LAN to MySQL
> database on my linux box (also on my LAN). It is failing. Testing
> telnet 192.168.1.106 3306 from my windoze box to the linux box
> fails to connect. I can ping the linux server successfully.
>
> I want to allow 192.168.1.100 access to the linux box over port
> 3306. But I don't want to cause security concerns. The one and
> only windoze box needing to talk to the linux box is 192.168.1.100.
>
> How do I configure linux to allow the connection? And, are there
> any gotchas I ought-a-know about?


First, are you sure that there is a server listening on that port? Do a
"netstat -an | grep 3306". This is the port used by MySQL? Is that what you
are trying to connect to? Make sure it is running.

Michael

--

"Microsoft isn't evil, they just make really crappy operating systems." -
Linus Torvald
Reply With Quote
  #3 (permalink)  
Old 04-04-2005
MLH
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

On Sun, 03 Apr 2005 23:55:11 -0700, Michael Pelletier
<mjpelletier@mjpelletier.com> wrote:

>MLH wrote:
>
>> I am trying to connect from a windoze client on my LAN to MySQL
>> database on my linux box (also on my LAN). It is failing. Testing
>> telnet 192.168.1.106 3306 from my windoze box to the linux box
>> fails to connect. I can ping the linux server successfully.
>>
>> I want to allow 192.168.1.100 access to the linux box over port
>> 3306. But I don't want to cause security concerns. The one and
>> only windoze box needing to talk to the linux box is 192.168.1.100.
>>
>> How do I configure linux to allow the connection? And, are there
>> any gotchas I ought-a-know about?

>
>First, are you sure that there is a server listening on that port? Do a
>"netstat -an | grep 3306". This is the port used by MySQL? Is that what you
>are trying to connect to? Make sure it is running.
>
>Michael

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You were right, Michael...

netstat -tl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State
tcp 0 0 appserver.crci.co:mysql *:*
LISTEN
tcp 0 0 *:www *:*
LISTEN
tcp 0 0 *:ssh *:*
LISTEN
tcp 0 0 *:smtp *:*
LISTEN
mlh@appserver credifree $ netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State
tcp 0 0 127.0.0.1:3306 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:25 0.0.0.0:*
LISTEN

mysql isn't listening to my ethernet interface. I seems its listening
to port 3306 over the linux box's own internal loopback address -
I'm not certain. A couple of files in etc/mysql seem likely places
to make desired change, although I don't know what that change
should be: my.cnf and mysqlaccess.conf.
Reply With Quote
  #4 (permalink)  
Old 04-04-2005
Rincewind
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

On Mon, 04 Apr 2005 09:09:44 -0400, MLH mumbled something like this:

> On Sun, 03 Apr 2005 23:55:11 -0700, Michael Pelletier
> <mjpelletier@mjpelletier.com> wrote:
>
>>MLH wrote:
>>
>>> I am trying to connect from a windoze client on my LAN to MySQL
>>> database on my linux box (also on my LAN). It is failing. Testing
>>> telnet 192.168.1.106 3306 from my windoze box to the linux box fails to
>>> connect. I can ping the linux server successfully.
>>>
>>> I want to allow 192.168.1.100 access to the linux box over port 3306.
>>> But I don't want to cause security concerns. The one and only windoze
>>> box needing to talk to the linux box is 192.168.1.100.
>>>
>>> How do I configure linux to allow the connection? And, are there any
>>> gotchas I ought-a-know about?

>>
>>First, are you sure that there is a server listening on that port? Do a
>>"netstat -an | grep 3306". This is the port used by MySQL? Is that what
>>you are trying to connect to? Make sure it is running.
>>
>>Michael

> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx You were right, Michael...
>
> netstat -tl
> Active Internet connections (only servers) Proto Recv-Q Send-Q Local
> Address Foreign Address State
> tcp 0 0 appserver.crci.co:mysql *:* LISTEN
> tcp 0 0 *:www *:* LISTEN
> tcp 0 0 *:ssh *:* LISTEN
> tcp 0 0 *:smtp *:* LISTEN
> mlh@appserver credifree $ netstat -ntl Active Internet connections (only
> servers) Proto Recv-Q Send-Q Local Address Foreign Address State
> tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
> tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
> tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
> tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
>
> mysql isn't listening to my ethernet interface.


Then, what is this?:
tcp 0 0 appserver.crci.co:mysql *:* LISTEN

> I seems its listening to
> port 3306 over the linux box's own internal loopback address - I'm not
> certain. A couple of files in etc/mysql seem likely places to make desired
> change, although I don't know what that change should be: my.cnf and
> mysqlaccess.conf.


My personal approach is to err on the side of security and block all
external access to port 3306 with an iptables rule along the lines of:

$IPTABLES -A INPUT -i $EXTERNALIF -p tcp --dport 3306 -j REJECT

Set or replace $IPTABLES and $EXTERNALIF to the appropriate values for
your situation. In my case they are set in my iptables init script:

IPTABLES="/sbin/iptables"
EXTERNALIF="eth1"

HTH
--
Rinso
/\
/ \
/wizz\
~~~~~~~~~~~~

Reply With Quote
  #5 (permalink)  
Old 04-05-2005
chud
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

On Mon, 04 Apr 2005 09:09:44 -0400, MLH wrote:

>
> mysql isn't listening to my ethernet interface. I seems its listening
> to port 3306 over the linux box's own internal loopback address -
> I'm not certain. A couple of files in etc/mysql seem likely places
> to make desired change, although I don't know what that change
> should be: my.cnf and mysqlaccess.conf.


Check the cmd line args that are being passed to mysqld. It may be using
the --skip-networking arg, which restricts incoming connections to the
local machine only. man mysqld

Reply With Quote
  #6 (permalink)  
Old 04-05-2005
MLH
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

On Mon, 04 Apr 2005 16:43:23 -0700, chud <chud@whoknowswhat.domain>
wrote:

>On Mon, 04 Apr 2005 09:09:44 -0400, MLH wrote:
>
>>
>> mysql isn't listening to my ethernet interface. I seems its listening
>> to port 3306 over the linux box's own internal loopback address -
>> I'm not certain. A couple of files in etc/mysql seem likely places
>> to make desired change, although I don't know what that change
>> should be: my.cnf and mysqlaccess.conf.

>
>Check the cmd line args that are being passed to mysqld. It may be using
>the --skip-networking arg, which restricts incoming connections to the
>local machine only. man mysqld


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I understood that until my linux server will respond to a command
like this: telnet 192.168.1.106 3306
I haven't got a snowball's chance of attaching to my mysql
tables on that same linux server. Does that sound right to you?.
It seems logical to me. BTW, my skip-networking arg is set to off.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxx


Reply With Quote
  #7 (permalink)  
Old 04-05-2005
MLH
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

<snip>

>Then, what is this?:
>tcp 0 0 appserver.crci.co:mysql *:* LISTEN
>


You've got me. I'm not sure what that is. But whatever it is,
it doesn't let telnet to the linux box over 3306...

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet> open \\192.168.1.106 3306
Connecting To \\192.168.1.106...Could not open connection to the host,
on port 3306: Connect failed

Microsoft Telnet> open 192.168.1.106 3306
Connecting To 192.168.1.106...Could not open connection to the host,
on port 3306: Connect failed
Microsoft Telnet>

<snip>
Reply With Quote
  #8 (permalink)  
Old 04-05-2005
MLH
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

<snip>

Also worthy of mention is that I cannot telnet to the linux
box over the default telnet port 23 either...

Welcome to Microsoft Telnet Client

Escape Character is 'CTRL+]'

Microsoft Telnet> open 192.168.1.106
Connecting To 192.168.1.106...Could not open connection to the host,
on port 23: Connect failed
Microsoft Telnet> quit

C:\WINDOWS>
Reply With Quote
  #9 (permalink)  
Old 04-05-2005
MLH
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306 for MyODBC driver traffic coming from my windoze box?

This may be a wild shot, but I have a router between my LAN and the
DSL pipe to the InterNET. All of my LAN nodes are connected into
that router. Is it possible that the router is filtering my telnet
requests? Just because ping works between boxes on my LAN
doesn't imply that telnet will get through. I was under the impression
that routers would filter transmissions going through it but not any
destined for local addresses on the same subnet.
Reply With Quote
  #10 (permalink)  
Old 04-06-2005
Jack Masters
 
Posts: n/a
Default Re: How does one go about setting up linux to 'listen' on port 3306for MyODBC driver traffic coming from my windoze box?

MLH wrote:
> This may be a wild shot, but I have a router between my LAN and the
> DSL pipe to the InterNET. All of my LAN nodes are connected into
> that router. Is it possible that the router is filtering my telnet
> requests? Just because ping works between boxes on my LAN
> doesn't imply that telnet will get through. I was under the impression
> that routers would filter transmissions going through it but not any
> destined for local addresses on the same subnet.


A few questions:

Can you connect locally on the Linux box?
From the linux box, do:
telnet 127.0.0.1 3306
and
telnet 192.168.0.106 3306

If both work, the problem is definitely networking/firewalls

Do you have a firewall running on the Linux box? Please post output of
iptables -L

The default iptables setup doesn't let 3306 through, so try

iptables -A INPUT -p tcp -s 192.168.0.100 -m tcp --dport 3306 -j ACCEPT

Last resort, see if the packets from the windoze box get there using
tcpdump or ethereal. That will definitely tell you if the router does
any funnies.

J
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 02:55 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0