Skip to content

Commit

Permalink
Merge pull request vanhauser-thc#767 from tarampampam/docker-image
Browse files Browse the repository at this point in the history
Hydra docker image
  • Loading branch information
vanhauser-thc authored Jun 13, 2022
2 parents b9a985f + 63e3dce commit c9555fb
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release

on:
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
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

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- uses: gacts/github-slug@v1 # Action page: <https://github.com/gacts/github-slug>
id: slug

- uses: docker/build-push-action@v3 # Action page: <https://github.com/docker/build-push-action>
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: vanhauser/hydra:latest

33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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: <https://git.io/JvxXE>
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: <https://github.com/docker/build-push-action>
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm/v7
push: false
tags: hydra:ci
72 changes: 72 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
FROM debian:buster-slim

ARG HYDRA_VERSION="github"

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"]

0 comments on commit c9555fb

Please sign in to comment.