mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-09-14 11:06:15 +05:00
fix: require TLS for FTP backup destinations
This commit is contained in:
parent
e82554c5ed
commit
6faf01ec3c
@ -64,6 +64,7 @@ const validateDestination = (
|
||||
accessKey?: string;
|
||||
region?: string;
|
||||
endpoint?: string;
|
||||
additionalFlags?: string[];
|
||||
},
|
||||
ctx: z.RefinementCtx,
|
||||
) => {
|
||||
@ -108,6 +109,33 @@ const validateDestination = (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.provider === RCLONE_DESTINATION_PROVIDERS.FTP) {
|
||||
const flags = data.additionalFlags ?? [];
|
||||
const implicitTlsEnabled =
|
||||
(flags.includes("--ftp-tls") || flags.includes("--ftp-tls=true")) &&
|
||||
!flags.includes("--ftp-tls=false");
|
||||
const explicitTlsEnabled =
|
||||
(flags.includes("--ftp-explicit-tls") ||
|
||||
flags.includes("--ftp-explicit-tls=true")) &&
|
||||
!flags.includes("--ftp-explicit-tls=false");
|
||||
|
||||
if (!implicitTlsEnabled && !explicitTlsEnabled) {
|
||||
ctx.addIssue({
|
||||
code: "custom",
|
||||
path: ["additionalFlags"],
|
||||
message:
|
||||
"FTP destinations must use TLS. Add --ftp-explicit-tls for port 21 or --ftp-tls for implicit FTPS (usually port 990).",
|
||||
});
|
||||
}
|
||||
if (implicitTlsEnabled && explicitTlsEnabled) {
|
||||
ctx.addIssue({
|
||||
code: "custom",
|
||||
path: ["additionalFlags"],
|
||||
message: "Choose either implicit FTPS or explicit FTPS, not both.",
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const apiCreateDestination = createSchema
|
||||
|
||||
Loading…
Reference in New Issue
Block a user