Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fc695d86
authored
Feb 19, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: hotfix
parent
41361840
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
firewall/fw.py
+2
-0
firewall/tasks.py
+12
-1
No files found.
firewall/fw.py
View file @
fc695d86
...
@@ -402,6 +402,8 @@ def dns():
...
@@ -402,6 +402,8 @@ def dns():
DNS
.
append
(
"@
%(fqdn)
s::
%(mx)
s:
%(dist)
s:
%(ttl)
s"
%
DNS
.
append
(
"@
%(fqdn)
s::
%(mx)
s:
%(dist)
s:
%(ttl)
s"
%
{
'fqdn'
:
d
[
'name'
],
'mx'
:
mx
[
1
],
'dist'
:
mx
[
0
],
{
'fqdn'
:
d
[
'name'
],
'mx'
:
mx
[
1
],
'dist'
:
mx
[
0
],
'ttl'
:
d
[
'ttl'
]})
'ttl'
:
d
[
'ttl'
]})
elif
d
[
'type'
]
==
'PTR'
:
DNS
.
append
(
"^
%
s:
%
s:
%
s"
%
(
d
[
'name'
],
d
[
'address'
],
d
[
'ttl'
]))
return
DNS
return
DNS
process
=
subprocess
.
Popen
([
'/usr/bin/ssh'
,
'tinydns@
%
s'
%
process
=
subprocess
.
Popen
([
'/usr/bin/ssh'
,
'tinydns@
%
s'
%
...
...
firewall/tasks.py
View file @
fc695d86
...
@@ -17,21 +17,32 @@ def reload_dhcp_task(data):
...
@@ -17,21 +17,32 @@ def reload_dhcp_task(data):
pass
pass
class
ReloadTask
(
Task
):
class
ReloadTask
(
Task
):
def
run
(
self
,
type
):
def
run
(
self
,
type
=
'Host'
):
sleep
=
False
if
type
in
[
"Host"
,
"Records"
,
"Domain"
,
"Vlan"
]:
if
type
in
[
"Host"
,
"Records"
,
"Domain"
,
"Vlan"
]:
lock
=
lambda
:
cache
.
add
(
"dns_lock"
,
"true"
,
9
)
lock
=
lambda
:
cache
.
add
(
"dns_lock"
,
"true"
,
9
)
if
lock
():
if
lock
():
if
not
sleep
:
sleep
=
True
time
.
sleep
(
10
)
reload_dns_task
.
delay
(
dns
())
reload_dns_task
.
delay
(
dns
())
if
type
==
"Host"
:
if
type
==
"Host"
:
lock
=
lambda
:
cache
.
add
(
"dhcp_lock"
,
"true"
,
9
)
lock
=
lambda
:
cache
.
add
(
"dhcp_lock"
,
"true"
,
9
)
if
lock
():
if
lock
():
if
not
sleep
:
sleep
=
True
time
.
sleep
(
10
)
reload_dhcp_task
.
delay
(
dhcp
())
reload_dhcp_task
.
delay
(
dhcp
())
if
type
in
[
"Host"
,
"Rule"
,
"Firewall"
]:
if
type
in
[
"Host"
,
"Rule"
,
"Firewall"
]:
lock
=
lambda
:
cache
.
add
(
"firewall_lock"
,
"true"
,
9
)
lock
=
lambda
:
cache
.
add
(
"firewall_lock"
,
"true"
,
9
)
if
lock
():
if
lock
():
if
not
sleep
:
sleep
=
True
time
.
sleep
(
10
)
ipv4
=
firewall
()
.
get
()
ipv4
=
firewall
()
.
get
()
ipv6
=
firewall
(
True
)
.
get
()
ipv6
=
firewall
(
True
)
.
get
()
reload_firewall_task
.
delay
(
ipv4
,
ipv6
)
reload_firewall_task
.
delay
(
ipv4
,
ipv6
)
...
...
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