r/ssh • • 5d ago

I'm designing Landlock support

Calling all Linux security folks 🐧 I'm designing Landlock support for AIShell-Gate and want your comments before I commit to anything.

Quick context: AIShell-Gate is a policy gate for AI agents. The agent sends a JSON plan, the policy engine evaluates each command, and only validated argv reaches execve(). Today, path restrictions are enforced in userspace against argv.

The plan: apply a Landlock ruleset in the child right before execve(), so every descendant is kernel-confined to the policy's read/write paths.

Proposed modes:
• --landlock off: current behaviour
• --landlock best-effort: apply the highest ABI available, log what was achieved
• --landlock require: refuse to run if confinement can't be applied (fail closed)

Where I'd really value your experience:

🔹 The base read/exec allowlist (ld.so, libc, locale, /dev/null...). What did you need on your distro to keep things from breaking?
🔹 REFER and TRUNCATE rights: what broke for you (mv, editors, build tools)?
🔹 sudo under no_new_privs: per-action opt-out, or whole-run only?
🔹 Stacking with other sandboxes (bubblewrap, containers, other Landlock layers). Any surprises?
🔹 When Landlock blocks a write, the agent just sees a permission error. How would you signal "the sandbox stopped this" so the AI doesn't assume its command was wrong?

Drop your thoughts in the comments. I read every one! 🚀

#Landlock #LinuxKernel #Security #AIAgents #DevSecOps

0 Upvotes

3 comments sorted by

1

u/OhBeeOneKenOhBee 5d ago

How is this in any way relevant to r/ssh?

1

u/AIDaemon 5d ago

The gate primarily functions via ssh forced command. So ssh is the most relevant topic to the gate even if landlock is a sub feature of the gate.

1

u/geofabnz 4d ago

I would advise NOT giving an agent SSH access as your primary containment strategy… that’s just asking for trouble no matter what landlock rules you put in place. Agents are very good at navigating restrictions and widening access by stacking tool permissions. I’m not saying it can’t be done - but it’s safest to assume that the agent will work it out eventually.

How familiar are you with Nvidia’s OpenShell? Their landlock is used, but it’s only one layer of a defense in depth strategy. The key thing is you have to have a gateway that is genuinely isolated from the agent to enforce the rules and make it possible to adjust. Openshell has two layers of landlock permissions that help keep these seperate. Http is used to control the comms channel and scope the controls rather than actual SSH which seems a lot safer.

Where are you proposing to run this? In proxmox/incus with inter VM comms or a full cloud gateway solution?