[chg] reorganize file
This commit is contained in:
parent
7143ef3654
commit
63197e78d5
|
@ -0,0 +1 @@
|
||||||
|
Deny from all
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mysqldb="fail2bancount"
|
||||||
|
mysqlpw=""
|
||||||
|
mysqluser="fail2bancount"
|
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
action=$1
|
action=$1
|
||||||
ip=$2
|
ip=$2
|
||||||
port=$3
|
service=$3
|
||||||
|
|
||||||
mysqldb="fail2bancount"
|
source bancount.cfg
|
||||||
mysqlpw=""
|
|
||||||
mysqluser="fail2bancount"
|
|
||||||
|
|
||||||
geoip () {
|
geoip () {
|
||||||
geoiplookup $ip | awk -F, '{print $2}' | sed s/\ //
|
geoiplookup $ip | awk -F, '{print $2}' | sed s/\ //
|
||||||
|
@ -15,12 +13,12 @@ geoip () {
|
||||||
case $action in
|
case $action in
|
||||||
|
|
||||||
ban)
|
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)
|
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`');"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
|
@ -25,6 +25,7 @@ DROP TABLE IF EXISTS `bans`;
|
||||||
CREATE TABLE `bans` (
|
CREATE TABLE `bans` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`ip` varchar(15) DEFAULT NULL,
|
`ip` varchar(15) DEFAULT NULL,
|
||||||
|
`service` TEXT NOT NULL,
|
||||||
`ban_date` varchar(10) DEFAULT NULL,
|
`ban_date` varchar(10) DEFAULT NULL,
|
||||||
`ban_time` varchar(8) DEFAULT NULL,
|
`ban_time` varchar(8) DEFAULT NULL,
|
||||||
`country` char(50) NOT NULL DEFAULT 'Martians!',
|
`country` char(50) NOT NULL DEFAULT 'Martians!',
|
||||||
|
@ -42,6 +43,7 @@ DROP TABLE IF EXISTS `unbans`;
|
||||||
CREATE TABLE `unbans` (
|
CREATE TABLE `unbans` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`ip` varchar(15) DEFAULT NULL,
|
`ip` varchar(15) DEFAULT NULL,
|
||||||
|
`service` TEXT NOT NULL,
|
||||||
`unban_date` varchar(10) DEFAULT NULL,
|
`unban_date` varchar(10) DEFAULT NULL,
|
||||||
`unban_time` varchar(8) DEFAULT NULL,
|
`unban_time` varchar(8) DEFAULT NULL,
|
||||||
`country` char(50) DEFAULT NULL,
|
`country` char(50) DEFAULT NULL,
|
Loading…
Reference in New Issue