smart-home-engine 1.1.17 → 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-
|
|
1
|
+
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-sjamTHx3.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
package/dist/web/index.html
CHANGED
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
}
|
|
173
173
|
})();
|
|
174
174
|
</script>
|
|
175
|
-
<script type="module" crossorigin src="/assets/index-
|
|
175
|
+
<script type="module" crossorigin src="/assets/index-sjamTHx3.js"></script>
|
|
176
176
|
<link rel="modulepreload" crossorigin href="/assets/monaco-langs-BW2J83t5.js">
|
|
177
177
|
<link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
|
|
178
178
|
<link rel="stylesheet" crossorigin href="/assets/index-b3gdLMp3.css">
|
package/package.json
CHANGED
|
@@ -191,10 +191,24 @@ function serialise(conf) {
|
|
|
191
191
|
lines.push('');
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
// Passthrough (comments, blanks, unmanaged keys)
|
|
195
|
-
|
|
194
|
+
// Passthrough (comments, blanks, unmanaged keys) — strip leading blank lines
|
|
195
|
+
// to avoid a double-blank at the managed/passthrough boundary.
|
|
196
|
+
const trimmedPassthrough = [...passthrough];
|
|
197
|
+
while (trimmedPassthrough.length > 0 && trimmedPassthrough[0].trim() === '') {
|
|
198
|
+
trimmedPassthrough.shift();
|
|
199
|
+
}
|
|
200
|
+
for (const l of trimmedPassthrough) lines.push(l);
|
|
196
201
|
|
|
197
|
-
|
|
202
|
+
// Collapse runs of more than one consecutive blank line into a single blank line.
|
|
203
|
+
const result = [];
|
|
204
|
+
let prevBlank = false;
|
|
205
|
+
for (const line of lines) {
|
|
206
|
+
const isBlank = line.trim() === '';
|
|
207
|
+
if (isBlank && prevBlank) continue;
|
|
208
|
+
result.push(line);
|
|
209
|
+
prevBlank = isBlank;
|
|
210
|
+
}
|
|
211
|
+
return result.join('\n');
|
|
198
212
|
}
|
|
199
213
|
|
|
200
214
|
/**
|
package/src/web/broker-api.js
CHANGED
|
@@ -801,6 +801,15 @@ router.post('/wizard/bootstrap', async (req, res) => {
|
|
|
801
801
|
|
|
802
802
|
if (isRemote) {
|
|
803
803
|
// mosquitto_ctrl must run on the broker host — invoke it via SSH.
|
|
804
|
+
// Delete any existing file first: mosquitto_ctrl init refuses to overwrite
|
|
805
|
+
// an existing file, which would leave the old credentials in place while
|
|
806
|
+
// config.json now holds new ones, causing "not authorised" on reconnect.
|
|
807
|
+
try {
|
|
808
|
+
await sshDeploy.runCommand(bc.ssh, `sudo rm -f "${dynSecPath}"`);
|
|
809
|
+
_log?.debug(`broker: removed existing ${dynSecPath} on remote (if any)`);
|
|
810
|
+
} catch (e) {
|
|
811
|
+
_log?.warn(`broker: could not remove existing ${dynSecPath} on remote: ${e.message}`);
|
|
812
|
+
}
|
|
804
813
|
const ctrlCmd = `mosquitto_ctrl dynsec init "${dynSecPath}" "${username}" "${password}"`;
|
|
805
814
|
_log?.debug(`broker: SSH mosquitto_ctrl on ${bc.ssh.host}: mosquitto_ctrl dynsec init "${dynSecPath}" "${username}" ***`);
|
|
806
815
|
try {
|
|
@@ -831,6 +840,16 @@ router.post('/wizard/bootstrap', async (req, res) => {
|
|
|
831
840
|
_log?.warn(`broker: could not verify dynamic-security.json after init: ${e.message}`);
|
|
832
841
|
}
|
|
833
842
|
|
|
843
|
+
// Fix ownership and permissions: mosquitto_ctrl creates the file owned by the
|
|
844
|
+
// SSH user (typically mode 600). Mosquitto runs as the 'mosquitto' system user
|
|
845
|
+
// and must be able to read it. Chown to mosquitto:mosquitto and set 644.
|
|
846
|
+
try {
|
|
847
|
+
await sshDeploy.runCommand(bc.ssh, `sudo chown mosquitto:mosquitto "${dynSecPath}" && sudo chmod 644 "${dynSecPath}"`);
|
|
848
|
+
_log?.debug(`broker: fixed ownership and permissions on remote ${dynSecPath}`);
|
|
849
|
+
} catch (e) {
|
|
850
|
+
_log?.warn(`broker: could not chown/chmod remote ${dynSecPath}: ${e.message} — mosquitto may fail with 'File is not readable'`);
|
|
851
|
+
}
|
|
852
|
+
|
|
834
853
|
// Discover the full path to the .so on the remote host.
|
|
835
854
|
let soPath = 'mosquitto_dynamic_security.so'; // fallback: rely on LD_LIBRARY_PATH
|
|
836
855
|
try {
|
|
@@ -866,6 +885,13 @@ router.post('/wizard/bootstrap', async (req, res) => {
|
|
|
866
885
|
} else {
|
|
867
886
|
// Local mode: run mosquitto_ctrl on this host.
|
|
868
887
|
fs.mkdirSync(configDir, { recursive: true });
|
|
888
|
+
// Delete any existing file first so mosquitto_ctrl always writes fresh credentials.
|
|
889
|
+
try {
|
|
890
|
+
fs.rmSync(dynSecPath, { force: true });
|
|
891
|
+
_log?.debug(`broker: removed existing ${dynSecPath} on local host (if any)`);
|
|
892
|
+
} catch (e) {
|
|
893
|
+
_log?.warn(`broker: could not remove existing ${dynSecPath}: ${e.message}`);
|
|
894
|
+
}
|
|
869
895
|
_log?.debug(`broker: local mosquitto_ctrl dynsec init ${dynSecPath} ${username} ***`);
|
|
870
896
|
try {
|
|
871
897
|
const r = await execFileAsync('mosquitto_ctrl', ['dynsec', 'init', dynSecPath, username, password], { timeout: 10000 });
|
|
@@ -892,6 +918,22 @@ router.post('/wizard/bootstrap', async (req, res) => {
|
|
|
892
918
|
} catch (e) {
|
|
893
919
|
_log?.warn(`broker: could not verify dynamic-security.json after init: ${e.message}`);
|
|
894
920
|
}
|
|
921
|
+
|
|
922
|
+
// Fix ownership and permissions: mosquitto_ctrl creates the file owned by the
|
|
923
|
+
// current user. Mosquitto runs as the 'mosquitto' system user and needs read access.
|
|
924
|
+
try {
|
|
925
|
+
await execFileAsync('sudo', ['chown', 'mosquitto:mosquitto', dynSecPath], { timeout: 5000 });
|
|
926
|
+
_log?.debug(`broker: fixed ownership on local ${dynSecPath}`);
|
|
927
|
+
} catch (e) {
|
|
928
|
+
_log?.warn(`broker: could not chown local ${dynSecPath}: ${e.message}`);
|
|
929
|
+
}
|
|
930
|
+
try {
|
|
931
|
+
fs.chmodSync(dynSecPath, 0o644);
|
|
932
|
+
_log?.debug(`broker: fixed permissions on local ${dynSecPath}`);
|
|
933
|
+
} catch (e) {
|
|
934
|
+
_log?.warn(`broker: could not chmod local ${dynSecPath}: ${e.message}`);
|
|
935
|
+
}
|
|
936
|
+
|
|
895
937
|
let soPath = 'mosquitto_dynamic_security.so'; // fallback: rely on LD_LIBRARY_PATH
|
|
896
938
|
try {
|
|
897
939
|
const r2 = await execFileAsync('find', ['/usr', '/lib', '-maxdepth', '8', '-name', 'mosquitto_dynamic_security.so'], { timeout: 8000 });
|