Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
fwdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d59f5827
authored
Dec 22, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
random fixes
parent
3c7d5c26
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
fw.py
+5
-5
miscellaneous/firewall.conf
+6
-4
ovs.py
+2
-1
No files found.
fw.py
View file @
d59f5827
...
@@ -7,13 +7,13 @@ import socket
...
@@ -7,13 +7,13 @@ import socket
from
ovs
import
Switch
from
ovs
import
Switch
IRC_CHANNEL
=
getenv
(
'IRC_CHANNEL'
,
'/home/cloud/irc/irc.atw.hu/#ik/in'
)
IRC_CHANNEL
=
getenv
(
'IRC_CHANNEL'
,
'/home/cloud/irc/irc.atw.hu/#ik/in'
)
DHCP_LOGFILE
=
getenv
(
'DHCP_LOGFILE'
,
'/
home/cloud/dhcp.
log'
)
DHCP_LOGFILE
=
getenv
(
'DHCP_LOGFILE'
,
'/
var/log/sys
log'
)
VLAN_CONF
=
getenv
(
'VLAN_CONF'
,
'vlan.conf'
)
VLAN_CONF
=
getenv
(
'VLAN_CONF'
,
'vlan.conf'
)
FIREWALL_CONF
=
getenv
(
'FIREWALL_CONF'
,
'firewall.conf'
)
FIREWALL_CONF
=
getenv
(
'FIREWALL_CONF'
,
'firewall.conf'
)
celery
=
Celery
(
'tasks'
,
backend
=
'amqp'
,
)
celery
=
Celery
(
'tasks'
,
backend
=
'amqp'
,
)
celery
.
conf
.
update
(
CELERY_TASK_RESULT_EXPIRES
=
3
6
00
,
celery
.
conf
.
update
(
CELERY_TASK_RESULT_EXPIRES
=
300
,
BROKER_URL
=
getenv
(
"AMQP_URI"
),
BROKER_URL
=
getenv
(
"AMQP_URI"
),
CELERY_CREATE_MISSING_QUEUES
=
True
)
CELERY_CREATE_MISSING_QUEUES
=
True
)
...
@@ -46,7 +46,7 @@ def reload_firewall_vlan(data, onstart=False):
...
@@ -46,7 +46,7 @@ def reload_firewall_vlan(data, onstart=False):
if
onstart
is
False
:
if
onstart
is
False
:
with
open
(
VLAN_CONF
,
'w'
)
as
f
:
with
open
(
VLAN_CONF
,
'w'
)
as
f
:
json
.
dump
(
data
,
f
)
json
.
dump
(
data
,
f
)
subprocess
.
call
(
"/sbin/ip ro add default via 10.7.255.254"
,
shell
=
True
)
@task
(
name
=
"firewall.reload_dhcp"
)
@task
(
name
=
"firewall.reload_dhcp"
)
def
reload_dhcp
(
data
):
def
reload_dhcp
(
data
):
...
@@ -135,7 +135,7 @@ dhcp_no_free_re = re.compile(r'\S DHCPDISCOVER '
...
@@ -135,7 +135,7 @@ dhcp_no_free_re = re.compile(r'\S DHCPDISCOVER '
# r'(\((?P<hostnamename>[^)]+)\) )?'
# r'(\((?P<hostnamename>[^)]+)\) )?'
@task
(
name
=
"firewall.
tasks.get_dhcp_clients_task
"
)
@task
(
name
=
"firewall.
get_dhcp_clients
"
)
def
get_dhcp_clients
():
def
get_dhcp_clients
():
clients
=
{}
clients
=
{}
...
@@ -152,7 +152,7 @@ def get_dhcp_clients():
...
@@ -152,7 +152,7 @@ def get_dhcp_clients():
ip
=
m
.
get
(
'ip'
,
None
)
ip
=
m
.
get
(
'ip'
,
None
)
hostname
=
m
.
get
(
'hostname'
,
None
)
hostname
=
m
.
get
(
'hostname'
,
None
)
interface
=
m
.
get
(
'interface'
,
None
)
interface
=
m
.
get
(
'interface'
,
None
)
clients
[
mac
]
=
(
ip
,
hostname
,
interface
)
clients
[
mac
]
=
{
'ip'
:
ip
,
'hostname'
:
hostname
,
'interface'
:
interface
}
return
clients
return
clients
...
...
miscellaneous/firewall.conf
View file @
d59f5827
...
@@ -5,12 +5,14 @@ stop on runlevel [!2345]
...
@@ -5,12 +5,14 @@ stop on runlevel [!2345]
respawn
respawn
respawn
limit
30
30
respawn
limit
30
30
setuid
cloud
env
USER
=
firewall
setgid
firewall
setuid
firewall
chdir
/
home
/
cloud
/
fwdriver
script
script
. /
home
/
cloud
/.
virtualenvs
/
fwdriver
/
local
/
bin
/
postactivate
cd
/
home
/$
USER
/
fwdriver
exec
/
home
/
cloud
/.
virtualenvs
/
fwdriver
/
bin
/
celeryd
-
A
fw
-
Q
firewall
--
loglevel
=
info
--
logfile
=/
tmp
/
fwcelery
.
log
. /
home
/$
USER
/.
virtualenvs
/
fwdriver
/
local
/
bin
/
postactivate
exec
/
home
/$
USER
/.
virtualenvs
/
fwdriver
/
bin
/
celeryd
-
A
fw
-
Q
firewall
--
loglevel
=
info
end
script
end
script
ovs.py
View file @
d59f5827
...
@@ -135,7 +135,8 @@ class Switch:
...
@@ -135,7 +135,8 @@ class Switch:
logging
.
debug
(
'[ovs] add:
%
s'
%
(
add
,
))
logging
.
debug
(
'[ovs] add:
%
s'
%
(
add
,
))
for
i
in
delete
:
for
i
in
delete
:
self
.
delete_port
(
i
)
if
not
i
.
startswith
(
'gre'
):
self
.
delete_port
(
i
)
for
i
in
add
:
for
i
in
add
:
internal
=
new_ports
[
i
]
.
get
(
'type'
,
''
)
==
'internal'
internal
=
new_ports
[
i
]
.
get
(
'type'
,
''
)
==
'internal'
tag
=
new_ports
[
i
][
'tag'
]
tag
=
new_ports
[
i
][
'tag'
]
...
...
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