### Build and Run Sandboxer Example Source: https://github.com/landlock-lsm/landlockconfig/blob/main/README.md Steps to clone the repository, navigate to the directory, and run the sandboxer example with a JSON configuration. ```sh git clone https://github.com/landlock-lsm/landlockconfig cd landlockconfig cargo run --example sandboxer -- --json examples/mini-write-tmp.json sh ``` -------------------------------- ### Install Landlock Config Shared Library Source: https://github.com/landlock-lsm/landlockconfig/blob/main/README.md Installs the Landlock Config shared library using cargo-c. Ensure cargo-c is installed first. ```sh cargo cinstall --package=landlockconfig_ffi --release --prefix=/usr/local --destdir=out sudo cp -dr out/usr/local/* /usr/local/ ``` -------------------------------- ### TOML Configuration Source 1 Source: https://github.com/landlock-lsm/landlockconfig/blob/main/tests/composition/README.md Example TOML configuration defining variables and path-based access rules for ABI version 5. Includes read/execute access for system hierarchies and read/write access for temporary directories. ```toml abi = 5 [[variable]] name = "rw" literal = ["/tmp", "/var/tmp"] # Main system file hierarchies can be read and executed. [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/bin", "/lib", "/usr", "/dev", "/proc", "/etc"] # Only allow writing to temporary and home directories. [[path_beneath]] allowed_access = ["abi.read_write"] parent = ["${rw}"] ``` -------------------------------- ### View Landlock Rules with TOML Configuration Source: https://github.com/landlock-lsm/landlockconfig/blob/main/README.md Command to run the sandboxer example with a TOML configuration and debug flag to view the created Landlock rules. ```sh cargo run --example sandboxer -- --toml examples/micro-var.toml --debug date ``` -------------------------------- ### TOML Composition Example Source: https://github.com/landlock-lsm/landlockconfig/blob/main/tests/composition/README.md A composed TOML configuration for ABI version 4, merging variables and path rules from different sources. It defines broader temporary directory access and includes custom application binary paths. ```toml abi = 4 [[variable]] name = "rw" literal = ["/tmp", "/var/tmp", "/home/user/tmp"] # Main system file hierarchies can be read and executed. [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/bin", "/lib", "/usr", "/dev", "/proc", "/etc", "/home/user/bin"] # Only allow writing to temporary and home directories. [[path_beneath]] allowed_access = ["abi.read_write"] parent = ["${rw}"] ``` -------------------------------- ### TOML Configuration Source 2 Source: https://github.com/landlock-lsm/landlockconfig/blob/main/tests/composition/README.md Example TOML configuration for ABI version 4. Defines a variable 'rw' and specifies read/execute access for custom application binaries. ```toml abi = 4 [[variable]] name = "rw" literal = ["/home/user/tmp"] [[ruleset]] handled_access_fs = ["abi.all"] # Custom apps. [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/home/user/bin"] ``` -------------------------------- ### JSON Composition Example Source: https://github.com/landlock-lsm/landlockconfig/blob/main/tests/composition/README.md A JSON representation of a composed Landlock configuration for ABI version 4. This mirrors the TOML composition, defining variables and path-based access control rules in JSON format. ```json { "abi": 4, "variable": [ { "name": "rw", "literal": [ "/tmp", "/var/tmp", "/home/user/tmp" ] } ], "pathBeneath": [ { "allowedAccess": [ "abi.read_execute" ], "parent": [ "/bin", "/lib", "/usr", "/dev", "/proc", "/etc", "/home/user/bin" ] }, { "allowedAccess": [ "abi.read_write" ], "parent": [ "${rw}" ] } ] } ``` -------------------------------- ### TOML Configuration for File Access Source: https://github.com/landlock-lsm/landlockconfig/blob/main/README.md A TOML configuration example that defines variables for directories and specifies access rights for file hierarchies. This configuration allows reading and executing from system directories and writing to temporary and home directories. ```toml abi = 6 [[variable]] name = "tmp" literal = ["/tmp", "/var/tmp"] [[variable]] name = "home" literal = ["/root", "/home"] [[variable]] name = "config" literal = ["/etc"] # Main system file hierarchies can be read and executed. [[path_beneath]] allowed_access = ["abi.read_execute"] parent = ["/bin", "/lib", "/usr", "/dev", "/proc", "${config}"] # Only allow writing to temporary and home directories. [[path_beneath]] allowed_access = ["abi.read_write"] parent = ["${tmp}", "${home}"] ``` -------------------------------- ### Build Landlock Config Package with Docker Source: https://github.com/landlock-lsm/landlockconfig/blob/main/pkg/arch/README.md Use this command to build the Arch Linux package for Landlock Config when Docker is available. ```bash make docker ``` -------------------------------- ### Build Landlock Config Package Natively on Arch Linux Source: https://github.com/landlock-lsm/landlockconfig/blob/main/pkg/arch/README.md Use this command to build the Arch Linux package for Landlock Config on a native Arch Linux system with development tools. ```bash make build ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.