GithubHelp home page GithubHelp logo

anthrax3 / opensnitch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evilsocket/opensnitch

0.0 1.0 0.0 317 KB

OpenSnitch is a GNU/Linux port of the Little Snitch application firewall.

Home Page: https://opensnitch.io/

License: GNU General Public License v3.0

Python 100.00%

opensnitch's Introduction

OpenSnitch

OpenSnitch is a GNU/Linux port of the Little Snitch application firewall.

OpenSnitch

Warning: This is still alpha quality software, don't rely on it (yet) for your computer security.

Requirements

You'll need a GNU/Linux distribution with iptables, NFQUEUE and ftrace kernel support. In addition, you'll need the following package dependencies:

Debian/Ubuntu:

sudo apt install build-essential \
                 libcap-dev \
                 libnetfilter-queue-dev \
                 libnfnetlink-dev \
                 python3-dbus \
                 python3-dev \
                 python3-gi \
                 python3-pyinotify \
                 python3-pyqt5 \
                 python3-setuptools

Fedora:

sudo dnf install @C-development \
                 libcap-devel \
                 libnetfilter_queue-devel \
                 python3-dbus \
                 python3-devel \
                 python3-inotify \
                 python3-qt5 \
                 python3-setuptools \
                 redhat-rpm-config

Arch:

There is an AUR package available at https://aur.archlinux.org/packages/opensnitch-git/

Build and Install

cd opensnitch
sudo python3 setup.py install

Run

sudo -HE opensnitchd
opensnitch-qt

Known Issues / Future Improvements

Before opening an issue, keep in mind that the current implementation is just an experiment to see the doability of the project, future improvements of OpenSnitch will include:

Split the project into opensnitchd, opensnitch-ui and opensnitch-ruleman:

  • opensnitchd will be a (C++ ? TBD) daemon, running as root with the main logic. It'll fix this.
  • opensnitch-ui python (?) UI running as normal user, getting the daemon messages. Will fix this.
  • opensnitch-ruleman python (?) UI for rule editing.

How Does It Work

OpenSnitch is an application level firewall, meaning then while running, it will detect and alert the user for every outgoing connection applications he's running are creating. This can be extremely effective to detect and block unwanted connections on your system that might be caused by a security breach, causing data exfiltration to be much harder for an attacker. In order to do that, OpenSnitch relies on NFQUEUE, an iptables target/extension which allows an userland software to intercept IP packets and either ALLOW or DROP them, once started it'll install the following iptables rules:

OUTPUT -t mangle -m conntrack --ctstate NEW -j NFQUEUE --queue-num 0 --queue-bypass

This will use conntrack iptables extension to pass all newly created connection packets to NFQUEUE number 0 (the one OpenSnitch is listening on), and then:

INPUT --protocol udp --sport 53 -j NFQUEUE --queue-num 0 --queue-bypass

This will also redirect DNS queries to OpenSnitch, allowing the software to perform and IP -> hostname resolution without performing active DNS queries itself.

Once a new connection is detected, the software relies on the ftrace kernel extension in order to track which PID (therefore which process) is creating the connection.

If ftrace is not available for your kernel, OpenSnitch will fallback using the /proc filesystem, even if this method will also work, it's vulnerable to application path manipulation as described in this issue, therefore it's highly suggested to run OpenSnitch on a ftrace enabled kernel.

TODOs

grep -r TODO opensnitch | cut -d '#' -f 2 | sort -u

License

This project is copyleft of Simone Margaritelli and released under the GPL 3 license.

opensnitch's People

Contributors

0xacb avatar adisbladis avatar carlosotgz avatar ckuethe avatar cyphar avatar da2x avatar evilsocket avatar jacobculley avatar kant avatar markoshiva avatar melizeche avatar omern1 avatar richardburleigh avatar

Watchers

 avatar

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.