收紧邮件协议认证并加固环境文件

This commit is contained in:
xuans committed 2026-09-15 23:18:15 +08:00
1 parent 702b6ddf30
commit 574dff6937
7 files changed
+47 -17

No files matched your search

@@ -113,6 +113,16 @@ func TestSmailServiceUsesOnlyBindServiceCapability(t *testing.T) {
t.Fatalf("smail unit is missing %q", required)
}
}
usesEnvironmentFile := false
for _, line := range strings.Split(content, "\n") {
if strings.TrimSpace(line) == "EnvironmentFile=/etc/smail/smail.env" {
usesEnvironmentFile = true
break
}
}
if !usesEnvironmentFile {
t.Fatal("smail unit must define EnvironmentFile as a standalone directive")
}
if strings.Contains(content, "User=root") {
t.Fatal("smail unit must not run as root")
}