rbsyd: Ruby FFI bindings of libsyd, the syd API C Library
!/usr/bin/env ruby frozen_string_literal: true
Syd: rock-solid application kernel
lib/src/syd.rb: Ruby FFI bindings of libsyd, the syd API C Library
Copyright © 2023, 2024, 2025 Ali Polatel <alip@chesswob.org>
SPDX-License-Identifier: LGPL-3.0
Top Level Namespace
Defined Under Namespace
Modules: Syd
Module: Syd
- Extended by:
- FFI::Library
- Defined in:
- syd.rb
Overview
Ruby FFI bindings of libsyd, the syd API C Library
Constant Summary collapse
- LOCK_OFF =
LOCK_OFF: The sandbox lock is off, allowing all sandbox commands. This state means that there are no restrictions on sandbox commands, providing full access to sandbox functionalities.
0
- LOCK_EXEC =
LOCK_EXEC: The sandbox lock is set to on for all processes except the initial process (syd exec child). This is the default state. In this state, the sandbox is locked for all new processes except for the initial process that executed the syd command. This provides a balance between security and functionality, allowing the initial process some level of control while restricting others.
1
- LOCK_ON =
LOCK_ON: The sandbox lock is on, disallowing all sandbox commands. This state imposes a complete lock down on the sandbox, preventing any sandbox commands from being executed. This is the most restrictive state, ensuring maximum security.
2
- ACTION_ALLOW =
Allow system call.
0
- ACTION_WARN =
Allow system call and warn.
1
- ACTION_FILTER =
Deny system call silently.
2
- ACTION_DENY =
Deny system call and warn.
3
- ACTION_PANIC =
Deny system call, warn and panic the current Syd thread.
4
- ACTION_STOP =
Deny system call, warn and stop offending process.
5
- ACTION_ABORT =
Deny system call, warn and abort offending process.
6
- ACTION_KILL =
Deny system call, warn and kill offending process.
7
- ACTION_EXIT =
Warn, and exit Syd immediately with deny errno as exit value.
8
Class Method Summary collapse
-
.api ⇒ Integer
Performs a syd API check by calling the ‘syd_api’ function from the ‘syd’ library.
-
.chattr_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chattr sandboxing.
-
.chattr_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chattr sandboxing.
-
.chattr_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chattr sandboxing.
-
.chdir_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chdir sandboxing.
-
.chdir_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chdir sandboxing.
-
.chdir_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chdir sandboxing.
-
.check ⇒ TrueClass
Performs a check by calling the ‘syd_check’ function from the ‘syd’ library.
-
.check_action(action) ⇒ Object
Helper method to check if the action is valid.
-
.check_return(r) ⇒ Object
Helper method to process return values from libsyd calls.
-
.chgrp_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chgrp sandboxing.
-
.chgrp_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chgrp sandboxing.
-
.chgrp_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chgrp sandboxing.
-
.chmod_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chmod sandboxing.
-
.chmod_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chmod sandboxing.
-
.chmod_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chmod sandboxing.
-
.chown_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chown sandboxing.
-
.chown_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chown sandboxing.
-
.chown_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chown sandboxing.
-
.chroot_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chroot sandboxing.
-
.chroot_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chroot sandboxing.
-
.chroot_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chroot sandboxing.
-
.create_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for create sandboxing.
-
.create_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for create sandboxing.
-
.create_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for create sandboxing.
-
.default_block(action) ⇒ TrueClass
Set default action for block sandboxing.
-
.default_chattr(action) ⇒ TrueClass
Set default action for chattr sandboxing.
-
.default_chdir(action) ⇒ TrueClass
Set default action for chdir sandboxing.
-
.default_chgrp(action) ⇒ TrueClass
Set default action for chgrp sandboxing.
-
.default_chmod(action) ⇒ TrueClass
Set default action for chmod sandboxing.
-
.default_chown(action) ⇒ TrueClass
Set default action for chown sandboxing.
-
.default_chroot(action) ⇒ TrueClass
Set default action for chroot sandboxing.
-
.default_create(action) ⇒ TrueClass
Set default action for create sandboxing.
-
.default_delete(action) ⇒ TrueClass
Set default action for delete sandboxing.
-
.default_exec(action) ⇒ TrueClass
Set default action for exec sandboxing.
-
.default_force(action) ⇒ TrueClass
Set default action for force sandboxing.
-
.default_ioctl(action) ⇒ TrueClass
Set default action for ioctl sandboxing.
-
.default_mem(action) ⇒ TrueClass
Set default action for memory sandboxing.
-
.default_mkdev(action) ⇒ TrueClass
Set default action for mkdev sandboxing.
-
.default_mkdir(action) ⇒ TrueClass
Set default action for mkdir sandboxing.
-
.default_mkfifo(action) ⇒ TrueClass
Set default action for mkfifo sandboxing.
-
.default_mktemp(action) ⇒ TrueClass
Set default action for mktemp sandboxing.
-
.default_net(action) ⇒ TrueClass
Set default action for net sandboxing.
-
.default_pid(action) ⇒ TrueClass
Set default action for PID sandboxing.
-
.default_read(action) ⇒ TrueClass
Set default action for read sandboxing.
-
.default_readdir(action) ⇒ TrueClass
Set default action for readdir sandboxing.
-
.default_rename(action) ⇒ TrueClass
Set default action for rename sandboxing.
-
.default_segvguard(action) ⇒ TrueClass
Set default action for SegvGuard.
-
.default_stat(action) ⇒ TrueClass
Set default action for stat sandboxing.
-
.default_symlink(action) ⇒ TrueClass
Set default action for symlink sandboxing.
-
.default_tpe(action) ⇒ TrueClass
Set default action for TPE sandboxing.
-
.default_truncate(action) ⇒ TrueClass
Set default action for truncate sandboxing.
-
.default_utime(action) ⇒ TrueClass
Set default action for utime sandboxing.
-
.default_write(action) ⇒ TrueClass
Set default action for write sandboxing.
-
.delete_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for delete sandboxing.
-
.delete_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for delete sandboxing.
-
.delete_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for delete sandboxing.
-
.disable_chattr ⇒ TrueClass
Disable chattr sandboxing.
-
.disable_chdir ⇒ TrueClass
Disable chdir sandboxing.
-
.disable_chgrp ⇒ TrueClass
Disable chgrp sandboxing.
-
.disable_chmod ⇒ TrueClass
Disable chmod sandboxing.
-
.disable_chown ⇒ TrueClass
Disable chown sandboxing.
-
.disable_chroot ⇒ TrueClass
Disable chroot sandboxing.
-
.disable_create ⇒ TrueClass
Disable create sandboxing.
-
.disable_delete ⇒ TrueClass
Disable delete sandboxing.
-
.disable_exec ⇒ TrueClass
Disable exec sandboxing.
-
.disable_force ⇒ TrueClass
Disable force sandboxing.
-
.disable_ioctl ⇒ TrueClass
Disable ioctl sandboxing.
-
.disable_mem ⇒ TrueClass
Disable memory sandboxing.
-
.disable_mkdev ⇒ TrueClass
Disable mkdev sandboxing.
-
.disable_mkdir ⇒ TrueClass
Disable mkdir sandboxing.
-
.disable_mkfifo ⇒ TrueClass
Disable mkfifo sandboxing.
-
.disable_mktemp ⇒ TrueClass
Disable mktemp sandboxing.
-
.disable_net ⇒ TrueClass
Disable net sandboxing.
-
.disable_pid ⇒ TrueClass
Disable PID sandboxing.
-
.disable_read ⇒ TrueClass
Disable read sandboxing.
-
.disable_readdir ⇒ TrueClass
Disable readdir sandboxing.
-
.disable_rename ⇒ TrueClass
Disable rename sandboxing.
-
.disable_stat ⇒ TrueClass
Disable stat sandboxing.
-
.disable_symlink ⇒ TrueClass
Disable symlink sandboxing.
-
.disable_tpe ⇒ TrueClass
Disable TPE sandboxing.
-
.disable_truncate ⇒ TrueClass
Disable truncate sandboxing.
-
.disable_utime ⇒ TrueClass
Disable utime sandboxing.
-
.disable_write ⇒ TrueClass
Disable write sandboxing.
-
.enable_chattr ⇒ TrueClass
Enable chattr sandboxing.
-
.enable_chdir ⇒ TrueClass
Enable chdir sandboxing.
-
.enable_chgrp ⇒ TrueClass
Enable chgrp sandboxing.
-
.enable_chmod ⇒ TrueClass
Enable chmod sandboxing.
-
.enable_chown ⇒ TrueClass
Enable chown sandboxing.
-
.enable_chroot ⇒ TrueClass
Enable chroot sandboxing.
-
.enable_create ⇒ TrueClass
Enable create sandboxing.
-
.enable_delete ⇒ TrueClass
Enable delete sandboxing.
-
.enable_exec ⇒ TrueClass
Enable exec sandboxing.
-
.enable_force ⇒ TrueClass
Enable force sandboxing.
-
.enable_ioctl ⇒ TrueClass
Enable ioctl sandboxing.
-
.enable_mem ⇒ TrueClass
Enable memory sandboxing.
-
.enable_mkdev ⇒ TrueClass
Enable mkdev sandboxing.
-
.enable_mkdir ⇒ TrueClass
Enable mkdir sandboxing.
-
.enable_mkfifo ⇒ TrueClass
Enable mkfifo sandboxing.
-
.enable_mktemp ⇒ TrueClass
Enable mktemp sandboxing.
-
.enable_net ⇒ TrueClass
Enable net sandboxing.
-
.enable_pid ⇒ TrueClass
Enable PID sandboxing.
-
.enable_read ⇒ TrueClass
Enable read sandboxing.
-
.enable_readdir ⇒ TrueClass
Enable readdir sandboxing.
-
.enable_rename ⇒ TrueClass
Enable rename sandboxing.
-
.enable_stat ⇒ TrueClass
Enable stat sandboxing.
-
.enable_symlink ⇒ TrueClass
Enable symlink sandboxing.
-
.enable_tpe ⇒ TrueClass
Enable TPE sandboxing.
-
.enable_truncate ⇒ TrueClass
Enable truncate sandboxing.
-
.enable_utime ⇒ TrueClass
Enable utime sandboxing.
-
.enable_write ⇒ TrueClass
Enable write sandboxing.
-
.enabled_chattr ⇒ Boolean
Checks if chattr sandboxing is enabled.
-
.enabled_chdir ⇒ Boolean
Checks if chdir sandboxing is enabled.
-
.enabled_chgrp ⇒ Boolean
Checks if chgrp sandboxing is enabled.
-
.enabled_chmod ⇒ Boolean
Checks if chmod sandboxing is enabled.
-
.enabled_chown ⇒ Boolean
Checks if chown sandboxing is enabled.
-
.enabled_chroot ⇒ Boolean
Checks if chroot sandboxing is enabled.
-
.enabled_create ⇒ Boolean
Checks if create sandboxing is enabled.
-
.enabled_crypt ⇒ Boolean
Checks if crypt sandboxing is enabled.
-
.enabled_delete ⇒ Boolean
Checks if delete sandboxing is enabled.
-
.enabled_exec ⇒ Boolean
Checks if exec sandboxing is enabled.
-
.enabled_force ⇒ Boolean
Checks if force sandboxing is enabled.
-
.enabled_ioctl ⇒ Boolean
Checks if ioctl sandboxing is enabled.
-
.enabled_lock ⇒ Boolean
Checks if lock sandboxing is enabled.
-
.enabled_mem ⇒ Boolean
Checks if memory sandboxing is enabled.
-
.enabled_mkdev ⇒ Boolean
Checks if mkdev sandboxing is enabled.
-
.enabled_mkdir ⇒ Boolean
Checks if mkdir sandboxing is enabled.
-
.enabled_mkfifo ⇒ Boolean
Checks if mkfifo sandboxing is enabled.
-
.enabled_mktemp ⇒ Boolean
Checks if mktemp sandboxing is enabled.
-
.enabled_net ⇒ Boolean
Checks if net sandboxing is enabled.
-
.enabled_pid ⇒ Boolean
Checks if PID sandboxing is enabled.
-
.enabled_proxy ⇒ Boolean
Checks if proxy sandboxing is enabled.
-
.enabled_read ⇒ Boolean
Checks if read sandboxing is enabled.
-
.enabled_readdir ⇒ Boolean
Checks if readdir sandboxing is enabled.
-
.enabled_rename ⇒ Boolean
Checks if rename sandboxing is enabled.
-
.enabled_stat ⇒ Boolean
Checks if stat sandboxing is enabled.
-
.enabled_symlink ⇒ Boolean
Checks if symlink sandboxing is enabled.
-
.enabled_tpe ⇒ Boolean
Checks if TPE sandboxing is enabled.
-
.enabled_truncate ⇒ Boolean
Checks if truncate sandboxing is enabled.
-
.enabled_utime ⇒ Boolean
Checks if utime sandboxing is enabled.
-
.enabled_write ⇒ Boolean
Checks if write sandboxing is enabled.
-
.exec(file, argv) ⇒ TrueClass
Execute a command outside the sandbox without sandboxing.
-
.exec_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for exec sandboxing.
-
.exec_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for exec sandboxing.
-
.exec_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for exec sandboxing.
-
.force_add(path, hash, action) ⇒ TrueClass
Adds an entry to the Integrity Force map for Force Sandboxing.
-
.force_clr ⇒ TrueClass
Clears the Integrity Force map for Force Sandboxing.
-
.force_del(path) ⇒ TrueClass
Removes an entry from the Integrity Force map for Force Sandboxing.
-
.info ⇒ Hash, NilClass
Reads the state of the syd sandbox from /dev/syd and returns it as a Ruby hash.
-
.ioctl_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for ioctl sandboxing.
-
.ioctl_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for ioctl sandboxing.
-
.ioctl_deny(request) ⇒ TrueClass
Adds a request to the ioctl(2) denylist.
-
.ioctl_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for ioctl sandboxing.
-
.load(fd) ⇒ TrueClass
Causes syd to read configuration from the given file descriptor.
-
.lock(state) ⇒ TrueClass
Sets the state of the sandbox lock.
-
.mem_max(size) ⇒ TrueClass
Set syd maximum per-process memory usage limit for memory sandboxing, parse-size crate is used to parse the value so formatted strings are OK.
-
.mem_vm_max(size) ⇒ TrueClass
Set syd maximum per-process virtual memory usage limit for memory sandboxing, parse-size crate is used to parse the value so formatted strings are OK.
-
.mkdev_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mkdev sandboxing.
-
.mkdev_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mkdev sandboxing.
-
.mkdev_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mkdev sandboxing.
-
.mkdir_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mkdir sandboxing.
-
.mkdir_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mkdir sandboxing.
-
.mkdir_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mkdir sandboxing.
-
.mkfifo_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mkfifo sandboxing.
-
.mkfifo_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mkfifo sandboxing.
-
.mkfifo_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mkfifo sandboxing.
-
.mktemp_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mktemp sandboxing.
-
.mktemp_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mktemp sandboxing.
-
.mktemp_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mktemp sandboxing.
-
.net_bind_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/bind sandboxing.
-
.net_bind_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/bind sandboxing.
-
.net_bind_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/bind sandboxing.
-
.net_connect_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/connect sandboxing.
-
.net_connect_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/connect sandboxing.
-
.net_connect_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/connect sandboxing.
-
.net_link_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/link sandboxing.
-
.net_link_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/link sandboxing.
-
.net_link_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/link sandboxing.
-
.net_sendfd_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/sendfd sandboxing.
-
.net_sendfd_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/sendfd sandboxing.
-
.net_sendfd_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/sendfd sandboxing.
-
.panic ⇒ TrueClass
Causes syd to exit immediately with code 127.
-
.pid_max(size) ⇒ TrueClass
Set syd maximum process id limit for PID sandboxing.
-
.read_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for read sandboxing.
-
.read_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for read sandboxing.
-
.read_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for read sandboxing.
-
.readdir_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for readdir sandboxing.
-
.readdir_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for readdir sandboxing.
-
.readdir_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for readdir sandboxing.
-
.rename_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for rename sandboxing.
-
.rename_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for rename sandboxing.
-
.rename_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for rename sandboxing.
-
.reset ⇒ TrueClass
Causes syd to reset sandboxing to the default state.
-
.segvguard_expiry(timeout) ⇒ TrueClass
Specify SegvGuard expiry timeout in seconds, must be greater than or equal to zero.
-
.segvguard_maxcrashes(limit) ⇒ TrueClass
Specify SegvGuard max number of crashes before suspension.
-
.segvguard_suspension(timeout) ⇒ TrueClass
Specify SegvGuard suspension timeout in seconds, must be greater than or equal to zero.
-
.stat_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for stat sandboxing.
-
.stat_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for stat sandboxing.
-
.stat_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for stat sandboxing.
-
.symlink_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for symlink sandboxing.
-
.symlink_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for symlink sandboxing.
-
.symlink_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for symlink sandboxing.
-
.truncate_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for truncate sandboxing.
-
.truncate_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for truncate sandboxing.
-
.truncate_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for truncate sandboxing.
-
.utime_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for utime sandboxing.
-
.utime_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for utime sandboxing.
-
.utime_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for utime sandboxing.
-
.write_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for write sandboxing.
-
.write_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for write sandboxing.
-
.write_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for write sandboxing.
Class Method Details
.api ⇒ Integer
Performs a syd API check by calling the ‘syd_api’ function from the ‘syd’ library.
This method is intended to be used as a preliminary check before making any other syd API calls. It is advisable to perform this check to ensure the API is accessible and functioning as expected.
118 119 120 |
# File 'syd.rb', line 118 def self.api check_return syd_api end |
.chattr_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chattr sandboxing.
1629 1630 1631 |
# File 'syd.rb', line 1629 def self.chattr_add(action, glob) check_return syd_chattr_add(check_action(action), glob) end |
.chattr_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chattr sandboxing.
1640 1641 1642 |
# File 'syd.rb', line 1640 def self.chattr_del(action, glob) check_return syd_chattr_del(check_action(action), glob) end |
.chattr_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chattr sandboxing.
1651 1652 1653 |
# File 'syd.rb', line 1651 def self.chattr_rem(action, glob) check_return syd_chattr_rem(check_action(action), glob) end |
.chdir_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chdir sandboxing.
1437 1438 1439 |
# File 'syd.rb', line 1437 def self.chdir_add(action, glob) check_return syd_chdir_add(check_action(action), glob) end |
.chdir_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chdir sandboxing.
1448 1449 1450 |
# File 'syd.rb', line 1448 def self.chdir_del(action, glob) check_return syd_chdir_del(check_action(action), glob) end |
.chdir_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chdir sandboxing.
1459 1460 1461 |
# File 'syd.rb', line 1459 def self.chdir_rem(action, glob) check_return syd_chdir_rem(check_action(action), glob) end |
.check ⇒ TrueClass
Performs a check by calling the ‘syd_check’ function from the ‘syd’ library. This function essentially performs an lstat system call on the file “/dev/syd”.
corresponding to the errno on failure.
The ‘syd_check’ function returns 0 on success and negated errno on failure. In Ruby, this method translates a non-zero return value into a corresponding SystemCallError exception, providing a more idiomatic way of error handling.
105 106 107 |
# File 'syd.rb', line 105 def self.check check_return syd_check end |
.check_action(action) ⇒ Object
Helper method to check if the action is valid.
2029 2030 2031 2032 2033 |
# File 'syd.rb', line 2029 def self.check_action(action) raise Errno::EINVAL unless action.is_a?(Integer) && (ACTION_ALLOW..ACTION_EXIT).cover?(action) action end |
.check_return(r) ⇒ Object
Helper method to process return values from libsyd calls
2036 2037 2038 2039 2040 2041 |
# File 'syd.rb', line 2036 def self.check_return(r) # Convert negative errno to Ruby exception. raise Errno.const_get(Errno.constants.find { |e| -r == Errno.const_get(e)::Errno }) unless r >= 0 r.zero? ? true : r end |
.chgrp_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chgrp sandboxing.
1565 1566 1567 |
# File 'syd.rb', line 1565 def self.chgrp_add(action, glob) check_return syd_chgrp_add(check_action(action), glob) end |
.chgrp_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chgrp sandboxing.
1576 1577 1578 |
# File 'syd.rb', line 1576 def self.chgrp_del(action, glob) check_return syd_chgrp_del(check_action(action), glob) end |
.chgrp_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chgrp sandboxing.
1587 1588 1589 |
# File 'syd.rb', line 1587 def self.chgrp_rem(action, glob) check_return syd_chgrp_rem(check_action(action), glob) end |
.chmod_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chmod sandboxing.
1597 1598 1599 |
# File 'syd.rb', line 1597 def self.chmod_add(action, glob) check_return syd_chmod_add(check_action(action), glob) end |
.chmod_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chmod sandboxing.
1608 1609 1610 |
# File 'syd.rb', line 1608 def self.chmod_del(action, glob) check_return syd_chmod_del(check_action(action), glob) end |
.chmod_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chmod sandboxing.
1619 1620 1621 |
# File 'syd.rb', line 1619 def self.chmod_rem(action, glob) check_return syd_chmod_rem(check_action(action), glob) end |
.chown_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chown sandboxing.
1533 1534 1535 |
# File 'syd.rb', line 1533 def self.chown_add(action, glob) check_return syd_chown_add(check_action(action), glob) end |
.chown_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chown sandboxing.
1544 1545 1546 |
# File 'syd.rb', line 1544 def self.chown_del(action, glob) check_return syd_chown_del(check_action(action), glob) end |
.chown_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chown sandboxing.
1555 1556 1557 |
# File 'syd.rb', line 1555 def self.chown_rem(action, glob) check_return syd_chown_rem(check_action(action), glob) end |
.chroot_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for chroot sandboxing.
1661 1662 1663 |
# File 'syd.rb', line 1661 def self.chroot_add(action, glob) check_return syd_chroot_add(check_action(action), glob) end |
.chroot_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for chroot sandboxing.
1672 1673 1674 |
# File 'syd.rb', line 1672 def self.chroot_del(action, glob) check_return syd_chroot_del(check_action(action), glob) end |
.chroot_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for chroot sandboxing.
1683 1684 1685 |
# File 'syd.rb', line 1683 def self.chroot_rem(action, glob) check_return syd_chroot_rem(check_action(action), glob) end |
.create_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for create sandboxing.
1277 1278 1279 |
# File 'syd.rb', line 1277 def self.create_add(action, glob) check_return syd_create_add(check_action(action), glob) end |
.create_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for create sandboxing.
1288 1289 1290 |
# File 'syd.rb', line 1288 def self.create_del(action, glob) check_return syd_create_del(check_action(action), glob) end |
.create_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for create sandboxing.
1299 1300 1301 |
# File 'syd.rb', line 1299 def self.create_rem(action, glob) check_return syd_create_rem(check_action(action), glob) end |
.default_block(action) ⇒ TrueClass
Set default action for block sandboxing.
1053 1054 1055 |
# File 'syd.rb', line 1053 def self.default_block(action) check_return syd_default_block(check_action(action)) end |
.default_chattr(action) ⇒ TrueClass
Set default action for chattr sandboxing.
990 991 992 |
# File 'syd.rb', line 990 def self.default_chattr(action) check_return syd_default_chattr(check_action(action)) end |
.default_chdir(action) ⇒ TrueClass
Set default action for chdir sandboxing.
936 937 938 |
# File 'syd.rb', line 936 def self.default_chdir(action) check_return syd_default_chdir(check_action(action)) end |
.default_chgrp(action) ⇒ TrueClass
Set default action for chgrp sandboxing.
972 973 974 |
# File 'syd.rb', line 972 def self.default_chgrp(action) check_return syd_default_chgrp(check_action(action)) end |
.default_chmod(action) ⇒ TrueClass
Set default action for chmod sandboxing.
981 982 983 |
# File 'syd.rb', line 981 def self.default_chmod(action) check_return syd_default_chmod(check_action(action)) end |
.default_chown(action) ⇒ TrueClass
Set default action for chown sandboxing.
963 964 965 |
# File 'syd.rb', line 963 def self.default_chown(action) check_return syd_default_chown(check_action(action)) end |
.default_chroot(action) ⇒ TrueClass
Set default action for chroot sandboxing.
999 1000 1001 |
# File 'syd.rb', line 999 def self.default_chroot(action) check_return syd_default_chroot(check_action(action)) end |
.default_create(action) ⇒ TrueClass
Set default action for create sandboxing.
891 892 893 |
# File 'syd.rb', line 891 def self.default_create(action) check_return syd_default_create(check_action(action)) end |
.default_delete(action) ⇒ TrueClass
Set default action for delete sandboxing.
900 901 902 |
# File 'syd.rb', line 900 def self.default_delete(action) check_return syd_default_delete(check_action(action)) end |
.default_exec(action) ⇒ TrueClass
Set default action for exec sandboxing.
873 874 875 |
# File 'syd.rb', line 873 def self.default_exec(action) check_return syd_default_exec(check_action(action)) end |
.default_force(action) ⇒ TrueClass
Set default action for force sandboxing.
1080 1081 1082 |
# File 'syd.rb', line 1080 def self.default_force(action) check_return syd_default_force(check_action(action)) end |
.default_ioctl(action) ⇒ TrueClass
Set default action for ioctl sandboxing.
882 883 884 |
# File 'syd.rb', line 882 def self.default_ioctl(action) check_return syd_default_ioctl(check_action(action)) end |
.default_mem(action) ⇒ TrueClass
Set default action for memory sandboxing.
1062 1063 1064 |
# File 'syd.rb', line 1062 def self.default_mem(action) check_return syd_default_mem(check_action(action)) end |
.default_mkdev(action) ⇒ TrueClass
Set default action for mkdev sandboxing.
1017 1018 1019 |
# File 'syd.rb', line 1017 def self.default_mkdev(action) check_return syd_default_mkdev(check_action(action)) end |
.default_mkdir(action) ⇒ TrueClass
Set default action for mkdir sandboxing.
954 955 956 |
# File 'syd.rb', line 954 def self.default_mkdir(action) check_return syd_default_mkdir(check_action(action)) end |
.default_mkfifo(action) ⇒ TrueClass
Set default action for mkfifo sandboxing.
1026 1027 1028 |
# File 'syd.rb', line 1026 def self.default_mkfifo(action) check_return syd_default_mkfifo(check_action(action)) end |
.default_mktemp(action) ⇒ TrueClass
Set default action for mktemp sandboxing.
1035 1036 1037 |
# File 'syd.rb', line 1035 def self.default_mktemp(action) check_return syd_default_mktemp(check_action(action)) end |
.default_net(action) ⇒ TrueClass
Set default action for net sandboxing.
1044 1045 1046 |
# File 'syd.rb', line 1044 def self.default_net(action) check_return syd_default_net(check_action(action)) end |
.default_pid(action) ⇒ TrueClass
Set default action for PID sandboxing.
1071 1072 1073 |
# File 'syd.rb', line 1071 def self.default_pid(action) check_return syd_default_pid(check_action(action)) end |
.default_read(action) ⇒ TrueClass
Set default action for read sandboxing.
855 856 857 |
# File 'syd.rb', line 855 def self.default_read(action) check_return syd_default_read(check_action(action)) end |
.default_readdir(action) ⇒ TrueClass
Set default action for readdir sandboxing.
945 946 947 |
# File 'syd.rb', line 945 def self.default_readdir(action) check_return syd_default_readdir(check_action(action)) end |
.default_rename(action) ⇒ TrueClass
Set default action for rename sandboxing.
909 910 911 |
# File 'syd.rb', line 909 def self.default_rename(action) check_return syd_default_rename(check_action(action)) end |
.default_segvguard(action) ⇒ TrueClass
Set default action for SegvGuard.
1089 1090 1091 |
# File 'syd.rb', line 1089 def self.default_segvguard(action) check_return syd_default_segvguard(check_action(action)) end |
.default_stat(action) ⇒ TrueClass
Set default action for stat sandboxing.
846 847 848 |
# File 'syd.rb', line 846 def self.default_stat(action) check_return syd_default_stat(check_action(action)) end |
.default_symlink(action) ⇒ TrueClass
Set default action for symlink sandboxing.
918 919 920 |
# File 'syd.rb', line 918 def self.default_symlink(action) check_return syd_default_symlink(check_action(action)) end |
.default_tpe(action) ⇒ TrueClass
Set default action for TPE sandboxing.
1098 1099 1100 |
# File 'syd.rb', line 1098 def self.default_tpe(action) check_return syd_default_tpe(check_action(action)) end |
.default_truncate(action) ⇒ TrueClass
Set default action for truncate sandboxing.
927 928 929 |
# File 'syd.rb', line 927 def self.default_truncate(action) check_return syd_default_truncate(check_action(action)) end |
.default_utime(action) ⇒ TrueClass
Set default action for utime sandboxing.
1008 1009 1010 |
# File 'syd.rb', line 1008 def self.default_utime(action) check_return syd_default_utime(check_action(action)) end |
.default_write(action) ⇒ TrueClass
Set default action for write sandboxing.
864 865 866 |
# File 'syd.rb', line 864 def self.default_write(action) check_return syd_default_write(check_action(action)) end |
.delete_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for delete sandboxing.
1309 1310 1311 |
# File 'syd.rb', line 1309 def self.delete_add(action, glob) check_return syd_delete_add(check_action(action), glob) end |
.delete_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for delete sandboxing.
1320 1321 1322 |
# File 'syd.rb', line 1320 def self.delete_del(action, glob) check_return syd_delete_del(check_action(action), glob) end |
.delete_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for delete sandboxing.
1331 1332 1333 |
# File 'syd.rb', line 1331 def self.delete_rem(action, glob) check_return syd_delete_rem(check_action(action), glob) end |
.disable_chattr ⇒ TrueClass
Disable chattr sandboxing.
579 580 581 |
# File 'syd.rb', line 579 def self.disable_chattr check_return syd_disable_chattr end |
.disable_chdir ⇒ TrueClass
Disable chdir sandboxing.
441 442 443 |
# File 'syd.rb', line 441 def self.disable_chdir check_return syd_disable_chdir end |
.disable_chgrp ⇒ TrueClass
Disable chgrp sandboxing.
533 534 535 |
# File 'syd.rb', line 533 def self.disable_chgrp check_return syd_disable_chgrp end |
.disable_chmod ⇒ TrueClass
Disable chmod sandboxing.
556 557 558 |
# File 'syd.rb', line 556 def self.disable_chmod check_return syd_disable_chmod end |
.disable_chown ⇒ TrueClass
Disable chown sandboxing.
510 511 512 |
# File 'syd.rb', line 510 def self.disable_chown check_return syd_disable_chown end |
.disable_chroot ⇒ TrueClass
Disable chroot sandboxing.
602 603 604 |
# File 'syd.rb', line 602 def self.disable_chroot check_return syd_disable_chroot end |
.disable_create ⇒ TrueClass
Disable create sandboxing.
326 327 328 |
# File 'syd.rb', line 326 def self.disable_create check_return syd_disable_create end |
.disable_delete ⇒ TrueClass
Disable delete sandboxing.
349 350 351 |
# File 'syd.rb', line 349 def self.disable_delete check_return syd_disable_delete end |
.disable_exec ⇒ TrueClass
Disable exec sandboxing.
280 281 282 |
# File 'syd.rb', line 280 def self.disable_exec check_return syd_disable_exec end |
.disable_force ⇒ TrueClass
Disable force sandboxing.
807 808 809 |
# File 'syd.rb', line 807 def self.disable_force check_return syd_disable_force end |
.disable_ioctl ⇒ TrueClass
Disable ioctl sandboxing.
303 304 305 |
# File 'syd.rb', line 303 def self.disable_ioctl check_return syd_disable_ioctl end |
.disable_mem ⇒ TrueClass
Disable memory sandboxing.
761 762 763 |
# File 'syd.rb', line 761 def self.disable_mem check_return syd_disable_mem end |
.disable_mkdev ⇒ TrueClass
Disable mkdev sandboxing.
648 649 650 |
# File 'syd.rb', line 648 def self.disable_mkdev check_return syd_disable_mkdev end |
.disable_mkdir ⇒ TrueClass
Disable mkdir sandboxing.
487 488 489 |
# File 'syd.rb', line 487 def self.disable_mkdir check_return syd_disable_mkdir end |
.disable_mkfifo ⇒ TrueClass
Disable mkfifo sandboxing.
671 672 673 |
# File 'syd.rb', line 671 def self.disable_mkfifo check_return syd_disable_mkfifo end |
.disable_mktemp ⇒ TrueClass
Disable mktemp sandboxing.
694 695 696 |
# File 'syd.rb', line 694 def self.disable_mktemp check_return syd_disable_mktemp end |
.disable_net ⇒ TrueClass
Disable net sandboxing.
717 718 719 |
# File 'syd.rb', line 717 def self.disable_net check_return syd_disable_net end |
.disable_pid ⇒ TrueClass
Disable PID sandboxing.
784 785 786 |
# File 'syd.rb', line 784 def self.disable_pid check_return syd_disable_pid end |
.disable_read ⇒ TrueClass
Disable read sandboxing.
234 235 236 |
# File 'syd.rb', line 234 def self.disable_read check_return syd_disable_read end |
.disable_readdir ⇒ TrueClass
Disable readdir sandboxing.
464 465 466 |
# File 'syd.rb', line 464 def self.disable_readdir check_return syd_disable_readdir end |
.disable_rename ⇒ TrueClass
Disable rename sandboxing.
372 373 374 |
# File 'syd.rb', line 372 def self.disable_rename check_return syd_disable_rename end |
.disable_stat ⇒ TrueClass
Disable stat sandboxing.
211 212 213 |
# File 'syd.rb', line 211 def self.disable_stat check_return syd_disable_stat end |
.disable_symlink ⇒ TrueClass
Disable symlink sandboxing.
395 396 397 |
# File 'syd.rb', line 395 def self.disable_symlink check_return syd_disable_symlink end |
.disable_tpe ⇒ TrueClass
Disable TPE sandboxing.
830 831 832 |
# File 'syd.rb', line 830 def self.disable_tpe check_return syd_disable_tpe end |
.disable_truncate ⇒ TrueClass
Disable truncate sandboxing.
418 419 420 |
# File 'syd.rb', line 418 def self.disable_truncate check_return syd_disable_truncate end |
.disable_utime ⇒ TrueClass
Disable utime sandboxing.
625 626 627 |
# File 'syd.rb', line 625 def self.disable_utime check_return syd_disable_utime end |
.disable_write ⇒ TrueClass
Disable write sandboxing.
257 258 259 |
# File 'syd.rb', line 257 def self.disable_write check_return syd_disable_write end |
.enable_chattr ⇒ TrueClass
Enable chattr sandboxing.
571 572 573 |
# File 'syd.rb', line 571 def self.enable_chattr check_return syd_enable_chattr end |
.enable_chdir ⇒ TrueClass
Enable chdir sandboxing.
433 434 435 |
# File 'syd.rb', line 433 def self.enable_chdir check_return syd_enable_chdir end |
.enable_chgrp ⇒ TrueClass
Enable chgrp sandboxing.
525 526 527 |
# File 'syd.rb', line 525 def self.enable_chgrp check_return syd_enable_chgrp end |
.enable_chmod ⇒ TrueClass
Enable chmod sandboxing.
548 549 550 |
# File 'syd.rb', line 548 def self.enable_chmod check_return syd_enable_chmod end |
.enable_chown ⇒ TrueClass
Enable chown sandboxing.
502 503 504 |
# File 'syd.rb', line 502 def self.enable_chown check_return syd_enable_chown end |
.enable_chroot ⇒ TrueClass
Enable chroot sandboxing.
594 595 596 |
# File 'syd.rb', line 594 def self.enable_chroot check_return syd_enable_chroot end |
.enable_create ⇒ TrueClass
Enable create sandboxing.
318 319 320 |
# File 'syd.rb', line 318 def self.enable_create check_return syd_enable_create end |
.enable_delete ⇒ TrueClass
Enable delete sandboxing.
341 342 343 |
# File 'syd.rb', line 341 def self.enable_delete check_return syd_enable_delete end |
.enable_exec ⇒ TrueClass
Enable exec sandboxing.
272 273 274 |
# File 'syd.rb', line 272 def self.enable_exec check_return syd_enable_exec end |
.enable_force ⇒ TrueClass
Enable force sandboxing.
799 800 801 |
# File 'syd.rb', line 799 def self.enable_force check_return syd_enable_force end |
.enable_ioctl ⇒ TrueClass
Enable ioctl sandboxing.
295 296 297 |
# File 'syd.rb', line 295 def self.enable_ioctl check_return syd_enable_ioctl end |
.enable_mem ⇒ TrueClass
Enable memory sandboxing.
753 754 755 |
# File 'syd.rb', line 753 def self.enable_mem check_return syd_enable_mem end |
.enable_mkdev ⇒ TrueClass
Enable mkdev sandboxing.
640 641 642 |
# File 'syd.rb', line 640 def self.enable_mkdev check_return syd_enable_mkdev end |
.enable_mkdir ⇒ TrueClass
Enable mkdir sandboxing.
479 480 481 |
# File 'syd.rb', line 479 def self.enable_mkdir check_return syd_enable_mkdir end |
.enable_mkfifo ⇒ TrueClass
Enable mkfifo sandboxing.
663 664 665 |
# File 'syd.rb', line 663 def self.enable_mkfifo check_return syd_enable_mkfifo end |
.enable_mktemp ⇒ TrueClass
Enable mktemp sandboxing.
686 687 688 |
# File 'syd.rb', line 686 def self.enable_mktemp check_return syd_enable_mktemp end |
.enable_net ⇒ TrueClass
Enable net sandboxing.
709 710 711 |
# File 'syd.rb', line 709 def self.enable_net check_return syd_enable_net end |
.enable_pid ⇒ TrueClass
Enable PID sandboxing.
776 777 778 |
# File 'syd.rb', line 776 def self.enable_pid check_return syd_enable_pid end |
.enable_read ⇒ TrueClass
Enable read sandboxing.
226 227 228 |
# File 'syd.rb', line 226 def self.enable_read check_return syd_enable_read end |
.enable_readdir ⇒ TrueClass
Enable readdir sandboxing.
456 457 458 |
# File 'syd.rb', line 456 def self.enable_readdir check_return syd_enable_readdir end |
.enable_rename ⇒ TrueClass
Enable rename sandboxing.
364 365 366 |
# File 'syd.rb', line 364 def self.enable_rename check_return syd_enable_rename end |
.enable_stat ⇒ TrueClass
Enable stat sandboxing.
203 204 205 |
# File 'syd.rb', line 203 def self.enable_stat check_return syd_enable_stat end |
.enable_symlink ⇒ TrueClass
Enable symlink sandboxing.
387 388 389 |
# File 'syd.rb', line 387 def self.enable_symlink check_return syd_enable_symlink end |
.enable_tpe ⇒ TrueClass
Enable TPE sandboxing.
822 823 824 |
# File 'syd.rb', line 822 def self.enable_tpe check_return syd_enable_tpe end |
.enable_truncate ⇒ TrueClass
Enable truncate sandboxing.
410 411 412 |
# File 'syd.rb', line 410 def self.enable_truncate check_return syd_enable_truncate end |
.enable_utime ⇒ TrueClass
Enable utime sandboxing.
617 618 619 |
# File 'syd.rb', line 617 def self.enable_utime check_return syd_enable_utime end |
.enable_write ⇒ TrueClass
Enable write sandboxing.
249 250 251 |
# File 'syd.rb', line 249 def self.enable_write check_return syd_enable_write end |
.enabled_chattr ⇒ Boolean
Checks if chattr sandboxing is enabled.
586 587 588 |
# File 'syd.rb', line 586 def self.enabled_chattr syd_enabled_chattr end |
.enabled_chdir ⇒ Boolean
Checks if chdir sandboxing is enabled.
448 449 450 |
# File 'syd.rb', line 448 def self.enabled_chdir syd_enabled_chdir end |
.enabled_chgrp ⇒ Boolean
Checks if chgrp sandboxing is enabled.
540 541 542 |
# File 'syd.rb', line 540 def self.enabled_chgrp syd_enabled_chgrp end |
.enabled_chmod ⇒ Boolean
Checks if chmod sandboxing is enabled.
563 564 565 |
# File 'syd.rb', line 563 def self.enabled_chmod syd_enabled_chmod end |
.enabled_chown ⇒ Boolean
Checks if chown sandboxing is enabled.
517 518 519 |
# File 'syd.rb', line 517 def self.enabled_chown syd_enabled_chown end |
.enabled_chroot ⇒ Boolean
Checks if chroot sandboxing is enabled.
609 610 611 |
# File 'syd.rb', line 609 def self.enabled_chroot syd_enabled_chroot end |
.enabled_create ⇒ Boolean
Checks if create sandboxing is enabled.
333 334 335 |
# File 'syd.rb', line 333 def self.enabled_create syd_enabled_create end |
.enabled_crypt ⇒ Boolean
Checks if crypt sandboxing is enabled.
738 739 740 |
# File 'syd.rb', line 738 def self.enabled_crypt syd_enabled_crypt end |
.enabled_delete ⇒ Boolean
Checks if delete sandboxing is enabled.
356 357 358 |
# File 'syd.rb', line 356 def self.enabled_delete syd_enabled_delete end |
.enabled_exec ⇒ Boolean
Checks if exec sandboxing is enabled.
287 288 289 |
# File 'syd.rb', line 287 def self.enabled_exec syd_enabled_exec end |
.enabled_force ⇒ Boolean
Checks if force sandboxing is enabled.
814 815 816 |
# File 'syd.rb', line 814 def self.enabled_force syd_enabled_force end |
.enabled_ioctl ⇒ Boolean
Checks if ioctl sandboxing is enabled.
310 311 312 |
# File 'syd.rb', line 310 def self.enabled_ioctl syd_enabled_ioctl end |
.enabled_lock ⇒ Boolean
Checks if lock sandboxing is enabled.
731 732 733 |
# File 'syd.rb', line 731 def self.enabled_lock syd_enabled_lock end |
.enabled_mem ⇒ Boolean
Checks if memory sandboxing is enabled.
768 769 770 |
# File 'syd.rb', line 768 def self.enabled_mem syd_enabled_mem end |
.enabled_mkdev ⇒ Boolean
Checks if mkdev sandboxing is enabled.
655 656 657 |
# File 'syd.rb', line 655 def self.enabled_mkdev syd_enabled_mkdev end |
.enabled_mkdir ⇒ Boolean
Checks if mkdir sandboxing is enabled.
494 495 496 |
# File 'syd.rb', line 494 def self.enabled_mkdir syd_enabled_mkdir end |
.enabled_mkfifo ⇒ Boolean
Checks if mkfifo sandboxing is enabled.
678 679 680 |
# File 'syd.rb', line 678 def self.enabled_mkfifo syd_enabled_mkfifo end |
.enabled_mktemp ⇒ Boolean
Checks if mktemp sandboxing is enabled.
701 702 703 |
# File 'syd.rb', line 701 def self.enabled_mktemp syd_enabled_mktemp end |
.enabled_net ⇒ Boolean
Checks if net sandboxing is enabled.
724 725 726 |
# File 'syd.rb', line 724 def self.enabled_net syd_enabled_net end |
.enabled_pid ⇒ Boolean
Checks if PID sandboxing is enabled.
791 792 793 |
# File 'syd.rb', line 791 def self.enabled_pid syd_enabled_pid end |
.enabled_proxy ⇒ Boolean
Checks if proxy sandboxing is enabled.
745 746 747 |
# File 'syd.rb', line 745 def self.enabled_proxy syd_enabled_proxy end |
.enabled_read ⇒ Boolean
Checks if read sandboxing is enabled.
241 242 243 |
# File 'syd.rb', line 241 def self.enabled_read syd_enabled_read end |
.enabled_readdir ⇒ Boolean
Checks if readdir sandboxing is enabled.
471 472 473 |
# File 'syd.rb', line 471 def self.enabled_readdir syd_enabled_readdir end |
.enabled_rename ⇒ Boolean
Checks if rename sandboxing is enabled.
379 380 381 |
# File 'syd.rb', line 379 def self.enabled_rename syd_enabled_rename end |
.enabled_stat ⇒ Boolean
Checks if stat sandboxing is enabled.
218 219 220 |
# File 'syd.rb', line 218 def self.enabled_stat syd_enabled_stat end |
.enabled_symlink ⇒ Boolean
Checks if symlink sandboxing is enabled.
402 403 404 |
# File 'syd.rb', line 402 def self.enabled_symlink syd_enabled_symlink end |
.enabled_tpe ⇒ Boolean
Checks if TPE sandboxing is enabled.
837 838 839 |
# File 'syd.rb', line 837 def self.enabled_tpe syd_enabled_tpe end |
.enabled_truncate ⇒ Boolean
Checks if truncate sandboxing is enabled.
425 426 427 |
# File 'syd.rb', line 425 def self.enabled_truncate syd_enabled_truncate end |
.enabled_utime ⇒ Boolean
Checks if utime sandboxing is enabled.
632 633 634 |
# File 'syd.rb', line 632 def self.enabled_utime syd_enabled_utime end |
.enabled_write ⇒ Boolean
Checks if write sandboxing is enabled.
264 265 266 |
# File 'syd.rb', line 264 def self.enabled_write syd_enabled_write end |
.exec(file, argv) ⇒ TrueClass
Execute a command outside the sandbox without sandboxing.
This method is used to execute a command in the operating system, bypassing the sandbox. It takes a file path and an array of arguments, converts them to the appropriate C types, and then invokes the syd_exec function from the syd library.
184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'syd.rb', line 184 def self.exec(file, argv) # Convert each argument into a memory pointer to a string argv_ptrs = argv.map { |arg| FFI::MemoryPointer.from_string(arg) } # Append a null pointer to the end of the array to signify the end of arguments argv_ptrs << nil # Create a memory pointer that will hold pointers to each argument string argv_ptr = FFI::MemoryPointer.new(:pointer, argv_ptrs.length) # Copy the pointers to the argument strings into the newly created memory pointer argv_ptr.put_array_of_pointer(0, argv_ptrs) # Call the syd_exec function and handle the return value check_return syd_exec(file, argv_ptr) end |
.exec_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for exec sandboxing.
1213 1214 1215 |
# File 'syd.rb', line 1213 def self.exec_add(action, glob) check_return syd_exec_add(check_action(action), glob) end |
.exec_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for exec sandboxing.
1224 1225 1226 |
# File 'syd.rb', line 1224 def self.exec_del(action, glob) check_return syd_exec_del(check_action(action), glob) end |
.exec_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for exec sandboxing.
1235 1236 1237 |
# File 'syd.rb', line 1235 def self.exec_rem(action, glob) check_return syd_exec_rem(check_action(action), glob) end |
.force_add(path, hash, action) ⇒ TrueClass
Adds an entry to the Integrity Force map for Force Sandboxing.
1950 1951 1952 |
# File 'syd.rb', line 1950 def self.force_add(path, hash, action) check_return syd_force_add(path, hash, check_action(action)) end |
.force_clr ⇒ TrueClass
Clears the Integrity Force map for Force Sandboxing.
1967 1968 1969 |
# File 'syd.rb', line 1967 def self.force_clr check_return syd_force_clr end |
.force_del(path) ⇒ TrueClass
Removes an entry from the Integrity Force map for Force Sandboxing.
1959 1960 1961 |
# File 'syd.rb', line 1959 def self.force_del(path) check_return syd_force_del(path) end |
.info ⇒ Hash, NilClass
Reads the state of the syd sandbox from /dev/syd and returns it as a Ruby hash.
This method opens the special file /dev/syd, which contains the current state of the syd sandbox in JSON format. It then parses this state and returns it as a Ruby hash.
a Ruby hash, or nil if JSON module is not available.
83 84 85 86 87 88 89 90 91 |
# File 'syd.rb', line 83 def self.info begin require "json" rescue LoadError return nil end JSON.parse File.read("/dev/syd"), symbolize_names: true end |
.ioctl_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for ioctl sandboxing.
1245 1246 1247 |
# File 'syd.rb', line 1245 def self.ioctl_add(action, glob) check_return syd_ioctl_add(check_action(action), glob) end |
.ioctl_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for ioctl sandboxing.
1256 1257 1258 |
# File 'syd.rb', line 1256 def self.ioctl_del(action, glob) check_return syd_ioctl_del(check_action(action), glob) end |
.ioctl_deny(request) ⇒ TrueClass
Adds a request to the ioctl(2) denylist.
param request [Integer] The ioctl(2) request to deny.
1107 1108 1109 |
# File 'syd.rb', line 1107 def self.ioctl_deny(request) check_return syd_ioctl_deny(request) end |
.ioctl_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for ioctl sandboxing.
1267 1268 1269 |
# File 'syd.rb', line 1267 def self.ioctl_rem(action, glob) check_return syd_ioctl_rem(check_action(action), glob) end |
.load(fd) ⇒ TrueClass
Causes syd to read configuration from the given file descriptor.
This function is utilized to load configuration settings for syd from a file represented by the provided file descriptor. It’s an essential function for initializing or reconfiguring syd based on external configuration files.
158 159 160 |
# File 'syd.rb', line 158 def self.load(fd) check_return syd_load(fd) end |
.lock(state) ⇒ TrueClass
Sets the state of the sandbox lock.
167 168 169 170 171 |
# File 'syd.rb', line 167 def self.lock(state) raise Errno::EINVAL unless state.is_a?(Integer) && (LOCK_OFF..LOCK_ON).cover?(state) check_return syd_lock(state) end |
.mem_max(size) ⇒ TrueClass
Set syd maximum per-process memory usage limit for memory sandboxing, parse-size crate is used to parse the value so formatted strings are OK.
1977 1978 1979 |
# File 'syd.rb', line 1977 def self.mem_max(size) check_return syd_mem_max(size) end |
.mem_vm_max(size) ⇒ TrueClass
Set syd maximum per-process virtual memory usage limit for memory sandboxing, parse-size crate is used to parse the value so formatted strings are OK.
1987 1988 1989 |
# File 'syd.rb', line 1987 def self.mem_vm_max(size) check_return syd_mem_vm_max(size) end |
.mkdev_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mkdev sandboxing.
1725 1726 1727 |
# File 'syd.rb', line 1725 def self.mkdev_add(action, glob) check_return syd_mkdev_add(check_action(action), glob) end |
.mkdev_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mkdev sandboxing.
1736 1737 1738 |
# File 'syd.rb', line 1736 def self.mkdev_del(action, glob) check_return syd_mkdev_del(check_action(action), glob) end |
.mkdev_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mkdev sandboxing.
1747 1748 1749 |
# File 'syd.rb', line 1747 def self.mkdev_rem(action, glob) check_return syd_mkdev_rem(check_action(action), glob) end |
.mkdir_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mkdir sandboxing.
1501 1502 1503 |
# File 'syd.rb', line 1501 def self.mkdir_add(action, glob) check_return syd_mkdir_add(check_action(action), glob) end |
.mkdir_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mkdir sandboxing.
1512 1513 1514 |
# File 'syd.rb', line 1512 def self.mkdir_del(action, glob) check_return syd_mkdir_del(check_action(action), glob) end |
.mkdir_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mkdir sandboxing.
1523 1524 1525 |
# File 'syd.rb', line 1523 def self.mkdir_rem(action, glob) check_return syd_mkdir_rem(check_action(action), glob) end |
.mkfifo_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mkfifo sandboxing.
1757 1758 1759 |
# File 'syd.rb', line 1757 def self.mkfifo_add(action, glob) check_return syd_mkfifo_add(check_action(action), glob) end |
.mkfifo_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mkfifo sandboxing.
1768 1769 1770 |
# File 'syd.rb', line 1768 def self.mkfifo_del(action, glob) check_return syd_mkfifo_del(check_action(action), glob) end |
.mkfifo_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mkfifo sandboxing.
1779 1780 1781 |
# File 'syd.rb', line 1779 def self.mkfifo_rem(action, glob) check_return syd_mkfifo_rem(check_action(action), glob) end |
.mktemp_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for mktemp sandboxing.
1789 1790 1791 |
# File 'syd.rb', line 1789 def self.mktemp_add(action, glob) check_return syd_mktemp_add(check_action(action), glob) end |
.mktemp_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for mktemp sandboxing.
1800 1801 1802 |
# File 'syd.rb', line 1800 def self.mktemp_del(action, glob) check_return syd_mktemp_del(check_action(action), glob) end |
.mktemp_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for mktemp sandboxing.
1811 1812 1813 |
# File 'syd.rb', line 1811 def self.mktemp_rem(action, glob) check_return syd_mktemp_rem(check_action(action), glob) end |
.net_bind_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/bind sandboxing.
1821 1822 1823 |
# File 'syd.rb', line 1821 def self.net_bind_add(action, addr) check_return syd_net_bind_add(check_action(action), addr) end |
.net_bind_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/bind sandboxing.
1832 1833 1834 |
# File 'syd.rb', line 1832 def self.net_bind_del(action, addr) check_return syd_net_bind_del(check_action(action), addr) end |
.net_bind_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/bind sandboxing.
1843 1844 1845 |
# File 'syd.rb', line 1843 def self.net_bind_rem(action, addr) check_return syd_net_bind_rem(check_action(action), addr) end |
.net_connect_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/connect sandboxing.
1853 1854 1855 |
# File 'syd.rb', line 1853 def self.net_connect_add(action, addr) check_return syd_net_connect_add(check_action(action), addr) end |
.net_connect_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/connect sandboxing.
1864 1865 1866 |
# File 'syd.rb', line 1864 def self.net_connect_del(action, addr) check_return syd_net_connect_del(check_action(action), addr) end |
.net_connect_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/connect sandboxing.
1875 1876 1877 |
# File 'syd.rb', line 1875 def self.net_connect_rem(action, addr) check_return syd_net_connect_rem(check_action(action), addr) end |
.net_link_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/link sandboxing.
1917 1918 1919 |
# File 'syd.rb', line 1917 def self.net_link_add(action, addr) check_return syd_net_link_add(check_action(action), addr) end |
.net_link_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/link sandboxing.
1928 1929 1930 |
# File 'syd.rb', line 1928 def self.net_link_del(action, addr) check_return syd_net_link_del(check_action(action), addr) end |
.net_link_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/link sandboxing.
1939 1940 1941 |
# File 'syd.rb', line 1939 def self.net_link_rem(action, addr) check_return syd_net_link_rem(check_action(action), addr) end |
.net_sendfd_add(action, addr) ⇒ TrueClass
Adds an address to the given actionlist for net/sendfd sandboxing.
1885 1886 1887 |
# File 'syd.rb', line 1885 def self.net_sendfd_add(action, addr) check_return syd_net_sendfd_add(check_action(action), addr) end |
.net_sendfd_del(action, addr) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for net/sendfd sandboxing.
1896 1897 1898 |
# File 'syd.rb', line 1896 def self.net_sendfd_del(action, addr) check_return syd_net_sendfd_del(check_action(action), addr) end |
.net_sendfd_rem(action, addr) ⇒ TrueClass
Removes all matching patterns from the given actionlist for net/sendfd sandboxing.
1907 1908 1909 |
# File 'syd.rb', line 1907 def self.net_sendfd_rem(action, addr) check_return syd_net_sendfd_rem(check_action(action), addr) end |
.panic ⇒ TrueClass
Causes syd to exit immediately with code 127.
This function is designed to trigger an immediate exit of syd with a specific exit code (127). It should be used in scenarios where an immediate and complete termination of syd is necessary.
130 131 132 |
# File 'syd.rb', line 130 def self.panic check_return syd_panic end |
.pid_max(size) ⇒ TrueClass
Set syd maximum process id limit for PID sandboxing
1996 1997 1998 |
# File 'syd.rb', line 1996 def self.pid_max(size) check_return syd_pid_max(size) end |
.read_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for read sandboxing.
1149 1150 1151 |
# File 'syd.rb', line 1149 def self.read_add(action, glob) check_return syd_read_add(check_action(action), glob) end |
.read_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for read sandboxing.
1160 1161 1162 |
# File 'syd.rb', line 1160 def self.read_del(action, glob) check_return syd_read_del(check_action(action), glob) end |
.read_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for read sandboxing.
1171 1172 1173 |
# File 'syd.rb', line 1171 def self.read_rem(action, glob) check_return syd_read_rem(check_action(action), glob) end |
.readdir_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for readdir sandboxing.
1469 1470 1471 |
# File 'syd.rb', line 1469 def self.readdir_add(action, glob) check_return syd_readdir_add(check_action(action), glob) end |
.readdir_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for readdir sandboxing.
1480 1481 1482 |
# File 'syd.rb', line 1480 def self.readdir_del(action, glob) check_return syd_readdir_del(check_action(action), glob) end |
.readdir_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for readdir sandboxing.
1491 1492 1493 |
# File 'syd.rb', line 1491 def self.readdir_rem(action, glob) check_return syd_readdir_rem(check_action(action), glob) end |
.rename_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for rename sandboxing.
1341 1342 1343 |
# File 'syd.rb', line 1341 def self.rename_add(action, glob) check_return syd_rename_add(check_action(action), glob) end |
.rename_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for rename sandboxing.
1352 1353 1354 |
# File 'syd.rb', line 1352 def self.rename_del(action, glob) check_return syd_rename_del(check_action(action), glob) end |
.rename_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for rename sandboxing.
1363 1364 1365 |
# File 'syd.rb', line 1363 def self.rename_rem(action, glob) check_return syd_rename_rem(check_action(action), glob) end |
.reset ⇒ TrueClass
Causes syd to reset sandboxing to the default state. This includes clearing any allowlists, denylists, and filters.
This function should be used when it is necessary to reset the state of syd sandboxing environment to its default settings. It’s particularly useful in scenarios where the sandboxing environment needs to be reconfigured or cleared of all previous configurations.
144 145 146 |
# File 'syd.rb', line 144 def self.reset check_return syd_reset end |
.segvguard_expiry(timeout) ⇒ TrueClass
Specify SegvGuard expiry timeout in seconds, must be greater than or equal to zero. Setting this timeout to 0 effectively disables SegvGuard.
2006 2007 2008 |
# File 'syd.rb', line 2006 def self.segvguard_expiry(timeout) check_return syd_segvguard_expiry(timeout) end |
.segvguard_maxcrashes(limit) ⇒ TrueClass
Specify SegvGuard max number of crashes before suspension.
2024 2025 2026 |
# File 'syd.rb', line 2024 def self.segvguard_maxcrashes(limit) check_return syd_segvguard_maxcrashes(limit) end |
.segvguard_suspension(timeout) ⇒ TrueClass
Specify SegvGuard suspension timeout in seconds, must be greater than or equal to zero.
2015 2016 2017 |
# File 'syd.rb', line 2015 def self.segvguard_suspension(timeout) check_return syd_segvguard_suspension(timeout) end |
.stat_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for stat sandboxing.
1117 1118 1119 |
# File 'syd.rb', line 1117 def self.stat_add(action, glob) check_return syd_stat_add(check_action(action), glob) end |
.stat_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for stat sandboxing.
1128 1129 1130 |
# File 'syd.rb', line 1128 def self.stat_del(action, glob) check_return syd_stat_del(check_action(action), glob) end |
.stat_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for stat sandboxing.
1139 1140 1141 |
# File 'syd.rb', line 1139 def self.stat_rem(action, glob) check_return syd_stat_rem(check_action(action), glob) end |
.symlink_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for symlink sandboxing.
1373 1374 1375 |
# File 'syd.rb', line 1373 def self.symlink_add(action, glob) check_return syd_symlink_add(check_action(action), glob) end |
.symlink_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for symlink sandboxing.
1384 1385 1386 |
# File 'syd.rb', line 1384 def self.symlink_del(action, glob) check_return syd_symlink_del(check_action(action), glob) end |
.symlink_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for symlink sandboxing.
1395 1396 1397 |
# File 'syd.rb', line 1395 def self.symlink_rem(action, glob) check_return syd_symlink_rem(check_action(action), glob) end |
.truncate_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for truncate sandboxing.
1405 1406 1407 |
# File 'syd.rb', line 1405 def self.truncate_add(action, glob) check_return syd_truncate_add(check_action(action), glob) end |
.truncate_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for truncate sandboxing.
1416 1417 1418 |
# File 'syd.rb', line 1416 def self.truncate_del(action, glob) check_return syd_truncate_del(check_action(action), glob) end |
.truncate_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for truncate sandboxing.
1427 1428 1429 |
# File 'syd.rb', line 1427 def self.truncate_rem(action, glob) check_return syd_truncate_rem(check_action(action), glob) end |
.utime_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for utime sandboxing.
1693 1694 1695 |
# File 'syd.rb', line 1693 def self.utime_add(action, glob) check_return syd_utime_add(check_action(action), glob) end |
.utime_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for utime sandboxing.
1704 1705 1706 |
# File 'syd.rb', line 1704 def self.utime_del(action, glob) check_return syd_utime_del(check_action(action), glob) end |
.utime_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for utime sandboxing.
1715 1716 1717 |
# File 'syd.rb', line 1715 def self.utime_rem(action, glob) check_return syd_utime_rem(check_action(action), glob) end |
.write_add(action, glob) ⇒ TrueClass
Adds a path to the given actionlist for write sandboxing.
1181 1182 1183 |
# File 'syd.rb', line 1181 def self.write_add(action, glob) check_return syd_write_add(check_action(action), glob) end |
.write_del(action, glob) ⇒ TrueClass
Removes the first instance from the end of the given actionlist for write sandboxing.
1192 1193 1194 |
# File 'syd.rb', line 1192 def self.write_del(action, glob) check_return syd_write_del(check_action(action), glob) end |
.write_rem(action, glob) ⇒ TrueClass
Removes all matching patterns from the given actionlist for write sandboxing.
1203 1204 1205 |
# File 'syd.rb', line 1203 def self.write_rem(action, glob) check_return syd_write_rem(check_action(action), glob) end |