mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
Merge pull request #771 from ZacharyZcR/fix/file-manager-auto-sudo
fix: auto-set sudo password in file manager from host config
This commit is contained in:
@@ -862,7 +862,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Resolve credentials server-side when frontend doesn't provide them
|
// Resolve credentials server-side when frontend doesn't provide them
|
||||||
let resolvedCredentials = { password, sshKey, keyPassword, authType };
|
let resolvedCredentials = { password, sshKey, keyPassword, authType, sudoPassword: undefined as string | undefined };
|
||||||
if (hostId && userId && !password && !sshKey) {
|
if (hostId && userId && !password && !sshKey) {
|
||||||
try {
|
try {
|
||||||
const { resolveHostById } = await import("./host-resolver.js");
|
const { resolveHostById } = await import("./host-resolver.js");
|
||||||
@@ -873,6 +873,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => {
|
|||||||
sshKey: resolvedHost.key,
|
sshKey: resolvedHost.key,
|
||||||
keyPassword: resolvedHost.keyPassword,
|
keyPassword: resolvedHost.keyPassword,
|
||||||
authType: resolvedHost.authType,
|
authType: resolvedHost.authType,
|
||||||
|
sudoPassword: resolvedHost.sudoPassword as string | undefined,
|
||||||
};
|
};
|
||||||
connectionLogs.push(
|
connectionLogs.push(
|
||||||
createConnectionLog(
|
createConnectionLog(
|
||||||
@@ -900,6 +901,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => {
|
|||||||
sshKey: resolvedHost.key,
|
sshKey: resolvedHost.key,
|
||||||
keyPassword: resolvedHost.keyPassword,
|
keyPassword: resolvedHost.keyPassword,
|
||||||
authType: resolvedHost.authType,
|
authType: resolvedHost.authType,
|
||||||
|
sudoPassword: resolvedHost.sudoPassword as string | undefined,
|
||||||
};
|
};
|
||||||
connectionLogs.push(
|
connectionLogs.push(
|
||||||
createConnectionLog(
|
createConnectionLog(
|
||||||
@@ -1194,6 +1196,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => {
|
|||||||
activeOperations: 0,
|
activeOperations: 0,
|
||||||
channelOpener: new ChannelOpenSerializer(),
|
channelOpener: new ChannelOpenSerializer(),
|
||||||
userId,
|
userId,
|
||||||
|
sudoPassword: resolvedCredentials.sudoPassword,
|
||||||
};
|
};
|
||||||
scheduleSessionCleanup(sessionId);
|
scheduleSessionCleanup(sessionId);
|
||||||
res.json({
|
res.json({
|
||||||
|
|||||||
Reference in New Issue
Block a user