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
2dc157bc
Commit
2dc157bc
authored
Mar 11, 2020
by
Ruzal Gimazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update hostname in ban.py
parent
9de2a89d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
eterban.spec
eterban.spec
+1
-1
eterban_switcher.py
gateway/usr/share/eterban/eterban_switcher.py
+2
-2
ban.py
prod-server/usr/share/eterban/ban.py
+3
-2
No files found.
eterban.spec
View file @
2dc157bc
...
...
@@ -83,7 +83,7 @@ cp -a prod-server/usr/share/%name/* %buildroot%_datadir/%name/
%files web
%webserver_htdocsdir/%name/
%buildroot
/etc/nginx/sites-enabled.d/
/etc/nginx/sites-enabled.d/
%files fail2ban
%config(noreplace) /etc/%name/settings.ini
...
...
gateway/usr/share/eterban/eterban_switcher.py
View file @
2dc157bc
...
...
@@ -6,7 +6,7 @@ import sys
import
configparser
import
os
import
signal
import
socket
...
...
@@ -17,7 +17,7 @@ def createConfig(path_to_config, path_to_log):
config
=
configparser
.
ConfigParser
()
config
.
add_section
(
"Settings"
)
config
.
set
(
"Settings"
,
"redis_server"
,
"10.20.30.101"
)
config
.
set
(
"Settings"
,
"hostname"
,
""
)
config
.
set
(
"Settings"
,
"hostname"
,
socket
.
gethostname
()
)
with
open
(
path_to_config
,
"w"
)
as
config_file
:
config
.
write
(
config_file
)
...
...
prod-server/usr/share/eterban/ban.py
View file @
2dc157bc
...
...
@@ -3,6 +3,7 @@ import redis
import
sys
import
configparser
import
os
import
socket
def
createConfig
(
path_to_config
):
"""
...
...
@@ -11,7 +12,7 @@ def createConfig(path_to_config):
config
=
configparser
.
ConfigParser
()
config
.
add_section
(
"Settings"
)
config
.
set
(
"Settings"
,
"redis_server"
,
"10.20.30.101"
)
config
.
set
(
"Settings"
,
"hostname"
,
"UNKNOWN"
)
config
.
set
(
"Settings"
,
"hostname"
,
socket
.
gethostname
()
)
with
open
(
path_to_config
,
"w"
)
as
config_file
:
config
.
write
(
config_file
)
...
...
@@ -27,7 +28,7 @@ def get_ip_redis_server (path_to_config):
# Читаем некоторые значения из конфиг. файла.
redis_server
=
config
.
get
(
"Settings"
,
"redis_server"
,
fallback
=
"No such things as redis_server"
)
hostname
=
config
.
get
(
"Settings"
,
"hostname"
,
fallback
=
"No such things as hostname"
)
hostname
=
config
.
get
(
"Settings"
,
"hostname"
,
fallback
=
socket
.
gethostname
()
)
if
redis_server
==
"No such things as redis_server"
:
config
.
set
(
"Settings"
,
"redis_server"
,
"10.20.30.101"
)
with
open
(
path_to_config
,
"a"
)
as
config_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