mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
avoid logging secrets in smb backend
This commit is contained in:
committed by
Nicolas Meienberger
parent
2df1fa53a0
commit
1fe026a76f
@@ -37,9 +37,8 @@ const mount = async (config: BackendConfig, path: string) => {
|
|||||||
const password = await cryptoUtils.decrypt(config.password);
|
const password = await cryptoUtils.decrypt(config.password);
|
||||||
|
|
||||||
const source = `//${config.server}/${config.share}`;
|
const source = `//${config.server}/${config.share}`;
|
||||||
const options = [
|
const baseOptions = [
|
||||||
`user=${config.username}`,
|
`user=${config.username}`,
|
||||||
`pass=${password}`,
|
|
||||||
`vers=${config.vers}`,
|
`vers=${config.vers}`,
|
||||||
`port=${config.port}`,
|
`port=${config.port}`,
|
||||||
"uid=1000",
|
"uid=1000",
|
||||||
@@ -47,18 +46,22 @@ const mount = async (config: BackendConfig, path: string) => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (config.domain) {
|
if (config.domain) {
|
||||||
options.push(`domain=${config.domain}`);
|
baseOptions.push(`domain=${config.domain}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.readOnly) {
|
if (config.readOnly) {
|
||||||
options.push("ro");
|
baseOptions.push("ro");
|
||||||
}
|
}
|
||||||
|
|
||||||
const args = ["-t", "cifs", "-o", options.join(","), source, path];
|
const baseArgs = ["-t", "cifs", "-o"];
|
||||||
|
|
||||||
logger.debug(`Mounting SMB volume ${path}...`);
|
logger.debug(`Mounting SMB volume ${path}...`);
|
||||||
logger.info(`Executing mount: mount ${args.join(" ")}`);
|
const safeOptions = [...baseOptions, "pass=***"];
|
||||||
|
const safeArgs = [...baseArgs, safeOptions.join(","), source, path];
|
||||||
|
logger.info(`Executing mount: mount ${safeArgs.join(" ")}`);
|
||||||
|
|
||||||
|
const options = [...baseOptions, `pass=${password}`];
|
||||||
|
const args = [...baseArgs, options.join(","), source, path];
|
||||||
await executeMount(args);
|
await executeMount(args);
|
||||||
|
|
||||||
logger.info(`SMB volume at ${path} mounted successfully.`);
|
logger.info(`SMB volume at ${path} mounted successfully.`);
|
||||||
|
|||||||
Reference in New Issue
Block a user