From 2dc4656d720a4dcbe819688584088b30a9afac0e Mon Sep 17 00:00:00 2001 From: Paramtamtam <7326800+tarampampam@users.noreply.github.com> Date: Mon, 13 Jun 2022 18:07:55 +0400 Subject: [PATCH 1/6] Docker env implemented --- .github/workflows/release.yml | 45 ++++++++++++++++++++++ .github/workflows/tests.yml | 33 ++++++++++++++++ Dockerfile | 72 +++++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b595cea --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: release + +on: + release: # Docs: + types: [published] + +jobs: + docker-image: + name: Build the docker image + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - uses: docker/setup-qemu-action@v2 + + - uses: docker/setup-buildx-action@v2 + + # uncomment for publishing on hub.docker.com (don't forget to fillup the repository secrets) + #- uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKER_LOGIN }} + # password: ${{ secrets.DOCKER_PASSWORD }} + + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: gacts/github-slug@v1 # Action page: + id: slug + + - uses: docker/build-push-action@v3 # Action page: + with: + context: . + file: Dockerfile + push: true + platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 + build-args: HYDRA_VERSION="${{ steps.slug.outputs.version-semantic }}" + tags: | + ghcr.io/${{ github.actor }}/hydra:${{ steps.slug.outputs.version-semantic }} + # append the following line to the list above for publishing on hub.docker.com + # (and don't forget to change on a real repo/user name) + # vanhauser-thc/thc-hydra:${{ steps.slug.outputs.version-semantic }} + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..84e173a --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,33 @@ +name: tests + +on: + push: + branches: [master, main] + tags-ignore: ['**'] + paths-ignore: [README, TODO, PROBLEMS] + pull_request: + paths-ignore: [README, TODO, PROBLEMS] + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: # Docs: + docker-build: + name: Build the docker image + runs-on: ubuntu-20.04 + timeout-minutes: 25 + steps: + - uses: actions/checkout@v3 + + - uses: docker/setup-qemu-action@v2 + + - uses: docker/setup-buildx-action@v2 + + - uses: docker/build-push-action@v3 # Action page: + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm/v7 + push: false + tags: hydra:ci diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4312a10 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,72 @@ +FROM debian:buster-slim + +ARG HYDRA_VERSION="unknown" + +LABEL \ + org.opencontainers.image.url="https://github.com/vanhauser-thc/thc-hydra" \ + org.opencontainers.image.source="https://github.com/vanhauser-thc/thc-hydra" \ + org.opencontainers.image.version="$HYDRA_VERSION" \ + org.opencontainers.image.vendor="vanhauser-thc" \ + org.opencontainers.image.title="hydra" \ + org.opencontainers.image.licenses="GNU AFFERO GENERAL PUBLIC LICENSE" + +COPY . /src + +RUN set -x \ + && apt-get update \ + && apt-get -y install \ + #libmysqlclient-dev \ + default-libmysqlclient-dev \ + libgpg-error-dev \ + #libmemcached-dev \ + #libgcrypt11-dev \ + libgcrypt-dev \ + #libgcrypt20-dev \ + #libgtk2.0-dev \ + libpcre3-dev \ + #firebird-dev \ + libidn11-dev \ + libssh-dev \ + #libsvn-dev \ + libssl-dev \ + #libpq-dev \ + make \ + curl \ + gcc \ + 1>/dev/null \ + # The next line fixes the curl "SSL certificate problem: unable to get local issuer certificate" for linux/arm + && c_rehash \ + # Get hydra sources and compile + && cd /src \ + && ./configure 1>/dev/null \ + && make 1>/dev/null \ + && make install \ + # Make clean + && apt-get purge -y make gcc libgpg-error-dev libgcrypt-dev \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* \ + # Verify hydra installation + && hydra -h || error_code=$? \ + && if [ ! "${error_code}" -eq 255 ]; then echo "Wrong exit code for 'hydra help' command"; exit 1; fi \ + # Unprivileged user creation + && echo 'hydra:x:10001:10001::/tmp:/sbin/nologin' > /etc/passwd \ + && echo 'hydra:x:10001:' > /etc/group + +ARG INCLUDE_SECLISTS="true" + +RUN set -x \ + && if [ "${INCLUDE_SECLISTS}" = "true" ]; then \ + mkdir /tmp/seclists \ + && curl -SL "https://api.github.com/repos/danielmiessler/SecLists/tarball" -o /tmp/seclists/src.tar.gz \ + && tar xzf /tmp/seclists/src.tar.gz -C /tmp/seclists \ + && mv /tmp/seclists/*SecLists*/Passwords /opt/passwords \ + && mv /tmp/seclists/*SecLists*/Usernames /opt/usernames \ + && chmod -R u+r /opt/passwords /opt/usernames \ + && rm -Rf /tmp/seclists \ + && ls -la /opt/passwords /opt/usernames \ + ;fi + +# Use an unprivileged user +USER 10001:10001 + +ENTRYPOINT ["hydra"] From f90c4d24c6fa2baeacb11f4bc5838dc7c6e74dfd Mon Sep 17 00:00:00 2001 From: Paramtamtam <7326800+tarampampam@users.noreply.github.com> Date: Mon, 13 Jun 2022 19:40:11 +0500 Subject: [PATCH 2/6] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b595cea..bfaee9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 build-args: HYDRA_VERSION="${{ steps.slug.outputs.version-semantic }}" tags: | - ghcr.io/${{ github.actor }}/hydra:${{ steps.slug.outputs.version-semantic }} + ghcr.io/${{ github.repository }}:${{ steps.slug.outputs.version-semantic }} # append the following line to the list above for publishing on hub.docker.com # (and don't forget to change on a real repo/user name) # vanhauser-thc/thc-hydra:${{ steps.slug.outputs.version-semantic }} From 26f97b54d56f84c6a2c5da3e226e2f5e5bec2cbf Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 13 Jun 2022 17:09:43 +0200 Subject: [PATCH 3/6] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4312a10..4496f50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM debian:buster-slim -ARG HYDRA_VERSION="unknown" +ARG HYDRA_VERSION="github" LABEL \ org.opencontainers.image.url="https://github.com/vanhauser-thc/thc-hydra" \ From 705a6c180dac7198aaf149aa7466a9d5123510eb Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 13 Jun 2022 17:13:37 +0200 Subject: [PATCH 4/6] Update release.yml --- .github/workflows/release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bfaee9d..5bd629b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,8 +24,8 @@ jobs: - uses: docker/login-action@v2 with: registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} - uses: gacts/github-slug@v1 # Action page: id: slug @@ -37,8 +37,7 @@ jobs: push: true platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 build-args: HYDRA_VERSION="${{ steps.slug.outputs.version-semantic }}" - tags: | - ghcr.io/${{ github.repository }}:${{ steps.slug.outputs.version-semantic }} + tags: vanhauser/hydra:latest # append the following line to the list above for publishing on hub.docker.com # (and don't forget to change on a real repo/user name) # vanhauser-thc/thc-hydra:${{ steps.slug.outputs.version-semantic }} From d5e525bcb0cd9f44a78c45c7ffd588637197d8a0 Mon Sep 17 00:00:00 2001 From: Paramtamtam <7326800+tarampampam@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:20:58 +0500 Subject: [PATCH 5/6] cleanup --- .github/workflows/release.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5bd629b..7c9308d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,12 +15,6 @@ jobs: - uses: docker/setup-buildx-action@v2 - # uncomment for publishing on hub.docker.com (don't forget to fillup the repository secrets) - #- uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_LOGIN }} - # password: ${{ secrets.DOCKER_PASSWORD }} - - uses: docker/login-action@v2 with: registry: ghcr.io @@ -38,7 +32,4 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 build-args: HYDRA_VERSION="${{ steps.slug.outputs.version-semantic }}" tags: vanhauser/hydra:latest - # append the following line to the list above for publishing on hub.docker.com - # (and don't forget to change on a real repo/user name) - # vanhauser-thc/thc-hydra:${{ steps.slug.outputs.version-semantic }} From 63e3dce877e96432a738f93fbedf8586277a0703 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Mon, 13 Jun 2022 17:30:57 +0200 Subject: [PATCH 6/6] Update .github/workflows/release.yml Co-authored-by: Paramtamtam <7326800+tarampampam@users.noreply.github.com> --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c9308d..6b13896 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,6 @@ jobs: - uses: docker/login-action@v2 with: - registry: ghcr.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }}