packetd

module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2019 License: GPL-2.0

README

Build Status Go Report Card GoDoc

packetd

Userspace packet processing daemon

Building locally

You'll need an Untangle mirror to get the patched libnetfilter-queue-dev:

apt-get install libnetfilter-log-dev libnetfilter-queue-dev libnetfilter-conntrack-dev

Then build the regular way:

make

If you want to use the golint tool, you can install it with this command:

go get -u golang.org/x/lint/golint

You can run golint with the following command: (assumes GOPATH=~/golang)

~/golang/bin/golint github.com/untangle/packetd/...

Building in docker

MUSL target

docker-compose -f build/docker-compose.build.yml up --build musl

Result:

# file ./cmd/packetd/packetd
./packetd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, with debug_info, not stripped

glibc target

docker-compose -f build/docker-compose.build.yml up --build glibc

Result:

# file ./cmd/packetd/packetd
./packetd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=7459d11c6fd1dd3ed5d3e3ed5c2320e27dc4bea4, with debug_info, not stripped

Running it locally

You'll also need an Untangle mirror for most of those:

apt-get install untangle-classd untangle-geoip-database untangle-python3-sync-settings libnetfilter-log1 libnetfilter-queue1 libnetfilter-conntrack3 nftables

Then:

./packetd

Running in an OpenWrt container

Make sure your packetd binary is build against MUSL, or it won't be able to run in the MFW container: see "Building in Docker -> MUSL target" above.

Getting the image

They're at https://hub.docker.com/r/untangleinc/mfw/tags

docker pull untangleinc/mfw:x86-64_latest

You can also build one yourself:

git clone https://github.com/untangle/mfw_build.git
cd mfw_build
curl -o openwrt-x86-64-generic-rootfs.tar.gz http://jenkins.untangle.int/.../artifacts/openwrt-x86-64-generic-rootfs_openwrt-18.06_<timestamp>.tar.gz
docker build -f Dockerfile.test.mfw --build-arg ROOTFS_TARBALL=openwrt-x86-64-generic-rootfs.tar.gz -t untangleinc/mfw:x86-64_mytag .

Running packetd in a container

First run this on the host:

modprobe nft_dict

Then launch the container with docker-compose:

docker-compose -f docker-compose.yml run --name mfw --rm packetd

To launch the container with packetd and a slave:

docker-compose -f docker-compose.yml up

To see the containers:

docker container ls

To get a shell in container (in another window):

docker exec -it <container_id> sh

or

ssh root@172.51.0.2

To open web admin from the host goto URL: http:/172.51.0.2/

Redirect your local traffic through the container

To redirect traffic from the host through your container

./util/reroute_host.sh

To undo the "redirect"

./util/unroute_host.sh

To redirect traffic from the slave throught the packetd container:

./util/reroute_slave.sh

Copying a new packetd inside that container

docker cp cmd/packetd/packetd fe6947926f3f:/usr/bin/packetd

golint

Get golint:

go get -u golang.org/x/lint/golint

Use it:

${GOPATH}/bin/golint $(pwd)/...

Directories

Path Synopsis
cmd
plugins
classify
Package classify classifies sessions as certain applications each packet gets sent to a classd daemon (the categorization engine) the classd daemon returns the classification information and classify attaches the information to the session.
Package classify classifies sessions as certain applications each packet gets sent to a classd daemon (the categorization engine) the classd daemon returns the classification information and classify attaches the information to the session.
dns
reporter
Package reporter provides the "reporter" plugin The reporter plugin listens to networking events and writes them to the database
Package reporter provides the "reporter" plugin The reporter plugin listens to networking events and writes them to the database
sni
services
dispatch
Package dispatch provides dispatching of network/kernel events to various subscribers It provides an API for plugins to subscribe to for 3 types of network events 1) NFqueue (netfilter queue) packets 2) Conntrack events (New, Update, Destroy) 3) Netlogger events (from NFLOG target) The dispatch will register global callbacks with the kernel package and then dispatch events to subscribers accordingly
Package dispatch provides dispatching of network/kernel events to various subscribers It provides an API for plugins to subscribe to for 3 types of network events 1) NFqueue (netfilter queue) packets 2) Conntrack events (New, Update, Destroy) 3) Netlogger events (from NFLOG target) The dispatch will register global callbacks with the kernel package and then dispatch events to subscribers accordingly

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL