Skip to content
Draft
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
30 changes: 3 additions & 27 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,14 @@ 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,,}:$version-${{ 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:
context: src
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

Expand All @@ -70,6 +45,7 @@ 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 }}
DEB_HOST_ARCH: ${{ matrix.arch }}
run: |
pytest tests/
25 changes: 12 additions & 13 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,24 @@ 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 && 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
Expand Down
Loading