Solved

MySQL through ipsec tunnel

Posted on 2014-03-25
11
697 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
  • 6
  • 5
11 Comments
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
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 76

Expert Comment

by:arnold
Comment Utility
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
 
LVL 23

Author Comment

by:savone
Comment Utility
No the systems are on the same network segment and CAN communicate without a VPN.
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 23

Author Comment

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

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
@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 76

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
@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 76

Accepted Solution

by:
arnold earned 500 total points
Comment Utility
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now