[Patchew-devel] [PATCH] dockerfile: fix copying identity file

Philippe Mathieu-Daudé philmd at redhat.com
Tue Jan 22 11:11:49 UTC 2019


On 1/18/19 4:07 PM, Paolo Bonzini wrote:
> 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

Which become now simply:

   RUN test -f /data/patchew/identity && echo
IdentityFile=/data/patchew/identity > ~/.ssh/config

>  RUN echo StrictHostKeyChecking no >> ~/.ssh/config
>  RUN echo UserKnownHostsFile=/dev/null >> ~/.ssh/config
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd at redhat.com>




More information about the Patchew-devel mailing list