Adding landlock support to Suricata

Eric Leblond <[email protected]> Wed, 3 Aug 2022 15:29:51 +0200
Newsgroups dev.linux.lists.landlock
Message-ID <CAGW2j+54_09ij9x2CUtYaWKz=k6ckHLY5un72=VVmeXuJxJoMQ@mail.gmail.com>
Hello,

I worked on implementing support for landlock in Suricata. Suricata is
an open source network threat
detection engine that reads packets from the network or files and
outputs analysis in other files.
As such it is a good candidate for Landlock sandboxing.

The MR on Suricata is here and feedbacks and reviews are welcome:
https://github.com/OISF/suricata/pull/7688

With regards to the usage of Landlock API, it was overall really fine
and it did not took me long to obtain something working.
I did although struggle with a few things (yes I'm a newbie here):
- I looked at first if I had to add a library to the build system
before realizing that up to date headers were enough
- The examples and documentation I found don't cover multiple calls to
setup a policy and it got me confused a bit:
  - I had to test to verify that the logic is create ruleset/add
multiple rules/enforce ruleset
- I did struggle a bit on the ruleset scope flags (handled_access_fs)
as it was not clear to me this was a choice of the sandbox software
implementation

It is just small things that are easy to fix in documentation, for the
rest it was really easy to implement (if you know the software you are
adding support to).

Thanks a lot for Landlock, this is a great feature that is easy to implement.

Best regards,
-- 
Eric Leblond, CTO
Stamus Networks: https://www.stamus-networks.com/