Selected fixes, hardenings to Init
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/jquery.leanModal.min.js" ></script>
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/jquery.smartWizard-2.0.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/jquery.json.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="/Scripts/Swarmops-v5.js"></script>
|
||||
|
||||
<!-- fonts -->
|
||||
<link href='https://fonts.googleapis.com/css?family=Permanent+Marker' rel='stylesheet' type='text/css' />
|
||||
@@ -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 @@
|
||||
<p>The Swarmops install sequence can set up the database and users for you, if you provide a root password to the MySQL database server.</p>
|
||||
<p>(If you don't trust the Swarmops install to do that, that's fine, go to <a href="javascript:goManualCredentials();">manual account credentials</a>.)</p>
|
||||
<div class="entryLabelsAdmin" style="width:250px">Hostname of MySQL database server<br/>Root password for that MySQL server<br/>Random label (suffixed to db, user names)<br/> </div>
|
||||
<div class="entryFieldsAdmin"><input type="text" id="TextMysqlServerHost" value="localhost"/> <br/><input type="password" id="TextMysqlRootPassword"/> <br/><asp:TextBox runat="server" ID="TextRandomDbLabel" /> </div>
|
||||
<div class="entryFieldsAdmin"><input type="text" id="TextMysqlServerHost" value="localhost"/> <br/><input type="password" id="TextMysqlRootPassword"/> <br/><asp:TextBox runat="server" MaxLength="5" ID="TextRandomDbLabel" /> </div>
|
||||
</div>
|
||||
<div id="DivDatabaseManualConfig" style="display:none">
|
||||
<h2>Connect to existing database</h2>
|
||||
|
||||
@@ -115,6 +115,11 @@ namespace Swarmops.Frontend.Pages.v5.Public
|
||||
{
|
||||
random = random.Trim();
|
||||
|
||||
if (random.Length > 5) // if UI-enforced maxlength beaten somehow, limit here
|
||||
{
|
||||
random = random.Substring (0, 5); // MySQL will hit a maxlength otherwise
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty (random))
|
||||
{
|
||||
random = Authentication.CreateRandomPassword (5);
|
||||
@@ -670,9 +675,7 @@ namespace Swarmops.Frontend.Pages.v5.Public
|
||||
throw new InvalidOperationException ("Cannot run initialization processes again when initialized.");
|
||||
}
|
||||
|
||||
Person newPerson = Person.Create (HttpUtility.UrlDecode (name),
|
||||
HttpUtility.UrlDecode (mail),
|
||||
HttpUtility.UrlDecode (password), string.Empty, string.Empty, string.Empty,
|
||||
Person newPerson = Person.Create (name, mail, password, string.Empty, string.Empty, string.Empty,
|
||||
string.Empty, string.Empty, DateTime.MinValue, PersonGender.Unknown);
|
||||
|
||||
newPerson.AddParticipation (Organization.Sandbox, DateTime.MaxValue); // Add membership in Sandbox
|
||||
|
||||
Reference in New Issue
Block a user