Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
fwdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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
from
ovs
import
Switch
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'
)
FIREWALL_CONF
=
getenv
(
'FIREWALL_CONF'
,
'firewall.conf'
)
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"
),
CELERY_CREATE_MISSING_QUEUES
=
True
)
...
...
@@ -46,7 +46,7 @@ def reload_firewall_vlan(data, onstart=False):
if
onstart
is
False
:
with
open
(
VLAN_CONF
,
'w'
)
as
f
:
json
.
dump
(
data
,
f
)
subprocess
.
call
(
"/sbin/ip ro add default via 10.7.255.254"
,
shell
=
True
)
@task
(
name
=
"firewall.reload_dhcp"
)
def
reload_dhcp
(
data
):
...
...
@@ -135,7 +135,7 @@ dhcp_no_free_re = re.compile(r'\S DHCPDISCOVER '
# r'(\((?P<hostnamename>[^)]+)\) )?'
@task
(
name
=
"firewall.
tasks.get_dhcp_clients_task
"
)
@task
(
name
=
"firewall.
get_dhcp_clients
"
)
def
get_dhcp_clients
():
clients
=
{}
...
...
@@ -152,7 +152,7 @@ def get_dhcp_clients():
ip
=
m
.
get
(
'ip'
,
None
)
hostname
=
m
.
get
(
'hostname'
,
None
)
interface
=
m
.
get
(
'interface'
,
None
)
clients
[
mac
]
=
(
ip
,
hostname
,
interface
)
clients
[
mac
]
=
{
'ip'
:
ip
,
'hostname'
:
hostname
,
'interface'
:
interface
}
return
clients
...
...
miscellaneous/firewall.conf
View file @
d59f5827
...
...
@@ -5,12 +5,14 @@ stop on runlevel [!2345]
respawn
respawn
limit
30
30
setuid
cloud
env
USER
=
firewall
setgid
firewall
setuid
firewall
chdir
/
home
/
cloud
/
fwdriver
script
. /
home
/
cloud
/.
virtualenvs
/
fwdriver
/
local
/
bin
/
postactivate
exec
/
home
/
cloud
/.
virtualenvs
/
fwdriver
/
bin
/
celeryd
-
A
fw
-
Q
firewall
--
loglevel
=
info
--
logfile
=/
tmp
/
fwcelery
.
log
cd
/
home
/$
USER
/
fwdriver
. /
home
/$
USER
/.
virtualenvs
/
fwdriver
/
local
/
bin
/
postactivate
exec
/
home
/$
USER
/.
virtualenvs
/
fwdriver
/
bin
/
celeryd
-
A
fw
-
Q
firewall
--
loglevel
=
info
end
script
ovs.py
View file @
d59f5827
...
...
@@ -135,7 +135,8 @@ class Switch:
logging
.
debug
(
'[ovs] add:
%
s'
%
(
add
,
))
for
i
in
delete
:
self
.
delete_port
(
i
)
if
not
i
.
startswith
(
'gre'
):
self
.
delete_port
(
i
)
for
i
in
add
:
internal
=
new_ports
[
i
]
.
get
(
'type'
,
''
)
==
'internal'
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