Commit d3cded80 by Guba Sándor

Merge branch 'master' of giccero.cloud.ik.bme.hu:cloud

parents 0c6bca57 915ec04b
...@@ -37,3 +37,5 @@ nosetests.xml ...@@ -37,3 +37,5 @@ nosetests.xml
# Other # Other
*.swp *.swp
*~ *~
local_settings.py
# Django settings for cloud project. # Django settings for cloud project.
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (
('Ory, Mate', 'maat@iit.bme.hu'), ('IK', 'cloud@iit.bme.hu'),
) )
MANAGERS = ADMINS MANAGERS = ADMINS
...@@ -113,12 +114,9 @@ INSTALLED_APPS = ( ...@@ -113,12 +114,9 @@ INSTALLED_APPS = (
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin', 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs', 'django.contrib.admindocs',
'one', 'one',
'school', 'school',
...@@ -128,7 +126,6 @@ INSTALLED_APPS = ( ...@@ -128,7 +126,6 @@ INSTALLED_APPS = (
'south', 'south',
'djcelery', 'djcelery',
'kombu.transport.django', 'kombu.transport.django',
#'django_bfm',
) )
# A sample logging configuration. The only tangible logging # A sample logging configuration. The only tangible logging
...@@ -136,7 +133,7 @@ INSTALLED_APPS = ( ...@@ -136,7 +133,7 @@ INSTALLED_APPS = (
# the site admins on every HTTP 500 error when DEBUG=False. # the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for # See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration. # more details on how to customize your logging configuration.
from logging.handlers import SysLogHandler from logging.handlers import SysLogHandler
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
...@@ -178,5 +175,9 @@ import djcelery ...@@ -178,5 +175,9 @@ import djcelery
djcelery.setup_loader() djcelery.setup_loader()
BROKER_URL = 'django://' BROKER_URL = 'django://'
try:
from cloud.local_settings import *
except:
pass
# vim: et sw=4 ai fenc=utf8 smarttab : # vim: et sw=4 ai fenc=utf8 smarttab :
from django.contrib import admin from django.contrib import admin
from firewall.models import * from firewall.models import *
from django import contrib
class AliasInline(contrib.admin.TabularInline):
model = Alias
class HostAdmin(admin.ModelAdmin): class HostAdmin(admin.ModelAdmin):
list_display = ('hostname', 'vlan', 'ipv4', 'ipv6', 'pub_ipv4', 'mac', 'shared_ip', 'owner', 'groups_l', 'rules_l', 'description') list_display = ('hostname', 'vlan', 'ipv4', 'ipv6', 'pub_ipv4', 'mac', 'shared_ip', 'owner', 'groups_l', 'rules_l', 'description', 'reverse')
ordering = ('hostname',) ordering = ('hostname', )
list_filter = ('owner', 'vlan', 'groups') list_filter = ('owner', 'vlan', 'groups')
search_fields = ('hostname', 'description', 'ipv4', 'ipv6', 'mac') search_fields = ('hostname', 'description', 'ipv4', 'ipv6', 'mac')
filter_horizontal = ('groups', 'rules',) filter_horizontal = ('groups', 'rules', )
inlines = (AliasInline, )
class HostInline(contrib.admin.TabularInline):
model = Host
fields = ('hostname', 'ipv4', 'ipv6', 'pub_ipv4', 'mac', 'shared_ip', 'owner', 'reverse')
class VlanAdmin(admin.ModelAdmin): class VlanAdmin(admin.ModelAdmin):
list_display = ('vid', 'name', 'rules_l', 'ipv4', 'net_ipv4', 'ipv6', 'net_ipv6', 'description', 'domain', 'snat_ip', 'snat_to_l') list_display = ('vid', 'name', 'rules_l', 'ipv4', 'net_ipv4', 'ipv6', 'net_ipv6', 'description', 'domain', 'snat_ip', 'snat_to_l')
ordering = ('vid',) ordering = ('vid', )
inlines = (HostInline, )
class RuleAdmin(admin.ModelAdmin): class RuleAdmin(admin.ModelAdmin):
list_display = ('r_type', 'color_desc', 'description', 'vlan_l', 'owner', 'extra', 'direction', 'accept', 'proto', 'sport', 'dport', 'nat', 'nat_dport') list_display = ('r_type', 'color_desc', 'description', 'vlan_l', 'owner', 'extra', 'direction', 'accept', 'proto', 'sport', 'dport', 'nat', 'nat_dport')
list_filter = ('r_type', 'vlan', 'owner', 'direction', 'accept', 'proto', 'nat') list_filter = ('r_type', 'vlan', 'owner', 'direction', 'accept', 'proto', 'nat')
class AliasAdmin(admin.ModelAdmin):
list_display = ('alias', 'host')
class SettingAdmin(admin.ModelAdmin):
list_display = ('key', 'value')
admin.site.register(Host, HostAdmin) admin.site.register(Host, HostAdmin)
admin.site.register(Vlan, VlanAdmin) admin.site.register(Vlan, VlanAdmin)
admin.site.register(Rule, RuleAdmin) admin.site.register(Rule, RuleAdmin)
admin.site.register(Alias, AliasAdmin)
admin.site.register(Setting, SettingAdmin)
admin.site.register(Group) admin.site.register(Group)
admin.site.register(Firewall) admin.site.register(Firewall)
...@@ -42,5 +42,5 @@ def val_domain(value): ...@@ -42,5 +42,5 @@ def val_domain(value):
raise ValidationError(u'%s - helytelen domain' % value) raise ValidationError(u'%s - helytelen domain' % value)
def ipv4_2_ipv6(ipv4): def ipv4_2_ipv6(ipv4):
m = ipv4_re.match(ipv4) m = ipv4_re.match(ipv4)
return "2001:738:2001:4031:%s:%s:%s:0" % (m.group(1), m.group(2), m.group(3)) return "2001:738:2001:4031:%s:%s:%s:0" % (m.group(1), m.group(2), m.group(3))
#!/usr/bin/env python
#from django.core.management import setup_environ
#from teszt import settings
#setup_environ(settings)
from django.contrib import auth from django.contrib import auth
from firewall import models from firewall import models
from modeldict import *
import os import os
import subprocess import subprocess
import re import re
DNS_SERVER = "152.66.243.60" import json
class firewall: class firewall:
IPV6=False IPV6=False
SZABALYOK = None SZABALYOK = None
SZABALYOK_NAT = [] SZABALYOK_NAT = []
vlans = None vlans = None
dmz = None dmz = None
pub = None pub = None
hosts = None hosts = None
fw = None fw = None
def dportsport(self, rule, repl=True): def dportsport(self, rule, repl=True):
retval = " " retval = " "
if(rule.proto == "tcp" or rule.proto == "udp"): if(rule.proto == "tcp" or rule.proto == "udp"):
retval = "-p %s " % rule.proto retval = "-p %s " % rule.proto
if(rule.sport): if(rule.sport):
retval += " --sport %s " % rule.sport retval += " --sport %s " % rule.sport
if(rule.dport): if(rule.dport):
retval += " --dport %s " % ( rule.nat_dport if (repl and rule.nat and rule.direction == '1') else rule.dport ) retval += " --dport %s " % ( rule.nat_dport if (repl and rule.nat and rule.direction == '1') else rule.dport )
elif(rule.proto == "icmp"): elif(rule.proto == "icmp"):
retval = "-p %s " % rule.proto retval = "-p %s " % rule.proto
return retval return retval
def iptables(self, s): def iptables(self, s):
self.SZABALYOK.append(s) self.SZABALYOK.append(s)
def iptablesnat(self, s): def iptablesnat(self, s):
self.SZABALYOK_NAT.append(s) self.SZABALYOK_NAT.append(s)
def host2vlan(self, host, rule): def host2vlan(self, host, rule):
if(self.IPV6): if(self.IPV6 and host.ipv6):
ipaddr = host.ipv6 + "/112" ipaddr = host.ipv6 + "/112"
else: else:
ipaddr = host.ipv4 ipaddr = host.ipv4
dport_sport = self.dportsport(rule) dport_sport = self.dportsport(rule)
for vlan in rule.vlan.all(): for vlan in rule.vlan.all():
if(rule.accept): if(rule.accept):
if(rule.direction == '0' and vlan.name == "PUB"): if(rule.direction == '0' and vlan.name == "PUB"):
if(rule.dport == 25): if(rule.dport == 25):
self.iptables("-A PUB_OUT -s %s %s -p tcp --dport 25 -j LOG_ACC" % (ipaddr, rule.extra)) self.iptables("-A PUB_OUT -s %s %s -p tcp --dport 25 -j LOG_ACC" % (ipaddr, rule.extra))
break break
action = "PUB_OUT" action = "PUB_OUT"
else: else:
action = "LOG_ACC" action = "LOG_ACC"
else: else:
action = "LOG_DROP" action = "LOG_DROP"
if(rule.direction == '1'): #HOSTHOZ megy if(rule.direction == '1'): # HOSTHOZ megy
self.iptables("-A %s_%s -d %s %s %s -g %s" % (vlan, host.vlan, ipaddr, dport_sport, rule.extra, action)); self.iptables("-A %s_%s -d %s %s %s -g %s" % (vlan, host.vlan, ipaddr, dport_sport, rule.extra, action))
else: else:
self.iptables("-A %s_%s -s %s %s %s -g %s" % (host.vlan, vlan, ipaddr, dport_sport, rule.extra, action)); self.iptables("-A %s_%s -s %s %s %s -g %s" % (host.vlan, vlan, ipaddr, dport_sport, rule.extra, action))
def fw2vlan(self, rule): def fw2vlan(self, rule):
dport_sport = self.dportsport(rule) dport_sport = self.dportsport(rule)
for vlan in rule.vlan.all(): for vlan in rule.vlan.all():
if(rule.direction == '1'): #HOSTHOZ megy if(rule.direction == '1'): # HOSTHOZ megy
self.iptables("-A INPUT -i %s %s %s -g %s" % (vlan.interface, dport_sport, rule.extra, "LOG_ACC" if rule.accept else "LOG_DROP")); self.iptables("-A INPUT -i %s %s %s -g %s" % (vlan.interface, dport_sport, rule.extra, "LOG_ACC" if rule.accept else "LOG_DROP"))
else: else:
self.iptables("-A OUTPUT -o %s %s %s -g %s" % (vlan.interface, dport_sport, rule.extra, "LOG_ACC" if rule.accept else "LOG_DROP")); self.iptables("-A OUTPUT -o %s %s %s -g %s" % (vlan.interface, dport_sport, rule.extra, "LOG_ACC" if rule.accept else "LOG_DROP"))
def vlan2vlan(self, l_vlan, rule): def vlan2vlan(self, l_vlan, rule):
dport_sport = self.dportsport(rule) dport_sport = self.dportsport(rule)
for vlan in rule.vlan.all(): for vlan in rule.vlan.all():
if(rule.accept): if(rule.accept):
if((rule.direction == '0') and vlan.name == "PUB"): if((rule.direction == '0') and vlan.name == "PUB"):
action = "PUB_OUT" action = "PUB_OUT"
else: else:
action = "LOG_ACC" action = "LOG_ACC"
else: else:
action = "LOG_DROP" action = "LOG_DROP"
if(rule.direction == '1'): #HOSTHOZ megy if(rule.direction == '1'): # HOSTHOZ megy
self.iptables("-A %s_%s %s %s -g %s" % (vlan, l_vlan, dport_sport, rule.extra, action)); self.iptables("-A %s_%s %s %s -g %s" % (vlan, l_vlan, dport_sport, rule.extra, action))
else: else:
self.iptables("-A %s_%s %s %s -g %s" % (l_vlan, vlan, dport_sport, rule.extra, action)); self.iptables("-A %s_%s %s %s -g %s" % (l_vlan, vlan, dport_sport, rule.extra, action))
def prerun(self): def prerun(self):
self.iptables("*filter") self.iptables("*filter")
self.iptables(":INPUT DROP [88:6448]") self.iptables(":INPUT DROP [88:6448]")
self.iptables(":FORWARD DROP [0:0]") self.iptables(":FORWARD DROP [0:0]")
self.iptables(":OUTPUT DROP [50:6936]") self.iptables(":OUTPUT DROP [50:6936]")
#inicialize logging # inicialize logging
self.iptables("-N LOG_DROP") self.iptables("-N LOG_DROP")
#windows port scan are silently dropped # windows port scan are silently dropped
self.iptables("-A LOG_DROP -p tcp --dport 445 -j DROP") self.iptables("-A LOG_DROP -p tcp --dport 445 -j DROP")
self.iptables("-A LOG_DROP -p udp --dport 137 -j DROP") self.iptables("-A LOG_DROP -p udp --dport 137 -j DROP")
self.iptables("-A LOG_DROP -j LOG --log-level 7 --log-prefix \"[ipt][drop]\"") self.iptables("-A LOG_DROP -j LOG --log-level 7 --log-prefix \"[ipt][drop]\"")
self.iptables("-A LOG_DROP -j DROP") self.iptables("-A LOG_DROP -j DROP")
self.iptables("-N LOG_ACC") self.iptables("-N LOG_ACC")
self.iptables("-A LOG_ACC -j LOG --log-level 7 --log-prefix \"[ipt][isok]\"") self.iptables("-A LOG_ACC -j LOG --log-level 7 --log-prefix \"[ipt][isok]\"")
self.iptables("-A LOG_ACC -j ACCEPT") self.iptables("-A LOG_ACC -j ACCEPT")
if not self.IPV6: if not self.IPV6:
#The chain which test is a packet has a valid public destination IP # The chain which test is a packet has a valid public destination IP
#(RFC-3330) packages passing this chain has valid destination IP addressed # (RFC-3330) packages passing this chain has valid destination IP addressed
self.iptables("-N r_pub_dIP") self.iptables("-N r_pub_dIP")
self.iptables("-A r_pub_dIP -d 0.0.0.0/8 -g LOG_DROP") self.iptables("-A r_pub_dIP -d 0.0.0.0/8 -g LOG_DROP")
self.iptables("-A r_pub_dIP -d 169.254.0.0/16 -g LOG_DROP") self.iptables("-A r_pub_dIP -d 169.254.0.0/16 -g LOG_DROP")
self.iptables("-A r_pub_dIP -d 172.16.0.0/12 -g LOG_DROP") self.iptables("-A r_pub_dIP -d 172.16.0.0/12 -g LOG_DROP")
self.iptables("-A r_pub_dIP -d 192.0.2.0/24 -g LOG_DROP") self.iptables("-A r_pub_dIP -d 192.0.2.0/24 -g LOG_DROP")
self.iptables("-A r_pub_dIP -d 192.168.0.0/16 -g LOG_DROP") self.iptables("-A r_pub_dIP -d 192.168.0.0/16 -g LOG_DROP")
self.iptables("-A r_pub_dIP -d 127.0.0.0/8 -g LOG_DROP") self.iptables("-A r_pub_dIP -d 127.0.0.0/8 -g LOG_DROP")
#self.iptables("-A r_pub_dIP -d 10.0.0.0/8 -g LOG_DROP") # self.iptables("-A r_pub_dIP -d 10.0.0.0/8 -g LOG_DROP")
#The chain which test is a packet has a valid public source IP # The chain which test is a packet has a valid public source IP
#(RFC-3330) packages passing this chain has valid destination IP addressed # (RFC-3330) packages passing this chain has valid destination IP addressed
self.iptables("-N r_pub_sIP") self.iptables("-N r_pub_sIP")
self.iptables("-A r_pub_sIP -s 0.0.0.0/8 -g LOG_DROP") self.iptables("-A r_pub_sIP -s 0.0.0.0/8 -g LOG_DROP")
self.iptables("-A r_pub_sIP -s 169.254.0.0/16 -g LOG_DROP") self.iptables("-A r_pub_sIP -s 169.254.0.0/16 -g LOG_DROP")
self.iptables("-A r_pub_sIP -s 172.16.0.0/12 -g LOG_DROP") self.iptables("-A r_pub_sIP -s 172.16.0.0/12 -g LOG_DROP")
self.iptables("-A r_pub_sIP -s 192.0.2.0/24 -g LOG_DROP") self.iptables("-A r_pub_sIP -s 192.0.2.0/24 -g LOG_DROP")
self.iptables("-A r_pub_sIP -s 192.168.0.0/16 -g LOG_DROP") self.iptables("-A r_pub_sIP -s 192.168.0.0/16 -g LOG_DROP")
self.iptables("-A r_pub_sIP -s 127.0.0.0/8 -g LOG_DROP") self.iptables("-A r_pub_sIP -s 127.0.0.0/8 -g LOG_DROP")
#self.iptables("-A r_pub_sIP -s 10.0.0.0/8 -g LOG_DROP") # self.iptables("-A r_pub_sIP -s 10.0.0.0/8 -g LOG_DROP")
#chain which tests if the destination specified by the DMZ host is valid # chain which tests if the destination specified by the DMZ host is valid
self.iptables("-N r_DMZ_dIP") self.iptables("-N r_DMZ_dIP")
self.iptables("-A r_DMZ_dIP -d 10.2.0.0/16 -j RETURN") self.iptables("-A r_DMZ_dIP -d 10.2.0.0/16 -j RETURN")
self.iptables("-A r_DMZ_dIP -j r_pub_dIP") self.iptables("-A r_DMZ_dIP -j r_pub_dIP")
self.iptables("-N PUB_OUT") self.iptables("-N PUB_OUT")
if not self.IPV6: if not self.IPV6:
self.iptables("-A PUB_OUT -j r_pub_dIP") self.iptables("-A PUB_OUT -j r_pub_dIP")
self.iptables("-A FORWARD -m state --state INVALID -g LOG_DROP") self.iptables("-A FORWARD -m state --state INVALID -g LOG_DROP")
self.iptables("-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT") self.iptables("-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT")
self.iptables("-A FORWARD -p icmp --icmp-type echo-request -g LOG_ACC") self.iptables("-A FORWARD -p icmp --icmp-type echo-request -g LOG_ACC")
if not self.IPV6: if not self.IPV6:
self.iptables("-A FORWARD -j r_pub_sIP -o pub") self.iptables("-A FORWARD -j r_pub_sIP -o pub")
self.iptables("-A INPUT -m state --state INVALID -g LOG_DROP") self.iptables("-A INPUT -m state --state INVALID -g LOG_DROP")
self.iptables("-A INPUT -i lo -j ACCEPT") self.iptables("-A INPUT -i lo -j ACCEPT")
if not self.IPV6: if not self.IPV6:
self.iptables("-A INPUT -j r_pub_sIP") self.iptables("-A INPUT -j r_pub_sIP")
self.iptables("-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT") self.iptables("-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT")
self.iptables("-A OUTPUT -m state --state INVALID -g LOG_DROP") self.iptables("-A OUTPUT -m state --state INVALID -g LOG_DROP")
self.iptables("-A OUTPUT -o lo -j ACCEPT") self.iptables("-A OUTPUT -o lo -j ACCEPT")
self.iptables("-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT") self.iptables("-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT")
def postrun(self): def postrun(self):
self.iptables("-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 25 -j LOG_ACC") self.iptables("-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 25 -j LOG_ACC")
self.iptables("-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 445 -j LOG_ACC") self.iptables("-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 445 -j LOG_ACC")
self.iptables("-A PUB_OUT -p tcp --dport 25 -j LOG_DROP") self.iptables("-A PUB_OUT -p tcp --dport 25 -j LOG_DROP")
self.iptables("-A PUB_OUT -p tcp --dport 445 -j LOG_DROP") self.iptables("-A PUB_OUT -p tcp --dport 445 -j LOG_DROP")
self.iptables("-A PUB_OUT -p udp --dport 445 -j LOG_DROP") self.iptables("-A PUB_OUT -p udp --dport 445 -j LOG_DROP")
self.iptables("-A PUB_OUT -g LOG_ACC") self.iptables("-A PUB_OUT -g LOG_ACC")
self.iptables("-A FORWARD -g LOG_DROP") self.iptables("-A FORWARD -g LOG_DROP")
self.iptables("-A INPUT -g LOG_DROP") self.iptables("-A INPUT -g LOG_DROP")
self.iptables("-A OUTPUT -g LOG_DROP") self.iptables("-A OUTPUT -g LOG_DROP")
self.iptables("COMMIT") self.iptables("COMMIT")
def ipt_nat(self): def ipt_nat(self):
self.iptablesnat("*nat") self.iptablesnat("*nat")
self.iptablesnat(":PREROUTING ACCEPT [0:0]") self.iptablesnat(":PREROUTING ACCEPT [0:0]")
self.iptablesnat(":INPUT ACCEPT [0:0]") self.iptablesnat(":INPUT ACCEPT [0:0]")
self.iptablesnat(":OUTPUT ACCEPT [1:708]") self.iptablesnat(":OUTPUT ACCEPT [1:708]")
self.iptablesnat(":POSTROUTING ACCEPT [1:708]") self.iptablesnat(":POSTROUTING ACCEPT [1:708]")
#portforward # portforward
for host in self.hosts.exclude(pub_ipv4=None): for host in self.hosts.exclude(pub_ipv4=None):
for rule in host.rules.filter(nat=True, direction='1'): for rule in host.rules.filter(nat=True, direction='1'):
dport_sport = self.dportsport(rule, False) dport_sport = self.dportsport(rule, False)
if host.vlan.snat_ip: if host.vlan.snat_ip:
self.iptablesnat("-A PREROUTING -d %s %s %s -j DNAT --to-destination %s:%s" % (host.pub_ipv4, dport_sport, rule.extra, host.ipv4, rule.nat_dport)) self.iptablesnat("-A PREROUTING -d %s %s %s -j DNAT --to-destination %s:%s" % (host.pub_ipv4, dport_sport, rule.extra, host.ipv4, rule.nat_dport))
#sajat publikus ipvel rendelkezo gepek szabalyai # sajat publikus ipvel rendelkezo gepek szabalyai
for host in self.hosts.exclude(shared_ip=True): for host in self.hosts.exclude(shared_ip=True):
if(host.pub_ipv4): if(host.pub_ipv4):
self.iptablesnat("-A PREROUTING -d %s -j DNAT --to-destination %s" % (host.pub_ipv4, host.ipv4)) self.iptablesnat("-A PREROUTING -d %s -j DNAT --to-destination %s" % (host.pub_ipv4, host.ipv4))
self.iptablesnat("-A POSTROUTING -s %s -j SNAT --to-source %s" % (host.ipv4, host.pub_ipv4)) self.iptablesnat("-A POSTROUTING -s %s -j SNAT --to-source %s" % (host.ipv4, host.pub_ipv4))
#alapertelmezett nat szabalyok a vlanokra # alapertelmezett nat szabalyok a vlanokra
for s_vlan in self.vlans: for s_vlan in self.vlans:
if(s_vlan.snat_ip): if(s_vlan.snat_ip):
for d_vlan in s_vlan.snat_to.all(): for d_vlan in s_vlan.snat_to.all():
self.iptablesnat("-A POSTROUTING -s %s -o %s -j SNAT --to-source %s" % (s_vlan.net_ipv4(), d_vlan.interface, s_vlan.snat_ip)) self.iptablesnat("-A POSTROUTING -s %s -o %s -j SNAT --to-source %s" % (s_vlan.net_ipv4(), d_vlan.interface, s_vlan.snat_ip))
#bedrotozott szabalyok # bedrotozott szabalyok
self.iptablesnat("-A POSTROUTING -s 10.5.0.0/16 -o vlan0003 -j SNAT --to-source 10.3.255.254") #man elerheto legyen self.iptablesnat("-A POSTROUTING -s 10.5.0.0/16 -o vlan0003 -j SNAT --to-source 10.3.255.254") # man elerheto legyen
self.iptablesnat("-A POSTROUTING -s 10.5.0.0/16 -o vlan0008 -j SNAT --to-source 10.0.0.247") #wolf halozat a nyomtatashoz self.iptablesnat("-A POSTROUTING -s 10.5.0.0/16 -o vlan0008 -j SNAT --to-source 10.0.0.247") # wolf halozat a nyomtatashoz
self.iptablesnat("-A POSTROUTING -s 10.3.0.0/16 -o vlan0002 -j SNAT --to-source %s" % self.pub.ipv4) #kulonben nemmegy a du self.iptablesnat("-A POSTROUTING -s 10.3.0.0/16 -o vlan0002 -j SNAT --to-source %s" % self.pub.ipv4) # kulonben nemmegy a du
self.iptablesnat("COMMIT") self.iptablesnat("COMMIT")
def ipt_filter(self): def ipt_filter(self):
regexp = re.compile('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') regexp = re.compile('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
regexp_icmp = re.compile('icmp'); regexp_icmp = re.compile('icmp')
#futas elotti dolgok # futas elotti dolgok
self.prerun() self.prerun()
#tuzfal sajat szabalyai # tuzfal sajat szabalyai
for f in self.fw: for f in self.fw:
for rule in f.rules.all(): for rule in f.rules.all():
self.fw2vlan(rule) self.fw2vlan(rule)
#zonak kozotti lancokra ugras # zonak kozotti lancokra ugras
for s_vlan in self.vlans: for s_vlan in self.vlans:
for d_vlan in self.vlans: for d_vlan in self.vlans:
self.iptables("-N %s_%s" % (s_vlan, d_vlan)) self.iptables("-N %s_%s" % (s_vlan, d_vlan))
self.iptables("-A FORWARD -i %s -o %s -g %s_%s" % (s_vlan.interface, d_vlan.interface, s_vlan, d_vlan)) self.iptables("-A FORWARD -i %s -o %s -g %s_%s" % (s_vlan.interface, d_vlan.interface, s_vlan, d_vlan))
#hosztok szabalyai # hosztok szabalyai
for i_vlan in self.vlans: for i_vlan in self.vlans:
for i_host in i_vlan.host_set.all(): for i_host in i_vlan.host_set.all():
for group in i_host.groups.all(): for group in i_host.groups.all():
for rule in group.rules.all(): for rule in group.rules.all():
self.host2vlan(i_host, rule) self.host2vlan(i_host, rule)
for rule in i_host.rules.all(): for rule in i_host.rules.all():
self.host2vlan(i_host, rule) self.host2vlan(i_host, rule)
#vlanok kozotti kommunikacio engedelyezese # vlanok kozotti kommunikacio engedelyezese
for s_vlan in self.vlans: for s_vlan in self.vlans:
for rule in s_vlan.rules.all(): for rule in s_vlan.rules.all():
self.vlan2vlan(s_vlan, rule) self.vlan2vlan(s_vlan, rule)
#zonak kozotti lancokat zarja le # zonak kozotti lancokat zarja le
for s_vlan in self.vlans: for s_vlan in self.vlans:
for d_vlan in self.vlans: for d_vlan in self.vlans:
self.iptables("-A %s_%s -g LOG_DROP" % (s_vlan, d_vlan)) self.iptables("-A %s_%s -g LOG_DROP" % (s_vlan, d_vlan))
#futas utani dolgok # futas utani dolgok
self.postrun() self.postrun()
if self.IPV6: if self.IPV6:
self.SZABALYOK = [x for x in self.SZABALYOK if not regexp.search(x)] self.SZABALYOK = [x for x in self.SZABALYOK if not regexp.search(x)]
self.SZABALYOK = [regexp_icmp.sub('icmpv6', x) for x in self.SZABALYOK] self.SZABALYOK = [regexp_icmp.sub('icmpv6', x) for x in self.SZABALYOK]
#####
def __init__(self, IPV6=False):
def __init__(self, IPV6=False): self.SZABALYOK=[]
self.SZABALYOK=[] self.SZABALYOK_NAT=[]
self.SZABALYOK_NAT=[] self.IPV6 = IPV6
self.IPV6 = IPV6 self.vlans = models.Vlan.objects.all()
self.vlans = models.Vlan.objects.all() self.hosts = models.Host.objects.all()
self.hosts = models.Host.objects.all() self.dmz = models.Vlan.objects.get(name="DMZ")
self.dmz = models.Vlan.objects.get(name="DMZ") self.pub = models.Vlan.objects.get(name="PUB")
self.pub = models.Vlan.objects.get(name="PUB") self.fw = models.Firewall.objects.all()
self.fw = models.Firewall.objects.all() self.ipt_filter()
self.ipt_filter() if not self.IPV6:
if not self.IPV6: self.ipt_nat()
self.ipt_nat()
def reload(self):
def reload(self): if self.IPV6:
if self.IPV6: process = subprocess.Popen(['/usr/bin/ssh', 'fw2', '/usr/bin/sudo', '/sbin/ip6tables-restore', '-c'], shell=False, stdin=subprocess.PIPE)
process = subprocess.Popen(['/usr/bin/ssh', 'fw2', '/usr/bin/sudo', '/sbin/ip6tables-restore', '-c'], shell=False, stdin=subprocess.PIPE) process.communicate("\n".join(self.SZABALYOK)+"\n")
process.communicate("\n".join(self.SZABALYOK)+"\n") else:
else: process = subprocess.Popen(['/usr/bin/ssh', 'fw2', '/usr/bin/sudo', '/sbin/iptables-restore', '-c'], shell=False, stdin=subprocess.PIPE)
process = subprocess.Popen(['/usr/bin/ssh', 'fw2', '/usr/bin/sudo', '/sbin/iptables-restore', '-c'], shell=False, stdin=subprocess.PIPE) process.communicate("\n".join(self.SZABALYOK)+"\n"+"\n".join(self.SZABALYOK_NAT)+"\n")
process.communicate("\n".join(self.SZABALYOK)+"\n"+"\n".join(self.SZABALYOK_NAT)+"\n")
def show(self):
def show(self): if self.IPV6:
if self.IPV6: return "\n".join(self.SZABALYOK)+"\n"
return "\n".join(self.SZABALYOK)+"\n" else:
else: return "\n".join(self.SZABALYOK)+"\n"+"\n".join(self.SZABALYOK_NAT)+"\n"
return "\n".join(self.SZABALYOK)+"\n"+"\n".join(self.SZABALYOK_NAT)+"\n"
def ipv6_to_octal(ipv6): def ipv6_to_octal(ipv6):
...@@ -299,6 +292,12 @@ def ipv6_to_octal(ipv6): ...@@ -299,6 +292,12 @@ def ipv6_to_octal(ipv6):
octets.append(int(part[2:], 16)) octets.append(int(part[2:], 16))
return '\\' + '\\'.join(['%03o' % x for x in octets]) return '\\' + '\\'.join(['%03o' % x for x in octets])
def ipv4_to_arpa(ipv4, cname=False):
m2 = re.search(r'^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$', ipv4)
if(cname):
return "%s.dns1.%s.%s.%s.in-addr.arpa" % (m2.group(4), m2.group(3), m2.group(2), m2.group(1))
else:
return "%s.%s.%s.%s.in-addr.arpa" % (m2.group(4), m2.group(3), m2.group(2), m2.group(1))
def ipv6_to_arpa(ipv6): def ipv6_to_arpa(ipv6):
while len(ipv6.split(':')) < 8: while len(ipv6.split(':')) < 8:
...@@ -318,141 +317,138 @@ def ipv6_to_arpa(ipv6): ...@@ -318,141 +317,138 @@ def ipv6_to_arpa(ipv6):
# =fqdn:ip:ttl A, PTR
# &fqdn:ip:x:ttl NS
# ZfqdnSOA
# +fqdn:ip:ttl A
# ^ PTR
# C CNAME
# : generic
def dns(): def dns():
vlans = models.Vlan.objects.all() vlans = models.Vlan.objects.all()
regex = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$') regex = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$')
DNS = [] DNS = []
DNS.append("=cloud.ik.bme.hu:152.66.243.98:600::\n") DNS.append("=cloud.ik.bme.hu:152.66.243.98:600::")
DNS.append(":cloud.ik.bme.hu:28:\040\001\007\070\040\001\100\061\000\002\000\000\000\007\000\000:600\n") DNS.append(":cloud.ik.bme.hu:28:\040\001\007\070\040\001\100\061\000\002\000\000\000\007\000\000:600")
#tarokkknak DNS.append("=r.cloud.ik.bme.hu:152.66.243.62:600::")
DNS.append("^%s.dns1.%s.%s.%s.in-addr.arpa:%s:600::\n" % (75, 243, 66, 152, "se.hpc.iit.bme.hu"))
DNS.append("^%s.dns1.%s.%s.%s.in-addr.arpa:%s:600::\n" % (76, 243, 66, 152, "ce.hpc.iit.bme.hu"))
DNS.append("^%s.dns1.%s.%s.%s.in-addr.arpa:%s:600::\n" % (77, 243, 66, 152, "mon.hpc.iit.bme.hu")) DNS.append("Z1.3.0.4.1.0.0.2.8.3.7.0.1.0.0.2.ip6.arpa:dns1.ik.bme.hu:support.ik.bme.hu::::::600") # soa
DNS.append("^%s.dns1.%s.%s.%s.in-addr.arpa:%s:600::\n" % (62, 243, 66, 152, "r.cloud.ik.bme.hu")) DNS.append("&1.3.0.4.1.0.0.2.8.3.7.0.1.0.0.2.ip6.arpa::dns1.ik.bme.hu:600::") # ns rekord
DNS.append("=r.cloud.ik.bme.hu:152.66.243.62:600::\n") DNS.append("&1.3.0.4.1.0.0.2.8.3.7.0.1.0.0.2.ip6.arpa::nic.bme.hu:600::") # ns rekord
for i_vlan in vlans:
DNS.append("Z1.3.0.4.1.0.0.2.8.3.7.0.1.0.0.2.ip6.arpa:dns1.ik.bme.hu:support.ik.bme.hu::::::600\n") #soa m = regex.search(i_vlan.net4)
DNS.append("&1.3.0.4.1.0.0.2.8.3.7.0.1.0.0.2.ip6.arpa::dns1.ik.bme.hu:600::\n") #ns if(i_vlan.name != "DMZ" and i_vlan.name != "PUB"):
DNS.append("&1.3.0.4.1.0.0.2.8.3.7.0.1.0.0.2.ip6.arpa::nic.bme.hu:600::\n") #ns DNS.append("Z%s.%s.in-addr.arpa:%s:support.ik.bme.hu::::::%s" % (m.group(2), m.group(1), models.settings['dns_hostname'], models.settings['dns_ttl']))
# DNS.append("&1.3.0.4.1.0.0.2.8.3.7.0.1.0.0.2.ip6.arpa::ns.bme.hu:600::\n") #ns DNS.append("&%s.%s.in-addr.arpa::%s:%s:" % (m.group(2), m.group(1), models.settings['dns_hostname'], models.settings['dns_ttl']))
DNS.append("Z%s:%s:support.ik.bme.hu::::::%s" % (i_vlan.domain, models.settings['dns_hostname'], models.settings['dns_ttl']))
for i_vlan in vlans: DNS.append("&%s::%s:%s" % (i_vlan.domain, models.settings['dns_hostname'], models.settings['dns_ttl']))
m = regex.search(i_vlan.net4) if(i_vlan.name == "WAR"):
if(i_vlan.name != "DMZ" and i_vlan.name != "PUB"): DNS.append("Zdns1.%s.%s.%s.in-addr.arpa:%s:support.ik.bme.hu::::::%s" % (m.group(3), m.group(2), m.group(1), models.settings['dns_hostname'], models.settings['dns_ttl']))
DNS.append("Z%s.%s.in-addr.arpa:dns1.ik.bme.hu:support.ik.bme.hu::::::600\n" % (m.group(2), m.group(1))) DNS.append("&dns1.%s.%s.%s.in-addr.arpa::%s:%s::" % (m.group(3), m.group(2), m.group(1), models.settings['dns_hostname'], models.settings['dns_ttl']))
DNS.append("&%s.%s.in-addr.arpa::dns1.ik.bme.hu:600::\n" % (m.group(2), m.group(1))) for i_host in i_vlan.host_set.all():
DNS.append("Z%s:dns1.ik.bme.hu:support.ik.bme.hu::::::600\n" % i_vlan.domain) ipv4 = ( i_host.pub_ipv4 if i_host.pub_ipv4 and not i_host.shared_ip else i_host.ipv4 )
DNS.append("&%s::dns1.ik.bme.hu:600::\n" % i_vlan.domain) reverse = i_host.reverse if(i_host.reverse and len(i_host.reverse)) else i_host.hostname + u'.' + i_vlan.domain
if(i_vlan.name == "WAR"): hostname = i_host.hostname + u'.' + i_vlan.domain
DNS.append("Zdns1.%s.%s.%s.in-addr.arpa:dns1.ik.bme.hu:support.ik.bme.hu::::::600\n" % (m.group(3), m.group(2), m.group(1)))
DNS.append("&dns1.%s.%s.%s.in-addr.arpa::dns1.ik.bme.hu:600::\n" % (m.group(3), m.group(2), m.group(1))) # ipv4
for i_host in i_vlan.host_set.all(): if i_host.ipv4:
ipv4 = ( i_host.pub_ipv4 if i_host.pub_ipv4 and not i_host.shared_ip else i_host.ipv4 ) # A record
m2 = regex.search(ipv4) DNS.append("+%s:%s:%s" % (hostname, ipv4, models.settings['dns_ttl']))
#ipv4 # PTR record 4.3.2.1.in-addr.arpa
DNS.append("=%s.%s:%s:600::\n" % (i_host.hostname, i_vlan.domain, ipv4)) DNS.append("^%s:%s:%s" % (ipv4_to_arpa(i_host.ipv4), reverse, models.settings['dns_ttl']))
DNS.append("^%s.dns1.%s.%s.%s.in-addr.arpa:%s.%s:600::\n" % (m2.group(4), m2.group(3), m2.group(2), m2.group(1), i_host.hostname, i_vlan.domain)) # PTR record 4.dns1.3.2.1.in-addr.arpa
#ipv6 DNS.append("^%s:%s:%s" % (ipv4_to_arpa(i_host.ipv4, cname=True), reverse, models.settings['dns_ttl']))
DNS.append(":%s.%s:28:%s:600\n" % (i_host.hostname, i_vlan.domain, ipv6_to_octal(i_host.ipv6)))
DNS.append("^%s:%s.%s:600::\n" % (ipv6_to_arpa(i_host.ipv6), i_host.hostname, i_vlan.domain)) # ipv6
if i_host.ipv6:
process = subprocess.Popen(['/usr/bin/ssh', 'tinydns@%s' % DNS_SERVER], shell=False, stdin=subprocess.PIPE) # AAAA record
process.communicate("\n".join(DNS)+"\n") DNS.append(":%s:28:%s:%s" % (hostname, ipv6_to_octal(i_host.ipv6), models.settings['dns_ttl']))
# PTR record
DNS.append("^%s:%s:%s" % (ipv6_to_arpa(i_host.ipv6), reverse, models.settings['dns_ttl']))
# cname
for i_alias in i_host.alias_set.all():
DNS.append("C%s:%s:%s" % (i_alias.alias, hostname, models.settings['dns_ttl']))
process = subprocess.Popen(['/usr/bin/ssh', 'tinydns@%s' % models.settings['dns_hostname']], shell=False, stdin=subprocess.PIPE)
process.communicate("\n".join(DNS)+"\n")
# print "\n".join(DNS)+"\n"
def prefix_to_mask(prefix): def prefix_to_mask(prefix):
t = [0,0,0,0] t = [0, 0, 0, 0]
for i in range(0,4): for i in range(0, 4):
if prefix > i*8+7: if prefix > i*8+7:
t[i] = 255 t[i] = 255
elif i*8 < prefix and prefix <= (i+1)*8: elif i*8 < prefix and prefix <= (i+1)*8:
t[i] = 256 - (2 ** ((i+1)*8 - prefix)) t[i] = 256 - (2 ** ((i+1)*8 - prefix))
return ".".join([str(i) for i in t]) return ".".join([str(i) for i in t])
def dhcp(): def dhcp():
vlans = models.Vlan.objects.all() vlans = models.Vlan.objects.all()
regex = re.compile(r'^([0-9]+)\.([0-9]+)\.[0-9]+\.[0-9]+\s+([0-9]+)\.([0-9]+)\.[0-9]+\.[0-9]+$') regex = re.compile(r'^([0-9]+)\.([0-9]+)\.[0-9]+\.[0-9]+\s+([0-9]+)\.([0-9]+)\.[0-9]+\.[0-9]+$')
DHCP = [] DHCP = []
#/tools/dhcp3/dhcpd.conf.generated # /tools/dhcp3/dhcpd.conf.generated
for i_vlan in vlans: for i_vlan in vlans:
if(i_vlan.dhcp_pool): if(i_vlan.dhcp_pool):
m = regex.search(i_vlan.dhcp_pool) m = regex.search(i_vlan.dhcp_pool)
if(m or i_vlan.dhcp_pool == "manual"): if(m or i_vlan.dhcp_pool == "manual"):
DHCP.append (''' DHCP.append ('''
#%(name)s - %(interface)s # %(name)s - %(interface)s
subnet %(net)s netmask %(netmask)s { subnet %(net)s netmask %(netmask)s {
%(extra)s; %(extra)s;
option domain-name "%(domain)s"; option domain-name "%(domain)s";
option routers %(router)s; option routers %(router)s;
option domain-name-servers %(dnsserver)s; option domain-name-servers %(dnsserver)s;
option ntp-servers %(ntp)s; option ntp-servers %(ntp)s;
next-server %(tftp)s; next-server %(tftp)s;
authoritative; authoritative;
filename \"pxelinux.0\"; filename \"pxelinux.0\";
allow bootp; allow booting; allow bootp; allow booting;
}''' % { }''' % {
'net': i_vlan.net4, 'net': i_vlan.net4,
'netmask': prefix_to_mask(i_vlan.prefix4), 'netmask': prefix_to_mask(i_vlan.prefix4),
'domain': i_vlan.domain, 'domain': i_vlan.domain,
'router': i_vlan.ipv4, 'router': i_vlan.ipv4,
'ntp': i_vlan.ipv4, 'ntp': i_vlan.ipv4,
'dnsserver': DNS_SERVER, 'dnsserver': models.settings['rdns_ip'],
'extra': "range %s" % i_vlan.dhcp_pool if m else "deny unknown-clients", 'extra': "range %s" % i_vlan.dhcp_pool if m else "deny unknown-clients",
'interface': i_vlan.interface, 'interface': i_vlan.interface,
'name': i_vlan.name, 'name': i_vlan.name,
'tftp': i_vlan.ipv4 'tftp': i_vlan.ipv4
}) })
for i_host in i_vlan.host_set.all(): for i_host in i_vlan.host_set.all():
DHCP.append (''' DHCP.append ('''
host %(hostname)s { host %(hostname)s {
hardware ethernet %(mac)s; hardware ethernet %(mac)s;
fixed-address %(ipv4)s; fixed-address %(ipv4)s;
}''' % { }''' % {
'hostname': i_host.hostname, 'hostname': i_host.hostname,
'mac': i_host.mac, 'mac': i_host.mac,
'ipv4': i_host.ipv4, 'ipv4': i_host.ipv4,
}) })
process = subprocess.Popen(['/usr/bin/ssh', 'fw2', 'cat > /tools/dhcp3/dhcpd.conf.generated;sudo /etc/init.d/isc-dhcp-server restart'], shell=False, stdin=subprocess.PIPE) process = subprocess.Popen(['/usr/bin/ssh', 'fw2', 'cat > /tools/dhcp3/dhcpd.conf.generated;sudo /etc/init.d/isc-dhcp-server restart'], shell=False, stdin=subprocess.PIPE)
# print "\n".join(DHCP)+"\n" # print "\n".join(DHCP)+"\n"
process.communicate("\n".join(DHCP)+"\n") process.communicate("\n".join(DHCP)+"\n")
#ipt_filter()
#ipt_nat()
#process = subprocess.Popen(['/usr/bin/sudo', 'iptables-restore'], shell=False, stdin=subprocess.PIPE)
#process.communicate("\n".join(SZABALYOK)+"\n"+"\n".join(SZABALYOK_NAT)+"\n")
#blabla = firewall()
#process = subprocess.Popen(['/usr/bin/sudo', 'ip6tables-restore'], shell=False, stdin=subprocess.PIPE)
#process.communicate("\n".join(SZABALYOK)+"\n")
#dns()
#dhcp()
i=2
''' '''
i=2
for mac, name, ipend in [("18:a9:05:64:19:aa", "mega6", 16), ("00:1e:0b:e9:79:1e", "blade1", 21), ("00:22:64:9c:fd:34", "blade2", 22), ("00:1e:0b:ec:65:46", "blade3", 23), ("b4:b5:2f:61:d2:5a", "cloud-man", 1)]: for mac, name, ipend in [("18:a9:05:64:19:aa", "mega6", 16), ("00:1e:0b:e9:79:1e", "blade1", 21), ("00:22:64:9c:fd:34", "blade2", 22), ("00:1e:0b:ec:65:46", "blade3", 23), ("b4:b5:2f:61:d2:5a", "cloud-man", 1)]:
h1 = models.Host(hostname= name, vlan=models.Vlan.objects.get(vid=3), mac=mac, ipv4="10.3.1.%d" % ipend, ipv6="2001:738:2001:4031:3:1:%d:0" % ipend, owner=auth.models.User.objects.get(username="bd")) h1 = models.Host(hostname= name, vlan=models.Vlan.objects.get(vid=3), mac=mac, ipv4="10.3.1.%d" % ipend, ipv6="2001:738:2001:4031:3:1:%d:0" % ipend, owner=auth.models.User.objects.get(username="bd"))
try: try:
h1.save() h1.save()
h1.groups.add(models.Group.objects.get(name="netezhet manbol")) h1.groups.add(models.Group.objects.get(name="netezhet manbol"))
h1.save() h1.save()
# i = i + 1 # i = i + 1
except: except:
print "nemok %s" % name print "nemok %s" % name
''' '''
#try:
# h1.save()
# h1.groups.add(models.Group.objects.get(name="irodai gep"))
# h1.save()
#except:
# print "nemsikerult"
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Alias'
db.create_table('firewall_alias', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('host', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['firewall.Host'])),
('hostname', self.gf('django.db.models.fields.CharField')(unique=True, max_length=40)),
))
db.send_create_signal('firewall', ['Alias'])
# Changing field 'Host.ipv6'
db.alter_column('firewall_host', 'ipv6', self.gf('django.db.models.fields.GenericIPAddressField')(max_length=39, unique=True, null=True))
def backwards(self, orm):
# Deleting model 'Alias'
db.delete_table('firewall_alias')
# User chose to not deal with backwards NULL issues for 'Host.ipv6'
raise RuntimeError("Cannot reverse this migration. 'Host.ipv6' and its values cannot be restored.")
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'firewall.alias': {
'Meta': {'object_name': 'Alias'},
'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Host']"}),
'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'firewall.firewall': {
'Meta': {'object_name': 'Firewall'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.host': {
'Meta': {'object_name': 'Host'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Group']", 'null': 'True', 'blank': 'True'}),
'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'location': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'mac': ('firewall.fields.MACAddressField', [], {'unique': 'True', 'max_length': '17'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'pub_ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'}),
'shared_ip': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'vlan': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Vlan']"})
},
'firewall.rule': {
'Meta': {'object_name': 'Rule'},
'accept': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'direction': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'extra': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nat': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'nat_dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'r_type': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'sport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'vlan': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'})
},
'firewall.vlan': {
'Meta': {'object_name': 'Vlan'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'dhcp_pool': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'domain': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interface': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'net4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'net6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'prefix4': ('django.db.models.fields.IntegerField', [], {'default': '16'}),
'prefix6': ('django.db.models.fields.IntegerField', [], {'default': '80'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'firewall_vlan_related'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['firewall.Rule']"}),
'snat_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'snat_to': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'}),
'vid': ('django.db.models.fields.IntegerField', [], {'unique': 'True'})
}
}
complete_apps = ['firewall']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Alias.hostname'
db.delete_column('firewall_alias', 'hostname')
# Adding field 'Alias.alias'
db.add_column('firewall_alias', 'alias',
self.gf('django.db.models.fields.CharField')(default=None, unique=True, max_length=40),
keep_default=False)
def backwards(self, orm):
# User chose to not deal with backwards NULL issues for 'Alias.hostname'
raise RuntimeError("Cannot reverse this migration. 'Alias.hostname' and its values cannot be restored.")
# Deleting field 'Alias.alias'
db.delete_column('firewall_alias', 'alias')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'firewall.alias': {
'Meta': {'object_name': 'Alias'},
'alias': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Host']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'firewall.firewall': {
'Meta': {'object_name': 'Firewall'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.host': {
'Meta': {'object_name': 'Host'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Group']", 'null': 'True', 'blank': 'True'}),
'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'location': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'mac': ('firewall.fields.MACAddressField', [], {'unique': 'True', 'max_length': '17'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'pub_ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'}),
'shared_ip': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'vlan': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Vlan']"})
},
'firewall.rule': {
'Meta': {'object_name': 'Rule'},
'accept': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'direction': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'extra': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nat': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'nat_dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'r_type': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'sport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'vlan': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'})
},
'firewall.vlan': {
'Meta': {'object_name': 'Vlan'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'dhcp_pool': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'domain': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interface': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'net4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'net6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'prefix4': ('django.db.models.fields.IntegerField', [], {'default': '16'}),
'prefix6': ('django.db.models.fields.IntegerField', [], {'default': '80'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'firewall_vlan_related'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['firewall.Rule']"}),
'snat_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'snat_to': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'}),
'vid': ('django.db.models.fields.IntegerField', [], {'unique': 'True'})
}
}
complete_apps = ['firewall']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Host.reverse'
db.add_column('firewall_host', 'reverse',
self.gf('django.db.models.fields.CharField')(max_length=40, unique=True, null=True, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Host.reverse'
db.delete_column('firewall_host', 'reverse')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'firewall.alias': {
'Meta': {'object_name': 'Alias'},
'alias': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Host']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'firewall.firewall': {
'Meta': {'object_name': 'Firewall'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.host': {
'Meta': {'object_name': 'Host'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Group']", 'null': 'True', 'blank': 'True'}),
'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'location': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'mac': ('firewall.fields.MACAddressField', [], {'unique': 'True', 'max_length': '17'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'pub_ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'reverse': ('django.db.models.fields.CharField', [], {'max_length': '40', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'}),
'shared_ip': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'vlan': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Vlan']"})
},
'firewall.rule': {
'Meta': {'object_name': 'Rule'},
'accept': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'direction': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'extra': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nat': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'nat_dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'r_type': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'sport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'vlan': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'})
},
'firewall.vlan': {
'Meta': {'object_name': 'Vlan'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'dhcp_pool': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'domain': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interface': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'net4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'net6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'prefix4': ('django.db.models.fields.IntegerField', [], {'default': '16'}),
'prefix6': ('django.db.models.fields.IntegerField', [], {'default': '80'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'firewall_vlan_related'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['firewall.Rule']"}),
'snat_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'snat_to': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'}),
'vid': ('django.db.models.fields.IntegerField', [], {'unique': 'True'})
}
}
complete_apps = ['firewall']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Host', fields ['reverse']
db.delete_unique('firewall_host', ['reverse'])
def backwards(self, orm):
# Adding unique constraint on 'Host', fields ['reverse']
db.create_unique('firewall_host', ['reverse'])
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'firewall.alias': {
'Meta': {'object_name': 'Alias'},
'alias': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Host']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'firewall.firewall': {
'Meta': {'object_name': 'Firewall'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.host': {
'Meta': {'object_name': 'Host'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Group']", 'null': 'True', 'blank': 'True'}),
'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'location': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'mac': ('firewall.fields.MACAddressField', [], {'unique': 'True', 'max_length': '17'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'pub_ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'reverse': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'}),
'shared_ip': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'vlan': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Vlan']"})
},
'firewall.rule': {
'Meta': {'object_name': 'Rule'},
'accept': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'direction': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'extra': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nat': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'nat_dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'r_type': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'sport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'vlan': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'})
},
'firewall.vlan': {
'Meta': {'object_name': 'Vlan'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'dhcp_pool': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'domain': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interface': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'net4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'net6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'prefix4': ('django.db.models.fields.IntegerField', [], {'default': '16'}),
'prefix6': ('django.db.models.fields.IntegerField', [], {'default': '80'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'firewall_vlan_related'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['firewall.Rule']"}),
'snat_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'snat_to': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'}),
'vid': ('django.db.models.fields.IntegerField', [], {'unique': 'True'})
}
}
complete_apps = ['firewall']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Setting'
db.create_table('firewall_setting', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('key', self.gf('django.db.models.fields.CharField')(max_length=32)),
('value', self.gf('django.db.models.fields.CharField')(max_length=200)),
))
db.send_create_signal('firewall', ['Setting'])
def backwards(self, orm):
# Deleting model 'Setting'
db.delete_table('firewall_setting')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'firewall.alias': {
'Meta': {'object_name': 'Alias'},
'alias': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'host': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Host']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'firewall.firewall': {
'Meta': {'object_name': 'Firewall'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'})
},
'firewall.host': {
'Meta': {'object_name': 'Host'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Group']", 'null': 'True', 'blank': 'True'}),
'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
'location': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'mac': ('firewall.fields.MACAddressField', [], {'unique': 'True', 'max_length': '17'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'pub_ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'reverse': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Rule']", 'null': 'True', 'blank': 'True'}),
'shared_ip': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'vlan': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['firewall.Vlan']"})
},
'firewall.rule': {
'Meta': {'object_name': 'Rule'},
'accept': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'direction': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'extra': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nat': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'nat_dport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'r_type': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'sport': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'vlan': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'})
},
'firewall.setting': {
'Meta': {'object_name': 'Setting'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '200'})
},
'firewall.vlan': {
'Meta': {'object_name': 'Vlan'},
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'dhcp_pool': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'domain': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interface': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'ipv4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'ipv6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20'}),
'net4': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'net6': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}),
'prefix4': ('django.db.models.fields.IntegerField', [], {'default': '16'}),
'prefix6': ('django.db.models.fields.IntegerField', [], {'default': '80'}),
'rules': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'firewall_vlan_related'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['firewall.Rule']"}),
'snat_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True', 'blank': 'True'}),
'snat_to': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['firewall.Vlan']", 'null': 'True', 'blank': 'True'}),
'vid': ('django.db.models.fields.IntegerField', [], {'unique': 'True'})
}
}
complete_apps = ['firewall']
\ No newline at end of file
...@@ -7,53 +7,60 @@ from django.utils.translation import ugettext_lazy as _ ...@@ -7,53 +7,60 @@ from django.utils.translation import ugettext_lazy as _
from firewall.fields import * from firewall.fields import *
from south.modelsinspector import add_introspection_rules from south.modelsinspector import add_introspection_rules
from django.core.validators import MinValueValidator, MaxValueValidator from django.core.validators import MinValueValidator, MaxValueValidator
from modeldict import ModelDict
class Setting(models.Model):
key = models.CharField(max_length=32)
value = models.CharField(max_length=200)
settings = ModelDict(Setting, key='key', value='value', instances=False)
class Rule(models.Model): class Rule(models.Model):
CHOICES_type = (('host', 'host'), ('firewall', 'firewall'), ('vlan', 'vlan')) CHOICES_type = (('host', 'host'), ('firewall', 'firewall'), ('vlan', 'vlan'))
CHOICES_proto = (('tcp', 'tcp'), ('udp', 'udp'), ('icmp', 'icmp')) CHOICES_proto = (('tcp', 'tcp'), ('udp', 'udp'), ('icmp', 'icmp'))
CHOICES_dir = (('0', 'out'), ('1', 'in')) CHOICES_dir = (('0', 'out'), ('1', 'in'))
direction = models.CharField(max_length=1, choices=CHOICES_dir, blank=False) direction = models.CharField(max_length=1, choices=CHOICES_dir, blank=False)
description = models.TextField(blank=True) description = models.TextField(blank=True)
vlan = models.ManyToManyField('Vlan', symmetrical=False, blank=True, null=True) vlan = models.ManyToManyField('Vlan', symmetrical=False, blank=True, null=True)
dport = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(65535)]) dport = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(65535)])
sport = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(65535)]) sport = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(65535)])
proto = models.CharField(max_length=10, choices=CHOICES_proto, blank=True, null=True) proto = models.CharField(max_length=10, choices=CHOICES_proto, blank=True, null=True)
extra = models.TextField(blank=True) extra = models.TextField(blank=True)
accept = models.BooleanField(default=False) accept = models.BooleanField(default=False)
owner = models.ForeignKey(User, blank=True, null=True) owner = models.ForeignKey(User, blank=True, null=True)
r_type = models.CharField(max_length=10, choices=CHOICES_type) r_type = models.CharField(max_length=10, choices=CHOICES_type)
nat = models.BooleanField(default=False) nat = models.BooleanField(default=False)
nat_dport = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(65535)]) nat_dport = models.IntegerField(blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(65535)])
def __unicode__(self): def __unicode__(self):
return self.desc() return self.desc()
def color_desc(self): def color_desc(self):
para = '</span>' para = '</span>'
if(self.dport): if(self.dport):
para = "dport=%s %s" % (self.dport, para) para = "dport=%s %s" % (self.dport, para)
if(self.sport): if(self.sport):
para = "sport=%s %s" % (self.sport, para) para = "sport=%s %s" % (self.sport, para)
if(self.proto): if(self.proto):
para = "proto=%s %s" % (self.proto, para) para = "proto=%s %s" % (self.proto, para)
para= u'<span style="color: #00FF00;">' + para para= u'<span style="color: #00FF00;">' + para
return u'<span style="color: #FF0000;">[' + self.r_type + u']</span> ' + (self.vlan_l() + u'<span style="color: #0000FF;"> ▸ </span>' + self.r_type if self.direction=='1' else self.r_type + u'<span style="color: #0000FF;"> ▸ </span>' + self.vlan_l()) + ' ' + para + ' ' +self.description return u'<span style="color: #FF0000;">[' + self.r_type + u']</span> ' + (self.vlan_l() + u'<span style="color: #0000FF;"> ▸ </span>' + self.r_type if self.direction=='1' else self.r_type + u'<span style="color: #0000FF;"> ▸ </span>' + self.vlan_l()) + ' ' + para + ' ' +self.description
color_desc.allow_tags = True color_desc.allow_tags = True
def desc(self): def desc(self):
para = u"" para = u""
if(self.dport): if(self.dport):
para = "dport=%s %s" % (self.dport, para) para = "dport=%s %s" % (self.dport, para)
if(self.sport): if(self.sport):
para = "sport=%s %s" % (self.sport, para) para = "sport=%s %s" % (self.sport, para)
if(self.proto): if(self.proto):
para = "proto=%s %s" % (self.proto, para) para = "proto=%s %s" % (self.proto, para)
return u'[' + self.r_type + u'] ' + (self.vlan_l() + u' ▸ ' + self.r_type if self.direction=='1' else self.r_type + u' ▸ ' + self.vlan_l()) + u' ' + para + u' ' +self.description return u'[' + self.r_type + u'] ' + (self.vlan_l() + u' ▸ ' + self.r_type if self.direction=='1' else self.r_type + u' ▸ ' + self.vlan_l()) + u' ' + para + u' ' +self.description
def vlan_l(self): def vlan_l(self):
retval = [] retval = []
for vl in self.vlan.all(): for vl in self.vlan.all():
retval.append(vl.name) retval.append(vl.name)
return u', '.join(retval) return u', '.join(retval)
class Vlan(models.Model): class Vlan(models.Model):
vid = models.IntegerField(unique=True) vid = models.IntegerField(unique=True)
...@@ -76,19 +83,19 @@ class Vlan(models.Model): ...@@ -76,19 +83,19 @@ class Vlan(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
def net_ipv6(self): def net_ipv6(self):
return self.net6 + "/" + unicode(self.prefix6) return self.net6 + "/" + unicode(self.prefix6)
def net_ipv4(self): def net_ipv4(self):
return self.net4 + "/" + unicode(self.prefix4) return self.net4 + "/" + unicode(self.prefix4)
def rules_l(self): def rules_l(self):
retval = [] retval = []
for rl in self.rules.all(): for rl in self.rules.all():
retval.append(unicode(rl)) retval.append(unicode(rl))
return ', '.join(retval) return ', '.join(retval)
def snat_to_l(self): def snat_to_l(self):
retval = [] retval = []
for rl in self.snat_to.all(): for rl in self.snat_to.all():
retval.append(unicode(rl)) retval.append(unicode(rl))
return ', '.join(retval) return ', '.join(retval)
class Group(models.Model): class Group(models.Model):
name = models.CharField(max_length=20, unique=True) name = models.CharField(max_length=20, unique=True)
...@@ -97,12 +104,19 @@ class Group(models.Model): ...@@ -97,12 +104,19 @@ class Group(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
class Alias(models.Model):
host = models.ForeignKey('Host')
alias = models.CharField(max_length=40, unique=True, validators=[val_domain])
class Meta:
verbose_name_plural = 'aliases'
class Host(models.Model): class Host(models.Model):
hostname = models.CharField(max_length=40, unique=True, validators=[val_alfanum]) hostname = models.CharField(max_length=40, unique=True, validators=[val_alfanum])
reverse = models.CharField(max_length=40, validators=[val_domain], blank=True, null=True)
mac = MACAddressField(unique=True) mac = MACAddressField(unique=True)
ipv4 = models.GenericIPAddressField(protocol='ipv4', unique=True) ipv4 = models.GenericIPAddressField(protocol='ipv4', unique=True)
pub_ipv4 = models.GenericIPAddressField(protocol='ipv4', blank=True, null=True) pub_ipv4 = models.GenericIPAddressField(protocol='ipv4', blank=True, null=True)
ipv6 = models.GenericIPAddressField(protocol='ipv6', unique=True, blank=True) ipv6 = models.GenericIPAddressField(protocol='ipv6', unique=True, blank=True, null=True)
shared_ip = models.BooleanField(default=False) shared_ip = models.BooleanField(default=False)
description = models.TextField(blank=True) description = models.TextField(blank=True)
comment = models.TextField(blank=True) comment = models.TextField(blank=True)
...@@ -115,57 +129,57 @@ class Host(models.Model): ...@@ -115,57 +129,57 @@ class Host(models.Model):
def __unicode__(self): def __unicode__(self):
return self.hostname return self.hostname
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if not self.id and not self.ipv6: if not self.id and self.ipv6 == "auto":
self.ipv6 = ipv4_2_ipv6(self.ipv4) self.ipv6 = ipv4_2_ipv6(self.ipv4)
if not self.shared_ip and self.pub_ipv4 and Host.objects.exclude(id=self.id).filter(pub_ipv4=self.pub_ipv4): if not self.shared_ip and self.pub_ipv4 and Host.objects.exclude(id=self.id).filter(pub_ipv4=self.pub_ipv4):
raise ValidationError("Ha a shared_ip be van pipalva, akkor egyedinek kell lennie a pub_ipv4-nek!") raise ValidationError("Ha a shared_ip be van pipalva, akkor egyedinek kell lennie a pub_ipv4-nek!")
if Host.objects.exclude(id=self.id).filter(pub_ipv4=self.ipv4): if Host.objects.exclude(id=self.id).filter(pub_ipv4=self.ipv4):
raise ValidationError("Egy masik host natolt cimet nem hasznalhatod sajat ipv4-nek") raise ValidationError("Egy masik host natolt cimet nem hasznalhatod sajat ipv4-nek")
super(Host, self).save(*args, **kwargs) super(Host, self).save(*args, **kwargs)
def groups_l(self): def groups_l(self):
retval = [] retval = []
for grp in self.groups.all(): for grp in self.groups.all():
retval.append(grp.name) retval.append(grp.name)
return ', '.join(retval) return ', '.join(retval)
def rules_l(self): def rules_l(self):
retval = [] retval = []
for rl in self.rules.all(): for rl in self.rules.all():
retval.append(unicode(rl.color_desc())) retval.append(unicode(rl.color_desc()))
return '<br>'.join(retval) return '<br>'.join(retval)
rules_l.allow_tags = True rules_l.allow_tags = True
def enable_net(self): def enable_net(self):
self.groups.add(Group.objects.get(name="netezhet")) self.groups.add(Group.objects.get(name="netezhet"))
def add_port(self, proto, public, private): def add_port(self, proto, public, private):
proto = "tcp" if (proto == "tcp") else "udp" proto = "tcp" if (proto == "tcp") else "udp"
if public < 1024: if public < 1024:
raise ValidationError("Csak az 1024 feletti portok hasznalhatok") raise ValidationError("Csak az 1024 feletti portok hasznalhatok")
for host in Host.objects.filter(pub_ipv4=self.pub_ipv4): for host in Host.objects.filter(pub_ipv4=self.pub_ipv4):
if host.rules.filter(nat=True, proto=proto, dport=public): if host.rules.filter(nat=True, proto=proto, dport=public):
raise ValidationError("A %s %s port mar hasznalva" % (proto, public)) raise ValidationError("A %s %s port mar hasznalva" % (proto, public))
rule = Rule(direction='1', owner=self.owner, description=u"%s %s %s ▸ %s" % (self.hostname, proto, public, private), dport=public, proto=proto, nat=True, accept=True, r_type="host", nat_dport=private) rule = Rule(direction='1', owner=self.owner, description=u"%s %s %s ▸ %s" % (self.hostname, proto, public, private), dport=public, proto=proto, nat=True, accept=True, r_type="host", nat_dport=private)
rule.full_clean() rule.full_clean()
rule.save() rule.save()
rule.vlan.add(Vlan.objects.get(name="PUB")) rule.vlan.add(Vlan.objects.get(name="PUB"))
rule.vlan.add(Vlan.objects.get(name="HOT")) rule.vlan.add(Vlan.objects.get(name="HOT"))
rule.vlan.add(Vlan.objects.get(name="LAB")) rule.vlan.add(Vlan.objects.get(name="LAB"))
rule.vlan.add(Vlan.objects.get(name="DMZ")) rule.vlan.add(Vlan.objects.get(name="DMZ"))
rule.vlan.add(Vlan.objects.get(name="VM-NET")) rule.vlan.add(Vlan.objects.get(name="VM-NET"))
rule.vlan.add(Vlan.objects.get(name="WAR")) rule.vlan.add(Vlan.objects.get(name="WAR"))
rule.vlan.add(Vlan.objects.get(name="OFF2")) rule.vlan.add(Vlan.objects.get(name="OFF2"))
self.rules.add(rule) self.rules.add(rule)
def del_port(self, proto, public): def del_port(self, proto, public):
self.rules.filter(owner=self.owner, proto=proto, nat=True, dport=public).delete() self.rules.filter(owner=self.owner, proto=proto, nat=True, dport=public).delete()
def list_ports(self): def list_ports(self):
retval = [] retval = []
for rule in self.rules.filter(owner=self.owner, nat=True): for rule in self.rules.filter(owner=self.owner, nat=True):
retval.append({'proto': rule.proto, 'public': rule.dport, 'private': rule.nat_dport}) retval.append({'proto': rule.proto, 'public': rule.dport, 'private': rule.nat_dport})
return retval return retval
def del_rules(self): def del_rules(self):
self.rules.filter(owner=self.owner).delete() self.rules.filter(owner=self.owner).delete()
class Firewall(models.Model): class Firewall(models.Model):
name = models.CharField(max_length=20, unique=True) name = models.CharField(max_length=20, unique=True)
......
...@@ -3,46 +3,50 @@ from django.core.cache import cache ...@@ -3,46 +3,50 @@ from django.core.cache import cache
import os import os
import time import time
from firewall.fw import * from firewall.fw import *
from firewall.models import settings
def reload_firewall_lock(): def reload_firewall_lock():
acquire_lock = lambda: cache.add("reload_lock1", "true", 9) acquire_lock = lambda: cache.add("reload_lock1", "true", 9)
if acquire_lock(): if acquire_lock():
print "megszereztem" print "megszereztem"
ReloadTask.delay() ReloadTask.delay()
else: else:
print "nem szereztem meg" print "nem szereztem meg"
class ReloadTask(Task): class ReloadTask(Task):
def run(self, **kwargs): def run(self, **kwargs):
acquire_lock = lambda: cache.add("reload_lock1", "true", 90) acquire_lock = lambda: cache.add("reload_lock1", "true", 90)
release_lock = lambda: cache.delete("reload_lock1") release_lock = lambda: cache.delete("reload_lock1")
if not acquire_lock(): if not acquire_lock():
print "mar folyamatban van egy reload" print "mar folyamatban van egy reload"
return return
print "indul" print "indul"
time.sleep(10) try:
sleep = float(settings['reload_sleep'])
try: except:
print "ipv4" sleep = 10
ipv4 = firewall() time.sleep(sleep)
ipv4.reload()
# print ipv4.show() try:
print "ipv6" print "ipv4"
ipv6 = firewall(True) ipv4 = firewall()
ipv6.reload() ipv4.reload()
print "dns" # print ipv4.show()
dns() print "ipv6"
print "dhcp" ipv6 = firewall(True)
dhcp() ipv6.reload()
print "vege" print "dns"
except: dns()
raise print "dhcp"
print "nem sikerult :(" dhcp()
print "vege"
print "leall" except:
release_lock() raise
print "nem sikerult :("
print "leall"
release_lock()
...@@ -15,63 +15,63 @@ import sys ...@@ -15,63 +15,63 @@ import sys
def reload_firewall(request): def reload_firewall(request):
if request.user.is_authenticated(): if request.user.is_authenticated():
if(request.user.is_superuser): if(request.user.is_superuser):
html = u"Be vagy jelentkezve es admin is vagy, kedves %s!" % request.user.username html = u"Be vagy jelentkezve es admin is vagy, kedves %s!" % request.user.username
html += "<br> 10 masodperc mulva ujratoltodik" html += "<br> 10 masodperc mulva ujratoltodik"
ReloadTask.delay() ReloadTask.delay()
else: else:
html = u"Be vagy jelentkezve, csak nem vagy admin, kedves %s!" % request.user.username html = u"Be vagy jelentkezve, csak nem vagy admin, kedves %s!" % request.user.username
else: else:
html = u"Nem vagy bejelentkezve, kedves ismeretlen!" html = u"Nem vagy bejelentkezve, kedves ismeretlen!"
return HttpResponse(html) return HttpResponse(html)
@csrf_exempt @csrf_exempt
def firewall_api(request): def firewall_api(request):
if request.method == 'POST': if request.method == 'POST':
try: try:
data=json.loads(base64.b64decode(request.POST["data"])) data=json.loads(base64.b64decode(request.POST["data"]))
command = request.POST["command"] command = request.POST["command"]
if(data["password"] != "bdmegintelrontottaanetet"): if(data["password"] != "bdmegintelrontottaanetet"):
raise Exception("rossz jelszo") raise Exception("rossz jelszo")
if(not(data["vlan"] == "vm-net" or data["vlan"] == "war")): if(not(data["vlan"] == "vm-net" or data["vlan"] == "war")):
raise Exception("csak vm-net es war-re mukodik") raise Exception("csak vm-net es war-re mukodik")
data["hostname"] = re.sub(r' ','_', data["hostname"]) data["hostname"] = re.sub(r' ','_', data["hostname"])
if(command == "create"): if(command == "create"):
data["owner"] = "opennebula" data["owner"] = "opennebula"
owner = auth.models.User.objects.get(username=data["owner"]) owner = auth.models.User.objects.get(username=data["owner"])
host = models.Host(hostname=data["hostname"], vlan=models.Vlan.objects.get(name=data["vlan"]), mac=data["mac"], ipv4=data["ip"], owner=owner, description=data["description"], pub_ipv4=models.Vlan.objects.get(name=data["vlan"]).snat_ip, shared_ip=True) host = models.Host(hostname=data["hostname"], vlan=models.Vlan.objects.get(name=data["vlan"]), mac=data["mac"], ipv4=data["ip"], owner=owner, description=data["description"], pub_ipv4=models.Vlan.objects.get(name=data["vlan"]).snat_ip, shared_ip=True)
host.full_clean() host.full_clean()
host.save() host.save()
host.enable_net() host.enable_net()
for p in data["portforward"]: for p in data["portforward"]:
host.add_port(proto=p["proto"], public=int(p["public_port"]), private=int(p["private_port"])) host.add_port(proto=p["proto"], public=int(p["public_port"]), private=int(p["private_port"]))
elif(command == "destroy"): elif(command == "destroy"):
data["owner"] = "opennebula" data["owner"] = "opennebula"
print data["hostname"] print data["hostname"]
owner = auth.models.User.objects.get(username=data["owner"]) owner = auth.models.User.objects.get(username=data["owner"])
host = models.Host.objects.get(hostname=data["hostname"], owner=owner) host = models.Host.objects.get(hostname=data["hostname"], owner=owner)
host.del_rules() host.del_rules()
host.delete() host.delete()
else: else:
raise Exception("rossz parancs") raise Exception("rossz parancs")
reload_firewall_lock() reload_firewall_lock()
except (ValidationError, IntegrityError, AttributeError, Exception) as e: except (ValidationError, IntegrityError, AttributeError, Exception) as e:
return HttpResponse(u"rosszul hasznalod! :(\n%s\n" % e); return HttpResponse(u"rosszul hasznalod! :(\n%s\n" % e);
except: except:
# raise # raise
return HttpResponse(u"rosszul hasznalod! :(\n"); return HttpResponse(u"rosszul hasznalod! :(\n");
return HttpResponse(u"ok"); return HttpResponse(u"ok");
return HttpResponse(u"ez kerlek egy api lesz!\n"); return HttpResponse(u"ez kerlek egy api lesz!\n");
#!/usr/bin/python
import base64
import xmltodict
import urllib2
import sys
xml = base64.b64decode(sys.argv[1])
data = xmltodict.parse(xml)
try:
booturl = data["VM"]["TEMPLATE"]["CONTEXT"]["BOOTURL"]
except:
print 'Error'
req=urllib2.Request(booturl)
response = urllib2.urlopen(req)
#!/bin/bash
if [ "$1" != -f ]
then
echo 'Clear ALL PRIVATE DATA ON THE VM. This is used for praparing VM template.'
echo -- '-f switch is required.'
exit 1
fi
rm -rf /opt/webadmin/cloud*
rm .bash_history
rm -f ~/.gitconfig
mysql <<A
DROP USER webadmin@localhost;
A
mysql <<A
DROP DATABASE webadmin;
A
sudo chpasswd <<<'cloud:ezmiez'
- fields:
accept: true
description: ''
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: 0
owner: 1
proto: null
r_type: host
sport: null
vlan: [4]
model: firewall.rule
pk: 1
- fields:
accept: true
description: ''
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: 0
owner: 1
proto: null
r_type: host
sport: null
vlan: [2]
model: firewall.rule
pk: 2
- fields:
accept: true
description: ''
direction: '1'
dport: null
extra: ''
nat: false
nat_dport: 0
owner: 1
proto: null
r_type: host
sport: null
vlan: [5]
model: firewall.rule
pk: 3
- fields:
accept: true
description: ssh ik net
direction: '1'
dport: 22
extra: -s 152.66.243.0/24
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 6
- fields:
accept: true
description: icmp
direction: '1'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: icmp
r_type: firewall
sport: null
vlan: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
model: firewall.rule
pk: 12
- fields:
accept: true
description: ''
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: firewall
sport: null
vlan: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
model: firewall.rule
pk: 15
- fields:
accept: true
description: dhcp, time, tftp
direction: '1'
dport: null
extra: -p udp -m multiport --dports 67,69,123
nat: false
nat_dport: null
owner: 1
proto: null
r_type: firewall
sport: null
vlan: [1, 2, 6, 8, 10, 12]
model: firewall.rule
pk: 26
- fields:
accept: true
description: iknet
direction: '0'
dport: null
extra: -d 152.66.243.0/24
nat: false
nat_dport: 0
owner: 1
proto: null
r_type: host
sport: null
vlan: [4]
model: firewall.rule
pk: 30
- fields:
accept: true
description: munin
direction: '1'
dport: 4949
extra: ''
nat: false
nat_dport: 0
owner: 1
proto: tcp
r_type: firewall
sport: null
vlan: [2]
model: firewall.rule
pk: 31
- fields:
accept: true
description: "nyomtat\xF3 egyteru"
direction: '0'
dport: null
extra: -d 10.0.0.253
nat: false
nat_dport: 0
owner: 1
proto: null
r_type: host
sport: null
vlan: [9]
model: firewall.rule
pk: 33
- fields:
accept: true
description: 'ssh '
direction: '1'
dport: 22
extra: ''
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 34
- fields:
accept: true
description: vpn
direction: '1'
dport: 3721
extra: ''
nat: false
nat_dport: null
owner: 1
proto: udp
r_type: firewall
sport: null
vlan: [4]
model: firewall.rule
pk: 35
- fields:
accept: true
description: iperf
direction: '1'
dport: 5001
extra: ''
nat: false
nat_dport: 0
owner: 1
proto: tcp
r_type: firewall
sport: null
vlan: [1, 2, 4, 6]
model: firewall.rule
pk: 36
- fields:
accept: true
description: dns
direction: '1'
dport: 53
extra: ''
nat: false
nat_dport: null
owner: 1
proto: udp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 37
- fields:
accept: true
description: ssh
direction: '1'
dport: 532
extra: ''
nat: false
nat_dport: 0
owner: 1
proto: tcp
r_type: firewall
sport: null
vlan: [1, 2, 4, 6]
model: firewall.rule
pk: 38
- fields:
accept: true
description: (pub)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [4, 11]
model: firewall.rule
pk: 39
- fields:
accept: true
description: (dmz)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [6]
model: firewall.rule
pk: 40
- fields:
accept: true
description: (lab)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [4, 8]
model: firewall.rule
pk: 41
- fields:
accept: true
description: (man)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [2]
model: firewall.rule
pk: 42
- fields:
accept: true
description: (hot)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [3, 4, 6, 7]
model: firewall.rule
pk: 43
- fields:
accept: true
description: (vpn)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [3, 4, 5, 6, 7, 8, 10]
model: firewall.rule
pk: 44
- fields:
accept: true
description: (off)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [1, 3, 5, 6, 7, 8, 10]
model: firewall.rule
pk: 45
- fields:
accept: true
description: radius bd
direction: '1'
dport: 1812
extra: ''
nat: false
nat_dport: 0
owner: 1
proto: udp
r_type: host
sport: null
vlan: [3]
model: firewall.rule
pk: 46
- fields:
accept: true
description: http
direction: '1'
dport: 80
extra: ''
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 47
- fields:
accept: true
description: syslog iknet
direction: '1'
dport: 1999
extra: -s 152.66.243.0/24
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10]
model: firewall.rule
pk: 48
- fields:
accept: true
description: pbx
direction: '1'
dport: null
extra: -p tcp -m multiport --dport 80,2000,5060
nat: false
nat_dport: null
owner: 3
proto: null
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 261
- fields:
accept: true
description: pbx
direction: '1'
dport: null
extra: -p udp -m multiport --dport 5000,5060,4569
nat: false
nat_dport: null
owner: 3
proto: null
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 262
- fields:
accept: true
description: "nyomtat\xF3 canon iR2870 (f\xE9nym\xE1sol\xF3)"
direction: '0'
dport: null
extra: -d 10.0.0.251
nat: false
nat_dport: null
owner: 1
proto: null
r_type: host
sport: null
vlan: [9]
model: firewall.rule
pk: 263
- fields:
accept: true
description: nyomtato hp laserjet cp1525
direction: '0'
dport: null
extra: -d 10.0.0.65
nat: false
nat_dport: 0
owner: 1
proto: null
r_type: host
sport: null
vlan: [9]
model: firewall.rule
pk: 264
- fields:
accept: true
description: identd
direction: '1'
dport: 113
extra: ''
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [4]
model: firewall.rule
pk: 265
- fields:
accept: true
description: id-81_user-bd tcp 23107->3389
direction: '1'
dport: 33107
extra: ''
nat: true
nat_dport: 3389
owner: 2
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 734
- fields:
accept: true
description: ''
direction: '1'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: host
sport: null
vlan: [4]
model: firewall.rule
pk: 750
- fields:
accept: true
description: ''
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 4
proto: null
r_type: host
sport: null
vlan: [8]
model: firewall.rule
pk: 751
- fields:
accept: true
description: id-412-Gabor_BackUp tcp 22005->22
direction: '1'
dport: 32005
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 773
- fields:
accept: true
description: id-412-Gabor_BackUp tcp 23005->3389
direction: '1'
dport: 33005
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 774
- fields:
accept: true
description: id-90_user-bd tcp 23019->3389
direction: '1'
dport: 33019
extra: ''
nat: true
nat_dport: 3389
owner: 2
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 825
- fields:
accept: true
description: dns
direction: '1'
dport: 53
extra: ''
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 849
- fields:
accept: true
description: (war)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [7]
model: firewall.rule
pk: 850
- fields:
accept: true
description: (vm-net)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [10]
model: firewall.rule
pk: 851
- fields:
accept: true
description: https
direction: '1'
dport: 443
extra: ''
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 856
- fields:
accept: true
description: opennebula novnc
direction: '1'
dport: 29876
extra: ''
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [2, 3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 859
- fields:
accept: true
description: smb server
direction: '0'
dport: null
extra: -d 10.0.0.253
nat: false
nat_dport: null
owner: 3
proto: null
r_type: host
sport: null
vlan: [9]
model: firewall.rule
pk: 866
- fields:
accept: true
description: time war
direction: '1'
dport: 123
extra: ''
nat: false
nat_dport: null
owner: 3
proto: udp
r_type: firewall
sport: null
vlan: [7]
model: firewall.rule
pk: 867
- fields:
accept: true
description: ''
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: host
sport: null
vlan: [7]
model: firewall.rule
pk: 870
- fields:
accept: true
description: ''
direction: '0'
dport: 25
extra: ''
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [4]
model: firewall.rule
pk: 948
- fields:
accept: true
description: (war2)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [4, 11]
model: firewall.rule
pk: 949
- fields:
accept: true
description: (off2)
direction: '0'
dport: null
extra: ''
nat: false
nat_dport: null
owner: 1
proto: null
r_type: vlan
sport: null
vlan: [12]
model: firewall.rule
pk: 950
- fields:
accept: true
description: id-140_user-root tcp 22001 -> 22
direction: '1'
dport: 32001
extra: ''
nat: true
nat_dport: 22
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 964
- fields:
accept: true
description: id-689-DP tcp 22066 -> 22
direction: '1'
dport: 32066
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 967
- fields:
accept: true
description: id-689-DP tcp 23066 -> 3389
direction: '1'
dport: 33066
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 968
- fields:
accept: true
description: id-690-DP tcp 22071 -> 22
direction: '1'
dport: 32071
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 969
- fields:
accept: true
description: id-690-DP tcp 23071 -> 3389
direction: '1'
dport: 33071
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 970
- fields:
accept: true
description: id-694-UI tcp 22073 -> 22
direction: '1'
dport: 32073
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 971
- fields:
accept: true
description: id-694-UI tcp 23073 -> 3389
direction: '1'
dport: 33073
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 972
- fields:
accept: true
description: id-696-VERS tcp 22074 -> 22
direction: '1'
dport: 32074
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 973
- fields:
accept: true
description: id-696-VERS tcp 23074 -> 3389
direction: '1'
dport: 33074
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 974
- fields:
accept: true
description: id-145_user-test tcp 23006 -> 3389
direction: '1'
dport: 33006
extra: ''
nat: true
nat_dport: 3389
owner: 7
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 978
- fields:
accept: true
description: ''
direction: '1'
dport: 33009
extra: ''
nat: true
nat_dport: 3389
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 980
- fields:
accept: true
description: id-708-Hanak-Windows7 tcp 22009 -> 22
direction: '1'
dport: 32009
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 984
- fields:
accept: true
description: id-708-Hanak-Windows7 tcp 23009 -> 3389
direction: '1'
dport: 33009
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 985
- fields:
accept: true
description: levelezhet cronosra
direction: '0'
dport: 25
extra: -d 152.66.243.1
nat: false
nat_dport: null
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [4]
model: firewall.rule
pk: 988
- fields:
accept: true
description: id-156_user-lennon tcp 23013 -> 3389
direction: '1'
dport: 33013
extra: ''
nat: true
nat_dport: 3389
owner: 6
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 994
- fields:
accept: true
description: id-158_user-K7YLW5 tcp 22015 -> 22
direction: '1'
dport: 32015
extra: ''
nat: true
nat_dport: 22
owner: 14
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 996
- fields:
accept: true
description: "id-161_user-root tcp 22017\u2009\u25B8\u200922"
direction: '1'
dport: 32017
extra: ''
nat: true
nat_dport: 22
owner: 1
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 999
- fields:
accept: true
description: "id-165_user-K2JL24 tcp 22021\u2009\u25B8\u200922"
direction: '1'
dport: 32021
extra: ''
nat: true
nat_dport: 22
owner: 11
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 1003
- fields:
accept: true
description: "id-740-one-740 tcp 22030\u2009\u25B8\u200922"
direction: '1'
dport: 32030
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 1021
- fields:
accept: true
description: "id-740-one-740 tcp 23030\u2009\u25B8\u20093389"
direction: '1'
dport: 33030
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 1022
- fields:
accept: true
description: "id-748-Dev tcp 22036\u2009\u25B8\u200922"
direction: '1'
dport: 32036
extra: ''
nat: true
nat_dport: 22
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 1027
- fields:
accept: true
description: "id-748-Dev tcp 23036\u2009\u25B8\u20093389"
direction: '1'
dport: 33036
extra: ''
nat: true
nat_dport: 3389
owner: 5
proto: tcp
r_type: host
sport: null
vlan: [3, 4, 6, 7, 8, 10, 12]
model: firewall.rule
pk: 1028
- fields:
comment: ''
description: ''
dhcp_pool: manual
domain: off.ik.bme.hu
interface: vlan0005
ipv4: 10.5.255.254
ipv6: 2001:738:2001:4031:5:255:254:0
name: 'OFF'
net4: 10.5.0.0
net6: '2001:738:2001:4031:5::'
prefix4: 16
prefix6: 80
rules: [45]
snat_ip: 152.66.243.160
snat_to: [4, 7]
vid: 5
model: firewall.vlan
pk: 1
- fields:
comment: ''
description: ''
dhcp_pool: 10.3.3.2 10.3.3.254
domain: man.ik.bme.hu
interface: vlan0003
ipv4: 10.3.255.254
ipv6: 2001:738:2001:4031:3:255:254:0
name: MAN
net4: 10.3.0.0
net6: '2001:738:2001:4031:3::'
prefix4: 16
prefix6: 80
rules: [42]
snat_ip: 152.66.243.160
snat_to: [4, 7]
vid: 3
model: firewall.vlan
pk: 2
- fields:
comment: ''
description: ''
dhcp_pool: 10.4.0.2 10.4.0.254
domain: hot.ik.bme.hu
interface: vlan0004
ipv4: 10.4.255.254
ipv6: 2001:738:2001:4031:4:255:254:0
name: HOT
net4: 10.4.0.0
net6: '2001:738:2001:4031:4::'
prefix4: 16
prefix6: 80
rules: [43]
snat_ip: 152.66.243.160
snat_to: [4, 7]
vid: 4
model: firewall.vlan
pk: 3
- fields:
comment: ''
description: ''
dhcp_pool: ''
domain: ''
interface: pub
ipv4: 152.66.243.160
ipv6: 2001:738:2001:4030::fffe
name: PUB
net4: 152.66.243.0
net6: '2001:738:2001:4030::'
prefix4: 24
prefix6: 64
rules: [39]
snat_ip: null
snat_to: []
vid: 66
model: firewall.vlan
pk: 4
- fields:
comment: ''
description: ''
dhcp_pool: ''
domain: vpn.ik.bme.hu
interface: vpn
ipv4: 10.1.255.254
ipv6: 2001:738:2001:4031:1:255:254:0
name: VPN
net4: 10.1.0.0
net6: '2001:738:2001:4031:1::'
prefix4: 16
prefix6: 80
rules: [44]
snat_ip: 152.66.243.160
snat_to: [4, 5, 7]
vid: 1
model: firewall.vlan
pk: 5
- fields:
comment: ''
description: ''
dhcp_pool: manual
domain: cloud.ik.bme.hu
interface: vlan0002
ipv4: 10.2.255.254
ipv6: 2001:738:2001:4031:2:255:254:0
name: DMZ
net4: 10.2.0.0
net6: '2001:738:2001:4031:2::'
prefix4: 16
prefix6: 80
rules: [40]
snat_ip: null
snat_to: []
vid: 2
model: firewall.vlan
pk: 6
- fields:
comment: ''
description: ''
dhcp_pool: manual
domain: cloud.ik.bme.hu
interface: vlan0006
ipv4: 152.66.243.126
ipv6: 2001:738:2001:4031:66:243:126:0
name: WAR
net4: 152.66.243.64
net6: '2001:738:2001:4031:66::'
prefix4: 26
prefix6: 80
rules: [850]
snat_ip: null
snat_to: []
vid: 6
model: firewall.vlan
pk: 7
- fields:
comment: ''
description: ''
dhcp_pool: 10.7.0.2 10.7.0.254
domain: lab.ik.bme.hu
interface: vlan0007
ipv4: 10.7.255.254
ipv6: 2001:738:2001:4031:7:255:254:0
name: LAB
net4: 10.7.0.0
net6: '2001:738:2001:4031:7::'
prefix4: 16
prefix6: 80
rules: [41]
snat_ip: 152.66.243.160
snat_to: [4, 7]
vid: 7
model: firewall.vlan
pk: 8
- fields:
comment: ''
description: "Ketler office h\xE1l\xF3zata a nyomtat\xF3 miatt (a M\xE1t\xE9 erre\
\ azt k\xE9rdezte, hogy a nyomtat\xF3 miatt az \xF6v\xE9?)"
dhcp_pool: ''
domain: ''
interface: vlan0008
ipv4: 10.0.0.247
ipv6: 2001:738:2001:4031:8:0:247:0
name: WOLF
net4: 10.0.0.0
net6: '2001:738:2001:4031:8::'
prefix4: 24
prefix6: 80
rules: []
snat_ip: null
snat_to: []
vid: 8
model: firewall.vlan
pk: 9
- fields:
comment: ''
description: ''
dhcp_pool: manual
domain: vm-net.ik.bme.hu
interface: vlan0009
ipv4: 10.9.255.254
ipv6: 2001:738:2001:4031:9:255:254:0
name: VM-NET
net4: 10.9.0.0
net6: '2001:738:2001:4031:9::'
prefix4: 16
prefix6: 80
rules: [851]
snat_ip: 152.66.243.62
snat_to: [4, 7, 10]
vid: 9
model: firewall.vlan
pk: 10
- fields:
comment: ''
description: mozdonyok
dhcp_pool: ''
domain: ''
interface: vlan0010
ipv4: 152.66.243.166
ipv6: 2001:738:2001:4031:10:255:254:0
name: WAR2
net4: 152.66.243.160
net6: '2001:738:2001:4031:10::'
prefix4: 27
prefix6: 80
rules: [949]
snat_ip: null
snat_to: []
vid: 10
model: firewall.vlan
pk: 11
- fields:
comment: ''
description: ''
dhcp_pool: ''
domain: ''
interface: vlan0011
ipv4: 10.11.255.254
ipv6: 2001:738:2001:4031:11:255:254:0
name: OFF2
net4: 10.11.0.0
net6: '2001:738:2001:4031:11::'
prefix4: 16
prefix6: 80
rules: [950]
snat_ip: 152.66.243.160
snat_to: [4, 7]
vid: 11
model: firewall.vlan
pk: 12
- fields:
name: irodai gep
rules: [1, 33, 263, 264]
model: firewall.group
pk: 1
- fields:
name: irodai telefon
rules: [30]
model: firewall.group
pk: 3
- fields:
name: mailezhet cronosra
rules: [988]
model: firewall.group
pk: 7
- fields:
name: mailszerver
rules: [948]
model: firewall.group
pk: 6
- fields:
name: minden pub fele
rules: [1, 750]
model: firewall.group
pk: 5
- fields:
name: netezhet
rules: [1, 870]
model: firewall.group
pk: 4
- fields:
name: vpnrol elerheto
rules: [3]
model: firewall.group
pk: 2
- fields:
comment: ''
description: bd gepe
groups: [1, 2]
hostname: bd
ipv4: 10.5.253.6
ipv6: 2001:738:2001:4031:5:253:6:0
location: ''
mac: 00:13:f7:d1:b8:af
owner: 2
pub_ipv4: null
rules: [2]
shared_ip: false
vlan: 1
model: firewall.host
pk: 7
- fields:
comment: "saj\xE1t g\xE9p"
description: "\u0150ry M\xE1t\xE9 laptopja"
groups: [1, 2]
hostname: mate
ipv4: 10.5.253.5
ipv6: 2001:738:2001:4031:5:253:5:0
location: ''
mac: 64:31:50:93:4e:5d
owner: 3
pub_ipv4: null
rules: [2]
shared_ip: false
vlan: 1
model: firewall.host
pk: 8
- fields:
comment: ''
description: Cziva Ricsi telefonja
groups: [3]
hostname: tele8
ipv4: 10.5.253.87
ipv6: 2001:738:2001:4031:5:253:87:0
location: ''
mac: 00:90:78:83:56:76
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 9
- fields:
comment: ''
description: "M\xE1t\xE9 \xE9s bd telefonja"
groups: [3]
hostname: tele6
ipv4: 10.5.253.85
ipv6: 2001:738:2001:4031:5:253:85:0
location: ''
mac: 00:18:f8:84:f9:64
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 10
- fields:
comment: ''
description: az uj fejgep
groups: [2, 4, 6]
hostname: cloud
ipv4: 10.2.0.7
ipv6: 2001:738:2001:4031:2:0:7:0
location: ''
mac: b4:b5:2f:67:ef:76
owner: 4
pub_ipv4: 152.66.243.98
rules: [2, 3, 34, 47, 751, 856, 859]
shared_ip: false
vlan: 6
model: firewall.host
pk: 12
- fields:
comment: ''
description: ''
groups: []
hostname: BLADE-VCETW280200SN
ipv4: 10.3.2.2
ipv6: 2001:738:2001:4031:3:2:2:0
location: ''
mac: 00:1b:78:6e:81:42
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 17
- fields:
comment: ''
description: ''
groups: []
hostname: BLADE-ILOGB8849B4JH
ipv4: 10.3.2.3
ipv6: 2001:738:2001:4031:3:2:3:0
location: ''
mac: 00:22:64:9c:24:96
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 18
- fields:
comment: ''
description: ''
groups: []
hostname: BLADE-VCETW280200SK
ipv4: 10.3.2.4
ipv6: 2001:738:2001:4031:3:2:4:0
location: ''
mac: 00:1b:78:6e:81:3c
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 19
- fields:
comment: ''
description: ''
groups: []
hostname: BLADE-ILOPZ81MP6122
ipv4: 10.3.2.5
ipv6: 2001:738:2001:4031:3:2:5:0
location: ''
mac: 00:1e:0b:ec:13:58
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 20
- fields:
comment: ''
description: ''
groups: []
hostname: BLADE-ILOCZJ80408UH
ipv4: 10.3.2.6
ipv6: 2001:738:2001:4031:3:2:6:0
location: ''
mac: 00:1e:0b:e9:66:78
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 21
- fields:
comment: ''
description: ''
groups: [4]
hostname: mega6
ipv4: 10.3.1.16
ipv6: 2001:738:2001:4031:3:1:16:0
location: ''
mac: 18:a9:05:64:19:aa
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 22
- fields:
comment: ''
description: ''
groups: [4]
hostname: blade1
ipv4: 10.3.1.21
ipv6: 2001:738:2001:4031:3:1:21:0
location: ''
mac: 00:1e:0b:e9:79:1e
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 23
- fields:
comment: ''
description: ''
groups: [4]
hostname: blade2
ipv4: 10.3.1.22
ipv6: 2001:738:2001:4031:3:1:22:0
location: ''
mac: 00:22:64:9c:fd:34
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 24
- fields:
comment: ''
description: ''
groups: [4]
hostname: blade3
ipv4: 10.3.1.23
ipv6: 2001:738:2001:4031:3:1:23:0
location: ''
mac: 00:1e:0b:ec:65:46
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 25
- fields:
comment: ''
description: tarokkkk laptopja
groups: [1]
hostname: tarokkk-off
ipv4: 10.5.253.3
ipv6: 2001:738:2001:4031:5:253:3:0
location: ''
mac: e4:11:5b:41:64:d9
owner: 4
pub_ipv4: null
rules: [2]
shared_ip: false
vlan: 1
model: firewall.host
pk: 27
- fields:
comment: ''
description: tarokkk iptelefonja
groups: [3]
hostname: tele4
ipv4: 10.5.253.83
ipv6: 2001:738:2001:4031:5:253:83:0
location: ''
mac: 00:01:a8:02:2d:2f
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 28
- fields:
comment: ''
description: ''
groups: [2, 4]
hostname: mega5
ipv4: 10.3.1.15
ipv6: 2001:738:2001:4031:3:1:15:0
location: ''
mac: 18:a9:05:61:fc:be
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 30
- fields:
comment: ''
description: ''
groups: [2]
hostname: mega5-ilo
ipv4: 10.3.2.15
ipv6: 2001:738:2001:4031:3:2:15:0
location: ''
mac: 18:a9:05:61:fc:c6
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 35
- fields:
comment: ''
description: ''
groups: []
hostname: mega6-ilo
ipv4: 10.3.2.16
ipv6: 2001:738:2001:4031:3:2:16:0
location: ''
mac: 18:a9:05:64:19:b2
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 36
- fields:
comment: ''
description: adjatok akkountot tipusu gep
groups: [1]
hostname: laborteszt
ipv4: 10.5.253.10
ipv6: 2001:738:2001:4031:5:253:10:0
location: ''
mac: c8:60:00:ca:bb:47
owner: 4
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 105
- fields:
comment: ''
description: "Ny\xEDri G\xE1bor iptelefonja"
groups: [3]
hostname: tele3
ipv4: 10.5.253.82
ipv6: 2001:738:2001:4031:5:253:82:0
location: ''
mac: 00:90:78:83:56:72
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 300
- fields:
comment: ''
description: "konyha \xE9s IL306 iptelefon"
groups: [3]
hostname: tele7
ipv4: 10.5.253.86
ipv6: 2001:738:2001:4031:5:253:86:0
location: IL312
mac: 00:90:78:83:56:75
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 303
- fields:
comment: ''
description: "K\xE1polnai Rich\xE1rd iptelefonja"
groups: [3]
hostname: tele2
ipv4: 10.5.253.81
ipv6: 2001:738:2001:4031:5:253:81:0
location: "az asztal\xE1n XDDDD"
mac: 00:01:a8:02:2d:40
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 304
- fields:
comment: ''
description: L212 iptelefon
groups: [3]
hostname: tele5
ipv4: 10.5.253.84
ipv6: 2001:738:2001:4031:5:253:84:0
location: ''
mac: 00:01:a8:02:2d:47
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 305
- fields:
comment: "K\xE1polnai Rich\xE1rd adminolja"
description: "Deklarat\xEDv Programoz\xE1s hallgat\xF3i shellszerver"
groups: [5]
hostname: dps
ipv4: 152.66.243.72
ipv6: 2001:738:2001:4031:66:243:72:0
location: cloud-os gep
mac: 02:00:98:42:f3:48
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 494
- fields:
comment: "\xC9rintettek: Ny\xEDri G\xE1bor (root), Schnell Henrik, Szebi stb.\r\
\n"
description: "web2grid projektg\xE9p (\xE9s egyebek)\r\n"
groups: [5]
hostname: bvp6
ipv4: 152.66.243.80
ipv6: 2001:738:2001:4031:66:243:80:0
location: cloud-os gep
mac: 02:00:98:42:f3:50
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 497
- fields:
comment: ''
description: cloud-os gep
groups: [4]
hostname: Gabor_BackUp
ipv4: 10.9.1.5
ipv6: 2001:738:2001:4031:9:1:5:0
location: ''
mac: 02:00:0a:09:01:05
owner: 5
pub_ipv4: 152.66.243.62
rules: [773, 774]
shared_ip: true
vlan: 10
model: firewall.host
pk: 501
- fields:
comment: ''
description: ''
groups: [2, 4]
hostname: mega4
ipv4: 10.3.1.14
ipv6: 2001:738:2001:4031:3:1:14:0
location: ''
mac: b4:99:ba:aa:20:44
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 510
- fields:
comment: ''
description: ''
groups: []
hostname: mega4-ilo
ipv4: 10.3.2.14
ipv6: 2001:738:2001:4031:3:2:14:0
location: ''
mac: b4:99:ba:aa:20:46
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 511
- fields:
comment: ''
description: ''
groups: [2, 4]
hostname: mega3
ipv4: 10.3.1.13
ipv6: 2001:738:2001:4031:3:1:13:0
location: ''
mac: b4:99:ba:aa:1b:d6
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 513
- fields:
comment: ''
description: ''
groups: []
hostname: mega3-ilo
ipv4: 10.3.2.13
ipv6: 2001:738:2001:4031:3:2:13:0
location: ''
mac: b4:99:ba:aa:1b:d5
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 514
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-90_user-bd
ipv4: 10.9.1.19
ipv6: 2001:738:2001:4031:9:1:19:0
location: ''
mac: 02:00:0a:09:01:13
owner: 2
pub_ipv4: 152.66.243.62
rules: [825]
shared_ip: true
vlan: 10
model: firewall.host
pk: 524
- fields:
comment: "BD szem\xE9lyes akkountoszt\xF3s g\xE9pe"
description: cloud-os gep
groups: [5]
hostname: kagylo
ipv4: 152.66.243.65
ipv6: 2001:738:2001:4031:66:243:65:0
location: ''
mac: 02:00:98:42:f3:41
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 532
- fields:
comment: ''
description: ''
groups: [2]
hostname: mega1-ilo
ipv4: 10.3.2.11
ipv6: 2001:738:2001:4031:3:2:11:0
location: ''
mac: 18:a9:05:c5:67:ca
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 535
- fields:
comment: ''
description: ''
groups: [2, 4]
hostname: mega1
ipv4: 10.3.1.11
ipv6: 2001:738:2001:4031:3:1:11:0
location: ''
mac: 18:a9:05:c5:67:c8
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 536
- fields:
comment: "Admin: Szeber\xE9nyi Imre"
description: "GridOO labor hallgat\xF3i szerver"
groups: [5]
hostname: ParaHead
ipv4: 152.66.243.90
ipv6: 2001:738:2001:4031:66:243:90:0
location: cloud
mac: 02:00:98:42:f3:5a
owner: 4
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 541
- fields:
comment: ''
description: ''
groups: [2]
hostname: mega2-ilo
ipv4: 10.3.2.12
ipv6: 2001:738:2001:4031:3:2:12:0
location: ''
mac: d8:d3:85:ae:f9:7a
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 544
- fields:
comment: ''
description: ''
groups: [2, 4]
hostname: mega2
ipv4: 10.3.1.12
ipv6: 2001:738:2001:4031:3:1:12:0
location: ''
mac: d8:d3:85:ae:f9:78
owner: 2
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 545
- fields:
comment: ''
description: cloud-os gep
groups: [5]
hostname: store
ipv4: 152.66.243.70
ipv6: 2001:738:2001:4031:66:243:70:0
location: ''
mac: 02:00:98:42:f3:46
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 546
- fields:
comment: ''
description: "Ny\xEDri G\xE1bor laptopja"
groups: [1, 2, 4]
hostname: gabor
ipv4: 10.5.253.7
ipv6: 2001:738:2001:4031:5:253:7:0
location: ''
mac: 00:1C:C4:C9:6C:DD
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 547
- fields:
comment: ''
description: Tarokkk anonim alkoholista szervere.
groups: [5]
hostname: tarokkk
ipv4: 152.66.243.78
ipv6: 2001:738:2001:4031:66:243:78:0
location: ''
mac: 02:00:98:42:f3:4e
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 550
- fields:
comment: ''
description: harmadik emeleti rendezoben levo linksys switch (regi denes fele
halozat resze volt)
groups: [2]
hostname: switch2
ipv4: 10.3.0.3
ipv6: 2001:738:2001:4031:3:254:2:0
location: ''
mac: 00:1e:e5:09:70:19
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 2
model: firewall.host
pk: 554
- fields:
comment: ''
description: "Dud\xE1s \xC1d\xE1m laptop"
groups: [1, 2]
hostname: dudi
ipv4: 10.5.253.8
ipv6: 2001:738:2001:4031:5:253:8:0
location: ''
mac: 00:1d:72:3b:64:b7
owner: 1
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 555
- fields:
comment: ''
description: "Prog2 t\xE1rgyhonlap drupal"
groups: [5]
hostname: infocpp
ipv4: 152.66.243.67
ipv6: 2001:738:2001:4031:66:243:67:0
location: cloud
mac: 02:00:98:42:f3:43
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 596
- fields:
comment: ''
description: cloud-os gep
groups: [5, 6]
hostname: zimbra
ipv4: 152.66.243.68
ipv6: 2001:738:2001:4031:66:243:68:0
location: ''
mac: 02:00:98:42:f3:44
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 612
- fields:
comment: ''
description: TeamConcert Windows 2008 server
groups: [5]
hostname: teamconcert
ipv4: 152.66.243.69
ipv6: 2001:738:2001:4031:66:243:69:0
location: ''
mac: 02:00:98:42:f3:45
owner: 4
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 618
- fields:
comment: ''
description: ''
groups: [5, 7]
hostname: cporta
ipv4: 152.66.243.81
ipv6: 2001:738:2001:4031:66:243:81:0
location: ''
mac: 02:00:98:42:f3:51
owner: 3
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 623
- fields:
comment: ''
description: cloud-os gep
groups: [5, 7]
hostname: ui
ipv4: 152.66.243.73
ipv6: 2001:738:2001:4031:66:243:73:0
location: ''
mac: 02:00:98:42:f3:49
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 630
- fields:
comment: ''
description: cloud-os gep
groups: [5, 7]
hostname: vers
ipv4: 152.66.243.74
ipv6: 2001:738:2001:4031:66:243:74:0
location: ''
mac: 02:00:98:42:f3:4a
owner: 5
pub_ipv4: null
rules: []
shared_ip: false
vlan: 7
model: firewall.host
pk: 631
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-145_user-test
ipv4: 10.9.1.6
ipv6: 2001:738:2001:4031:9:1:6:0
location: ''
mac: 02:00:0a:09:01:06
owner: 7
pub_ipv4: 152.66.243.62
rules: [978]
shared_ip: true
vlan: 10
model: firewall.host
pk: 635
- fields:
comment: "Migr\xE1lva r\xE9gi cloudr\xF3l: 2013-01-22"
description: "Han\xE1k P\xE9ter win7 g\xE9pe"
groups: [4]
hostname: id-708-Hanak-Windows7
ipv4: 10.9.1.9
ipv6: 2001:738:2001:4031:9:1:9:0
location: cloud-os gep
mac: 02:00:0a:09:01:09
owner: 5
pub_ipv4: 152.66.243.62
rules: [984, 985]
shared_ip: true
vlan: 10
model: firewall.host
pk: 640
- fields:
comment: ''
description: lennon laptopja
groups: [1]
hostname: lennon
ipv4: 10.5.253.11
ipv6: 2001:738:2001:4031:5:253:11:0
location: ''
mac: a4:ba:db:d7:96:4c
owner: 6
pub_ipv4: null
rules: []
shared_ip: false
vlan: 1
model: firewall.host
pk: 645
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-156_user-lennon
ipv4: 10.9.1.13
ipv6: 2001:738:2001:4031:9:1:13:0
location: ''
mac: 02:00:0a:09:01:0d
owner: 6
pub_ipv4: 152.66.243.62
rules: [994]
shared_ip: true
vlan: 10
model: firewall.host
pk: 648
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-158_user-K7YLW5
ipv4: 10.9.1.15
ipv6: 2001:738:2001:4031:9:1:15:0
location: ''
mac: 02:00:0a:09:01:0f
owner: 14
pub_ipv4: 152.66.243.62
rules: [996]
shared_ip: true
vlan: 10
model: firewall.host
pk: 650
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-161_user-root
ipv4: 10.9.1.17
ipv6: 2001:738:2001:4031:9:1:17:0
location: ''
mac: 02:00:0a:09:01:11
owner: 1
pub_ipv4: 152.66.243.62
rules: [999]
shared_ip: true
vlan: 10
model: firewall.host
pk: 653
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-165_user-K2JL24
ipv4: 10.9.1.21
ipv6: 2001:738:2001:4031:9:1:21:0
location: ''
mac: 02:00:0a:09:01:15
owner: 11
pub_ipv4: 152.66.243.62
rules: [1003]
shared_ip: true
vlan: 10
model: firewall.host
pk: 657
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-166_user-TFDAZ6
ipv4: 10.9.1.26
ipv6: 2001:738:2001:4031:9:1:26:0
location: ''
mac: 02:00:0a:09:01:1a
owner: 13
pub_ipv4: 152.66.243.62
rules: []
shared_ip: true
vlan: 10
model: firewall.host
pk: 664
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-167_user-TFDAZ6
ipv4: 10.9.1.27
ipv6: 2001:738:2001:4031:9:1:27:0
location: ''
mac: 02:00:0a:09:01:1b
owner: 13
pub_ipv4: 152.66.243.62
rules: []
shared_ip: true
vlan: 10
model: firewall.host
pk: 665
- fields:
comment: ''
description: ''
groups: [4]
hostname: id-169_user-TFDAZ6
ipv4: 10.9.1.29
ipv6: 2001:738:2001:4031:9:1:29:0
location: ''
mac: 02:00:0a:09:01:1d
owner: 13
pub_ipv4: 152.66.243.62
rules: []
shared_ip: true
vlan: 10
model: firewall.host
pk: 667
- fields:
comment: ''
description: cloud-os gep
groups: [4]
hostname: id-740-one-740
ipv4: 10.9.1.30
ipv6: 2001:738:2001:4031:9:1:30:0
location: ''
mac: 02:00:0a:09:01:1e
owner: 5
pub_ipv4: 152.66.243.62
rules: [1021, 1022]
shared_ip: true
vlan: 10
model: firewall.host
pk: 668
- fields:
name: default
rules: [12, 15, 26, 31, 35, 36, 38, 867]
model: firewall.firewall
pk: 1
#!/bin/bash
if [ -z "$SSH_AUTH_SOCK" ]
then
cat <<A
Use SSH authentication agent forwarding ("ssh -A cloud@host").
On the client side you can use "ssh-add [filename]" to let the agent know more keys.
In .ssh/config you can also use "ForwardAgent yes" setting.
A
exit 1
fi
if ! git config user.name
then
echo -n "Your name: "
read NAME
git config --global user.name "$NAME"
fi
mysql <<A
DROP USER webadmin@localhost;
A
mysql <<A
DROP DATABASE webadmin;
A
set -e
mysql <<A
CREATE USER webadmin@localhost IDENTIFIED BY 'asjklddfjklqjf';
CREATE DATABASE webadmin CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON webadmin.* TO webadmin@localhost;
A
cd /opt/webadmin/
mv cloud cloud.$(date +%s) || true
git clone 'ssh://git@giccero.cloud.ik.bme.hu/cloud'
cd cloud
./manage.py syncdb --noinput
./manage.py migrate
./manage.py createsuperuser --email=cloud@ik.bme.hu
./manage.py loaddata /home/cloud/user.yaml 2>/dev/null || true
./manage.py loaddata /home/cloud/fw.yaml
./manage.py loaddata /home/cloud/one.yaml
./manage.py update
- fields: {name: wifi, nat: true, public: false}
model: one.network
pk: 1
- fields: {CPU: 1, RAM: 102, name: small}
model: one.instancetype
pk: 1
- fields: {access_type: ssh, created_at: !!timestamp '2013-01-24 23:06:00+00:00', disk: 1, instance_type: 1, name: tty, network: 1, owner: 1}
model: one.template
pk: 1
- fields: {name: Copy of ttylinux - kvm}
model: one.disk
pk: 1
- fields:
comment: ''
description: ''
dhcp_pool: manual
domain: wifi.ik.bme.hu
interface: fake
ipv4: 192.168.255.254
ipv6: 2001:738:2001:4031:168:255:254:0
name: 'wifi'
net4: 192.168.0.0
net6: '2001:738:2001:4031:168::'
prefix4: 16
prefix6: 80
snat_ip: 152.66.243.160
snat_to: [4, 7]
vid: 168
model: firewall.vlan
pk: 168
- fields:
date_joined: 2012-11-27 10:33:20+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: true
is_superuser: false
last_login: 2013-01-14 21:41:28+00:00
last_name: ''
password: pbkdf2_sha256$10000$nKZoYcdY1hCp$EUltsuHxLC4hYDMjh0P/3JCqZshnrvYTZpQDcotqjns=
user_permissions: []
username: bd
model: auth.user
pk: 2
- fields:
date_joined: 2012-11-27 10:40:57+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: false
is_superuser: false
last_login: 2012-11-27 10:40:57+00:00
last_name: ''
password: pbkdf2_sha256$10000$yQSOV0aqQyKoM$YryBbUnvH8pc3+OcpU6CoxPfxA+H/+s5LIRgKKbtrA=
user_permissions: []
username: mate
model: auth.user
pk: 3
- fields:
date_joined: 2012-11-27 10:41:08+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: false
is_superuser: false
last_login: 2012-11-27 10:41:08+00:00
last_name: ''
password: pbkdf2_sha256$10000$aDfLP2f50s9$/J3We6Rbgx5karvbK/xRcGJVPpQHKlPnGSxHMYl7/AgU=
user_permissions: []
username: tarokkk
model: auth.user
pk: 4
- fields:
date_joined: 2012-12-23 18:57:31+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: false
is_superuser: false
last_login: 2012-12-23 18:57:31+00:00
last_name: ''
password: pbkdf2_sha256$10000$fJrZiQ78vfDi$obQ8lqeEbWu1gJkUohGaL2VXDB+zHuc7qzrWwmDKye4=
user_permissions: []
username: opennebula
model: auth.user
pk: 5
- fields:
date_joined: 2013-01-14 15:01:51+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: true
is_superuser: true
last_login: 2013-01-14 15:07:27+00:00
last_name: ''
password: pbkdf2_sha256$10000$PxbeA5QOMTNr$hxUBeBD9yU7Gmu75+drJoqgpHFeYtop0w5ovx978Ec8=
user_permissions: []
username: lennon
model: auth.user
pk: 6
- fields:
date_joined: 2013-01-16 12:36:01+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: true
is_superuser: true
last_login: 2013-01-22 15:21:22+00:00
last_name: ''
password: pbkdf2_sha256$10000$gx04X6OpW8kW$iCU3cuhqQcvq7I8tRVkrnES03ty/3vqN8ou4xZgfPBQ=
user_permissions: []
username: test
model: auth.user
pk: 7
- fields:
date_joined: 2013-01-21 18:07:32+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: true
is_superuser: true
last_login: 2013-01-21 18:08:27+00:00
last_name: ''
password: pbkdf2_sha256$10000$1ckVZD48XFt8$7vj20S4x33KDRP/y02PKm8is9zf1FoLHJQ+xf1zhKzw=
user_permissions: []
username: test23
model: auth.user
pk: 9
- fields:
date_joined: 2013-01-21 18:11:21+00:00
email: ''
first_name: ''
groups: []
is_active: true
is_staff: true
is_superuser: true
last_login: 2013-01-22 00:09:01+00:00
last_name: ''
password: pbkdf2_sha256$10000$9gr7ctlRFCS8$A3Ex+7gs0OVU+SzZNvijisjvCQjBT6l0Tl3dGCQ5UEs=
user_permissions: []
username: test77
model: auth.user
pk: 10
- fields:
date_joined: 2013-01-22 23:03:18+00:00
email: orymate@gmail.com
first_name: "M\xE1t\xE9"
groups: []
is_active: true
is_staff: false
is_superuser: false
last_login: 2013-01-23 22:12:20+00:00
last_name: "\u0150ry"
password: '!'
user_permissions: []
username: K2JL24
model: auth.user
pk: 11
- fields:
date_joined: 2013-01-23 08:49:10+00:00
email: bd@doszgep.hu
first_name: "D\xE1niel"
groups: []
is_active: true
is_staff: false
is_superuser: false
last_login: 2013-01-23 11:30:27+00:00
last_name: Bach
password: '!'
user_permissions: []
username: JI1M92
model: auth.user
pk: 12
- fields:
date_joined: 2013-01-23 13:37:22+00:00
email: gubasanyi@gmail.com
first_name: "S\xE1ndor"
groups: []
is_active: true
is_staff: false
is_superuser: false
last_login: 2013-01-24 21:40:05+00:00
last_name: Guba
password: '!'
user_permissions: []
username: TFDAZ6
model: auth.user
pk: 13
- fields:
date_joined: 2013-01-23 15:04:46+00:00
email: madbence@gmail.com
first_name: Bence
groups: []
is_active: true
is_staff: false
is_superuser: false
last_login: 2013-01-23 15:04:46+00:00
last_name: "D\xE1nyi"
password: '!'
user_permissions: []
username: K7YLW5
model: auth.user
pk: 14
<!DOCTYPE html>
<html lang="hu-hu">
<head>
<title>
IK Cloud
</title>
<link href='http://fonts.googleapis.com/css?family=Metrophobic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../../one/static/style.css">
<link rel="icon" type="image/png" href="one/static/favicon.png">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('.wm').click(function(){
if($(this).children('.details').is(':hidden')){
$(this).children('.details')
.css('height',0)
.css('padding','0px 5px')
.show()
.animate({height:160,paddingTop:15,paddingBottom:15},700);
} else {
var that=this;
$(this).children('.details')
.css('height',130)
.css('padding','15px 5px')
.animate({height:0,paddingTop:0,paddingBottom:0},700,function(){
$(that).children('.details').hide();
});
}
})
})
</script>
</head>
<body>
<div id="header">
<div id="loginblock">
<p>
Bejelentkezve: root. <a href="/logout/">Kijelentkezés</a> . <a href="/admin/">Admin</a> .
</p>
</div>
<h1>
<a href="/">IK Cloud</a>
</h1>
</div>
<div id="content">
<div class="boxes">
<div class="contentblock" id="state">
<h2>
Virtuális gépek
</h2>
<ul class="content" id="wm-list">
<div class="wm">
<div class="summary">
<!--<div class="id">161</div>-->
<div class="name wm-on">
<a href="/vm/show/161/" title="root Ubuntu 12.04 server (724)">root Ubuntu 12.04...</a>
</div>
<div class="actions">
<a href="#"><img src="../../one/static/icons/plug.png" alt="plug" /></a>
<a href="#"><img src="../../one/static/icons/control-pause.png" alt="pause" /></a>
<a href="#"><img src="../../one/static/icons/minus-circle.png" alt="delete" /></a>
</div>
<div class="status">
DONE
</div>
<div class="clear"></div>
</div>
<div class="details" style="display: none">
<h3>Részletek</h3>
<ul>
<li class="name">Gép neve: <span class="value">Ubuntyu</span></li>
<li class="os-linux">Operációs rendszer: <span class="value">Ubuntu 12.04 Desktop</span></li>
<li class="type">Instance típus: <span class="value">Small</span></li>
<li class="date">Létrehozás dátuma: <span class="value">2013.01.24. 12:04</span></li>
</ul>
</div>
</div>
<div class="wm">
<div class="summary">
<!--<div class="id">161</div>-->
<div class="name wm-off">
<a href="/vm/show/161/" title="root Ubuntu 12.04 server (724)">root Windows 7...</a>
</div>
<div class="actions">
<a href="#"><img src="../../one/static/icons/control.png" alt="connect" /></a>
<a href="#"><img src="../../one/static/icons/minus-circle.png" alt="delete" /></a>
</div>
<div class="status">
SUSPENDED
</div>
<div class="clear"></div>
<div class="details" style="display: none">asdasd</div>
</div>
<div class="details" style="display: none">
<h3>Részletek</h3>
<ul>
<li class="name">Gép neve: <span class="value">Wendóz</span></li>
<li class="os-win">Operációs rendszer: <span class="value">Windows 7</span></li>
<li class="type">Instance típus: <span class="value">Medium</span></li>
<li class="date">Létrehozás dátuma: <span class="value">2013.01.21. 22:15</span></li>
</ul>
</div>
</div>
<div id="new-wm-tooltip" style="display: none">
<div id="new-wm-tooltip-container">
<p>
Még nem indított egy gépet sem.
</p>
<p>
Válasszon sablont, és iziben használhatja a kiválasztott rendszert.
</p>
</div>
</div>
<div id="new-wm-button" class="wm">
<div class="summary">
<div class="name">Új gép indítása</div>
<div class="clear"></div>
</div>
</div>
<div id="new-wm" style="display: none;">
<form method="post" action="/vm/new/3/">
<div style='display:none'>
<input type='hidden' name='csrfmiddlewaretoken' value='Q01Rek6t07uPWEbTvI9zmz5k6hyCIsvZ'>
</div>
<p>
<input type="submit" value="Ubuntu 12.04 server" class="button widebutton">
</p>
</form>
<form method="post" action="/vm/new/4/">
<div style='display:none'>
<input type='hidden' name='csrfmiddlewaretoken' value='Q01Rek6t07uPWEbTvI9zmz5k6hyCIsvZ'>
</div>
<p>
<input type="submit" value="Windows 7" class="button widebutton">
</p>
</form>
<form method="post" action="/vm/new/7/">
<div style='display:none'>
<input type='hidden' name='csrfmiddlewaretoken' value='Q01Rek6t07uPWEbTvI9zmz5k6hyCIsvZ'>
</div>
<p>
<input type="submit" value="Ubuntu 12.04 Desktop" class="button widebutton">
</p>
</form>
</div>
</ul>
</div>
</div>
<div class="boxes">
<div class="contentblock">
<h2>
Adattár
</h2>
<div class="content">
<ul class="file-list">
<li class="wm">
<div class="summary">
<div class="name filetype-c">hello.c</div>
<div class="actions">
<a href="#"><img src="../../one/static/icons/pencil.png" alt="rename" /></a>
<a href="#"><img src="../../one/static/icons/minus-circle.png" alt="delete" /></a>
<a href="#"><img src="../../one/static/icons/download-cloud.png" alt="download" /></a>
</div>
<div class="info">1 Kb</div>
<div class="clear"></div>
</div>
<div class="details">
<h3>Részletek</h3>
<ul>
<li>Létrehozva: <span class="value">2012.12.29. 23:12</span></li>
<li>Módosítva: <span class="value">2012.12.29. 23:12</span></li>
<li>Hozzáférés: <span class="value">2012.12.29. 23:12</span></li>
<li>Típus: <span class="value">text/plain</span></li>
</ul>
</div>
</li>
<li class="wm">
<div class="summary">
<div class="name filetype-image">suna.jpg</div>
<div class="actions">
<a href="#"><img src="../../one/static/icons/pencil.png" alt="rename" /></a>
<a href="#"><img src="../../one/static/icons/minus-circle.png" alt="delete" /></a>
<a href="#"><img src="../../one/static/icons/download-cloud.png" alt="download" /></a>
</div>
<div class="info">1 Kb</div>
<div class="clear"></div>
</div>
<div class="details">
<h3>Részletek</h3>
<ul>
<li>Létrehozva: <span class="value">2012.12.29. 23:12</span></li>
<li>Módosítva: <span class="value">2012.12.29. 23:12</span></li>
<li>Hozzáférés: <span class="value">2012.12.29. 23:12</span></li>
<li>Típus: <span class="value">image/jpg</span></li>
</ul>
</div>
</li>
<li class="wm">
<div class="summary">
<div class="name filetype-folder">poresz</div>
<div class="actions">
<a href="#"><img src="../../one/static/icons/pencil.png" alt="rename" /></a>
<a href="#"><img src="../../one/static/icons/minus-circle.png" alt="delete" /></a>
</div>
<div class="info">katalógus</div>
<div class="clear"></div>
</div>
<div class="details">
<h3>Részletek</h3>
<ul>
<li>Létrehozva: <span class="value">2012.12.29. 23:12</span></li>
<li>Módosítva: <span class="value">2012.12.29. 23:12</span></li>
<li>Hozzáférés: <span class="value">2012.12.29. 23:12</span></li>
<li>Fájlok: <span class="value">666 db</span></li>
</ul>
</div>
</li>
<li class="file-details wm">
<div class="summary">
<div class="name filetype-more">Mutasd a régebbi fájlokat!</div>
<div class="clear"></div>
</div>
</li>
<li class="file-upload wm">
<div class="summary">
<div class="name filetype-up">Fájlfeltöltés</div>
<div class="clear"></div>
</div>
</li>
</ul>
</div>
</div>
<div class="contentblock" id="state">
<h2>
A cluster állapota
</h2>
<div class="content">
<p>
<a href="http://cloud.ik.bme.hu/"><img src="/stat/cpu.png" alt="aktuális terhelés"> <img src="/stat/ram.png" alt="aktuális memóriafoglaltság"></a>
</p>
</div>
</div>
</div>
</div>
<div id="modal" style="display: none">
<div id="shadow"></div>
<div id="modal-container">
<div></div>
</div>
</div>
</body>
</html>
...@@ -7,16 +7,18 @@ from django.db import transaction ...@@ -7,16 +7,18 @@ from django.db import transaction
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django import forms from django import forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from one.util import keygen
from school.models import Person
from firewall.models import Host, Rule, Vlan from firewall.models import Host, Rule, Vlan
from firewall.tasks import reload_firewall_lock from firewall.tasks import reload_firewall_lock
from one.util import keygen
from school.models import Person
import subprocess, tempfile, os, stat, re import subprocess, tempfile, os, stat, re
pwgen = User.objects.make_random_password
pwgen = User.objects.make_random_password """
User creation hook: create cloud details object
"""
def create_user_profile(sender, instance, created, **kwargs): def create_user_profile(sender, instance, created, **kwargs):
if created: if created:
d = UserCloudDetails(user=instance) d = UserCloudDetails(user=instance)
...@@ -24,13 +26,22 @@ def create_user_profile(sender, instance, created, **kwargs): ...@@ -24,13 +26,22 @@ def create_user_profile(sender, instance, created, **kwargs):
d.save() d.save()
post_save.connect(create_user_profile, sender=User) post_save.connect(create_user_profile, sender=User)
"""
Cloud related details of a user
"""
class UserCloudDetails(models.Model): class UserCloudDetails(models.Model):
user = models.ForeignKey(User, null=False, blank=False, unique=True) user = models.ForeignKey(User, null=False, blank=False, unique=True, verbose_name=_('user'))
smb_password = models.CharField(max_length=20) smb_password = models.CharField(max_length=20,
ssh_key = models.ForeignKey('SshKey', null=True) verbose_name=_('Samba password'),
ssh_private_key = models.TextField() help_text=_('Generated password for accessing store from Windows.'))
ssh_key = models.ForeignKey('SshKey', null=True, verbose_name=_('SSH key (public)'),
help_text=_('Generated SSH public key for accessing store from Linux.'))
ssh_private_key = models.TextField(verbose_name=_('SSH key (private)'),
help_text=_('Generated SSH private key for accessing store from Linux.'))
"""
Delete old SSH key pair and generate new one.
"""
def reset_keys(self): def reset_keys(self):
pri, pub = keygen() pri, pub = keygen()
self.ssh_private_key = pri self.ssh_private_key = pri
...@@ -41,9 +52,15 @@ class UserCloudDetails(models.Model): ...@@ -41,9 +52,15 @@ class UserCloudDetails(models.Model):
self.ssh_key = SshKey(user=self.user, key=pub) self.ssh_key = SshKey(user=self.user, key=pub)
self.ssh_key.save() self.ssh_key.save()
"""
Generate new Samba password.
"""
def reset_smb(self): def reset_smb(self):
self.smb_password = pwgen() self.smb_password = pwgen()
"""
Generate key pair and Samba password if needed.
"""
def clean(self): def clean(self):
super(UserCloudDetails, self).clean() super(UserCloudDetails, self).clean()
if not self.ssh_key: if not self.ssh_key:
...@@ -51,6 +68,9 @@ class UserCloudDetails(models.Model): ...@@ -51,6 +68,9 @@ class UserCloudDetails(models.Model):
if not self.smb_password or len(self.smb_password) == 0: if not self.smb_password or len(self.smb_password) == 0:
self.reset_smb() self.reset_smb()
"""
Validate OpenSSH keys (length and type).
"""
class OpenSshKeyValidator(object): class OpenSshKeyValidator(object):
valid_types = ['ssh-rsa', 'ssh-dsa'] valid_types = ['ssh-rsa', 'ssh-dsa']
...@@ -74,13 +94,16 @@ class OpenSshKeyValidator(object): ...@@ -74,13 +94,16 @@ class OpenSshKeyValidator(object):
except: except:
raise ValidationError(_('Invalid OpenSSH public key.')) raise ValidationError(_('Invalid OpenSSH public key.'))
"""
SSH public key (in OpenSSH format).
"""
class SshKey(models.Model): class SshKey(models.Model):
user = models.ForeignKey(User, null=False, blank=False) user = models.ForeignKey(User, null=False, blank=False)
key = models.CharField(max_length=2000, verbose_name=_('SSH key'), key = models.CharField(max_length=2000, verbose_name=_('SSH key'),
help_text=_('<a href="/info/ssh/">SSH public key in OpenSSH format</a> used for shell login ' help_text=_('<a href="/info/ssh/">SSH public key in OpenSSH format</a> used for shell login '
'(2048+ bit RSA preferred). Example: <code>ssh-rsa AAAAB...QtQ== ' '(2048+ bit RSA preferred). Example: <code>ssh-rsa AAAAB...QtQ== '
'john</code>.'), validators=[OpenSshKeyValidator()]) 'john</code>.'), validators=[OpenSshKeyValidator()])
def __unicode__(self): def __unicode__(self):
try: try:
keycomment = self.key.split(None, 2)[2] keycomment = self.key.split(None, 2)[2]
...@@ -89,10 +112,15 @@ class SshKey(models.Model): ...@@ -89,10 +112,15 @@ class SshKey(models.Model):
return u"%s (%s)" % (keycomment, self.user) return u"%s (%s)" % (keycomment, self.user)
"""
Virtual disks automatically synchronized with OpenNebula.
"""
class Disk(models.Model): class Disk(models.Model):
name = models.CharField(max_length=100, unique=True, verbose_name=_('name')) name = models.CharField(max_length=100, unique=True, verbose_name=_('name'))
"""
Get and register virtual disks from OpenNebula.
"""
@classmethod @classmethod
def update(cls): def update(cls):
import subprocess import subprocess
...@@ -121,12 +149,17 @@ class Disk(models.Model): ...@@ -121,12 +149,17 @@ class Disk(models.Model):
class Meta: class Meta:
ordering = ['name'] ordering = ['name']
"""
Virtual networks automatically synchronized with OpenNebula.
"""
class Network(models.Model): class Network(models.Model):
name = models.CharField(max_length=100, unique=True, verbose_name=_('name')) name = models.CharField(max_length=100, unique=True, verbose_name=_('name'))
nat = models.BooleanField() nat = models.BooleanField(verbose_name=_('NAT'), help_text=_('If network address translation is done.'))
public = models.BooleanField() public = models.BooleanField(verbose_name=_('public'), help_text=_('If internet gateway is available.'))
"""
Get and register virtual networks from OpenNebula.
"""
@classmethod @classmethod
def update(cls): def update(cls):
import subprocess import subprocess
...@@ -154,56 +187,84 @@ class Network(models.Model): ...@@ -154,56 +187,84 @@ class Network(models.Model):
class Meta: class Meta:
ordering = ['name'] ordering = ['name']
"""
Instance types in OCCI configuration (manually synchronized).
"""
class InstanceType(models.Model): class InstanceType(models.Model):
name = models.CharField(max_length=100, unique=True, name = models.CharField(max_length=100, unique=True,
verbose_name=_('name')) verbose_name=_('name'))
CPU = models.IntegerField() CPU = models.IntegerField(help_text=_('CPU cores.'))
RAM = models.IntegerField() RAM = models.IntegerField(help_text=_('Mebibytes of memory.'))
def __unicode__(self): def __unicode__(self):
return u"%s" % self.name return u"%s" % self.name
"""
Virtual machine template specifying OS, disk, type and network.
"""
class Template(models.Model): class Template(models.Model):
name = models.CharField(max_length=100, unique=True, name = models.CharField(max_length=100, unique=True,
verbose_name=_('név')) verbose_name=_('name'))
access_type = models.CharField(max_length=10, choices=[('rdp', 'rdp'), ('nx', 'nx'), ('ssh', 'ssh')]) access_type = models.CharField(max_length=10,
disk = models.ForeignKey(Disk) choices=[('rdp', 'rdp'), ('nx', 'nx'), ('ssh', 'ssh')],
instance_type = models.ForeignKey(InstanceType) verbose_name=_('access method'))
network = models.ForeignKey(Network) disk = models.ForeignKey(Disk, verbose_name=_('disk'))
owner = models.ForeignKey(User) instance_type = models.ForeignKey(InstanceType, verbose_name=_('instance type'))
created_at = models.DateTimeField(auto_now_add=True) network = models.ForeignKey(Network, verbose_name=_('network'))
owner = models.ForeignKey(User, verbose_name=_('owner'))
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_('created at'))
def __unicode__(self): def __unicode__(self):
return self.name return self.name
class Meta: class Meta:
verbose_name = _('sablon') verbose_name = _('template')
verbose_name_plural = _('sablonok') verbose_name_plural = _('templates')
"""
Virtual machine instance.
"""
class Instance(models.Model): class Instance(models.Model):
name = models.CharField(max_length=100, unique=True, name = models.CharField(max_length=100, unique=True,
verbose_name=_('név'), null=True, blank=True) verbose_name=_('név'), null=True, blank=True)
ip = models.IPAddressField(blank=True, null=True) ip = models.IPAddressField(blank=True, null=True, verbose_name=_('IP address'))
template = models.ForeignKey(Template) template = models.ForeignKey(Template, verbose_name=_('template'))
owner = models.ForeignKey(User) owner = models.ForeignKey(User, verbose_name=_('owner'))
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True, verbose_name=_('created_at'))
state = models.CharField(max_length=20, choices=[('DEPLOYABLE', 'DEPLOYABLE'), ('PENDING', 'PENDING'), ('DONE', 'DONE'), ('ACTIVE', 'ACTIVE'),('UNKNOWN', 'UNKNOWN'), ('SUSPENDED', 'SUSPENDED'), ('FAILED', 'FAILED')], default='DEPLOYABLE') state = models.CharField(max_length=20,
active_since = models.DateTimeField(null=True, blank=True) choices=[('DEPLOYABLE', _('deployable')),
firewall_host = models.ForeignKey(Host, blank=True, null=True) ('PENDING', _('pending')),
pw = models.CharField(max_length=20) ('DONE', _('done')),
one_id = models.IntegerField(unique=True, blank=True, null=True) ('ACTIVE', _('active')),
('UNKNOWN', _('unknown')),
('SUSPENDED', _('suspended')),
('FAILED', _('failed'))], default='DEPLOYABLE')
active_since = models.DateTimeField(null=True, blank=True,
verbose_name=_('active since'),
help_text=_('Time stamp of successful boot report.'))
firewall_host = models.ForeignKey(Host, blank=True, null=True, verbose_name=_('host in firewall'))
pw = models.CharField(max_length=20, verbose_name=_('password'), help_text=_('Original password of instance'))
one_id = models.IntegerField(unique=True, blank=True, null=True, verbose_name=_('OpenNebula ID'))
"""
Get public port number for default access method.
"""
def get_port(self): def get_port(self):
proto = self.template.access_type proto = self.template.access_type
if self.template.network.nat: if self.template.network.nat:
return {"rdp": 23000, "nx": 22000, "ssh": 22000}[proto] + int(self.ip.split('.')[3]) return {"rdp": 23000, "nx": 22000, "ssh": 22000}[proto] + int(self.ip.split('.')[3])
else: else:
return {"rdp": 3389, "nx": 22, "ssh": 22}[proto] return {"rdp": 3389, "nx": 22, "ssh": 22}[proto]
"""
Get public hostname.
"""
def get_connect_host(self): def get_connect_host(self):
if self.template.network.nat: if self.template.network.nat:
return 'cloud' return 'cloud'
else: else:
return self.ip return self.ip
"""
Get access parameters in URI format.
"""
def get_connect_uri(self): def get_connect_uri(self):
try: try:
proto = self.template.access_type proto = self.template.access_type
...@@ -217,6 +278,10 @@ class Instance(models.Model): ...@@ -217,6 +278,10 @@ class Instance(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
"""
Get and update VM state from OpenNebula.
"""
def update_state(self): def update_state(self):
import subprocess import subprocess
...@@ -241,11 +306,14 @@ class Instance(models.Model): ...@@ -241,11 +306,14 @@ class Instance(models.Model):
self.save() self.save()
return x return x
"""
Get age of VM in seconds.
"""
def get_age(self): def get_age(self):
from datetime import datetime from datetime import datetime
age = 0 age = 0
try: try:
age = (datetime.now().replace(tzinfo=None) age = (datetime.now().replace(tzinfo=None)
- self.active_since.replace(tzinfo=None)).seconds - self.active_since.replace(tzinfo=None)).seconds
except: except:
pass pass
...@@ -253,8 +321,11 @@ class Instance(models.Model): ...@@ -253,8 +321,11 @@ class Instance(models.Model):
@models.permalink @models.permalink
def get_absolute_url(self): def get_absolute_url(self):
return ('vm_show', None, {'iid':self.id,}) return ('vm_show', None, {'iid':self.id})
"""
Submit a new instance to OpenNebula.
"""
@classmethod @classmethod
def submit(cls, template, owner): def submit(cls, template, owner):
from django.template.defaultfilters import escape from django.template.defaultfilters import escape
...@@ -296,10 +367,9 @@ class Instance(models.Model): ...@@ -296,10 +367,9 @@ class Instance(models.Model):
"net": template.network.id, "net": template.network.id,
"pw": escape(inst.pw), "pw": escape(inst.pw),
"smbpw": escape(details.smb_password), "smbpw": escape(details.smb_password),
"sshkey": escape(details.ssh_private_key), "sshkey": escape(details.ssh_private_key),
"neptun": escape(owner.username), "neptun": escape(owner.username),
"booturl": "http://cloud.ik.bme.hu/b/%s/" % token, "booturl": "http://cloud.ik.bme.hu/b/%s/" % token, }
}
f.write(tpl) f.write(tpl)
f.close() f.close()
import subprocess import subprocess
...@@ -332,6 +402,9 @@ class Instance(models.Model): ...@@ -332,6 +402,9 @@ class Instance(models.Model):
reload_firewall_lock() reload_firewall_lock()
return inst return inst
"""
Delete host in OpenNebula.
"""
def delete(self): def delete(self):
proc = subprocess.Popen(["/opt/occi.sh", "compute", proc = subprocess.Popen(["/opt/occi.sh", "compute",
"delete", "%d"%self.one_id], stdout=subprocess.PIPE) "delete", "%d"%self.one_id], stdout=subprocess.PIPE)
...@@ -343,8 +416,3 @@ class Instance(models.Model): ...@@ -343,8 +416,3 @@ class Instance(models.Model):
class Meta: class Meta:
verbose_name = _('instance') verbose_name = _('instance')
verbose_name_plural = _('instances') verbose_name_plural = _('instances')
# vim: et sw=4 ai fenc=utf8 smarttab :
.contentblock { *{margin:0;padding:0;}
background-color: #ccc; .clear{
border-radius: 10px; clear: both;
margin: 5px;
} }
a{
.contentblock p, dl { text-decoration: none;
padding: 5px;
margin: 0;
} }
a:link,a:visited{
.contentblock h2 { color:black;
background-color: #000;
background-image: url(hexabar.png);
background-position: right center;
background-repeat: no-repeat;
border-radius: 10px;
color: #fff;
font-weight: bold;
padding: 10px;
border-style: none!important;
margin-bottom: 5px;
font-size: 1.3em;
} }
.contentblock
/* TABLES */ {
table { background-color:#ccc;
/*border-left: 1px solid #ccc; border-radius:4px;
border-right: 1px solid #ccc;*/ border:1px solid #aaa;
background-color: #ccc; box-shadow:0 0 30px rgba(0,0,0,0.3);
border-radius: 10px; margin:20px;
margin: 5px;
} }
.contentblock p,dl
td, th { {
border-bottom: 1px solid #bbb; margin:0;
padding: 5px; padding:5px;
vertical-align: top;
} }
table input, .contentblock h2
table select, {
table textarea { background-color:#000;
min-width: 300px; background-image:url(hexabar.png);
border: 1px solid #aaa; background-position:right center;
display: block; background-repeat:no-repeat;
} border-radius:4px;
input[type=submit], .button, .smallbutton { border-bottom-left-radius: 0px;
background-color: #072c61; border-bottom-right-radius: 0px;
padding: 5px; color:#eee;
text-decoration: none; font-size:1.5em;
color: #fff!important; margin-top:0;
border: 2px solid #fff; padding:10px;
border-radius: 10px;
min-width: 5em;
margin: 0;
font-size: .9em;
line-height: .9em;
font-weight: bold;
}
.smallbutton {
padding: 1px 5px;
}
p.rightbuttons {
float: right;
margin: 7px 0;
} }
table p.help { #new-wm-tooltip{
font-size: .85em; position: relative;
color: #666;
} }
#new-wm-tooltip-container{
th.fieldset { margin: 10px 10px 5px 150px;
background-color: #000; border-radius: 4px;
background-image: url(hexabar.png); border: 1px solid #888;
background-position: right center; background: #FFFF66;
background-repeat: no-repeat; box-shadow: 0 0 20px rgba(0,0,0,0.2);
border-radius: 10px;
color: #fff;
font-weight: bold;
padding: 10px;
border-style: none!important;
margin-bottom: 5px;
font-size: 1.3em;
}
html {
/* background: #b3b3b3;*/
min-height: 100%;
margin: 0;
padding: 0;
}
body {
min-height: 100%;
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: .9em;
background: #dadada url("site_bgr.png") repeat-x;
background-position: 80px 0;
}
div#header {
margin: 0;
padding: 0;
height: 80px;
background-color: #379acc; /* per www.ik.bme.hu */
background-color: #072c61; /* per www.ik.bme.hu */
padding-left: 200px;
background-image: url(bme_feher2.png);
background-repeat: no-repeat;
background-position: 20px 18px;
border-bottom: 2px solid #fff;
} }
div#header a:link, #new-wm-tooltip #new-wm-tooltip-container p{
div#header a:visited { text-align: left;
color: #fff; font-size: 0.8em;
word-spacing: 2px;
} }
div#header #loginblock { #new-wm-tooltip-container:after{
content: "";
position: absolute; position: absolute;
right: 0; left: 300px;
top: 0; border-width: 15px;
margin: 0; border-style: solid;
padding: 7px; border-color: #FFFF66 transparent transparent transparent;
background-color: #000; }
background-image: url(hexabar.png); .wm .summary{
background-position: center center; padding: 15px 5px;
border-radius: 0 0 0 10px; border-top: 1px solid #888;
color: #fff; cursor: pointer;
font-weight: bold; background-color: #c1c1c1;
} }
div#header #loginblock p { .wm .details{
margin: 0; border-top: 1px solid #888;
} background-color: #d1d1d1;
div#header h1 { padding: 15px 5px;
margin: 0; display: none;
padding: 0 1em; }
font-size: 2em; .wm .details h3{
line-height: 80px; font-weight: normal;
}
.wm .details ul{
list-style: none;
margin: 10px 3px;
}
.wm .details li{
margin: 12px 0px;
padding: 3px 0px 3px 20px;
border-bottom: 1px dotted #aaa;
background-repeat: no-repeat;
background-position: 0px 4px;
}
.wm .details .name{
float: none;
background-image: url(icons/computer.png);
}
.wm .details .os-win{
background-image: url(icons/windows.png)
}
.wm .details .os-linux{
background-image: url(icons/animal-penguin.png)
}
.wm .details .type{
background-image: url(icons/processor.png)
}
.wm .details .date{
background-image: url(icons/calendar-day.png)
}
.wm .details .value{
float: right;
}
.wm:hover{
background-color: #b1b1b1;
}
.wm .name{
float: left; float: left;
color: #fff;
} }
div#header h1 a { .wm .status{
color: #fff; float: right;
text-decoration: none;
} }
.wm .id{
div#content { float: right;
width: 850px; width: 30px;
margin: 0 auto;
text-align: left;
} }
.file-list{
div.boxes{ list-style: none;
width: 420px; }
.file-list .name{
float: left; float: left;
} }
div.box { .file-list .info{
background-color: #000; float: right;
background-image: url(hexa.png); width: 60px;
background-position: center 30%; }
.wm .actions{
float: right;
width: 60px;
margin-left: 5px;
}
.wm .actions a{
height: 16px;
width: 16px;
display: block;
float: left;
margin-left: 2px;
}
.wm .actions a:hover{
box-shadow: 0 0 10px rgba(0,0,0,0.4);
background-color: rgba(0,0,0,0.4);
}
.wm .name{
padding-left: 25px;
background-repeat: no-repeat; background-repeat: no-repeat;
color: #fff; background-position: 0 0;
font-weight: bold; }
line-height: 1.5em; .filetype-c {
width: 400px; background-image: url(icons/document-visual-studio.png);
margin: 10px; }
padding: 2px; .filetype-image {
border-radius: 10px; background-image: url(icons/document-image.png);
border-top-width: 30px; }
margin-right: 420px; .filetype-folder {
} background-image: url(icons/folder-horizontal.png);
div.box h3 { }
color: #fff; .filetype-more {
margin: 0; background-image: url(icons/arrow-circle-double.png);
padding: 3px; }
text-align: center; .filetype-up {
} background-image: url(icons/upload-cloud.png);
div.box .content { }
padding: 5px; #new-wm-button .name{
margin: 0; background-image: url(icons/computer--plus.png);
min-height: 100px; }
} .wm-on{
div.box a:link, div.box a:visited { background-image: url(icons/computer-cloud.png);
color: #fff; }
} .wm-off{
a:link, a:visited { background-image: url(icons/computer-off.png);
color: #892034; }
}
table
#project_running ul a:link, #project_running ul a:visited, {
#project_closed ul a:link, #project_closed ul a:visited { background-color:#ccc;
color: #fff; border-radius:10px;
text-decoration: none; margin:5px;
}
td,th
{
border-bottom:1px solid #bbb;
vertical-align:top;
padding:5px;
}
table input,table select,table textarea
{
min-width:300px;
border:1px solid #aaa;
display:block;
}
input[type=submit],.button,.smallbutton
{
background-color:#072c61;
text-decoration:none;
color:#fff!important;
border:2px solid #fff;
border-radius:10px;
min-width:5em;
font-size:.9em;
line-height:.9em;
font-weight:700;
margin:0;
padding:5px;
} }
/* MESSAGES & ERRORS */ .smallbutton
{
padding:1px 5px;
}
p.rightbuttons
{
float:right;
margin:7px 0;
}
table p.help
{
font-size:.85em;
color:#666;
}
th.fieldset
{
background-color:#000;
background-image:url(hexabar.png);
background-position:right center;
background-repeat:no-repeat;
border-radius:10px;
color:#fff;
font-weight:700;
margin-bottom:5px;
font-size:1.3em;
border-style:none!important;
padding:10px;
}
html
{
min-height:100%;
margin:0;
padding:0;
}
body
{
min-height:100%;
font-family:'Metrophobic',sans-serif;
font-size:.9em;
background:#dadada url(site_bgr.png) repeat-x;
background-position:80px 0;
margin:0;
padding:0;
}
#header
{
height:80px;
background-color:#072c61;
background-image:url(bme_feher2.png);
background-repeat:no-repeat;
background-position:20px 18px;
border-bottom:3px solid #0B4599;
box-shadow:0 0 30px rgba(0,0,0,0.4);
margin:0;
padding:0 0 0 200px;
}
div#header #loginblock
{
position:absolute;
right:0;
top:0;
background-color:#000;
background-image:url(hexabar.png);
background-position:center center;
border-radius:0 0 0 10px;
color:#fff;
font-weight:700;
margin:0;
padding:7px;
}
div#header #loginblock p
{
margin:0;
}
div#header h1
{
font-size:2em;
line-height:80px;
float:left;
color:#fff;
margin:0;
padding:0 1em;
}
div#content
{
width:850px;
text-align:left;
margin:0 auto;
}
div.boxes
{
width:420px;
float:left;
}
div.box
{
background-color:#000;
background-image:url(hexa.png);
background-position:center 30%;
background-repeat:no-repeat;
color:#fff;
font-weight:700;
line-height:1.5em;
width:400px;
border-radius:10px;
border-top-width:30px;
margin:10px 420px 10px 10px;
padding:2px;
}
div.box h3
{
color:#fff;
text-align:center;
margin:0;
padding:3px;
}
ul.messagelist { div.box .content
padding: 0 0 5px 0; {
margin: 0; min-height:100px;
text-align: left; margin:0;
padding:5px;
} }
ul.messagelist li { ul.messagelist
font-size: 12px; {
display: block; text-align:left;
padding: 4px 5px 4px 25px; margin:0;
margin: 0 0 3px 0; padding:0 0 5px;
border-bottom: 1px solid #ddd; }
color: #666;
background: #ffc url(admin/img/icon_success.gif) 5px .3em no-repeat; ul.messagelist li
{
font-size:12px;
display:block;
border-bottom:1px solid #ddd;
color:#666;
background:#ffc url(admin/img/icon_success.gif) 5px .3em no-repeat;
margin:0 0 3px;
padding:4px 5px 4px 25px;
} }
ul.messagelist li.warning{ ul.messagelist li.warning
background-image: url(admin/img/icon_alert.gif); {
background-image:url(admin/img/icon_alert.gif);
} }
ul.messagelist li.error{ ul.messagelist li.error
background-image: url(admin/img/icon_error.gif); {
background-image:url(admin/img/icon_error.gif);
} }
.errornote { .errornote
font-size: 12px !important; {
display: block; font-size:12px!important;
padding: 4px 5px 4px 25px; display:block;
margin: 0 0 3px 0; border:1px solid red;
border: 1px solid red; color:red;
color: red; background:#ffc url(admin/img/icon_error.gif) 5px .3em no-repeat;
background: #ffc url(admin/img/icon_error.gif) 5px .3em no-repeat; margin:0 0 3px;
padding:4px 5px 4px 25px;
} }
ul.errorlist { .errorlist li
margin: 0 !important; {
padding: 0 !important; font-size:12px!important;
display:block;
border:1px solid red;
color:#FFF;
background:red url(admin/img/icon_alert.gif) 5px .3em no-repeat;
margin:0 0 3px;
padding:4px 5px 4px 25px;
} }
.errorlist li { .errorlist li a
font-size: 12px !important; {
display: block; color:#FFF;
padding: 4px 5px 4px 25px; text-decoration:underline;
margin: 0 0 3px 0;
border: 1px solid red;
color: white;
background: red url(admin/img/icon_alert.gif) 5px .3em no-repeat;
} }
.errorlist li a { td ul.errorlist li
color: white; {
text-decoration: underline; margin:0!important;
} }
td ul.errorlist { .errors
margin: 0 !important; {
padding: 0 !important; background:#ffc;
} }
td ul.errorlist li { .errors input,.errors select,.errors textarea
margin: 0 !important; {
border:1px solid red;
} }
.errors { div.system-message
background: #ffc; {
background:#ffc;
font-size:.8em;
margin:10px;
padding:6px 8px;
} }
.errors input, .errors select, .errors textarea { div.system-message p.system-message-title
border: 1px solid red; {
color:red;
background:#ffc url(admin/img/icon_error.gif) 5px .3em no-repeat;
margin:0;
padding:4px 5px 4px 25px;
} }
div.system-message { .description
background: #ffc; {
margin: 10px; font-size:12px;
padding: 6px 8px; padding:5px 0 0 12px;
font-size: .8em;
} }
div.system-message p.system-message-title { #state .content p
padding: 4px 5px 4px 25px; {
margin: 0; text-align:center;
color: red;
background: #ffc url(admin/img/icon_error.gif) 5px .3em no-repeat;
} }
.description { input.widebutton
font-size: 12px; {
padding: 5px 0 0 12px; font-size:25px;
line-height:1em;
text-align:left;
width:100%;
display:block;
cursor:pointer;
} }
#state .content p {
text-align: center; .icon-delete
{
background-image:url(/static/icons/Edit-delete-2.png);
background-repeat:no-repeat;
padding-left:26px!important;
} }
#state .content a img {
border: solid #072C61 2px; div#header a:link,div#header a:visited,div.box a:link,div.box a:visited
border-radius:10px; {
background-color: #fff; color:#fff;
padding: 3px;
} }
input.widebutton {
font-size:25px; div#header h1 a,#project_running ul a:link,#project_running ul a:visited,#project_closed ul a:link,#project_closed ul a:visited
line-height:1em; {
text-align:left; color:#fff;
width:400px; text-decoration:none;
display:block;
cursor:pointer;
} }
.icon-delete { ul.errorlist,td ul.errorlist
background-image: url(/static/icons/Edit-delete-2.png); {
background-repeat: no-repeat; margin:0!important;
padding-left: 26px!important; padding:0!important;
} }
#modal{
position: absolute;
width: 100%;
height: 100%;
}
#shadow{
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.6);
}
#modal-container{
width: 500px;
position: fixed;
left:50%;
top:50%;
margin-left: -270px;
margin-top: -100px;
min-height: 200px;
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
\ No newline at end of file
...@@ -6,6 +6,30 @@ ...@@ -6,6 +6,30 @@
<title>{% block title %}IK Cloud{% endblock %}</title> <title>{% block title %}IK Cloud{% endblock %}</title>
<link rel="stylesheet" href="/static/style.css" /> <link rel="stylesheet" href="/static/style.css" />
<link rel="icon" type="image/png" href="/static/favicon.png" /> <link rel="icon" type="image/png" href="/static/favicon.png" />
<link rel="icon" type="image/png" href="one/static/favicon.png">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('.wm').click(function(){
if($(this).children('.details').is(':hidden')){
$(this).children('.details')
.css('height',0)
.css('padding','0px 5px')
.show()
.animate({height:160,paddingTop:15,paddingBottom:15},700);
} else {
var that=this;
$(this).children('.details')
.css('height',130)
.css('padding','15px 5px')
.animate({height:0,paddingTop:0,paddingBottom:0},700,function(){
$(that).children('.details').hide();
});
}
})
})
</script>
{{ form.media }} {{ form.media }}
{% block js %}{% endblock %} {% block js %}{% endblock %}
......
...@@ -26,27 +26,91 @@ ...@@ -26,27 +26,91 @@
{% endfor %} {% endfor %}
</div> </div>
<div class="boxes"> <div class="boxes">
<div class="contentblock">
<h2>Adattár</h2>
<div class="content"> <div class="contentblock">
<ul> <h2>
<li>a.out <span class="file-size">4K</span> <span class="file-age">(5 perce)</span> <a href="" class="file-download">Letöltés</a></li> Adattár
<li>a.out <span class="file-size">4K</span> <span class="file-age">(5 perce)</span> <a href="" class="file-download">Letöltés</a></li> </h2>
<li class="file-details">Tovább</li> <div class="content">
<li class="file-upload">Fájl feltöltése</li> <ul class="file-list">
</ul> <li class="wm">
</div> <div class="summary">
</div> <div class="name filetype-c">hello.c</div>
<div class="contentblock" id="state"> <div class="actions">
<h2>A cluster állapota</h2> <a href="#"><img src="/static/icons/pencil.png" alt="rename" /></a>
<div class="content"> <a href="#"><img src="/static/icons/minus-circle.png" alt="delete" /></a>
<p> <a href="#"><img src="/static/icons/download-cloud.png" alt="download" /></a>
<a href="http://cloud.ik.bme.hu/"> </div>
<img src="/stat/cpu.png" alt="aktuális terhelés" /> <div class="info">1 Kb</div>
<img src="/stat/ram.png" alt="aktuális memóriafoglaltság" /> <div class="clear"></div>
</a> </div>
</p> <div class="details">
</div> <h3>Részletek</h3>
</div> <ul>
<li>Létrehozva: <span class="value">2012.12.29. 23:12</span></li>
<li>Módosítva: <span class="value">2012.12.29. 23:12</span></li>
<li>Hozzáférés: <span class="value">2012.12.29. 23:12</span></li>
<li>Típus: <span class="value">text/plain</span></li>
</ul>
</div>
</li>
<li class="wm">
<div class="summary">
<div class="name filetype-image">suna.jpg</div>
<div class="actions">
<a href="#"><img src="/static/icons/pencil.png" alt="rename" /></a>
<a href="#"><img src="/static/icons/minus-circle.png" alt="delete" /></a>
<a href="#"><img src="/static/icons/download-cloud.png" alt="download" /></a>
</div>
<div class="info">1 Kb</div>
<div class="clear"></div>
</div>
<div class="details">
<h3>Részletek</h3>
<ul>
<li>Létrehozva: <span class="value">2012.12.29. 23:12</span></li>
<li>Módosítva: <span class="value">2012.12.29. 23:12</span></li>
<li>Hozzáférés: <span class="value">2012.12.29. 23:12</span></li>
<li>Típus: <span class="value">image/jpg</span></li>
</ul>
</div>
</li>
<li class="wm">
<div class="summary">
<div class="name filetype-folder">poresz</div>
<div class="actions">
<a href="#"><img src="/static/icons/pencil.png" alt="rename" /></a>
<a href="#"><img src="/static/icons/minus-circle.png" alt="delete" /></a>
</div>
<div class="info">katalógus</div>
<div class="clear"></div>
</div>
<div class="details">
<h3>Részletek</h3>
<ul>
<li>Létrehozva: <span class="value">2012.12.29. 23:12</span></li>
<li>Módosítva: <span class="value">2012.12.29. 23:12</span></li>
<li>Hozzáférés: <span class="value">2012.12.29. 23:12</span></li>
<li>Fájlok: <span class="value">666 db</span></li>
</ul>
</div>
</li>
<li class="file-details wm">
<div class="summary">
<div class="name filetype-more">Mutasd a régebbi fájlokat!</div>
<div class="clear"></div>
</div>
</li>
<li class="file-upload wm">
<div class="summary">
<div class="name filetype-up">Fájlfeltöltés</div>
<div class="clear"></div>
</div>
</li>
</ul>
</div>
</div>
</div> </div>
{% endblock %} {% endblock %}
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