nextcloud: make the mesh's own account match its secret when Nextcloud refuses it, and back off a refusal that stays (issue 1253)
The image creates NEXTCLOUD_ADMIN_USER only on a fresh install. novox's instance was installed before the mesh adopted it, so mesh-admin was never created there, and the shares poll asked Nextcloud every minute with a login that cannot pass: 401, then Nextcloud's brute-force throttle (429), which also held the backup before a delivery. On a refused login the client now adds the account through occ (admin group), or sets its password to the module's own secret, passing it by OC_PASS so it is on no argv, and asks once more. A refusal that stays is said once and the poll backs off from 5 minutes to an hour instead of nine lines of XML every minute. An empty setting no longer becomes an empty name.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// existing user and share as freshly created.
|
||||
|
||||
import { emit } from "@novox/mesh-sdk/events";
|
||||
import { NextcloudClient } from "./client.js";
|
||||
import { Backoff, NextcloudClient, pollSharesGuarded } from "./client.js";
|
||||
|
||||
// Constructed lazily so an unconfigured node (no admin password) loads this entrypoint without
|
||||
// crashing the events host — it simply watches nothing.
|
||||
@@ -69,7 +69,11 @@ if (nextcloud) {
|
||||
run();
|
||||
};
|
||||
tick(pollUsers);
|
||||
tick(pollShares);
|
||||
// A refused login is said once and the shares are left alone for 5 minutes, doubling to an hour,
|
||||
// instead of a refusal every minute that Nextcloud's brute-force protection then throttles
|
||||
// (novox/hq issue 1253).
|
||||
const sharesBackoff = new Backoff(5 * 60_000, 60 * 60_000);
|
||||
tick((c) => pollSharesGuarded(c, sharesBackoff, pollShares));
|
||||
tick(applyOnlyOffice);
|
||||
console.log("[nextcloud] watching users, shares and onlyoffice settings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user