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

Docker: Switch base image to ubuntu:latest from debian:stretch to avoid security issues. #17066

Merged
merged 5 commits into from Jun 14, 2019

Conversation

bergquist
Copy link
Contributor

Let's see what the CI pipeline say about it.

ref #14182

@@ -357,7 +357,7 @@ jobs:
- run: docker info
- run: docker run --privileged linuxkit/binfmt:v0.6
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh --fast "${CIRCLE_SHA1}"
- run: cd packaging/docker && ./build.sh "${CIRCLE_SHA1}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed --fast so we build arm containers as well.

Copy link
Contributor

@xlson xlson left a comment

Choose a reason for hiding this comment

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

Looks good. I read a little about the release, trying to figure out when it's going from testing to stable (some time this year) and found this:

Please note that security updates for testing distribution are not yet managed by the security team. Hence, testing does not get security updates in a timely manner. You are encouraged to switch your sources.list entries from testing to stretch for the time being if you need security support.

source

Not sure how much this affects our decision.

@bergquist
Copy link
Contributor Author

bergquist commented May 15, 2019

This makes total sense :)

The real workaround for this I guess is to rebuild old images, pull security updates from the mirrors and push them to dockerhub. It's not that strange that images we published 8 months ago have security vulnerabilities and fresh alpine does not. Switching from Debian to alpine or any other base would not help us regardless unless we republish old containers.

Alpine might have a smaller attack surface which is good. But we still need to republish those containers to get security fixes.

@xlson
Copy link
Contributor

xlson commented May 15, 2019

I could be wrong, but I think part of our problem is that there aren't security fixes for all the issues in stretch.

@woodsaj
Copy link
Member

woodsaj commented May 15, 2019

As @xlson points out, the security update issue isn't about updating existing installations. It is about there being a lag for security fixes showing up in the repo.

I guess the question comes down to: is buster more secure than stretch?

My opinion is yes. Right now, buster has fewer known vulnerabilities then stretch. Security updates for buster may not yet be managed by the security team, but they will when it becomes stable and so security should improve. For stretch, security updates are managed by the security team, but they still haven't fixed high severity issues that have be known for a really long time.

@xlson
Copy link
Contributor

xlson commented May 15, 2019

That's a good point. I agree, let's move to buster for now.

@bergquist
Copy link
Contributor Author

bergquist commented May 16, 2019

TLDR; Phantomjs does not work on buster out of the box.

Copy pasting what @xlson wrote on slack

t=2019-05-16T07:51:01+0000 lvl=info msg=Rendering logger=rendering path="d-solo/ppGIbmWZz/new-dashboard-copy?orgId=1&from=1557971460841&to=1557993060841&panelId=2&width=1000&height=500&tz=Europe%2FStockholm"
t=2019-05-16T07:51:01+0000 lvl=dbug msg="executing Phantomjs" logger=rendering binPath=/usr/share/grafana/tools/phantomjs/phantomjs cmdArgs="[--ignore-ssl-errors=true --web-security=true --local-url-access=false --debug=true /usr/share/grafana/tools/phantomjs/render.js url=http://localhost:3000/d-solo/ppGIbmWZz/new-dashboard-copy?orgId=1&from=1557971460841&to=1557993060841&panelId=2&width=1000&height=500&tz=Europe%2FStockholm&render=1 width=1000 height=500 png=/var/lib/grafana/png/UWq6y0vo1U6tsYQEgUcC.png domain=localhost timeout=60 renderKey=BddXCMP6Ykv9tQJC4H6hvYa3JQAfCJI7]" timezone=Europe/Stockholm
t=2019-05-16T07:51:01+0000 lvl=dbug msg="Phantomjs output" logger=rendering out=
t=2019-05-16T07:51:01+0000 lvl=dbug msg="Phantomjs error" logger=rendering error="exit status 1"
t=2019-05-16T07:51:01+0000 lvl=eror msg="Phantomjs exited with non zero exit code" logger=rendering error="exit status 1"
t=2019-05-16T07:51:01+0000 lvl=eror msg="Rendering failed." logger=context userId=1 orgId=1 uname=admin error="exit status 1"
grafana@049524d5ecd4:/usr/share/grafana/tools/phantomjs$ ./phantomjs 
Auto configuration failed
140631040630400:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory
140631040630400:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
140631040630400:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
140631040630400:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf

bazelbuild/rules_closure#351

Leo: But it sounds like the newer openssl and phantomjs aren't compatible.

creating an empty file as /etc/ssl/openssl.conf as suggested in AustinSchuh/rules_closure@a932350#diff-c58da55f8955a22ae62287e8fea9ad7eR1 might solve it but I'm not sure that's a solution we want.

To build and package grafana as a docker container...

go run build.go build pkg-archive latest sha-dist && \
cp dist/grafana-latest.linux-*.tar.gz packaging/docker && \
./packaging/docker/build.sh --fast fakegitsha && \
docker run --net=host -e GF_LOG_LEVEL=debug grafana/grafana-dev:fakegitsha

@bergquist
Copy link
Contributor Author

bergquist commented May 22, 2019

Phantomjs works fine on ubuntu:latest.

Results from running trivy locally

https://github.com/knqyf263/trivy/releases/download/v0.1.1/trivy_0.1.1_Linux-64bit.tar.g
tar zxvf trivy_0.1.1_Linux-64bit.tar.gz
make build-docker-dev
./trivy --exit-code 1 --quiet --auto-refresh --format=json grafana/grafana:dev

ubuntu:latest


CRITICAL        0 
HIGH            12 
MEDIUM	        33
LOW 		17

debian:stretch

CRITICAL	3
HIGH            38
MEDIUM          98
LOW		37

Since Ubuntu is based on debian I think it shouldn't cause any problems to switch base for the docker image.

@bergquist bergquist marked this pull request as ready for review May 22, 2019 13:38
@bergquist bergquist requested a review from xlson June 4, 2019 19:19
Copy link
Contributor

@xlson xlson left a comment

Choose a reason for hiding this comment

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

Ubuntu seems like a good option if that gets us part of the way. How much bigger is the image vs the slim ones from debian?

@bergquist
Copy link
Contributor Author

bergquist commented Jun 11, 2019

debian:stretch-slim is 22mb
ubuntu:latest is 29mb

So I dont think its an issue.

@bergquist
Copy link
Contributor Author

bergquist commented Jun 11, 2019

I think this deserves a longer beta period than we normally do.

@bergquist bergquist changed the title Docker: switch to debian-buster to avoid security issues in stretch Docker: Switch base image to ubuntu:latest from debian:stretch to avoid security issues. Jun 11, 2019
@bergquist bergquist merged commit f9b691b into master Jun 14, 2019
@bergquist bergquist deleted the docker_buster branch June 14, 2019 20:58
@bergquist bergquist added this to the 6.3 milestone Jun 14, 2019
ryantxu added a commit to ryantxu/grafana that referenced this pull request Jun 17, 2019
* grafana/master: (58 commits)
  AppPlugin: Fix load legacy plugin app (grafana#17574)
  Typescript: A batch of implicit any fixes (grafana#17590)
  RefreshPicker: Handle empty intervals (grafana#17585)
  Docker: Switch base to ubuntu:latest (grafana#17066)
  SQLStore: extend `user.SearchUsers` method (grafana#17514)
  Explore: Tag and Values for Influx are filtered by the selected measurement (grafana#17539)
  ldap: makes mocks available for testing. (grafana#17576)
  Devenv: Add nginx proxy for mac (grafana#17572)
  Graph: Added new fill gradient option (grafana#17528)
  Typescript: Reduce implicit any errors (grafana#17550)
  SinglestatPanel: Manages when getColorForValue() function returns null value. Closes grafana#9747 (grafana#17552)
  LDAP: refactoring  (grafana#17479)
  Elasticsearch: Fix empty query request to send properly (grafana#17488)
  SinglestatPanel: fix min/max config in singlestat sparklines (grafana#17543)
  AuthProxy: Optimistic lock pattern for remote cache Set (grafana#17485)
  Explore: Includes context parameter when invoking getExploreState() from Prometheus datasource (grafana#17569)
  Tests: Replaces truth image (grafana#17570)
  Fix: Fixes merge conflict (grafana#17568)
  Build: Fix failing e2e tests and implicit any check (grafana#17567)
  Explore: Fixes implicit any error in AdHocFilterField.test.tsx (grafana#17565)
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Jun 17, 2019
…-mapping-to-field

* grafana/master: (75 commits)
  AppPlugin: Fix load legacy plugin app (grafana#17574)
  Typescript: A batch of implicit any fixes (grafana#17590)
  RefreshPicker: Handle empty intervals (grafana#17585)
  Docker: Switch base to ubuntu:latest (grafana#17066)
  SQLStore: extend `user.SearchUsers` method (grafana#17514)
  Explore: Tag and Values for Influx are filtered by the selected measurement (grafana#17539)
  ldap: makes mocks available for testing. (grafana#17576)
  Devenv: Add nginx proxy for mac (grafana#17572)
  Graph: Added new fill gradient option (grafana#17528)
  Typescript: Reduce implicit any errors (grafana#17550)
  SinglestatPanel: Manages when getColorForValue() function returns null value. Closes grafana#9747 (grafana#17552)
  LDAP: refactoring  (grafana#17479)
  Elasticsearch: Fix empty query request to send properly (grafana#17488)
  SinglestatPanel: fix min/max config in singlestat sparklines (grafana#17543)
  AuthProxy: Optimistic lock pattern for remote cache Set (grafana#17485)
  Explore: Includes context parameter when invoking getExploreState() from Prometheus datasource (grafana#17569)
  Tests: Replaces truth image (grafana#17570)
  Fix: Fixes merge conflict (grafana#17568)
  Build: Fix failing e2e tests and implicit any check (grafana#17567)
  Explore: Fixes implicit any error in AdHocFilterField.test.tsx (grafana#17565)
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Jun 17, 2019
* grafana/master: (73 commits)
  AppPlugin: Fix load legacy plugin app (grafana#17574)
  Typescript: A batch of implicit any fixes (grafana#17590)
  RefreshPicker: Handle empty intervals (grafana#17585)
  Docker: Switch base to ubuntu:latest (grafana#17066)
  SQLStore: extend `user.SearchUsers` method (grafana#17514)
  Explore: Tag and Values for Influx are filtered by the selected measurement (grafana#17539)
  ldap: makes mocks available for testing. (grafana#17576)
  Devenv: Add nginx proxy for mac (grafana#17572)
  Graph: Added new fill gradient option (grafana#17528)
  Typescript: Reduce implicit any errors (grafana#17550)
  SinglestatPanel: Manages when getColorForValue() function returns null value. Closes grafana#9747 (grafana#17552)
  LDAP: refactoring  (grafana#17479)
  Elasticsearch: Fix empty query request to send properly (grafana#17488)
  SinglestatPanel: fix min/max config in singlestat sparklines (grafana#17543)
  AuthProxy: Optimistic lock pattern for remote cache Set (grafana#17485)
  Explore: Includes context parameter when invoking getExploreState() from Prometheus datasource (grafana#17569)
  Tests: Replaces truth image (grafana#17570)
  Fix: Fixes merge conflict (grafana#17568)
  Build: Fix failing e2e tests and implicit any check (grafana#17567)
  Explore: Fixes implicit any error in AdHocFilterField.test.tsx (grafana#17565)
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Jun 17, 2019
* grafana/master: (70 commits)
  AppPlugin: Fix load legacy plugin app (grafana#17574)
  Typescript: A batch of implicit any fixes (grafana#17590)
  RefreshPicker: Handle empty intervals (grafana#17585)
  Docker: Switch base to ubuntu:latest (grafana#17066)
  SQLStore: extend `user.SearchUsers` method (grafana#17514)
  Explore: Tag and Values for Influx are filtered by the selected measurement (grafana#17539)
  ldap: makes mocks available for testing. (grafana#17576)
  Devenv: Add nginx proxy for mac (grafana#17572)
  Graph: Added new fill gradient option (grafana#17528)
  Typescript: Reduce implicit any errors (grafana#17550)
  SinglestatPanel: Manages when getColorForValue() function returns null value. Closes grafana#9747 (grafana#17552)
  LDAP: refactoring  (grafana#17479)
  Elasticsearch: Fix empty query request to send properly (grafana#17488)
  SinglestatPanel: fix min/max config in singlestat sparklines (grafana#17543)
  AuthProxy: Optimistic lock pattern for remote cache Set (grafana#17485)
  Explore: Includes context parameter when invoking getExploreState() from Prometheus datasource (grafana#17569)
  Tests: Replaces truth image (grafana#17570)
  Fix: Fixes merge conflict (grafana#17568)
  Build: Fix failing e2e tests and implicit any check (grafana#17567)
  Explore: Fixes implicit any error in AdHocFilterField.test.tsx (grafana#17565)
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Jun 17, 2019
* grafana/master: (75 commits)
  AppPlugin: Fix load legacy plugin app (grafana#17574)
  Typescript: A batch of implicit any fixes (grafana#17590)
  RefreshPicker: Handle empty intervals (grafana#17585)
  Docker: Switch base to ubuntu:latest (grafana#17066)
  SQLStore: extend `user.SearchUsers` method (grafana#17514)
  Explore: Tag and Values for Influx are filtered by the selected measurement (grafana#17539)
  ldap: makes mocks available for testing. (grafana#17576)
  Devenv: Add nginx proxy for mac (grafana#17572)
  Graph: Added new fill gradient option (grafana#17528)
  Typescript: Reduce implicit any errors (grafana#17550)
  SinglestatPanel: Manages when getColorForValue() function returns null value. Closes grafana#9747 (grafana#17552)
  LDAP: refactoring  (grafana#17479)
  Elasticsearch: Fix empty query request to send properly (grafana#17488)
  SinglestatPanel: fix min/max config in singlestat sparklines (grafana#17543)
  AuthProxy: Optimistic lock pattern for remote cache Set (grafana#17485)
  Explore: Includes context parameter when invoking getExploreState() from Prometheus datasource (grafana#17569)
  Tests: Replaces truth image (grafana#17570)
  Fix: Fixes merge conflict (grafana#17568)
  Build: Fix failing e2e tests and implicit any check (grafana#17567)
  Explore: Fixes implicit any error in AdHocFilterField.test.tsx (grafana#17565)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants