New attempt with file system key
This commit is contained in:
@@ -104,6 +104,7 @@ if [ "$COPYFILES" == "yes" ]; then
|
||||
mkdir -p etc/swarmops
|
||||
mv $DEPLOYDIR/$TARGETDIR/machineKey.config etc/swarmops/.
|
||||
sed -i 's/\"machineKey.config\"/\"..\/..\/..\/..\/etc\/swarmops\/machineKey.config\"/g' $DEPLOYDIR/$TARGETDIR/web.config
|
||||
cat "UNINITIALIZED" > etc/swarmops/symmetricKey.config
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
/etc/swarmops/machineKey.config
|
||||
/etc/swarmops/symmetricKey.config
|
||||
/usr/share/swarmops/frontend/favicon.ico
|
||||
|
||||
@@ -18,6 +18,10 @@ chown www-data:www-data /etc/swarmops/machineKey.config
|
||||
|
||||
chown www-data:www-data /etc/swarmops/database.config
|
||||
|
||||
# make sure the web frontend (and its init) can write to symmetricKey.config
|
||||
|
||||
chown www-data:www-data /etc/swarmops/symmetricKey.config
|
||||
|
||||
# if we stopped Apache in preinst (1st install), restart it
|
||||
|
||||
if [ -e /tmp/swarmops-restart-apache.flag ]; then
|
||||
|
||||
@@ -602,7 +602,10 @@ namespace Swarmops.Logic.Security
|
||||
|
||||
if (File.Exists ("/etc/swarmops/symmetricKey.config"))
|
||||
{
|
||||
throw new InvalidOperationException("Can't overwrite encryption key - BAD BAD BAD code!");
|
||||
if (!File.ReadAllText ("/etc/swarmops/symmetricKey.config").StartsWith ("UNINIT"))
|
||||
{
|
||||
throw new InvalidOperationException ("Can't overwrite encryption key - BAD BAD BAD code!");
|
||||
}
|
||||
}
|
||||
|
||||
using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())
|
||||
|
||||
@@ -180,14 +180,17 @@ namespace Swarmops.Logic.Support
|
||||
|
||||
_cacheFileSystemSymmetricKey = new byte[32]; // return 256 bits all zero
|
||||
}
|
||||
else if (!File.Exists ("/etc/swarmops/symmetricKey.config"))
|
||||
{
|
||||
_cacheFileSystemSymmetricKey = Authentication.InitializeSymmetricFileSystemKey();
|
||||
}
|
||||
else
|
||||
{
|
||||
string keyString = File.ReadAllText ("/etc/swarmops/symmetricKey.config", Encoding.ASCII);
|
||||
_cacheFileSystemSymmetricKey = Convert.FromBase64String (keyString);
|
||||
if (keyString.StartsWith ("UNINIT"))
|
||||
{
|
||||
_cacheFileSystemSymmetricKey = Authentication.InitializeSymmetricFileSystemKey();
|
||||
}
|
||||
else
|
||||
{
|
||||
_cacheFileSystemSymmetricKey = Convert.FromBase64String(keyString);
|
||||
}
|
||||
}
|
||||
|
||||
return _cacheFileSystemSymmetricKey;
|
||||
|
||||
@@ -13,7 +13,7 @@ public partial class Default : PageV5Base
|
||||
PageIcon = "iconshock-steering-wheel";
|
||||
this.PageAccessRequired = new Access(AccessAspect.Null, AccessType.Read); // dummy security until there's something to show on Dashboard
|
||||
|
||||
// byte[] symmetricKey = SystemSettings.SymmetricEncryptionKeyFileSystem; // Access forces initialization if it's not there: remove by Alpha-12 // TODO
|
||||
byte[] symmetricKey = SystemSettings.SymmetricEncryptionKeyFileSystem; // Access forces initialization if it's not there: remove by Alpha-12 // TODO
|
||||
|
||||
/*
|
||||
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
|
||||
|
||||
Reference in New Issue
Block a user