diff --git a/agents/meshcore.js b/agents/meshcore.js
index 1aaadb36c6..96559aa268 100644
--- a/agents/meshcore.js
+++ b/agents/meshcore.js
@@ -654,22 +654,6 @@ var meshCoreObj = { action: 'coreinfo', value: (require('MeshAgent').coreHash ?
// Get the operating system description string
try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; meshCoreObjChanged(); }); } catch (ex) { }
-// Get Volumes and BitLocker if Windows
-try {
- if (process.platform == 'win32') {
- if (require('computer-identifiers').volumes_promise != null) {
- var p = require('computer-identifiers').volumes_promise();
- p.then(function (res) {
- meshCoreObj.volumes = res;
- meshCoreObjChanged();
- });
- } else if (require('computer-identifiers').volumes != null) {
- meshCoreObj.volumes = require('computer-identifiers').volumes();
- meshCoreObjChanged();
- }
- }
-} catch(e) { }
-
// Setup logged in user monitoring (THIS IS BROKEN IN WIN7)
try {
var userSession = require('user-sessions');
@@ -1959,28 +1943,24 @@ function getSystemInformation(func) {
results.hardware.network = { dns: require('os').dns() };
replaceSpacesWithUnderscoresRec(results);
var hasher = require('SHA384Stream').create();
- // results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
- // func(results);
-
// On Windows platforms, get volume information - Needs more testing.
if (process.platform == 'win32')
{
results.pendingReboot = require('win-info').pendingReboot(); // Pending reboot
-
if (require('computer-identifiers').volumes_promise != null)
{
var p = require('computer-identifiers').volumes_promise();
p.then(function (res)
{
- results.hardware.windows.volumes = res;
+ results.hardware.windows.volumes = cleanGetBitLockerVolumeInfo(res);
results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
func(results);
});
}
else if (require('computer-identifiers').volumes != null)
{
- results.hardware.windows.volumes = require('computer-identifiers').volumes();
+ results.hardware.windows.volumes = cleanGetBitLockerVolumeInfo(require('computer-identifiers').volumes());
results.hash = hasher.syncHash(JSON.stringify(results)).toString('hex');
func(results);
}
@@ -3801,7 +3781,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
if (require('os').dns != null) { availcommands += ',dnsinfo'; }
try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { }
if (process.platform == 'win32') {
- availcommands += ',cs,wpfhwacceleration,uac,volumes,rdpport';
+ availcommands += ',bitlocker,cs,wpfhwacceleration,uac,volumes,rdpport';
if (bcdOK()) { availcommands += ',safemode'; }
if (require('notifybar-desktop').DefaultPinned != null) { availcommands += ',privacybar'; }
try { require('win-utils'); availcommands += ',taskbar'; } catch (ex) { }
@@ -3962,6 +3942,17 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
case 'volumes':
response = JSON.stringify(require('win-volumes').getVolumes(), null, 1);
break;
+ case 'bitlocker':
+ if (process.platform == 'win32') {
+ if (require('computer-identifiers').volumes_promise != null) {
+ var p = require('computer-identifiers').volumes_promise();
+ p.then(function (res) { sendConsoleText(JSON.stringify(cleanGetBitLockerVolumeInfo(res), null, 1), this.session); });
+ response = "Please wait...";
+ } else if (require('computer-identifiers').volumes != null) {
+ sendConsoleText(JSON.stringify(cleanGetBitLockerVolumeInfo(require('computer-identifiers').volumes()), null, 1), this.session);
+ }
+ }
+ break;
case 'dhcp': // This command is only supported on Linux, this is because Linux does not give us the DNS suffix for each network adapter independently so we have to ask the DHCP server.
{
try { require('linux-dhcp'); } catch (ex) { response = 'Unknown command "dhcp", type "help" for list of available commands.'; break; }
@@ -5702,6 +5693,7 @@ function sendPeriodicServerUpdate(flags, force) {
});
} catch (ex) { }
}
+
// Get Defender for Windows Server
try {
var d = require('win-info').defender();
@@ -5709,20 +5701,7 @@ function sendPeriodicServerUpdate(flags, force) {
meshCoreObj.defender = res;
meshCoreObjChanged();
});
- } catch (ex){ }
- // Get Volumes and BitLocker if Windows
- try {
- if (require('computer-identifiers').volumes_promise != null){
- var p = require('computer-identifiers').volumes_promise();
- p.then(function (res){
- meshCoreObj.volumes = res;
- meshCoreObjChanged();
- });
- }else if (require('computer-identifiers').volumes != null){
- meshCoreObj.volumes = require('computer-identifiers').volumes();
- meshCoreObjChanged();
- }
- } catch(e) { }
+ } catch (ex) { }
}
// Send available data right now
@@ -5736,6 +5715,24 @@ function sendPeriodicServerUpdate(flags, force) {
}
}
+// Sort the names in an object
+function sortObject(obj) { return Object.keys(obj).sort().reduce(function(a, v) { a[v] = obj[v]; return a; }, {}); }
+
+// Fix the incoming data and cut down how much data we use
+function cleanGetBitLockerVolumeInfo(volumes) {
+ for (var i in volumes) {
+ const v = volumes[i];
+ if (typeof v.size == 'string') { v.size = parseInt(v.size); }
+ if (v.identifier == '') { delete v.identifier; }
+ if (v.name == '') { delete v.name; }
+ if (v.removable != true) { delete v.removable; }
+ if (v.protectionStatus == 'On') { v.protectionStatus = true; } else { delete v.protectionStatus; }
+ if (v.volumeStatus == 'FullyDecrypted') { delete v.volumeStatus; }
+ if (v.recoveryPassword == '') { delete v.recoveryPassword; }
+ }
+ return sortObject(volumes);
+}
+
// Once we are done collecting all the data, send to server if needed
var LastPeriodicServerUpdate = null;
var PeriodicServerUpdateNagleTimer = null;
diff --git a/meshagent.js b/meshagent.js
index e86cac079e..53a4ee0331 100644
--- a/meshagent.js
+++ b/meshagent.js
@@ -1940,21 +1940,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
// TODO: Check that the agent has an interface that is the same as the one we got this websocket connection on. Only set if we have a match.
}
- // Volumes and BitLocker
- if (command.volumes != null) {
- for (var i in command.volumes) {
- // Fix the incoming data and cut down how much data we use
- const v = command.volumes[i];
- if (typeof v.size == 'string') { v.size = parseInt(v.size); }
- if (v.recoveryPassword == '') { delete v.recoveryPassword; }
- if (v.identifier == '') { delete v.identifier; }
- if (v.name == '') { delete v.name; }
- if (v.removable != true) { delete v.removable; }
- if (v.protectionStatus == 'On') { v.protectionStatus = true; } else { delete v.protectionStatus; }
- if (v.volumeStatus == "FullyDecrypted") { delete v.volumeStatus; }
- }
- if (JSON.stringify(device.volumes) != JSON.stringify(command.volumes)) { device.volumes = command.volumes; change = 1; }
- }
+ // Remove old volumes and BitLocker data, this is part of sysinfo.
+ delete device.volumes;
// If there are changes, event the new device
if (change == 1) {
diff --git a/meshuser.js b/meshuser.js
index b06b5b6309..184a441f70 100644
--- a/meshuser.js
+++ b/meshuser.js
@@ -6273,6 +6273,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
delete doc.type;
delete doc.domain;
delete doc._id;
+
+ // If this is not a device group admin users, don't send any BitLocker recovery passwords
+ if ((rights != MESHRIGHT_ADMIN) && (doc.hardware) && (doc.hardware.windows) && (doc.hardware.windows.volumes)) {
+ for (var i in doc.hardware.windows.volumes) { delete doc.hardware.windows.volumes[i].recoveryPassword; }
+ }
+
if (command.nodeinfo === true) { doc.node = node; doc.rights = rights; }
obj.send(doc);
} else {
diff --git a/views/default.handlebars b/views/default.handlebars
index a22ffaefeb..c9492a66b9 100644
--- a/views/default.handlebars
+++ b/views/default.handlebars
@@ -7451,21 +7451,6 @@
x += addDeviceAttribute("Antivirus", y.join('
'));
}
- /*
- // Volumes and Bitlocker
- if (node.volumes){
- var bitlocker = [];
- for (var i in node.volumes) {
- if (typeof node.volumes[i].protectionStatus !== 'undefined' && node.volumes[i].protectionStatus == 'On'){
- bitlocker.push('
' + "Identifier" + '
' + EscapeHtml(currentNode.volumes[drive].identifier ? currentNode.volumes[drive].identifier : "Unknown") + '
'; - x += '' + "Recovery Password" + '
' + EscapeHtml(currentNode.volumes[drive].recoveryPassword ? currentNode.volumes[drive].recoveryPassword : "Unknown") + '
' + "Identifier" + '
' + (identifier ? decodeURIComponent(identifier) : "Unknown") + '
'; + x += '' + "Recovery Password" + '
' + (password ? decodeURIComponent(password) : "Unknown") + '