Commit c3562202 authored by Ruzal Gimazov's avatar Ruzal Gimazov

Create messages on channel 'by'

parent d3d9a8f9
......@@ -5,6 +5,7 @@
$redis = new Redis();
$redis->pconnect($host_redis,6379);
$redis->publish('unban', $ip);
$redis->publish('by', $ip . " was unblocked by ckick");
$redis->close();
echo "Wait 5 secons, please"
?>
......
......@@ -35,7 +35,7 @@ Etersoft ban service.
%package web
Summary: Etersoft ban service: web
Group: Development/Other
Requires: php-redis
Requires: php7-redis
%description web
Etersoft ban service.
......@@ -59,23 +59,20 @@ Etersoft ban service.
mkdir -p %buildroot%_datadir/%name/
mkdir -p %buildroot/etc/%name/
mkdir -p %buildroot/etc/fail2ban/action.d/
mkdir -p %buildroot/etc/fail2ban/jail.d/
mkdir -p %buildroot/etc/systemd/system/
mkdir -p %buildroot/var/log/eterban/
mkdir -p %buildroot%webserver_htdocsdir/%name/
mkdir -p %buildroot/etc/fail2ban/jail.d/
cp -a gateway/usr/share/%name/* %buildroot%_datadir/%name/
install -m 644 gateway/etc/eterban/* %buildroot/etc/%name/
install -m 644 gateway/etc/fail2ban/action.d/* %buildroot/etc/fail2ban/action.d/
install -m 644 gateway/etc/fail2ban/jail.d/* %buildroot/etc/fail2ban/jail.d/
install -m 644 gateway/etc/systemd/system/* %buildroot/etc/systemd/system/
install -m 644 ban-server/data/www/* %buildroot%webserver_htdocsdir/%name/
install -m 644 prod-server/etc/fail2ban/action.d/* %buildroot/etc/fail2ban/action.d/
install -m 644 prod-server/etc/fail2ban/jail.d/* %buildroot/etc/fail2ban/jail.d/
cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/
......@@ -94,7 +91,6 @@ cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/
%config(noreplace) /etc/%name/settings.ini
%_datadir/%name/ban.py
%config(noreplace) /etc/fail2ban/action.d/eterban.conf
%config(noreplace) /etc/fail2ban/jail.d/eterban.conf
%changelog
* Sun Nov 10 2019 Ruzal Gimazov <diff@etersoft.ru> 0.2-eter1
......
......@@ -62,7 +62,7 @@ redis_server = get_ip_redis_server (path_to_config, path_to_log)
print ("done!")
#print ("done!")
#print (time.strftime( "%Y-%m-%d %H:%M:%S", time.localtime()))
#subprocess.call ('ipset create blacklist hash:ip', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell = True)
......
[Definition]
actionban = /usr/share/eterban/ban.py <ip>
\ No newline at end of file
actionban = /usr/share/eterban/ban.py <ip> <name>
\ No newline at end of file
......@@ -41,5 +41,9 @@ redis_server, hostname = get_ip_redis_server (path_to_config)
r = redis.Redis (host=redis_server)
r.publish ('ban', sys.argv[1])
message = sys.argv[1] + " was blocked by " + hostname
try:
message = sys.argv[1] + " was blocked by " + hostname + ": " + sys.argv[2]
except:
message = sys.argv[1] + " was blocked by " + hostname + " (set block: [name=NAME_OF_RULE] on " + hostname + ":/etc/fail2ban/jail.conf)"
r.publish ('by', message)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment