From 0041aedaad74b3caa83ef926a4ccfd4932f92b40 Mon Sep 17 00:00:00 2001 From: Florian Wahl <41266220+wahlflo@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:42:26 +0100 Subject: [PATCH 1/5] updated Dockerfile --- src/Dockerfile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 585841e..b6cd021 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -5,25 +5,25 @@ FROM ubuntu:22.04 AS builder ENV DEBIAN_FRONTEND=noninteractive # Enable 'deb-src' entries and install dependencies -RUN sed -i -e 's/^# deb-src/deb-src/' /etc/apt/sources.list && \ - apt-get update && \ - apt-get install --no-install-recommends -y \ +RUN sed -i -e 's/^# deb-src/deb-src/' /etc/apt/sources.list +RUN apt-get update +RUN apt-get install --no-install-recommends -y \ build-essential \ fakeroot \ devscripts \ tzdata \ openssh-client \ putty-tools \ - python3-twisted && \ - apt-get build-dep --no-install-recommends -y openssh-server && \ - mkdir -p /src && cd /src && \ - apt-get source openssh-server && \ - cd openssh-* && \ - sed -i 's/^\([ \t]*\)\(struct passwd \*pw = authctxt->pw;\)/\1logit("Login attempt by username '\''%s'\'', password '\''%s'\'', from ip '\''%.200s'\''", authctxt->user, password, ssh_remote_ipaddr(ssh));\nreturn 0;\1\2/' auth-passwd.c && \ - debchange --nmu 'add verbose logging of usernames and passwords' && \ - EDITOR=true dpkg-source --commit . 'chatty-ssh.patch' && \ - debuild -us -uc -i -I && \ - apt-get clean && apt-get autoremove -y + python3-twisted +RUN apt-get build-dep --no-install-recommends -y openssh-server +RUN mkdir -p /src && cd /src +RUN apt-get source openssh-server +RUN cd openssh-* +RUN sed -i 's/^\([ \t]*\)\(struct passwd \*pw = authctxt->pw;\)/\1logit("Login attempt by username '\''%s'\'', password '\''%s'\'', from ip '\''%.200s'\''", authctxt->user, password, ssh_remote_ipaddr(ssh));\nreturn 0;\1\2/' auth-passwd.c +RUN debchange --nmu 'add verbose logging of usernames and passwords' +RUN EDITOR=true dpkg-source --commit . 'chatty-ssh.patch' +RUN debuild -us -uc -i -I +RUN apt-get clean && apt-get autoremove -y # Stage 2: Runtime stage FROM ubuntu:22.04 From f2b585cef999e9da5bed9cf0700e6552cc9acb9d Mon Sep 17 00:00:00 2001 From: Florian Wahl <41266220+wahlflo@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:51:26 +0100 Subject: [PATCH 2/5] updated integration test --- .github/workflows/integration-tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b264c8d..a8fd35c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,7 +47,7 @@ jobs: fi repo="${{ github.repository }}" - echo VERSIONED_IMAGE_FQN="ghcr.io/${repo,,}:$version-${{ matrix.arch }}" >> $GITHUB_ENV + echo VERSIONED_IMAGE_FQN="ghcr.io/${repo,,}:latest-${{ matrix.arch }}" >> $GITHUB_ENV echo LATEST_IMAGE_FQN="ghcr.io/${repo,,}:latest-${{ matrix.arch }}" >> $GITHUB_ENV echo OVERWRITE_LATEST="$overwrite_latest" >> $GITHUB_ENV @@ -58,8 +58,7 @@ jobs: file: src/Dockerfile platforms: linux/${{ matrix.arch }} tags: | - ${{ env.VERSIONED_IMAGE_FQN }} - ${{ env.LATEST_IMAGE_FQN }} + netwatch_ssh-attackpod:latest-${{ matrix.arch }} load: true push: false @@ -70,6 +69,6 @@ jobs: - name: Run python based integration tests via pytest env: - DOCKER_IMAGE_FQN: ${{ env.VERSIONED_IMAGE_FQN }} + DOCKER_IMAGE_FQN: netwatch_ssh-attackpod:latest-${{ matrix.arch }} run: | pytest tests/ From 2b14f20542c510ced6cd76d64e30da0bd4ee3d01 Mon Sep 17 00:00:00 2001 From: Florian Wahl <41266220+wahlflo@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:56:59 +0100 Subject: [PATCH 3/5] update --- src/Dockerfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index b6cd021..c500706 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -16,14 +16,13 @@ RUN apt-get install --no-install-recommends -y \ putty-tools \ python3-twisted RUN apt-get build-dep --no-install-recommends -y openssh-server -RUN mkdir -p /src && cd /src -RUN apt-get source openssh-server -RUN cd openssh-* -RUN sed -i 's/^\([ \t]*\)\(struct passwd \*pw = authctxt->pw;\)/\1logit("Login attempt by username '\''%s'\'', password '\''%s'\'', from ip '\''%.200s'\''", authctxt->user, password, ssh_remote_ipaddr(ssh));\nreturn 0;\1\2/' auth-passwd.c -RUN debchange --nmu 'add verbose logging of usernames and passwords' -RUN EDITOR=true dpkg-source --commit . 'chatty-ssh.patch' -RUN debuild -us -uc -i -I -RUN apt-get clean && apt-get autoremove -y +RUN mkdir -p /src && cd /src && apt-get source openssh-server +RUN cd /src && cd openssh-* && \ + sed -i 's/^\([ \t]*\)\(struct passwd \*pw = authctxt->pw;\)/\1logit("Login attempt by username '\''%s'\'', password '\''%s'\'', from ip '\''%.200s'\''", authctxt->user, password, ssh_remote_ipaddr(ssh));\nreturn 0;\1\2/' auth-passwd.c +RUN cd /src && cd openssh-* && debchange --nmu 'add verbose logging of usernames and passwords' +RUN cd /src && cd openssh-* && EDITOR=true dpkg-source --commit . 'chatty-ssh.patch' +RUN cd /src && cd openssh-* && debuild -us -uc -i -I +RUN cd /src && cd openssh-* && apt-get clean && apt-get autoremove -y # Stage 2: Runtime stage FROM ubuntu:22.04 From 0175bc6614f418cf8cdc6ba6a26550309c75c96a Mon Sep 17 00:00:00 2001 From: Florian Wahl <41266220+wahlflo@users.noreply.github.com> Date: Tue, 11 Feb 2025 20:38:01 +0100 Subject: [PATCH 4/5] removed not needed section from integration test workflow --- .github/workflows/integration-tests.yml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a8fd35c..3ca45c3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -27,30 +27,6 @@ jobs: with: platforms: linux/${{ matrix.arch }} - - name: Build image repo name - run: | - version="" - overwrite_latest="" - if [ -n "${{ github.event.inputs.image_tag_version }}" ]; then - # use input string as version - version="${{ github.event.inputs.image_tag_version }}" - overwrite_latest="${{ github.event.inputs.override_latest }}" - else - # use git tag as version - version="${{ github.ref_name }}" - overwrite_latest="true" - fi - - if [ -z "$version" ] || [ -z "$overwrite_latest" ]; then - echo "Image tag version or overwrite_latest flag could not be determined" - exit 1 - fi - - repo="${{ github.repository }}" - echo VERSIONED_IMAGE_FQN="ghcr.io/${repo,,}:latest-${{ matrix.arch }}" >> $GITHUB_ENV - echo LATEST_IMAGE_FQN="ghcr.io/${repo,,}:latest-${{ matrix.arch }}" >> $GITHUB_ENV - echo OVERWRITE_LATEST="$overwrite_latest" >> $GITHUB_ENV - - name: Docker build uses: docker/build-push-action@v6 with: From bff28a8f42cacfddf1c2a58f4a2dadc5c8ec3374 Mon Sep 17 00:00:00 2001 From: Florian Wahl <41266220+wahlflo@users.noreply.github.com> Date: Tue, 11 Feb 2025 21:45:01 +0100 Subject: [PATCH 5/5] added DEB_HOST_ARCH env var at build --- .github/workflows/integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 3ca45c3..76ae303 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -46,5 +46,6 @@ jobs: - name: Run python based integration tests via pytest env: DOCKER_IMAGE_FQN: netwatch_ssh-attackpod:latest-${{ matrix.arch }} + DEB_HOST_ARCH: ${{ matrix.arch }} run: | pytest tests/