import { describe, expect, it } from "vitest"; import { sshdHinweise } from "@/lib/sshd-hinweise"; describe("sshd-Hinweise (#010)", () => { it("empfiehlt prohibit-password, wenn root per Passwort darf", () => { expect(sshdHinweise({ permitRootLogin: "yes" })[0]).toMatchObject({ stufe: "warnung" }); expect(sshdHinweise({ permitRootLogin: "without-password" })).toEqual([]); }); it("warnt, wenn sshd authorized_keys gar nicht liest", () => { expect(sshdHinweise({ authorizedKeysFile: ".ssh/authorized_keys .ssh/authorized_keys2" })).toEqual([]); expect(sshdHinweise({ authorizedKeysFile: "/etc/ssh/keys/%u" })[0]).toMatchObject({ stufe: "gefahr" }); }); it("kommt mit fehlenden Angaben zurecht", () => { expect(sshdHinweise(null)).toEqual([]); expect(sshdHinweise({})).toEqual([]); }); });