diff --git a/compilation.txt b/compilation.txt deleted file mode 100644 index 220fcf0..0000000 --- a/compilation.txt +++ /dev/null @@ -1,59 +0,0 @@ -In order to compile this application you need the following packages: - -g++ -make -libpcre -libmysqlclient -libevent -flex -bison -libpq - -For Ubuntu and Debian I had to install: - -libmysqlclient15-dev -libevent-dev -libpcre3-dev -libpcre3 -libpq-dev -make -g++ -gcc - -For example in Debian Oldstable you will need: -libpcre3 -libpcre3-dev -libevent1 -libevent-dev -libmysqlclient14 -libmysqlclient14-dev -libpq-dev -make - -In order to build deb package you will need the folowing: -sudo apt-get install gcc g++ -sudo apt-get install make -sudo apt-get install devscripts -sudo apt-get install fakeroot -sudo apt-get install debhelper -sudo apt-get install build-essential -sudo apt-get install flex -sudo apt-get install bison -sudo apt-get install libevent-dev -sudo apt-get install libmysqlclient15-dev -sudo apt-get install libpcre3 -sudo apt-get install libpcre3-dev -sudo apt-get install libpq-dev - -For OpenSuse you need to run the following commands that will install missing packages: -yast -i flex bison gcc gcc-c++ make -yast -i postgresql-devel libmysqlclient-devel -yast -i pcre-devel libevent-devel - -If you use default installation of FreeBSD you will need to install the following packages: - -pkg_add -r bison -pkg_add -r libevent -pkg_add -r pcre -pkg_add -r mysql51-client - diff --git a/install.txt b/install.txt deleted file mode 100644 index 2a73db1..0000000 --- a/install.txt +++ /dev/null @@ -1,158 +0,0 @@ -GreenSQL Database Firewall Installation - -For installation you have a number of options: -1. Download installation package for your favorite distribution - from the following url and install it: - http://www.greensql.net/download -2. Build your own installation package. -3. Manual installation: compile & install from source. - - -Building your own installation package --------------------------------------- -If you distribution is not listed in the project download page, you -can try to build a package for your operation system. We have build a -special script that takes all steps required to build package for -popular operating systems. It automatically builds deb/rpm/bsd packages. - -Before proceeding with the instalation you need to download source -code of the greensql firewall. Download it from the project download -page: http://www.greensql.net/download - -Run the following commands: - - shell> tar -xzvf greensql-fw-X.X.X.tar.gz - shell> cd greensql-fw - shell> ./build.sh - -Last script - build.sh will create package for your OS. After installing -newly created package you need to install GreenSQL configuration db stored -in MySQL. You can do it by running the following shell script: - - shell> greensql-create-db.sh - -Next step is to start the application. You can simply do it by running -the following command as a root user: - - shell> /etc/init.d/greensql-fw start - -For application troubleshooting check the log file: - - shell> tail -f /var/log/greensql.log - -Manual Installation -------------------- -Before installing the application you need to compile it. Without going -into much details you can do it as followed: - - shell> tar -xzvf greensql-fw-X.X.X.tar.gz - shell> cd greensql-fw - shell> ./build.sh - -There are a number of steps to perform in order to install application. -They are: - -1. Create dedicated user for greensql service. -2. Creating MySQL config db and a db user. -3. Setting up configuration files. -3. Setting log file. -4. Configure start up scripts - - -Creating greensql system group and user ---------------------------------------- - -In order to create greensql group and user run the following -commands (run these commands as a root user): - - shell> groupadd greensql - shell> useradd -M -g greensql -s /dev/null greensql - -Alternatively you do the ame by execurting the following commands: - - shell> cd scripts/ - shell> ./setup_user.sh - - -Creating MySQL DB and user --------------------------- -Just run the following script: greensql-create-db.sh . It will -automatically create configuration database. - - shell> cd scripts/ - shell> ./greensql-create-db.sh - -Setting up configuration files ------------------------------- - -You will find a number of configuration files in the ./conf/ directory. -GreenSQL start up script expects to find the configuration files in the -following directory: - - /etc/greensql/ - -You simply need to copy files from ./conf/* to /etc/greensql . You can do it -as followed: - - shell> mkdir -p /etc/greensql - shell> cp ./conf/* /etc/greensql/ -r - shell> chown greensql:greensql /etc/greensql -R - shell> chmod 700 /etc/greensql - -Alternativly you can run setup_conf.sh file located in the scripts -directory. - - shell> cd scripts/ - shell> ./setup_conf.sh - -Next step is to alter /etc/greensql/greensql.conf file and specify correct -db name, server, port, user and password. - - -Setting log file ----------------- - -By default greensql expects to find log file in: - -/var/log/greensql.log - -In addition, log file rotation must be enabled. You can do it by running -the following commands: - - shell> touch /var/log/greensql.log - shell> chown greensql:greensql /var/log/greensql.log - shell> chmod 600 /var/log/greensql.log - shell> cp scripts/greensql.rotate /etc/logrotate.d/greensql - -Alternatively you can run ./setup_log.sh script located in the scripts/ -directory. - - -Configure start up scripts --------------------------- - -As a final step you need to copy greensql-fw binary to the /user/sbin/ -or /sbin directory and copy greensql service initialization script to the -/etc/init.d/ directory. - -Run the following commands: - - shell> cp greensql-fw /usr/sbin/ - shell> cp scripts/rc.greensql /etc/init.d/greensql - -Another alternative is to run ./setup_binary.sh script located in the scripts/ -directory. - - -After that you can start the application by running the following command: - - shell> /etc/init.d/greensql start - -In order to stop the application use the following command: - - shell> /etc/init.d/greensql stop - -For application troubleshooting check the log file: - - shell> tail -f /var/log/greensql.log - diff --git a/readme.txt b/readme.txt index 6cad86c..1c0ef58 100644 --- a/readme.txt +++ b/readme.txt @@ -1,33 +1,177 @@ +Overview -The following directory contains source code of the GreenSQL firewall. GreenSQL is an Open Source database firewall used to protect databases from SQL injection attacks. GreenSQL works as a proxy and has built in support for MySQL. The logic is based on evaluation of SQL commands using a risk scoring matrix as well as blocking known db administrative commands (DROP, CREATE, etc). -For additional info check: +Compilation -http://www.greensql.net/ +In order to build the debian package you will need to install the folowing: -In order to run this application you need the following packages: +sudo apt-get install gcc g++ +sudo apt-get install make +sudo apt-get install devscripts +sudo apt-get install fakeroot +sudo apt-get install debhelper +sudo apt-get install build-essential +sudo apt-get install flex +sudo apt-get install bison +sudo apt-get install libevent-dev +sudo apt-get install libmysqlclient15-dev +sudo apt-get install libpcre3 +sudo apt-get install libpcre3-dev +sudo apt-get install libpq-dev -libpcre -libmysqlclient -libevent -libpq (for postgresql) +For OpenSuse you need to run the following commands that will install missing packages: + +yast -i flex bison gcc gcc-c++ make +yast -i postgresql-devel libmysqlclient-devel +yast -i pcre-devel libevent-devel + +If you use default installation of FreeBSD you will need to install the following packages: + +pkg_add -r bison +pkg_add -r libevent +pkg_add -r pcre +pkg_add -r mysql51-client + +Installation + +Before proceeding with the instalation you need to copy the source +code of the greensql firewall. You can do this by cloning this repository +to your local machine using git clone. + +Enter your cloned directory and run the following command: + + ./build.sh + +After this there are two ways to go about setting up the firewall, +either through manual installation or building your own package. + +Building your own installation package +-------------------------------------- +run the following shell script: + + greensql-create-db.sh + +Next step is to start the application, run the following command as a root user: + + /etc/init.d/greensql-fw start + + +Manual Installation +------------------- +There are a number of steps to perform in order to install application. +They are: + +1. Create dedicated user for greensql service. +2. Creating MySQL config db and a db user. +3. Setting up configuration files. +3. Setting log file. +4. Configure start up scripts + + +Creating greensql system group and user +--------------------------------------- + +In order to create greensql group and user run the following +commands (run these commands as a root user): + + groupadd greensql + useradd -M -g greensql -s /dev/null greensql + +Alternatively you do the ame by execurting the following commands: + + cd scripts/ + ./setup_user.sh + + +Creating MySQL DB and user +-------------------------- +Just run the following script: greensql-create-db.sh . It will +automatically create configuration database. + + cd scripts/ + ./greensql-create-db.sh + +Setting up configuration files +------------------------------ + +You will find a number of configuration files in the ./conf/ directory. +GreenSQL start up script expects to find the configuration files in the +following directory: + + /etc/greensql/ + +You simply need to copy files from ./conf/* to /etc/greensql . You can do it +as followed: + + mkdir -p /etc/greensql + cp ./conf/* /etc/greensql/ -r + chown greensql:greensql /etc/greensql -R + chmod 700 /etc/greensql + +Alternativly you can run setup_conf.sh file located in the scripts +directory. + + cd scripts/ + ./setup_conf.sh + +Next step is to alter /etc/greensql/greensql.conf file and specify correct +db name, server, port, user and password. + + +Setting log file +---------------- + +By default greensql expects to find log file in: + +/var/log/greensql.log + +In addition, log file rotation must be enabled. You can do it by running +the following commands: + + touch /var/log/greensql.log + chown greensql:greensql /var/log/greensql.log + chmod 600 /var/log/greensql.log + cp scripts/greensql.rotate /etc/logrotate.d/greensql + +Alternatively you can run ./setup_log.sh script located in the scripts/ +directory. + + +Configure start up scripts +-------------------------- + +As a final step you need to copy greensql-fw binary to the /user/sbin/ +or /sbin directory and copy greensql service initialization script to the +/etc/init.d/ directory. + +Run the following commands: -You can install the various dependencies on debian by running: + cp greensql-fw /usr/sbin/ + cp scripts/rc.greensql /etc/init.d/greensql + +Another alternative is to run ./setup_binary.sh script located in the scripts/ +directory. + +Start the application: + + /etc/init.d/greensql start + +Stop the application: + + /etc/init.d/greensql stop + +Troubleshooting + +If you encounter problems at any point run: -apt-get install libpcre3 -apt-get install libmysqlclient15off -apt-get install libevent1 -apt-get install libpq5 + tail -f /var/log/greensql.log -You can install the various dependencies on centos by running: +License -yum install libevent -yum install mysql -yum install pcre -yum install postgresql-libs +GNU General Public License v2.0