Skip to content

Instantly share code, notes, and snippets.

@aN0mad
Created December 13, 2023 16:23
Show Gist options
  • Save aN0mad/b82166a0c303a6b16170e76747ba86ab to your computer and use it in GitHub Desktop.
Save aN0mad/b82166a0c303a6b16170e76747ba86ab to your computer and use it in GitHub Desktop.
Generate OpenSSH pre 7.8 keys for use with Nessus Authenticated Linux Scanning
FROM alpine:3.8.4
# Run command
# docker run -v ${pwd}:/keys -it keygen
# Do update and install openssh
RUN apk update
RUN apk add openssh
# Create script and folder
RUN mkdir /keys
RUN echo "#!/bin/sh" >> /entrypoint.sh
RUN echo "/usr/bin/ssh-keygen -t rsa -f /keys/id_rsa -q -P ''" >> /entrypoint.sh
RUN echo "echo -------------START PUB KEY-------------" >> /entrypoint.sh
RUN echo "/bin/cat /keys/id_rsa.pub" >> /entrypoint.sh
RUN echo "echo -------------STOP PUB KEY-------------" >> /entrypoint.sh
RUN echo "echo " >> /entrypoint.sh
RUN echo "echo -------------START PRIVATE KEY-------------" >> /entrypoint.sh
RUN echo "/bin/cat /keys/id_rsa" >> /entrypoint.sh
RUN echo "echo -------------STOP PRIVATE KEY-------------" >> /entrypoint.sh
# Change permissions of entrypoint
RUN chmod 755 /entrypoint.sh
# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment