Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eterban
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eterban
Commits
c3562202
Commit
c3562202
authored
Jan 10, 2020
by
Ruzal Gimazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create messages on channel 'by'
parent
d3d9a8f9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
10 deletions
+12
-10
unban.php
ban-server/data/www/unban.php
+1
-0
eterban.spec
eterban.spec
+2
-6
eterban_switcher.py
gateway/usr/share/eterban/eterban_switcher.py
+1
-1
eterban.conf
prod-server/etc/fail2ban/action.d/eterban.conf
+2
-2
ban.py
prod-server/usr/share/eterban/ban.py
+6
-1
No files found.
ban-server/data/www/unban.php
View file @
c3562202
...
...
@@ -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"
?>
...
...
eterban.spec
View file @
c3562202
...
...
@@ -35,7 +35,7 @@ Etersoft ban service.
%package web
Summary: Etersoft ban service: web
Group: Development/Other
Requires: php-redis
Requires: php
7
-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
...
...
gateway/usr/share/eterban/eterban_switcher.py
View file @
c3562202
...
...
@@ -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)
...
...
prod-server/etc/fail2ban/action.d/eterban.conf
View file @
c3562202
[
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
prod-server/usr/share/eterban/ban.py
View file @
c3562202
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment