Commit 19c976c1 by Danyi Bence

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

parents 41dcdfa8 4384f55d
...@@ -31,6 +31,8 @@ class Rule(models.Model): ...@@ -31,6 +31,8 @@ class Rule(models.Model):
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)])
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
def __unicode__(self): def __unicode__(self):
return self.desc() return self.desc()
...@@ -79,6 +81,8 @@ class Vlan(models.Model): ...@@ -79,6 +81,8 @@ class Vlan(models.Model):
comment = models.TextField(blank=True) comment = models.TextField(blank=True)
domain = models.TextField(blank=True, validators=[val_domain]) domain = models.TextField(blank=True, validators=[val_domain])
dhcp_pool = models.TextField(blank=True) dhcp_pool = models.TextField(blank=True)
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -100,6 +104,8 @@ class Vlan(models.Model): ...@@ -100,6 +104,8 @@ class Vlan(models.Model):
class Group(models.Model): class Group(models.Model):
name = models.CharField(max_length=20, unique=True) name = models.CharField(max_length=20, unique=True)
rules = models.ManyToManyField('Rule', symmetrical=False, blank=True, null=True) rules = models.ManyToManyField('Rule', symmetrical=False, blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
def __unicode__(self): def __unicode__(self):
return self.name return self.name
...@@ -107,6 +113,9 @@ class Group(models.Model): ...@@ -107,6 +113,9 @@ class Group(models.Model):
class Alias(models.Model): class Alias(models.Model):
host = models.ForeignKey('Host') host = models.ForeignKey('Host')
alias = models.CharField(max_length=40, unique=True, validators=[val_domain]) alias = models.CharField(max_length=40, unique=True, validators=[val_domain])
owner = models.ForeignKey(User, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
class Meta: class Meta:
verbose_name_plural = 'aliases' verbose_name_plural = 'aliases'
...@@ -125,6 +134,8 @@ class Host(models.Model): ...@@ -125,6 +134,8 @@ class Host(models.Model):
owner = models.ForeignKey(User) owner = models.ForeignKey(User)
groups = models.ManyToManyField('Group', symmetrical=False, blank=True, null=True) groups = models.ManyToManyField('Group', symmetrical=False, blank=True, null=True)
rules = models.ManyToManyField('Rule', symmetrical=False, blank=True, null=True) rules = models.ManyToManyField('Rule', symmetrical=False, blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
def __unicode__(self): def __unicode__(self):
return self.hostname return self.hostname
......
...@@ -49,4 +49,27 @@ cd cloud ...@@ -49,4 +49,27 @@ cd cloud
./manage.py loaddata /home/cloud/user.yaml 2>/dev/null || true ./manage.py loaddata /home/cloud/user.yaml 2>/dev/null || true
./manage.py loaddata /home/cloud/fw.yaml ./manage.py loaddata /home/cloud/fw.yaml
./manage.py loaddata /home/cloud/one.yaml ./manage.py loaddata /home/cloud/one.yaml
./manage.py loaddata /home/cloud/store.yaml
./manage.py update ./manage.py update
#Set up store server
rm -rf /var/www/*
mkdir -p /var/www
cd /opt/webadmin/cloud/miscellaneous/store-server/
LOCAL_IP=$(ip addr show dev eth0|grep inet|head -1|awk '{print $2}'|cut -d '/' -f 1)
cat <<EOF > store.config
[store]
#Default root folder (for download and upload)
root_www_folder = /var/www
#Deafult binary folder (for executables)
root_bin_folder = /opt/webadmin/cloud/miscellaneous/store-server/
#Site host (for standalone server)
site_host = 0.0.0.0
#Site port (for standalone server)
site_port = 9000
#Site url (for download and upload links) %(variable)formatter ex: %(port)s
site_url = http://${LOCAL_IP}:%(site_port)s
#User manager script (add, del, set, update)
user_manager = FAKEUserManager.sh
EOF
sudo /opt/webadmin/cloud/miscellaneous/store-server/CloudStore.py >/dev/null 2>&1 &
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
is_superuser: true is_superuser: true
last_login: 2013-01-22 15:21:22+00:00 last_login: 2013-01-22 15:21:22+00:00
last_name: '' last_name: ''
password: pbkdf2_sha256$10000$gx04X6OpW8kW$iCU3cuhqQcvq7I8tRVkrnES03ty/3vqN8ou4xZgfPBQ= password: pbkdf2_sha256$10000$tHbyy0OTBCBQ$YVdhrXZVK6wi7Px/zX5zmpOGkQUnddXXdrwNFnJskx0=
user_permissions: [] user_permissions: []
username: test username: test
model: auth.user model: auth.user
......
...@@ -11,7 +11,7 @@ from pwd import getpwnam ...@@ -11,7 +11,7 @@ from pwd import getpwnam
#Get configuration file #Get configuration file
config = ConfigParser.ConfigParser() config = ConfigParser.ConfigParser()
config.read('store.config') config.read('/opt/webadmin/cloud/miscellaneous/store-server/store.config')
#ROOT_WWW_FOLDER='/var/www' #ROOT_WWW_FOLDER='/var/www'
......
...@@ -20,23 +20,23 @@ class StoreApi: ...@@ -20,23 +20,23 @@ class StoreApi:
headers = {'content-type': 'application/json'} headers = {'content-type': 'application/json'}
if settings['ssl_auth'] == 'True' and settings['basic_auth'] == 'True': if settings['ssl_auth'] == 'True' and settings['basic_auth'] == 'True':
r = requests.post(url, data=payload, headers=headers, \ r = requests.post(url, data=payload, headers=headers, \
verify = settings['verify_ssl'], \ verify = settings['verify_ssl']=='True', \
cert=(settings['store_client_cert'], settings['store_client_key']), \ cert=(settings['store_client_cert'], settings['store_client_key']), \
auth=(settings['store_client_user'], settings['store_client_pass']) auth=(settings['store_client_user'], settings['store_client_pass'])
) )
elif settings['ssl_auth'] == 'True': elif settings['ssl_auth'] == 'True':
r = requests.post(url, data=payload, headers=headers, \ r = requests.post(url, data=payload, headers=headers, \
verify = settings['verify_ssl'], \ verify = settings['verify_ssl']=='True', \
cert=(settings['store_client_cert'], settings['store_client_key']) \ cert=(settings['store_client_cert'], settings['store_client_key']) \
) )
elif settings['basic_auth'] == 'True': elif settings['basic_auth'] == 'True':
r = requests.post(url, data=payload, headers=headers, \ r = requests.post(url, data=payload, headers=headers, \
verify = settings['verify_ssl'], \ verify = settings['verify_ssl']=='True', \
auth=(settings['store_client_user'], settings['store_client_pass']) \ auth=(settings['store_client_user'], settings['store_client_pass']) \
) )
else: else:
r = requests.post(url, data=payload, headers=headers, \ r = requests.post(url, data=payload, headers=headers, \
verify = settings['verify_ssl'] \ verify = settings['verify_ssl']=='True' \
) )
return r return r
@staticmethod @staticmethod
...@@ -44,23 +44,23 @@ class StoreApi: ...@@ -44,23 +44,23 @@ class StoreApi:
headers = {'content-type': 'application/json'} headers = {'content-type': 'application/json'}
if settings['ssl_auth'] == 'True' and settings['basic_auth'] == 'True': if settings['ssl_auth'] == 'True' and settings['basic_auth'] == 'True':
r = requests.get(url, headers=headers, \ r = requests.get(url, headers=headers, \
verify = settings['verify_ssl'], \ verify = settings['verify_ssl']=='True', \
cert=(settings['store_client_cert'], settings['store_client_key']), \ cert=(settings['store_client_cert'], settings['store_client_key']), \
auth=(settings['store_client_user'], settings['store_client_pass']) auth=(settings['store_client_user'], settings['store_client_pass'])
) )
elif settings['ssl_auth'] == 'True': elif settings['ssl_auth'] == 'True':
r = requests.get(url, headers=headers, \ r = requests.get(url, headers=headers, \
verify = settings['verify_ssl'], \ verify = settings['verify_ssl']=='True', \
cert=(settings['store_client_cert'], settings['store_client_key']) \ cert=(settings['store_client_cert'], settings['store_client_key']) \
) )
elif settings['basic_auth'] == 'True': elif settings['basic_auth'] == 'True':
r = requests.get(url, headers=headers, \ r = requests.get(url, headers=headers, \
verify = settings['verify_ssl'], \ verify = settings['verify_ssl']=='True', \
auth=(settings['store_client_user'], settings['store_client_pass']) \ auth=(settings['store_client_user'], settings['store_client_pass']) \
) )
else: else:
r = requests.get(url, headers=headers, \ r = requests.get(url, headers=headers, \
verify = settings['verify_ssl'] \ verify = settings['verify_ssl']=='True' \
) )
return r return r
@staticmethod @staticmethod
......
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