mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-02 00:36:38 +00:00
Move up figerprint so it happens before block
This commit is contained in:
@@ -45,6 +45,71 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fingerprint) {
|
||||||
|
const [existingFingerprint] = await db
|
||||||
|
.select()
|
||||||
|
.from(fingerprints)
|
||||||
|
.where(eq(fingerprints.olmId, olm.olmId))
|
||||||
|
.limit(1);
|
||||||
|
|
||||||
|
if (!existingFingerprint) {
|
||||||
|
await db.insert(fingerprints).values({
|
||||||
|
olmId: olm.olmId,
|
||||||
|
firstSeen: now,
|
||||||
|
lastSeen: now,
|
||||||
|
|
||||||
|
username: fingerprint.username,
|
||||||
|
hostname: fingerprint.hostname,
|
||||||
|
platform: fingerprint.platform,
|
||||||
|
osVersion: fingerprint.osVersion,
|
||||||
|
kernelVersion: fingerprint.kernelVersion,
|
||||||
|
arch: fingerprint.arch,
|
||||||
|
deviceModel: fingerprint.deviceModel,
|
||||||
|
serialNumber: fingerprint.serialNumber,
|
||||||
|
platformFingerprint: fingerprint.platformFingerprint
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await db
|
||||||
|
.update(fingerprints)
|
||||||
|
.set({
|
||||||
|
lastSeen: now,
|
||||||
|
username: fingerprint.username,
|
||||||
|
hostname: fingerprint.hostname,
|
||||||
|
platform: fingerprint.platform,
|
||||||
|
osVersion: fingerprint.osVersion,
|
||||||
|
kernelVersion: fingerprint.kernelVersion,
|
||||||
|
arch: fingerprint.arch,
|
||||||
|
deviceModel: fingerprint.deviceModel,
|
||||||
|
serialNumber: fingerprint.serialNumber,
|
||||||
|
platformFingerprint: fingerprint.platformFingerprint
|
||||||
|
})
|
||||||
|
.where(eq(fingerprints.olmId, olm.olmId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (postures) {
|
||||||
|
await db.insert(clientPostureSnapshots).values({
|
||||||
|
clientId: olm.clientId,
|
||||||
|
|
||||||
|
biometricsEnabled: postures?.biometricsEnabled,
|
||||||
|
diskEncrypted: postures?.diskEncrypted,
|
||||||
|
firewallEnabled: postures?.firewallEnabled,
|
||||||
|
autoUpdatesEnabled: postures?.autoUpdatesEnabled,
|
||||||
|
tpmAvailable: postures?.tpmAvailable,
|
||||||
|
|
||||||
|
windowsDefenderEnabled: postures?.windowsDefenderEnabled,
|
||||||
|
|
||||||
|
macosSipEnabled: postures?.macosSipEnabled,
|
||||||
|
macosGatekeeperEnabled: postures?.macosGatekeeperEnabled,
|
||||||
|
macosFirewallStealthMode: postures?.macosFirewallStealthMode,
|
||||||
|
|
||||||
|
linuxAppArmorEnabled: postures?.linuxAppArmorEnabled,
|
||||||
|
linuxSELinuxEnabled: postures?.linuxSELinuxEnabled,
|
||||||
|
|
||||||
|
collectedAt: now
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const [client] = await db
|
const [client] = await db
|
||||||
.select()
|
.select()
|
||||||
.from(clients)
|
.from(clients)
|
||||||
@@ -243,72 +308,6 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
relay
|
relay
|
||||||
);
|
);
|
||||||
|
|
||||||
if (fingerprint) {
|
|
||||||
const [existingFingerprint] = await db
|
|
||||||
.select()
|
|
||||||
.from(fingerprints)
|
|
||||||
.where(eq(fingerprints.olmId, olm.olmId))
|
|
||||||
.limit(1);
|
|
||||||
|
|
||||||
if (!existingFingerprint) {
|
|
||||||
await db.insert(fingerprints).values({
|
|
||||||
olmId: olm.olmId,
|
|
||||||
firstSeen: now,
|
|
||||||
lastSeen: now,
|
|
||||||
|
|
||||||
username: fingerprint.username,
|
|
||||||
hostname: fingerprint.hostname,
|
|
||||||
platform: fingerprint.platform,
|
|
||||||
osVersion: fingerprint.osVersion,
|
|
||||||
kernelVersion: fingerprint.kernelVersion,
|
|
||||||
arch: fingerprint.arch,
|
|
||||||
deviceModel: fingerprint.deviceModel,
|
|
||||||
serialNumber: fingerprint.serialNumber,
|
|
||||||
platformFingerprint: fingerprint.platformFingerprint
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await db
|
|
||||||
.update(fingerprints)
|
|
||||||
.set({
|
|
||||||
lastSeen: now,
|
|
||||||
|
|
||||||
username: fingerprint.username,
|
|
||||||
hostname: fingerprint.hostname,
|
|
||||||
platform: fingerprint.platform,
|
|
||||||
osVersion: fingerprint.osVersion,
|
|
||||||
kernelVersion: fingerprint.kernelVersion,
|
|
||||||
arch: fingerprint.arch,
|
|
||||||
deviceModel: fingerprint.deviceModel,
|
|
||||||
serialNumber: fingerprint.serialNumber,
|
|
||||||
platformFingerprint: fingerprint.platformFingerprint
|
|
||||||
})
|
|
||||||
.where(eq(fingerprints.olmId, olm.olmId));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (postures && olm.clientId) {
|
|
||||||
await db.insert(clientPostureSnapshots).values({
|
|
||||||
clientId: olm.clientId,
|
|
||||||
|
|
||||||
biometricsEnabled: postures?.biometricsEnabled,
|
|
||||||
diskEncrypted: postures?.diskEncrypted,
|
|
||||||
firewallEnabled: postures?.firewallEnabled,
|
|
||||||
autoUpdatesEnabled: postures?.autoUpdatesEnabled,
|
|
||||||
tpmAvailable: postures?.tpmAvailable,
|
|
||||||
|
|
||||||
windowsDefenderEnabled: postures?.windowsDefenderEnabled,
|
|
||||||
|
|
||||||
macosSipEnabled: postures?.macosSipEnabled,
|
|
||||||
macosGatekeeperEnabled: postures?.macosGatekeeperEnabled,
|
|
||||||
macosFirewallStealthMode: postures?.macosFirewallStealthMode,
|
|
||||||
|
|
||||||
linuxAppArmorEnabled: postures?.linuxAppArmorEnabled,
|
|
||||||
linuxSELinuxEnabled: postures?.linuxSELinuxEnabled,
|
|
||||||
|
|
||||||
collectedAt: now
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// REMOVED THIS SO IT CREATES THE INTERFACE AND JUST WAITS FOR THE SITES
|
// REMOVED THIS SO IT CREATES THE INTERFACE AND JUST WAITS FOR THE SITES
|
||||||
// if (siteConfigurations.length === 0) {
|
// if (siteConfigurations.length === 0) {
|
||||||
// logger.warn("No valid site configurations found");
|
// logger.warn("No valid site configurations found");
|
||||||
|
|||||||
Reference in New Issue
Block a user