Commit d59f5827 by Bach Dániel

random fixes

parent 3c7d5c26
...@@ -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/syslog')
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=3600, 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
......
...@@ -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
...@@ -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']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment