From 6dc7473ab05d14d8c3e7a62a1d2b60600c7f7cc7 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sun, 8 May 2016 16:12:50 +0200 Subject: [PATCH] Use JSON Web Signature and Encryption (JWS & JWE) between webvirtcloud and gstfsd --- computes/forms.py | 11 ++++ .../migrations/0002_compute_gstfsd_key.py | 19 +++++++ computes/models.py | 1 + computes/templates/computes.html | 24 ++++++++ computes/templates/create_comp_block.html | 24 ++++++++ computes/views.py | 16 ++++-- conf/daemon/gstfsd | 45 ++++++++++++--- conf/requirements.txt | 1 + instances/views.py | 55 +++++++++++++------ 9 files changed, 166 insertions(+), 30 deletions(-) create mode 100644 computes/migrations/0002_compute_gstfsd_key.py diff --git a/computes/forms.py b/computes/forms.py index a626106..e08210f 100644 --- a/computes/forms.py +++ b/computes/forms.py @@ -13,6 +13,8 @@ class ComputeAddTcpForm(forms.Form): max_length=100) password = forms.CharField(error_messages={'required': _('No password has been entered')}, max_length=100) + gstfsd_key = forms.CharField(max_length=256, required=False) + def clean_name(self): name = self.cleaned_data['name'] @@ -49,6 +51,8 @@ class ComputeAddSshForm(forms.Form): max_length=100) login = forms.CharField(error_messages={'required': _('No login has been entered')}, max_length=20) + gstfsd_key = forms.CharField(max_length=256, required=False) + def clean_name(self): name = self.cleaned_data['name'] @@ -87,6 +91,8 @@ class ComputeAddTlsForm(forms.Form): max_length=100) password = forms.CharField(error_messages={'required': _('No password has been entered')}, max_length=100) + gstfsd_key = forms.CharField(max_length=256, required=False) + def clean_name(self): name = self.cleaned_data['name'] @@ -126,6 +132,8 @@ class ComputeEditHostForm(forms.Form): max_length=100) password = forms.CharField(max_length=100) + gstfsd_key = forms.CharField(max_length=256, required=False) + def clean_name(self): name = self.cleaned_data['name'] have_symbol = re.match('[^a-zA-Z0-9._-]+', name) @@ -150,6 +158,9 @@ class ComputeAddSocketForm(forms.Form): name = forms.CharField(error_messages={'required': _('No hostname has been entered')}, max_length=20) + gstfsd_key = forms.CharField(max_length=256, required=False) + + def clean_name(self): name = self.cleaned_data['name'] have_symbol = re.match('[^a-zA-Z0-9._-]+', name) diff --git a/computes/migrations/0002_compute_gstfsd_key.py b/computes/migrations/0002_compute_gstfsd_key.py new file mode 100644 index 0000000..f1c4deb --- /dev/null +++ b/computes/migrations/0002_compute_gstfsd_key.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('computes', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='compute', + name='gstfsd_key', + field=models.CharField(max_length=256, null=True, blank=True), + ), + ] diff --git a/computes/models.py b/computes/models.py index 6ee7de8..553f037 100644 --- a/computes/models.py +++ b/computes/models.py @@ -7,6 +7,7 @@ class Compute(models.Model): login = models.CharField(max_length=20) password = models.CharField(max_length=14, blank=True, null=True) type = models.IntegerField() + gstfsd_key = models.CharField(max_length=256, blank=True, null=True) def __unicode__(self): return self.hostname diff --git a/computes/templates/computes.html b/computes/templates/computes.html index 7c1c28f..70fec70 100644 --- a/computes/templates/computes.html +++ b/computes/templates/computes.html @@ -84,6 +84,12 @@ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+