Coder Social home page Coder Social logo

polaris64 / syswall Goto Github PK

View Code? Open in Web Editor NEW
125.0 10.0 6.0 208 KB

Work in progress firewall for Linux syscalls, written in Rust

License: GNU Lesser General Public License v3.0

Rust 100.00%
rust linux security security-tools syscalls syscall

syswall's Introduction

syswall

A work in progress firewall for Linux syscalls, written in Rust.

Introduction

syswall functions similarly to the *nix strace tool, however for each syscall the program blocks the child process's execution and asks the user if the syscall should be allowed or not. As such, syswall can act as a safety barrier between a process and the OS kernel.

syswall also collects statistics about the handled syscalls and is able to produce a report after the child process finishes execution.

For more information about what syswall does, what is planned, and why, please see this blog post on my website

Structure

This repository is split as a Cargo workspace into two separate projects: -

  • lib: the main syswall library containing the main functionality which can be used in other applications as a Cargo crate.
  • cli: a simple CLI to the syswall library, allowing a single program to be traced similarly to the strace tool but with additonal syswall functionality.

The project has been split in this way in order to allow for easier integration of other interfaces. For example, a graphical, web-based or scripting interface could easily be written for the syswall library allowing for usage in environments other than the command-line.

Installation

If you just want to use the CLI, the simplest method of installation is to use cargo install: -

cargo install syswall_cli

This will download the latest version of syswall_cli and all dependencies, build them and install them to your local Cargo binary directory. As long as this directory is in your path, you can now simply run syswall_cli on the command-line.

This method requires you to have installed the Rust toolchain. If you haven't already done this, please follow these official instructions to do so.

Current progress

syswall is a very early prototype and as such only a small amount of the planned functionality is currently implemented.

The handling of syscalls is of course very much platform-dependent. syswall separates the library fuctionality from the actual code to handle particular syscalls, meaning that support for other platforms shold be relatively easy to integrate. So far however only the Linux x86_64 platform is supported.

From the Linux x86_64 platform, only a relatively small number of syscalls are actively handled at present. Currently this includes file I/O and some socket syscalls only.

strace

The syswall CLI can be run with the -vv switch causing it to display all syscalls and results. This provides similar functionality to the strace tool, without the interpretation of syscall arguments as yet.

Interactive execution

For supported syscalls, syswall allows the user to perform the following actions: -

  • Allow the syscall once
  • Always allow that particular syscall
  • Block the syscall once (hard or soft)
  • Always block that particular syscall (hard or soft)

When blocking, the program can perform either a "hard" or a "soft" block. A hard block prevents the syscall from executing and returns an permission denied error to the child process. A soft block on the other hand prevents the syscall but attempts to return a suitable response to the child process in order to pretend that the syscall was actually executed.

Saving and loading of a process configuration

The choices made during execution can be saved to a JSON file. This file can then be loaded during another execution so that the previous choices are used.

This is a work in progress: only always allowed/blocked answers will be saved.

Reporting

When the child process terminates, syswall will output a brief report about the child process's syscalls. Currently this consists of all files and sockets opened or blocked but will be expanded upon in future versions.

Future plans

There is a large to-do list for the project, but some of the highlights are: -

  • Allowing more fine-grained choices, such as always allowing a particular syscall with one or more matching arguments
  • Allowing the child process's state (list of files, sockets, etc) to be saved to a file. This will eventually allow different executions of a program to be compared.
  • Adding an option to ignore all dynamic .so loads.
  • Adding a set of default configurations (e.g. block all sockets but allow file access).
  • Adding of new interfaces, such as graphical, web-based and scripting (Python) interfaces.

syswall's People

Contributors

polaris64 avatar squareflame-simon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

syswall's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.