Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
firewall
Commits
7eb4e611
Commit
7eb4e611
authored
Aug 07, 2020
by
Benjamin Graillot
Browse files
Open /etc/nftables.conf in write mode
parent
58c1a1bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
firewall.py
View file @
7eb4e611
...
...
@@ -204,6 +204,6 @@ if __name__ == "__main__":
if
args
.
export
:
print
(
template
.
render
(
nat
=
nat
,
ports_openings
=
ports_openings
,
ports_openings_adh
=
ports_openings_adh
))
else
:
with
open
(
'/etc/nftables.conf'
)
as
nftables
:
with
open
(
'/etc/nftables.conf'
,
'w'
)
as
nftables
:
nftables
.
write
(
template
.
render
(
nat
=
nat
,
ports_openings
=
ports_openings
,
ports_openings_adh
=
ports_openings_adh
))
subprocess
.
run
([
'systemctl'
,
'reload'
,
'nftables'
])
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