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
c8fbe0d6
Commit
c8fbe0d6
authored
Sep 30, 2019
by
Ruzal Gimazov
Committed by
Ruzal Gimazov
Nov 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixed
parent
bd01bbdb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
ban.conf
gateway/etc/fail2ban/action.d/ban.conf
+11
-1
eterban.service
gateway/etc/systemd/system/eterban.service
+2
-1
eterban_switcher.py
gateway/usr/share/eterban/eterban_switcher.py
+9
-3
No files found.
gateway/etc/fail2ban/action.d/ban.conf
View file @
c8fbe0d6
[
Definition
]
[
INCLUDES
]
before
=
iptables
-
common
.
conf
[
Definition
]
# Notes.: create list blacklist at the start of Fail2Ban
# Value: CMD (eterban-switcher.py)
actionstart
=
ipset
--
create
blacklist
iphash
<
iptables
> -
t
nat
-
I
PREROUTING
-
p
tcp
-
m
tcp
--
dport
80
-
m
set
--
match
-
set
blacklist
src
-
j
REDIRECT
--
to
-
ports
4564
actionflush
=
ipset
flush
blacklist
actionstop
= <
iptables
> -
t
nat
-
D
PREROUTING
-
p
tcp
-
m
tcp
--
dport
80
-
m
set
--
match
-
set
blacklist
src
-
j
REDIRECT
--
to
-
ports
4564
<
actionflush
>
ipset
destroy
blacklist
actionban
=
ipset
-
A
blacklist
<
ip
>
actionunban
=
ipset
-
D
blacklist
<
ip
>
gateway/etc/systemd/system/eterban.service
View file @
c8fbe0d6
...
...
@@ -2,7 +2,7 @@
Description= Start eterban_switcher.py
[Service]
ExecStart=/
etc
/eterban/eterban_switcher.py
ExecStart=/
usr/share
/eterban/eterban_switcher.py
[Install]
WantedBy=multi-user.target
\ No newline at end of file
gateway/usr/share/eterban/eterban_switcher.py
View file @
c8fbe0d6
...
...
@@ -6,14 +6,20 @@ f = open ('/etc/eterban/eterban.conf','r')
line
=
f
.
readline
()
f
.
close
()
if
line
[:
10
]
==
"host_redis"
:
i
=
10
while
(
line
[
i
]
==
" "
):
i
+=
1
i
+=
1
while
(
line
[
i
]
==
" "
):
i
+=
1
if
line
[
-
1
]
==
'
\n
'
:
host_redis
=
line
[
-
16
:
-
1
]
host_redis
=
line
[
i
:
-
1
]
else
:
host_redis
=
line
[
-
15
:]
host_redis
=
line
[
i
:]
del
(
line
)
del
(
f
)
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)
r
=
redis
.
Redis
(
host
=
host_redis
)
p
=
r
.
pubsub
()
...
...
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