diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..e69de29 diff --git a/bin/.htaccess b/bin/.htaccess new file mode 100644 index 0000000..14249c5 --- /dev/null +++ b/bin/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/bancount b/bin/bancount similarity index 100% rename from bancount rename to bin/bancount diff --git a/bin/bancount.cfg.sample b/bin/bancount.cfg.sample new file mode 100644 index 0000000..7d9123a --- /dev/null +++ b/bin/bancount.cfg.sample @@ -0,0 +1,5 @@ +#!/bin/bash + +mysqldb="fail2bancount" +mysqlpw="" +mysqluser="fail2bancount" \ No newline at end of file diff --git a/bancount.sh b/bin/bancount.sh similarity index 100% rename from bancount.sh rename to bin/bancount.sh diff --git a/bancountmysql b/bin/bancountmysql similarity index 60% rename from bancountmysql rename to bin/bancountmysql index 47e394f..b0b9b22 100755 --- a/bancountmysql +++ b/bin/bancountmysql @@ -2,11 +2,9 @@ action=$1 ip=$2 -port=$3 +service=$3 -mysqldb="fail2bancount" -mysqlpw="" -mysqluser="fail2bancount" +source bancount.cfg geoip () { geoiplookup $ip | awk -F, '{print $2}' | sed s/\ // @@ -15,12 +13,12 @@ geoip () { case $action in ban) - mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO bans (ip, ban_date, ban_time, country) VALUES ( '$ip', '`date +%F`', '`date +%T`', '`geoip $ip`');" + mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO bans (ip, service, ban_date, ban_time, country) VALUES ( '$ip', '$service', '`date +%F`', '`date +%T`', '`geoip $ip`');" ;; unban) - mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO unbans (ip, unban_date, unban_time, country) VALUES ( '$ip', '`date +%F`', '`date +%T`', '`geoip $ip`');" + mysql $mysqldb -u $mysqluser --password=$mysqlpw -e "INSERT INTO unbans (ip, service, unban_date, unban_time, country) VALUES ( '$ip', '$service', '`date +%F`', '`date +%T`', '`geoip $ip`');" ;; *) diff --git a/fail2bancount.sql b/bin/fail2bancount.sql similarity index 97% rename from fail2bancount.sql rename to bin/fail2bancount.sql index d77152c..84c9ec9 100644 --- a/fail2bancount.sql +++ b/bin/fail2bancount.sql @@ -25,6 +25,7 @@ DROP TABLE IF EXISTS `bans`; CREATE TABLE `bans` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ip` varchar(15) DEFAULT NULL, + `service` TEXT NOT NULL, `ban_date` varchar(10) DEFAULT NULL, `ban_time` varchar(8) DEFAULT NULL, `country` char(50) NOT NULL DEFAULT 'Martians!', @@ -42,6 +43,7 @@ DROP TABLE IF EXISTS `unbans`; CREATE TABLE `unbans` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ip` varchar(15) DEFAULT NULL, + `service` TEXT NOT NULL, `unban_date` varchar(10) DEFAULT NULL, `unban_time` varchar(8) DEFAULT NULL, `country` char(50) DEFAULT NULL,