From 6f0dca008968588a6065801a3646c07f583127f0 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 13 Mar 2016 11:36:03 +0100 Subject: [PATCH] Selected fixes, hardenings to Init --- Logic/Security/Authentication.cs | 2 +- Site5/Pages/v5/Public/Initialize.aspx | 30 +++++++++++++++--------- Site5/Pages/v5/Public/Initialize.aspx.cs | 9 ++++--- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Logic/Security/Authentication.cs b/Logic/Security/Authentication.cs index e407e249..b49070c3 100644 --- a/Logic/Security/Authentication.cs +++ b/Logic/Security/Authentication.cs @@ -595,7 +595,7 @@ namespace Swarmops.Logic.Security public static byte[] InitializeSymmetricFileSystemKey() { - if (Debugger.IsAttached && Path.DirectorySeparatorChar == '/') // check if we're debugging - double check to overdo security + if (Debugger.IsAttached && Path.DirectorySeparatorChar == '\\') // check if we're debugging - double check to overdo security { return new byte[32]; // can't write to /etc/swarmops in the debugger; return an all-zero key while debugging } diff --git a/Site5/Pages/v5/Public/Initialize.aspx b/Site5/Pages/v5/Public/Initialize.aspx index c84cf5a3..c543b6e3 100644 --- a/Site5/Pages/v5/Public/Initialize.aspx +++ b/Site5/Pages/v5/Public/Initialize.aspx @@ -11,6 +11,7 @@ + @@ -301,16 +302,19 @@ // If all is valid, create the first user. if (isValid) { - $.ajax({ - type: "POST", - url: "/Pages/v5/Public/Initialize.aspx/CreateFirstUser", - data: "{'name': '" + escape($('#<%=this.TextFirstUserName.ClientID %>').val()) + "', 'mail': '" + escape($('#<%=this.TextFirstUserMail.ClientID %>').val()) + "', 'password': '" + escape($('#<%=this.TextFirstUserPassword1.ClientID %>').val()) + "'}", - contentType: "application/json; charset=utf-8", - dataType: "json", - success: function (msg) { - // Don't care - } - }); + + var jsonDataFirstUser = { + name: $('#<%=this.TextFirstUserName.ClientID %>').val(), + mail: $('#<%=this.TextFirstUserMail.ClientID %>').val(), + password: $('#<%=this.TextFirstUserPassword1.ClientID %>').val() + } + + SwarmopsJS.ajaxCall("/Pages/v5/Public/Initialize.aspx/CreateFirstUser", + jsonDataFirstUser, + function () { + // To avoid a race condition, enable login/finish only when first user actually created + $('a.buttonFinish').removeClass("buttonDisabled"); + }); } } else if (stepNumber == 5) { @@ -322,6 +326,10 @@ return isValid; } + // Start by disabling Finish + + $('a.buttonFinish').addClass("buttonDisabled"); + }); // end of document.ready var disableNext = false; @@ -634,7 +642,7 @@

The Swarmops install sequence can set up the database and users for you, if you provide a root password to the MySQL database server.

(If you don't trust the Swarmops install to do that, that's fine, go to manual account credentials.)

Hostname of MySQL database server
Root password for that MySQL server
Random label (suffixed to db, user names)
 
-
 
 
 
+