Aide Configuration?

Any ideas how to configure this package?

https://search.nixos.org/packages?channel=22.05&show=aide&from=0&size=50&sort=relevance&type=packages&query=aide

I can install it, but, e.g.

    aide = {
      enable = true;
    };

does not work…

Hello,

You are trying to use it like a service, but it’s only a package

Try nix-shell -p aide, then if you want to schedule a job to run it every n day or hours, you need to write a systemd service.

Here is a skeleton ready to use for making such a service:

  systemd.timers.skeleton = {
    enable = true;
    timerConfig = {
      OnCalendar = "daily";
      Unit = "skeleton.service";
    };
    wantedBy = ["timers.target"];
  };

  systemd.services.skeleton = {
    enable = true;
    serviceConfig.Type = "oneshot";
    path = [ pkgs.aide ];
    script = ''
       # do your stuff with aide
    '';
  };

The value of OnCalendar is a systemd time.
Replace the three occurences of skeleton to what you want :slight_smile:

2 Likes

thanks! I will give it a shot!

I must be missing something simple! How do I setup the initial configuration file? (usually I’d do this in a nix file, but here, do I have to do something different?

This should be in your NixOS configuration file.

Yep, I was trying to sketch out in the shell first… I’ll appreciate any tips on a basic script to get me started! Thanks.

nix-shell -p aide?

Then, you need to figure what aide commands you want to run on a regular basis.

IIRC you need to create a database with checksums, and after you can run aide to check the files against the database. You may want to handle the database creation manually, and run the check in a systemd service.

1 Like