Inspect before you load
Export human-readable pseudo filter code or BPF. Review the policy before applying it to a process.
Native CRuby bindings for libseccomp
Decide which system calls your Ruby process can make. Write the policy in Ruby. Let the Linux kernel enforce it.
Linux only. Ruby-friendly by design.
require "libseccomp"
filter = Seccomp.filter(default: :kill_process) do
no_new_privs true
allow :read, :write
allow :exit, :exit_group, :rt_sigreturn
deny :ptrace, errno: Errno::EPERM
end
puts filter.to_pfc
filter.close
Start with a readable filter DSL. Match individual arguments, inspect the generated policy, or work directly with the libseccomp API.
Compare file descriptors, flags, and other arguments. This rule returns EBADF when a process tries to close standard error.
filter.deny(
:close,
filter.arg(0).eq(2),
errno: Errno::EBADF
)
Explore argument filtering
Export human-readable pseudo filter code or BPF. Review the policy before applying it to a process.
Receive syscall notifications with Ruby IO waiting and timeouts. Respond through the user-notification API.
Use Seccomp::LowLevel for direct bindings. RBS signatures describe the public API; feature checks expose optional library support.
Use a Linux environment with CRuby, libseccomp development headers, and a C compiler.
Browse runnable examplesOn Debian or Ubuntu:
sudo apt-get install libseccomp-dev build-essential
gem "seccomp-ruby"
bundle install