Create firewall _ MySQL for MySQL using GreenSQL

Source: Internet
Author: User
Using GreenSQL to build a firewall for MySQL can protect your database from SQL attacks. GreenSQL is known as the "firewall" of MySQL database ".

A large number of attacks against websites and Web applications are directly related to the so-called SQL injection vulnerability. This problem is very serious for some poorly written applications. By manipulating the data sent to the Web server, it allows remote users to send arbitrary SQL commands to the database server, and uses SQL commands to defend against legal database queries executed by Web applications. Generally, this confrontation occurs without any prior check or cleaning. How can we make up for this defect? GreenSQL is the "firewall" of the MySQL database ". What it does is to intercept the SQL commands that are being sent to MySQL, check the commands, and then stop asking or release them in a proper amount. Then return the query result to the called application.

GreenSQL provides binary packages for some Linux distributions. If your release is not covered on the download page (http://www.greensql.net/download), you can download greensql-console and greensql-fw source code compilation. The following describes how to install these two files:

# Tar xvzf greensql-fw-0.9.4.tar.bz2

# Cd greensql-fw-0.9.4

#./Build. sh

# Greensql-create-db.sh

The Last Command creates a required MySQL database for GreenSQL, so you must ensure that MySQL is running and set to follow a port (in other words, make sure that "skip network connection" is not set to/etc/my. cnf ). To start and test GreenSQL, use this:

# Greensql-fw-p/etc/greensql &

# Mysql-u root-h 127.5.0.0.1-P 3305-p

The GreenSQL proxy listens to Port 3305. This means that any proxy application through GreenSQL needs to be set to be unable to use the local UNIX Jack or to connect to Port 3306 of the local host. Instead, it should be connected through Port 3305.

The Greensql-console package provides a Web interface that can be used to view locked queries or to set the content and category to be locked. Compile and decompress the greensql-console source code to your site tree, and adjust config. phg to suit your selected GreenSQL username, password, and database name.

In addition, if you have installed GreenSQL, you will want to ensure that GreenSQL can run on any system. Depending on your Linux version, it may be as easy as copying an initialization command from the greensql-fw source tree. (For example, rpm/greensql-fw.redhat.init), maybe, you want to add it to your local startup script.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.