From 17780ff1945027624fe90f7d4fbacf28453f93f8 Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Tue, 20 Oct 2020 11:31:50 -0400 Subject: [PATCH] Added support for building official docker images. (#76) --- .dockerignore | 3 +++ Dockerfile | 10 ++++++++++ Makefile.docker | 13 +++++++++++++ PACKAGING | 12 ++++++++++++ README.md | 6 ++++++ 5 files changed, 44 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Makefile.docker diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e7e7b48 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +src/ssh_audit/__pycache__/ +src/ssh_audit.egg-info/ +src/ssh_audit/*~ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bacd451 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.8-slim + +WORKDIR / + +COPY ssh-audit.py . +COPY src/ . + +ENTRYPOINT ["python3", "/ssh-audit.py"] + +EXPOSE 2222 diff --git a/Makefile.docker b/Makefile.docker new file mode 100644 index 0000000..3028f2c --- /dev/null +++ b/Makefile.docker @@ -0,0 +1,13 @@ +VERSION = $(shell grep VERSION src/ssh_audit/globals.py | grep -E -o "'(v.*)'" | tr -d "'") +ifeq ($(VERSION),) + $(error "could not determine version!") +endif + +all: + docker build -t positronsecurity/ssh-audit:${VERSION} . + docker tag positronsecurity/ssh-audit:${VERSION} positronsecurity/ssh-audit:latest + +upload: + docker login + docker push positronsecurity/ssh-audit:${VERSION} + docker push positronsecurity/ssh-audit:latest diff --git a/PACKAGING b/PACKAGING index d3cb2ed..393696e 100644 --- a/PACKAGING +++ b/PACKAGING @@ -45,3 +45,15 @@ As root, run: Leave all options default. Bump the version number in snapcraft.yaml. Then run: # make -f Makefile.snap + +---- + += Docker = + +Build image with: + +$ make -f Makefile.docker + +Then upload them to Dockerhub with: + +$ make -f Makefile.docker upload diff --git a/README.md b/README.md index 26df6bb..90283e4 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,12 @@ To install on Homebrew: $ brew install ssh-audit ``` +To install from Dockerhub: +``` +$ docker pull positronsecurity/ssh-audit +``` +(Then run with: `docker run -it -p 2222:2222 positronsecurity/ssh-audit 10.1.1.1`) + ### Web Front-End For convenience, a web front-end on top of the command-line tool is available at [https://www.ssh-audit.com/](https://www.ssh-audit.com/).