()
| 305 | } |
| 306 | |
| 307 | func (n *NFSServerSetup) assignAppendOnlyAttribute() error { |
| 308 | args := []string{n.nfsDir, "-type", "d", "-exec", "chattr", "+a", "{}", ";"} |
| 309 | if output, err := cmd.NewExecutor("", "find", args...).ExecuteOutput(); err != nil { |
| 310 | return fmt.Errorf("failed to chattr +a to %s -> %s -> %w", n.nfsDir, output, err) |
| 311 | } |
| 312 | |
| 313 | color.PrintHint("✔ apply append-only attribute (chattr +a) to %s", n.nfsDir) |
| 314 | return nil |
| 315 | } |
| 316 | |
| 317 | // installChattrCronJob installs a cron job that runs "find <nfs-dir> -type d -exec chattr +a" |
| 318 | // every minute, ensuring directories created by NFS clients are protected. |
no test coverage detected