diff --git a/.github/workflows/auto-update-from-base-docker.yml b/.github/workflows/auto-update-from-base-docker.yml new file mode 100644 index 0000000..84e2448 --- /dev/null +++ b/.github/workflows/auto-update-from-base-docker.yml @@ -0,0 +1,58 @@ +name: Docker Base Auto Update CI + +on: + schedule: + - cron: "23 13 3 * *" + + +jobs: + + build: + + runs-on: ubuntu-latest + env: + DOCKER_PLATFORMS: linux/amd64,linux/armhf,linux/arm64 + + + steps: + - + name: Docker Image Update Checker + id: baseupdatecheck + uses: lucacome/docker-image-update-checker@v1 + with: + base-image: library/ubuntu:latest + image: simeononsecurity/samplicator:latest + - + name: Checkout + uses: actions/checkout@v3 + if: steps.check.outputs.needs-updating == 'true' + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + if: steps.check.outputs.needs-updating == 'true' + - + name: setup docker buildx + uses: docker/setup-buildx-action@v1 + id: buildx + with: + install: true + if: steps.check.outputs.needs-updating == 'true' + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + if: steps.check.outputs.needs-updating == 'true' + - + name: Build the Docker image + run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && docker buildx build --platform linux/amd64,linux/armhf,linux/arm64 -t simeononsecurity/samplicator:latest --progress=plain --push . + if: steps.check.outputs.needs-updating == 'true' + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: simeononsecurity/samplicator:latest + if: steps.check.outputs.needs-updating == 'true' diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..62b4631 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,56 @@ +name: Docker Image CI + +on: + push: + branches: [ master ] + + +jobs: + + build: + + runs-on: ubuntu-latest + env: + DOCKER_PLATFORMS: linux/amd64,linux/armhf,linux/arm64 + + + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: setup docker buildx + uses: docker/setup-buildx-action@v1 + id: buildx + with: + install: true + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Build the Docker image + run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && docker buildx build --platform linux/amd64,linux/armhf,linux/arm64 -t simeononsecurity/samplicator:latest --progress=plain --push . + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: simeononsecurity/samplicator:latest + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.PAT_TOKEN }} + + - name: Build the simeononsecurity/samplicator:latest Docker image for Github Registry + run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && docker buildx build --platform linux/amd64,linux/armhf,linux/arm64 -t ghcr.io/simeononsecurity/samplicator:latest --progress=plain --push . + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9c70f7e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +#https://github.com/sleinen/samplicator +FROM ubuntu:latest + +LABEL org.opencontainers.image.source="https://github.com/simeononsecurity/samplicator" +LABEL org.opencontainers.image.description="Send copies of (UDP) datagrams to multiple receivers, with optional sampling and spoofing" +LABEL org.opencontainers.image.authors="simeononsecurity" + +ENV DEBIAN_FRONTEND noninteractive +ENV container docker + +# Specify Samplicator Environment Variables +#ENV samplicator_port=1700 +#ENV samplicator_arguments='192.168.1.1/1700' + +# Open Samplicator Listening Ports +#EXPOSE ${samplicator_port}:${samplicator_port}/udp + +# Update Packages +RUN apt-get update && apt-get install -y --no-install-recommends apt-utils && apt-get -y -f -m --show-progress --no-install-recommends full-upgrade + +# Install Supporting Software +RUN apt-get install -y --no-install-recommends git cmake make htop wget systemctl gcc curl gpg automake autogen + +# Install Samplicator +RUN git clone https://github.com/simeononsecurity/samplicator.git +RUN cd ./samplicator && bash ./autogen.sh +RUN cd /samplicator && ./configure +RUN cd /samplicator && make +RUN cd /samplicator && make install + +#RUN cd /samplicator/ && chmod +x ./dockersetup.sh +#RUN cd /samplicator/ && cat ./dockersetup.sh +#CMD ["/bin/bash", "/samplicator/dockersetup.sh"] + +# Clean APT +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +ENTRYPOINT ["samplicate"] diff --git a/INSTALL.md b/INSTALL.md index 737cca4..52bda12 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -44,3 +44,13 @@ Then install and start the new service. On my CentOS 7.2, it looks like this: cp samplicator.service /etc/systemd/system/samplicator.service systemctl daemon-reload systemctl start samplicator.service + +Run Samplicator in Docker +-------------------------- +Example: +```bash +docker run \ + --net='bridge' \ + -p '1700:1700'/udp \ + --name samplicator -td sleinen/samplicator -S 192.168.1.10 -x 10 -p 1700 192.168.1.11/1700 192.168.1.12/1700 +``` diff --git a/samplicator.service b/samplicator.service index db3b2ca..129e673 100644 --- a/samplicator.service +++ b/samplicator.service @@ -12,7 +12,7 @@ After=network.target [Service] Type=forking -ExecStart=/opt/samplicator/bin/samplicate -S -c /opt/samplicator/etc/samplicator.conf -p 162 -d 0 -f +ExecStart=/usr/local/bin/samplicate -p ${samplicator_port} ${samplicator_arguments} [Install] WantedBy=multi-user.target