Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update security of Dockerfile #18

Merged
merged 4 commits into from
Aug 9, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,29 @@ RUN buildDeps=' \
libencode-perl \
make \
' \
url="https://rakudo.org/downloads/star/rakudo-star-${rakudo_version}.tar.gz" \
keyserver='hkps.pool.sks-keyservers.net' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, this won't actually use hkps (it'll use hkp against the hkps pool, which will generally work), but I'd also argue that when using a full fingerprint, hkps doesn't provide additional benefit since gpg will verify the fingerprint of the key after fetching which is a stronger guarantee, and not using hkps allows us to intentionally mitm for increased reliability (see docker-library/php#666), which we do on all the official build servers for the official images.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the insight! I'll update the branch to use the 'ha' pool as suggested on the official image readme.

keyfp='ECF8B611205B447E091246AF959E3D6197190DD5' \
tmpdir="$(mktemp -d)" \
&& set -x \
&& export GNUPGHOME="$tmpdir" \
&& apt-get update \
&& apt-get --yes install --no-install-recommends $buildDeps \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /root/rakudo \
&& curl -fsSL http://rakudo.org/downloads/star/rakudo-star-${rakudo_version}.tar.gz -o rakudo.tar.gz \
&& tar xzf rakudo.tar.gz --strip-components=1 -C /root/rakudo \
&& mkdir ${tmpdir}/rakudo \
\
&& curl -fsSL ${url}.asc -o ${tmpdir}/rakudo.tar.gz.asc \
&& curl -fsSL $url -o ${tmpdir}/rakudo.tar.gz \
&& gpg2 --keyserver $keyserver --recv-keys $keyfp \
&& gpg2 --batch --verify ${tmpdir}/rakudo.tar.gz.asc ${tmpdir}/rakudo.tar.gz \
\
&& tar xzf ${tmpdir}/rakudo.tar.gz --strip-components=1 -C ${tmpdir}/rakudo \
&& ( \
cd /root/rakudo \
cd ${tmpdir}/rakudo \
&& perl Configure.pl --prefix=/usr --gen-moar \
&& make install \
) \
&& rm -rf /rakudo.tar.gz /root/rakudo \
&& rm -rf $tmpdir \
&& apt-get purge -y --auto-remove $buildDeps

ENV PATH=$PATH:/usr/share/perl6/site/bin
Expand Down