Refactor SecurityAudit component: remove unused root login security check and related UI elements to streamline the code and improve readability.

This commit is contained in:
Mauricio Siu 2025-03-29 15:04:33 -06:00
parent 17a859d26d
commit 7a6e1dbc1b

View File

@ -25,21 +25,6 @@ export const SecurityAudit = ({ serverId }: Props) => {
enabled: !!serverId,
},
);
const _utils = api.useUtils();
// Helper function to check if root login is securely configured
const isRootLoginSecure = () => {
if (!data?.ssh?.permitRootLogin) return false;
// These are secure options for PermitRootLogin
const secureOptions = [
"no",
"prohibit-password",
"without-password",
"forced-commands-only",
];
return secureOptions.includes(data.ssh.permitRootLogin);
};
return (
<CardContent className="p-0">
@ -162,15 +147,6 @@ export const SecurityAudit = ({ serverId }: Props) => {
: "Enabled (Password Authentication should be disabled)"
}
/>
<StatusRow
label="Root Login"
isEnabled={isRootLoginSecure()}
description={
isRootLoginSecure()
? `${data?.ssh?.permitRootLogin} (Secure)`
: `${data?.ssh?.permitRootLogin || "yes"} (Should be set to 'prohibit-password' or 'no')`
}
/>
<StatusRow
label="Use PAM"
isEnabled={data?.ssh?.usePam === "no"}