[Patchew-devel] [PATCH] dockerfile: fix copying identity file
Paolo Bonzini
pbonzini at redhat.com
Fri Jan 18 15:07:59 UTC 2019
The identity file is copied into ~/.ssh but ~/.ssh may not exist. Fix that
with mkdir -p.
If not using an identity file supplied via ansible, in addition, we should
not regenerate it on every deployment; test for id_rsa before creating a
new key pair.
Reported-by: Davide Caratti <dcaratti at redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
scripts/dockerfiles/importer.docker | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/dockerfiles/importer.docker b/scripts/dockerfiles/importer.docker
index 953a75b..ab15d45 100644
--- a/scripts/dockerfiles/importer.docker
+++ b/scripts/dockerfiles/importer.docker
@@ -2,10 +2,10 @@ FROM fedora:latest
RUN dnf install -y python offlineimap findutils git wget
RUN git config --global user.email "importer at patchew.org"
RUN git config --global user.name "Patchew Importer"
+RUN mkdir -p -m 0700 ~/.ssh
+RUN test -f /data/patchew/id_rsa || ssh-keygen -t rsa -q -C patchew-importer -f ~/.ssh/id_rsa
RUN if test -f /data/patchew/identity; then \
echo IdentityFile=/data/patchew/identity > ~/.ssh/config; \
- else \
- ssh-keygen -t rsa -q -C patchew-importer -f ~/.ssh/id_rsa; \
fi
RUN echo StrictHostKeyChecking no >> ~/.ssh/config
RUN echo UserKnownHostsFile=/dev/null >> ~/.ssh/config
--
2.20.1
More information about the Patchew-devel
mailing list