Skip to content

Commit 78e33f2

Browse files
committed
feat: Initial release
0 parents  commit 78e33f2

File tree

8 files changed

+435
-0
lines changed

8 files changed

+435
-0
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: monthly

.github/workflows/release.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
name: Release
3+
'on':
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
schedule:
9+
- cron: "0 7 * * 0"
10+
11+
env:
12+
IMAGE_NAME: fixbuf
13+
14+
jobs:
15+
16+
# Test the image builds and works correctly.
17+
test:
18+
name: Test
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Check out the codebase.
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python 3.
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.x'
29+
30+
- name: Install test dependencies.
31+
run: pip3 install pytest-testinfra
32+
33+
- name: Build image.
34+
run: docker build -t cmusei/${{ env.IMAGE_NAME }} .
35+
36+
- name: Run the built image.
37+
run: docker run --name=${{ env.IMAGE_NAME }} -td cmusei/${{ env.IMAGE_NAME }}
38+
39+
- name: Test the built image.
40+
run: py.test --hosts='docker://${{ env.IMAGE_NAME }}'
41+
42+
# If on main branch, build and release image.
43+
release2:
44+
name: Release2
45+
runs-on: ubuntu-latest
46+
needs: test
47+
if: github.ref == 'refs/heads/main'
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: docker/setup-qemu-action@v3
52+
- uses: docker/setup-buildx-action@v3
53+
54+
- name: Login to DockerHub
55+
uses: docker/login-action@v3
56+
with:
57+
username: ${{ secrets.DOCKER_USERNAME }}
58+
password: ${{ secrets.DOCKER_PASSWORD }}
59+
60+
- name: Build and push image.
61+
uses: docker/build-push-action@v6
62+
with:
63+
context: ./
64+
file: Dockerfile
65+
platforms: linux/amd64,linux/arm64
66+
push: true
67+
tags: |
68+
cmusei/${{ env.IMAGE_NAME }}:latest
69+
cmusei/${{ env.IMAGE_NAME }}:2
70+
cmusei/${{ env.IMAGE_NAME }}:2.5.0
71+
release3:
72+
name: Release3
73+
runs-on: ubuntu-latest
74+
needs: test
75+
if: github.ref == 'refs/heads/main'
76+
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: docker/setup-qemu-action@v3
80+
- uses: docker/setup-buildx-action@v3
81+
82+
- name: Login to DockerHub
83+
uses: docker/login-action@v3
84+
with:
85+
username: ${{ secrets.DOCKER_USERNAME }}
86+
password: ${{ secrets.DOCKER_PASSWORD }}
87+
88+
- name: Build and push image.
89+
uses: docker/build-push-action@v6
90+
with:
91+
context: ./
92+
file: Dockerfile
93+
platforms: linux/amd64,linux/arm64
94+
push: true
95+
build-args: |
96+
FIXBUF_VERSION=3.0.0.alpha2
97+
tags: |
98+
cmusei/${{ env.IMAGE_NAME }}:3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__pycache__/
2+
inventory
3+
pytest_junit.xml

Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM debian:11 AS build
2+
3+
# Specify software versions to download
4+
ARG FIXBUF_VERSION=2.5.0
5+
6+
# Pre-reqs:
7+
# curl for downloading
8+
# build-essentials for build tools
9+
# ca-certs to download https
10+
# glib2.0 for fixbuf
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
curl \
13+
build-essential \
14+
ca-certificates \
15+
libssl-dev \
16+
libglib2.0-dev \
17+
&& apt-get clean && \
18+
rm -rf /var/lib/apt/lists/*
19+
20+
RUN mkdir /netsa
21+
WORKDIR /netsa
22+
23+
# Download & Install fixbuf
24+
RUN curl https://tools.netsa.cert.org/releases/libfixbuf-$FIXBUF_VERSION.tar.gz | \
25+
tar -xz && cd libfixbuf-* && \
26+
./configure --prefix=/netsa \
27+
--with-openssl && \
28+
make && \
29+
make install && \
30+
cd ../ && rm -rf libfixbuf-$FIXBUF_VERSION
31+
32+
FROM debian:11-slim
33+
LABEL maintainer="[email protected]"
34+
35+
RUN mkdir /netsa
36+
37+
RUN apt-get update && apt-get install -y --no-install-recommends \
38+
libssl1.1 \
39+
pkg-config \
40+
libglib2.0-0 \
41+
&& apt-get clean && \
42+
rm -rf /var/lib/apt/lists/*
43+
44+
ENV PATH=$PATH:/netsa/bin
45+
46+
COPY --from=build /netsa/ /netsa/

LICENSE

Lines changed: 133 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# source: https://jmkhael.io/makefiles-for-your-dockerfiles/
2+
# Run in parallel via make -j2 see: https://stackoverflow.com/a/9220818
3+
4+
NS = cmusei
5+
export SOFTWARE_NAME = fixbuf
6+
7+
export IMAGE_NAME += $(NS)/$(SOFTWARE_NAME)
8+
9+
export WORK_DIR = .
10+
11+
.PHONY: build build2 build3 test
12+
13+
build: build2
14+
15+
build2:
16+
docker build --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy -t $(IMAGE_NAME):latest -f Dockerfile .
17+
docker tag $(IMAGE_NAME):latest $(IMAGE_NAME):2
18+
19+
build3:
20+
docker build --build-arg http_proxy --build-arg https_proxy --build-arg no_proxy --build-arg FIXBUF_VERSION=3.0.0.alpha2 -t $(IMAGE_NAME):3 -f Dockerfile .
21+
22+
test:
23+
docker rm -f $(SOFTWARE_NAME)
24+
docker run --name=$(SOFTWARE_NAME) -td $(IMAGE_NAME)
25+
py.test --hosts='docker://$(SOFTWARE_NAME)'
26+
docker rm -f $(SOFTWARE_NAME)
27+
28+
default: build

README.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
[![Software Engineering Institute](https://avatars.githubusercontent.com/u/12465755?s=200&v=4)](https://www.sei.cmu.edu/)
2+
3+
[![Blog](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Blog)](https://insights.sei.cmu.edu/blog/ "blog posts from our experts in Software Engineering.")
4+
[![Youtube](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Youtube&logo=youtube)](https://www.youtube.com/@TheSEICMU/ "vidoes from our experts in Software Engineering.")
5+
[![Podcasts](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Podcasts&logo=applepodcasts)](https://insights.sei.cmu.edu/podcasts/ "podcasts from our experts in Software Engineering.")
6+
[![GitHub](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=GitHub&logo=github)](https://github.com/cmu-sei "view the source for all of our repositories.")
7+
[![Flow Tools](https://img.shields.io/static/v1.svg?color=468f8b&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=SEI&message=Flow%20Tools)](https://tools.netsa.cert.org/ "documentation and source for all our flow collection and analysis tools.")
8+
9+
10+
At the [SEI](https://www.sei.cmu.edu/), we research software engineering, cybersecurity, and AI engineering problems; create innovative technologies; and put solutions into practice.
11+
12+
Find us at:
13+
14+
* [Blog](https://insights.sei.cmu.edu/blog/) - blog posts from our experts in Software Engineering.
15+
* [Youtube](https://www.youtube.com/@TheSEICMU/) - vidoes from our experts in Software Engineering.
16+
* [Podcasts](https://insights.sei.cmu.edu/podcasts/) - podcasts from our experts in Software Engineering.
17+
* [GitHub](https://github.com/cmu-sei) - view the source for all of our repositories.
18+
* [Flow Tools](https://tools.netsa.cert.org/) - documentation and source for all our flow collection and analysis tools.
19+
20+
# [certcc/fixbuf](https://tools.netsa.cert.org/fixbuf2/index.html)
21+
22+
[libfixbuf](https://tools.netsa.cert.org/fixbuf2/index.html) is a compliant implementation of the IPFIX Protocol, as defined in the "Specification of the IPFIX Protocol for the Exchange of Flow Information" (RFC 7011). It supports the information model defined in "Information Model for IP Flow Information Export" (RFC 7012), extended as proposed by "Bidirectional Flow Export using IPFIX" (RFC 5103) to support information elements for representing biflows. libfixbuf supports structured data elements as described in "Export of Structured Data in IPFIX" (RFC 6313), which adds the ability to export basicLists, subTemplateLists, and subTemplateMultiLists. libfixbuf can export type information for IPFIX elements as described in "Exporting Type Information for IPFIX Information Elements" (RFC 5610), and it supports reading this information.
23+
24+
## Documentation
25+
26+
More information [here](https://tools.netsa.cert.org/fixbuf2/libfixbuf/index.html).
27+
28+
## Usage
29+
30+
The intention of this container is to be used as a base for building other [NetSA tool](https://tools.netsa.cert.org/index.html) container images.
31+
32+
However, [ipfixDump](https://tools.netsa.cert.org/fixbuf2/ipfixDump.html) is included as part of the fixbuf install and can be used to print contents of an IPFIX file as human-readable text. For example, the below command mounts the `$PWD/test` folder from the host to `/tmp` in the `fixbuf` container. It contains a yaf produced ipfix file named `flows.yaf-20231026175944-00000.yaf`, that we use ipfixDump to produce stats for:
33+
34+
```bash
35+
docker run --rm -it -v $PWD/test:/tmp \
36+
cmusei/fixbuf:latest \
37+
ipfixDump \
38+
--in /tmp/flows.yaf-20231026175944-00000.yaf \
39+
--stats \
40+
--yaf
41+
```
42+
```
43+
*** File Stats: 2 Messages, 9 Data Records, 43 Template Records ***
44+
Template ID | Records
45+
45873 (0xb331)| 9
46+
49155 (0xc003)| 0
47+
49156 (0xc004)| 0
48+
49157 (0xc005)| 0
49+
49160 (0xc008)| 0
50+
49161 (0xc009)| 0
51+
49171 (0xc013)| 0
52+
49173 (0xc015)| 0
53+
49176 (0xc018)| 0
54+
49664 (0xc200)| 0
55+
49670 (0xc206)| 0
56+
49920 (0xc300)| 0
57+
50176 (0xc400)| 0
58+
50432 (0xc500)| 0
59+
50688 (0xc600)| 0
60+
50944 (0xc700)| 0
61+
51200 (0xc800)| 0
62+
51456 (0xc900)| 0
63+
51712 (0xca00)| 0
64+
51722 (0xca0a)| 4
65+
51723 (0xca0b)| 4
66+
51969 (0xcb01)| 0
67+
51970 (0xcb02)| 0
68+
51971 (0xcb03)| 0
69+
52224 (0xcc00)| 1
70+
52480 (0xcd00)| 0
71+
52736 (0xce00)| 0
72+
52737 (0xce01)| 0
73+
52738 (0xce02)| 0
74+
52739 (0xce03)| 0
75+
52740 (0xce04)| 0
76+
52741 (0xce05)| 0
77+
52742 (0xce06)| 0
78+
52743 (0xce07)| 0
79+
52744 (0xce08)| 0
80+
52745 (0xce09)| 0
81+
52748 (0xce0c)| 0
82+
52749 (0xce0d)| 0
83+
52756 (0xce14)| 0
84+
52992 (0xcf00)| 0
85+
53251 (0xd003)| 0
86+
53252 (0xd004)| 0
87+
53253 (0xd005)| 0
88+
```
89+
90+
Version 3+ of the fixbuf container contains the [ipfix2json](https://tools.netsa.cert.org/fixbuf/ipfix2json.html) tool, which can be used to print contents of an IPFIX file as json text. For example, using the same IPFIX input file from above `flows.yaf-20231026175944-00000.yaf`:
91+
92+
```bash
93+
docker run --rm -it -v $PWD/test:/tmp \
94+
cmusei/fixbuf:3 \
95+
ipfix2json \
96+
--in /tmp/flows.yaf-20231026175944-00000.yaf \
97+
--out -
98+
```
99+
```
100+
{"template_record:0xd005()":["certToolId","observationTimeSeconds"]}
101+
{"template_record:0xc003()":["tcpSequenceNumber","initialTCPFlags","unionTCPFlags"]}
102+
{"template_record:0xce07()":["dnsTXTData"]}
103+
{"template_record:0xc009()":["mptcpInitialDataSequenceNumber","mptcpReceiverToken","mptcpMaximumSegmentSize","mptcpAddressId","mptcpFlags"]}
104+
{"template_record:0xca00()":["basicList","basicList","basicList","basicList","basicList","basicList","basicList"]}
105+
{"template_record:0xc400()":["tftpFilename","tftpMode"]}
106+
{"template_record:0xce02()":["sourceIPv6Address"]}
107+
{"template_record:0xce0d()":["mysqlCommandText","mysqlCommandCode","paddingOctets"]}
108+
{"template_record:0xc004()":["sourceMacAddress","destinationMacAddress"]}
109+
{"template_record:0xce08()":["dnsSRVTarget","dnsSRVPriority","dnsSRVWeight","dnsSRVPort","paddingOctets"]}
110+
{"template_record:0xc015()":["dataByteCount","averageInterarrivalTime","standardDeviationInterarrivalTime","tcpUrgTotalCount","smallPacketCount","nonEmptyPacketCount","largePacketCount","firstNonEmptyPacketSize","maxPacketSize","standardDeviationPayloadLength","firstEightNonEmptyPacketDirections","paddingOctets","reverseDataByteCount","reverseAverageInterarrivalTime","reverseStandardDeviationInterarrivalTime","reverseTcpUrgTotalCount","reverseSmallPacketCount","reverseNonEmptyPacketCount","reverseLargePacketCount","reverseFirstNonEmptyPacketSize","reverseMaxPacketSize","reverseStandardDeviationPayloadLength","paddingOctets"]}
111+
snip...
112+
```

tests/default/test_default.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def test_fixbuf_version(host):
2+
version = "2.5.0"
3+
command = """PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/netsa/lib/pkgconfig \
4+
pkg-config --modversion libfixbuf"""
5+
6+
cmd = host.run(command)
7+
8+
assert version in cmd.stdout

0 commit comments

Comments
 (0)