?
Solved

MySQL through ipsec tunnel

Posted on 2014-03-25
11
Medium Priority
?
760 Views
Last Modified: 2014-04-13
I have two Red Hat Enterprise Linux 6 systems that are both on the same network:

HOST1 - Snort Sensor - 192.168.1.5
HOST2 - MySQL Database Server - 192.168.1.10

I need to make the Snort sensor write to the database via an ipsec tunnel.  I have the tunnel created using openswan using these instructions: http://www.putorius.net/2012/08/creating-end-to-end-ipsec-tunnel.html

Now I am wondering how do I force all MySQL traffic through the tunnel?  Any help would be appreciated.
0
Comment
Question by:savone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 79

Expert Comment

by:arnold
ID: 39955033
You would use the are the IPs referenced on the 192.168.1.x the IP used in the IPSec tunnel or both locations use the same LAN segment?
Snort IPA for IPSec
Mysql DB server IPB for IPSec.

In your DB connection setting on the snort box you will use IPB and not the 192.168.1.10 IP.

You however have to make sure when granting the snort user reference IPA as the host from which that user will be connecting.
0
 
LVL 23

Author Comment

by:savone
ID: 39957817
So the IP addresses in the conf files should not be their real IP addresses, but rather a new network I made up?
0
 
LVL 79

Expert Comment

by:arnold
ID: 39957861
Are the two systems on the same segment and are accessible without a VPN?

If the two systems are at different locations that are using the same IP segments, IP overlay as part of the IPSec policy will be required.
0
WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

 
LVL 23

Author Comment

by:savone
ID: 39957989
No the systems are on the same network segment and CAN communicate without a VPN.
0
 
LVL 79

Expert Comment

by:arnold
ID: 39958276
Then what is the purpose for the VPN?

Are you merely looking to encrypt the connection?

Mysql 5.1 and newer have the features to encrypt connections.
http://dev.mysql.com/doc/refman/5.1/en/ssl-connections.html
0
 
LVL 23

Author Comment

by:savone
ID: 39958517
Yes, I need to separate the traffic and they (management) want me to do it with ipsec tunnels.
0
 
LVL 79

Expert Comment

by:arnold
ID: 39959000
The IPs in the VPN configuration will the current IPs of each /32 defining only IP1 to IP2 traffic to match the VPN pattern and only this traffic will flow through the VPN.  

If the concern deals with observance of data, using SSL encryption of the mysql connection might be an alternative.

The only adjustment to the instructions you would replace 10.0.0.1 with 192.168.1.4
And 10.0.0.40 with 192.168.1.15.
0
 
LVL 23

Author Comment

by:savone
ID: 39959109
@arnold, why should I use 192.168.1.4 and 192.168.1.15?  Those are not the IP addresses of my machines.

Also, I have it set up as you are suggestion, but MySQL traffic is still using the default route and going around the ipsec tunnel.
0
 
LVL 79

Expert Comment

by:arnold
ID: 39959329
Oops, I checked which IPs to use prior to starting to write the response,
you would use the 192.168.1.5 and the 192.168.1.10

Since you want your snort box to access the mysql server, you should configure the openswan such that the client on the snort box initiate the connection.
0
 
LVL 23

Author Comment

by:savone
ID: 39960698
@arnold, we are back to square one.  The tunnel is up, but the MySQL data is still being send over the regular network and not the ipsec tunnel.
0
 
LVL 79

Accepted Solution

by:
arnold earned 2000 total points
ID: 39960711
Check the IP xfrm policy to see whether it has the definition to route traffic between the two hosts via the tunnel.

During your configuration you might have missed the step that determines whether the data should enter the IPSec tunnel or not.

See the guide and double check every referenced configuration/setting.
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question