Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
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
1
Merge Requests
1
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
settingsd
Commits
3a6a458f
Commit
3a6a458f
authored
Mar 26, 2019
by
Дмитрий Никулин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add access table generation for postfix
parent
6bb1b51d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
fmod_postfix.py
plugins/functions/fmod_postfix.py
+15
-0
No files found.
plugins/functions/fmod_postfix.py
View file @
3a6a458f
...
@@ -25,6 +25,21 @@ POSTFIX_MAIN_CF = "/etc/postfix/main.cf"
...
@@ -25,6 +25,21 @@ POSTFIX_MAIN_CF = "/etc/postfix/main.cf"
##### Private classes #####
##### Private classes #####
class
Postfix
(
service
.
FunctionObject
)
:
class
Postfix
(
service
.
FunctionObject
)
:
### DBus methods ###
### DBus methods ###
@service.functionMethod
(
POSTFIX_METHODS_NAMESPACE
,
in_signature
=
"ss"
)
def
generateAccessTable
(
self
,
filters_file_path
,
access_file_path
):
with
open
(
filters_file_path
,
'r'
)
as
filters_file
:
lists
=
safe_load
(
filters_file
.
read
())
entries
=
[]
for
item
in
lists
[
'whitelist'
]:
entries
.
append
([
item
[
'key'
],
'OK'
])
for
item
in
lists
[
'blacklist'
]:
entries
.
append
([
item
[
'key'
],
item
[
'action'
]
.
upper
()])
with
open
(
access_file_path
,
'w+'
)
as
access_file
:
access_file
.
write
(
'
\n
'
.
join
([
' '
.
join
(
pair
)
for
pair
in
entries
]))
@service.functionMethod
(
POSTFIX_METHODS_NAMESPACE
,
in_signature
=
"ss"
,
out_signature
=
"s"
)
@service.functionMethod
(
POSTFIX_METHODS_NAMESPACE
,
in_signature
=
"ss"
,
out_signature
=
"s"
)
def
regenerateMainCf
(
self
,
config_filename
,
templates_dir
):
def
regenerateMainCf
(
self
,
config_filename
,
templates_dir
):
with
open
(
config_filename
,
'r'
)
as
postfix_config
:
with
open
(
config_filename
,
'r'
)
as
postfix_config
:
...
...
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