Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to pcapyng #302

Merged
merged 11 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 32 additions & 19 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,54 @@ on:
release:
types: [published]

workflow_dispatch:
inputs:
opencanary-branch:
description: "Branch of the opencanary repo to use"
default: 'master'
required: false

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set Image tag
run: |
if [[ "${{ github.ref_name }}" == "master" ]]; then
echo "TAG=latest" >> "$GITHUB_ENV"
else
echo "TAG=${{ github.ref_name }}" >> "$GITHUB_ENV"
fi

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
ref: ${{ inputs.opencanary-branch }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Github Container Registry
- name: Login to Dockerhub Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
thinkst/opencanary
tags: |
type=raw,value=latest
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha

- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.latest
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ env.TAG }}
cache-to: type=inline
tags: ghcr.io/${{ github.repository }}:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
9 changes: 5 additions & 4 deletions Dockerfile.latest
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM python:3.10-buster

# Download cache lists and install minimal versions
RUN apt-get update && apt-get -yq install --no-install-recommends \
# Required linux dependencies
sudo && \
# Remove cache lists and clean up anything not needed to minimize image size
apt-get autoremove -yq && apt-get clean && rm -rf /var/lib/apt/lists/*
# Required linux dependencies
sudo vim build-essential libssl-dev libffi-dev python-dev libpcap-dev && \
# Remove cache lists and clean up anything not needed to minimize image size
apt-get autoremove -yq && apt-get clean && rm -rf /var/lib/apt/lists/*

# Create and set the working directory
WORKDIR /opencanary
Expand All @@ -17,6 +17,7 @@ COPY bin /opencanary/bin

# Install the required dependencies
RUN pip install -r requirements.txt
RUN pip install scapy pcapy-ng

# Copy in the latest version
COPY opencanary ./opencanary
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.stable
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-buster
FROM python:3.10-buster

# Download cache lists and install minimal versions
RUN apt-get update && apt-get -yq install --no-install-recommends \
Expand All @@ -9,7 +9,7 @@ RUN apt-get update && apt-get -yq install --no-install-recommends \

# Install required pip dependencies
RUN pip install opencanary
RUN pip install scapy pcapy
RUN pip install scapy pcapy-ng

# Set the default application we are running
ENTRYPOINT [ "opencanaryd" ]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $ sudo apt install samba # if you plan to use the smb module
$ virtualenv env/
$ . env/bin/activate
$ pip install opencanary
$ pip install scapy pcapy # optional
$ pip install scapy pcapy-ng # optional
```
## Installation [OS X]

Expand Down Expand Up @@ -88,7 +88,7 @@ $ env ARCHFLAGS="-arch arm64" LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" CFLA
Now the installation can run as usual:
```
$ pip install opencanary
$ pip install scapy pcapy # optional
$ pip install scapy pcapy-ng # optional
```
## Installation [GIT]

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ x-common: &common
volumes:
- ./data/.opencanary.conf:/root/.opencanary.conf
image: "opencanary"
network_mode: "host"
ports:
# Comment/un-comment the port lines below to disable/enable the services you are using
# FTP
Expand Down Expand Up @@ -44,6 +45,7 @@ services:
latest: # docker-compose up --build -d latest
<<: *common
container_name: opencanary_latest
image: thinkst/opencanary
build:
context: .
dockerfile: Dockerfile.latest
Expand Down