Commit c3562202 authored by Ruzal Gimazov's avatar Ruzal Gimazov

Create messages on channel 'by'

parent d3d9a8f9
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
$redis = new Redis(); $redis = new Redis();
$redis->pconnect($host_redis,6379); $redis->pconnect($host_redis,6379);
$redis->publish('unban', $ip); $redis->publish('unban', $ip);
$redis->publish('by', $ip . " was unblocked by ckick");
$redis->close(); $redis->close();
echo "Wait 5 secons, please" echo "Wait 5 secons, please"
?> ?>
......
...@@ -35,7 +35,7 @@ Etersoft ban service. ...@@ -35,7 +35,7 @@ Etersoft ban service.
%package web %package web
Summary: Etersoft ban service: web Summary: Etersoft ban service: web
Group: Development/Other Group: Development/Other
Requires: php-redis Requires: php7-redis
%description web %description web
Etersoft ban service. Etersoft ban service.
...@@ -59,23 +59,20 @@ Etersoft ban service. ...@@ -59,23 +59,20 @@ Etersoft ban service.
mkdir -p %buildroot%_datadir/%name/ mkdir -p %buildroot%_datadir/%name/
mkdir -p %buildroot/etc/%name/ mkdir -p %buildroot/etc/%name/
mkdir -p %buildroot/etc/fail2ban/action.d/ mkdir -p %buildroot/etc/fail2ban/action.d/
mkdir -p %buildroot/etc/fail2ban/jail.d/
mkdir -p %buildroot/etc/systemd/system/ mkdir -p %buildroot/etc/systemd/system/
mkdir -p %buildroot/var/log/eterban/ mkdir -p %buildroot/var/log/eterban/
mkdir -p %buildroot%webserver_htdocsdir/%name/ mkdir -p %buildroot%webserver_htdocsdir/%name/
mkdir -p %buildroot/etc/fail2ban/jail.d/
cp -a gateway/usr/share/%name/* %buildroot%_datadir/%name/ cp -a gateway/usr/share/%name/* %buildroot%_datadir/%name/
install -m 644 gateway/etc/eterban/* %buildroot/etc/%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/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/fail2ban/jail.d/* %buildroot/etc/fail2ban/jail.d/
install -m 644 gateway/etc/systemd/system/* %buildroot/etc/systemd/system/ 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 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/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/ cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/
...@@ -94,7 +91,6 @@ 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 %config(noreplace) /etc/%name/settings.ini
%_datadir/%name/ban.py %_datadir/%name/ban.py
%config(noreplace) /etc/fail2ban/action.d/eterban.conf %config(noreplace) /etc/fail2ban/action.d/eterban.conf
%config(noreplace) /etc/fail2ban/jail.d/eterban.conf
%changelog %changelog
* Sun Nov 10 2019 Ruzal Gimazov <diff@etersoft.ru> 0.2-eter1 * 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) ...@@ -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())) #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) #subprocess.call ('ipset create blacklist hash:ip', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell = True)
......
[Definition] [Definition]
actionban = /usr/share/eterban/ban.py <ip> actionban = /usr/share/eterban/ban.py <ip> <name>
\ No newline at end of file \ No newline at end of file
...@@ -41,5 +41,9 @@ redis_server, hostname = get_ip_redis_server (path_to_config) ...@@ -41,5 +41,9 @@ redis_server, hostname = get_ip_redis_server (path_to_config)
r = redis.Redis (host=redis_server) r = redis.Redis (host=redis_server)
r.publish ('ban', sys.argv[1]) 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) 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