Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e75ea1fde2 | |||
| 416726dd51 | |||
| 522093e898 | |||
| 7b84a10420 |
@@ -1,3 +1,7 @@
|
|||||||
|
## v1.19.1
|
||||||
|
- fix: regex syntax error in docker discovery plugin
|
||||||
|
- fix: remove missing documentation files from Docker build context
|
||||||
|
|
||||||
## v1.19.0
|
## v1.19.0
|
||||||
- Added WebSocket endpoint for theta-agent C2
|
- Added WebSocket endpoint for theta-agent C2
|
||||||
|
|
||||||
|
|||||||
@@ -182,10 +182,8 @@ COPY tos.md /tos.md
|
|||||||
# without internet access. Same flattened-path convention as tos.md above.
|
# without internet access. Same flattened-path convention as tos.md above.
|
||||||
COPY README.md /README.md
|
COPY README.md /README.md
|
||||||
COPY CHANGELOG.md /CHANGELOG.md
|
COPY CHANGELOG.md /CHANGELOG.md
|
||||||
COPY DEPLOYMENT.md /DEPLOYMENT.md
|
|
||||||
COPY API.md /API.md
|
COPY API.md /API.md
|
||||||
COPY directory_spec.md /directory_spec.md
|
COPY directory_spec.md /directory_spec.md
|
||||||
COPY docs /docs
|
|
||||||
|
|
||||||
# Baked commit hash from the gitinfo stage (see build_info.js).
|
# Baked commit hash from the gitinfo stage (see build_info.js).
|
||||||
COPY --from=gitinfo /commit.txt ./.build_commit
|
COPY --from=gitinfo /commit.txt ./.build_commit
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ RUN mkdir -p /app/config
|
|||||||
COPY tos.md /tos.md
|
COPY tos.md /tos.md
|
||||||
COPY README.md /README.md
|
COPY README.md /README.md
|
||||||
COPY CHANGELOG.md /CHANGELOG.md
|
COPY CHANGELOG.md /CHANGELOG.md
|
||||||
COPY DEPLOYMENT.md /DEPLOYMENT.md
|
|
||||||
COPY API.md /API.md
|
COPY API.md /API.md
|
||||||
COPY directory_spec.md /directory_spec.md
|
COPY directory_spec.md /directory_spec.md
|
||||||
COPY docs /docs
|
|
||||||
|
|
||||||
# Seed script and utility
|
# Seed script and utility
|
||||||
COPY test_seed.js ./test_seed.js
|
COPY test_seed.js ./test_seed.js
|
||||||
|
|||||||
Binary file not shown.
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "t42-sso-manager",
|
"name": "t42-sso-manager",
|
||||||
"version": "1.19.0",
|
"version": "1.19.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "t42-sso-manager",
|
"name": "t42-sso-manager",
|
||||||
"version": "1.19.0",
|
"version": "1.19.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^7.3.0",
|
"@fortawesome/fontawesome-free": "^7.3.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "t42-sso-manager",
|
"name": "t42-sso-manager",
|
||||||
"version": "1.19.0",
|
"version": "1.19.1",
|
||||||
"description": "A very simple LDAP management and SSO system",
|
"description": "A very simple LDAP management and SSO system",
|
||||||
"author": [
|
"author": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ module.exports = {
|
|||||||
const edges = [];
|
const edges = [];
|
||||||
|
|
||||||
for (const c of containers) {
|
for (const c of containers) {
|
||||||
const name = c.Names && c.Names.length > 0 ? c.Names[0].replace(/^\\//, '') : c.Id.substring(0, 12);
|
const name = c.Names && c.Names.length > 0 ? c.Names[0].replace(/^\//, '') : c.Id.substring(0, 12);
|
||||||
const slug = `docker-cnt-${c.Id.substring(0, 12)}`;
|
const slug = `docker-cnt-${c.Id.substring(0, 12)}`;
|
||||||
|
|
||||||
const ports = (c.Ports || []).map(p => p.PublicPort ? `${p.PublicPort}:${p.PrivatePort}` : `${p.PrivatePort}`).join(', ');
|
const ports = (c.Ports || []).map(p => p.PublicPort ? `${p.PublicPort}:${p.PrivatePort}` : `${p.PrivatePort}`).join(', ');
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class DiscoveryReconciler {
|
|||||||
|
|
||||||
for (const res of resources) {
|
for (const res of resources) {
|
||||||
if (!res.metadata) res.metadata = {};
|
if (!res.metadata) res.metadata = {};
|
||||||
|
res._originalSlug = res.slug; // Keep track for edge mapping
|
||||||
|
|
||||||
let existing = null;
|
let existing = null;
|
||||||
|
|
||||||
@@ -94,10 +95,11 @@ class DiscoveryReconciler {
|
|||||||
metadata: mergedMeta,
|
metadata: mergedMeta,
|
||||||
updated_on: Math.floor(Date.now() / 1000)
|
updated_on: Math.floor(Date.now() / 1000)
|
||||||
});
|
});
|
||||||
|
res._actualId = existing.id;
|
||||||
} else {
|
} else {
|
||||||
// Create new
|
// Create new
|
||||||
const sources = [sourceName];
|
const sources = new Set([sourceName]);
|
||||||
res.metadata.discovery_sources = sources;
|
res.metadata.discovery_sources = [...sources];
|
||||||
res.metadata.last_seen = Date.now();
|
res.metadata.last_seen = Date.now();
|
||||||
|
|
||||||
const slug = res.slug || `${res.kind}-${crypto.randomBytes(4).toString('hex')}`;
|
const slug = res.slug || `${res.kind}-${crypto.randomBytes(4).toString('hex')}`;
|
||||||
@@ -112,12 +114,48 @@ class DiscoveryReconciler {
|
|||||||
});
|
});
|
||||||
|
|
||||||
newDevices++;
|
newDevices++;
|
||||||
|
res._actualId = created.id; // Map original slug to actual ID
|
||||||
WebhookEmitter.emit('discovery.new_device', created.toJSON());
|
WebhookEmitter.emit('discovery.new_device', created.toJSON());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can handle edges similarly if needed, but for simplicity we assume edges are managed elsewhere
|
// Now process edges
|
||||||
// or we just trust the plugins to give us explicit parent-child mappings by slug.
|
const allRes = await Resource.list();
|
||||||
|
const existingEdges = await ResourceEdge.list();
|
||||||
|
|
||||||
|
for (const edge of edges) {
|
||||||
|
// Find parent ID. It might be in the current payload (mapped to _actualId) or in DB by slug
|
||||||
|
let parentId = null;
|
||||||
|
const parentResInPayload = resources.find(r => r._originalSlug === edge.parentSlug);
|
||||||
|
if (parentResInPayload && parentResInPayload._actualId) {
|
||||||
|
parentId = parentResInPayload._actualId;
|
||||||
|
} else {
|
||||||
|
const parentResInDb = allRes.find(r => r.slug === edge.parentSlug);
|
||||||
|
if (parentResInDb) parentId = parentResInDb.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find child ID
|
||||||
|
let childId = null;
|
||||||
|
const childResInPayload = resources.find(r => r._originalSlug === edge.childSlug);
|
||||||
|
if (childResInPayload && childResInPayload._actualId) {
|
||||||
|
childId = childResInPayload._actualId;
|
||||||
|
} else {
|
||||||
|
const childResInDb = allRes.find(r => r.slug === edge.childSlug);
|
||||||
|
if (childResInDb) childId = childResInDb.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentId && childId) {
|
||||||
|
const edgeExists = existingEdges.find(e => e.parentId === parentId && e.childId === childId && e.relation === edge.relation);
|
||||||
|
if (!edgeExists) {
|
||||||
|
await ResourceEdge.create({
|
||||||
|
id: crypto.randomUUID(),
|
||||||
|
parentId,
|
||||||
|
childId,
|
||||||
|
relation: edge.relation
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (newDevices > 0) {
|
if (newDevices > 0) {
|
||||||
console.log(`[DiscoveryReconciler] Source ${sourceName} discovered ${newDevices} new devices.`);
|
console.log(`[DiscoveryReconciler] Source ${sourceName} discovered ${newDevices} new devices.`);
|
||||||
|
|||||||
Reference in New Issue
Block a user