You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/07/08 23:34:20 UTC

[GitHub] [pulsar] michaeljmarshall opened a new issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

michaeljmarshall opened a new issue #11269:
URL: https://github.com/apache/pulsar/issues/11269


   **Is your feature request related to a problem? Please describe.**
   Update the Pulsar docker images to run as a non root user by default.
   
   **Describe the solution you'd like**
   The right solution will meet the following requirements:
   
   * Pulsar docker images run as a non root user by default.
   * Pulsar docker images are able to run on OpenShift (a platform with stricter requirements than basic kubernetes)
       * Mainly, we'll need to make sure that the root group has sufficient permissions to write to all necessary directories/files.
       * Additionally, someone mentioned to me that they had trouble writing to a persistent file after restarting a Pulsar docker image on OpenShift. We should make sure the solution includes the ability to restart pulsar components successfully.
   * The Pulsar helm chart includes an easy way for end users to upgrade without any breaking changes.
       * We will likely be able to make use of the kubernetes feature that will `chown` persistent volumes to the configured `fsGroup`. However, I'm uncertain how this works on OpenShift, so I will need to research this a bit more.
   * The non root user and the root group only receive write permissions where necessary for each pulsar component to run.
   
   Additionally, I think we should produce images that are minimal. Making minimal containers means that we won't include debug tools in them. This will make it harder to debug, but more importantly, it increases the security of the container by removing possible attack vectors. Note that it is trivial for developers to extend our docker images to add _any_ debug tool they would like to use. This prevents us from having to curate and maintain a list of extra tools in the docker image.
   
   **Test criteria**
   There are several important test cases to cover.
   
   1. Make sure we're able to upgrade and downgrade pulsar components (mainly all of the ones utilizing persistent storage). Do this using the official Apache Pulsar helm chart.
   2. Test the image on OpenShift. I plan to use a local OpenShift cluster on my Mac, but perhaps someone would be able to validate our docker images on a real cluster.
   3. Be sure to include test cases for function workers. (They were one of the missed cases before that led https://github.com/apache/pulsar/pull/8796 to get reverted in https://github.com/apache/pulsar/pull/10861).
   4. Test the `chown` feature for volumes in kubernetes. Make sure that managed kubernetes offerings from the major cloud providers actually support this `chown` feature. (I mention it because I'm not sure if this is an add-on or a native feature within the kubelet.)
   
   Please let me know if you have any additional test cases you'd like to see covered.
   
   **Communication**
   Communicate this change on the mailing list to ensure that the community has time to test the new docker images before we begin the release process.
   
   **Describe alternatives you've considered**
   The main alternative here is whether or not the docker image should contain debugging tools. Otherwise, I think the community has generally accepted this feature, as is.
   
   **Additional context**
   I plan to contribute this fix later this month.
   
   Relevant PRs and Issues: https://github.com/apache/pulsar/pull/10861, https://github.com/apache/pulsar/issues/8751, https://github.com/apache/pulsar/pull/8242, https://github.com/apache/pulsar/pull/10861
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hpvd edited a comment on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
hpvd edited a comment on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-877009828


   @eolivelli 
   many thanks for pointing to this discussion!
   
   In an ideal world we would have both:
   - one pure image without any tools
   - and one ready to start to use and dive in
   
   Having these both offers, everyone can choose which image best meets their needs.
   The big question: is there an efficient way to do so?
   
   edit: in the end we can track download numbers of both ;-)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hpvd commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
hpvd commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-893428179


   since it's also a non-root (security) topic and is somehow related to this:
   latest Kubernetes 1.22 support running all Kubernetes node components (including the kubelet, kube-proxy, and container runtime) as a non-root user.
   https://kubernetes.io/blog/2021/08/04/kubernetes-1-22-release-announcement/
   
   
   Should we open an issue to address this on places like setup-guides, testing environment etc.?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-877001957


   @hpvd 
   during the first iteration of the rootless docker image I sent this PR
   https://github.com/apache/pulsar/pull/10815
   
   that is in the direction of your comment


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] michaeljmarshall commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-896325282


   Note that using a distroless base image (https://github.com/GoogleContainerTools/distroless/tree/main/java) is not a viable option for pulsar 2.x because we use shell scripts to configure each component before executing the `java` command and changing that configuration paradigm would be a breaking change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hpvd commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
hpvd commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-877009828


   @eolivelli 
   many thanks for pointing to this discussion!
   
   In an ideal world we would have both:
   - one pure image without any tools
   - and one ready to start to use and dive in
   
   Having these both offers, everyone can choose which image best meets their needs.
   The big question: is there an efficient way to do so?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] eolivelli commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-877033722


   having more images to maintain is very costly because ideally you would have to run tests and security auditing against all the released images.
   
   I suggest to just add the basic tools to the standard images, and if you want to add more than you can create a custom image locally and create an issue/send a PR to add the missing tool to the next version of the standard public image


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-1058888423


   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hpvd edited a comment on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
hpvd edited a comment on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-876914367


   Perfect. Non root and making minimal images available will be a huge step in security.
   
   The one thing I would like to think about is the future availability of full images in the actual manner including debugtools.
   
   Imho one often start with pulsar or a new release version in a dev environment.
   
   Having the possibility directly using ready to use dev images in addition to in sync production ones, would be at least neat and comfortable (and lower any hurdl)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lhotari commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
lhotari commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-1027743065


   I created a separate enhancement request to provide a slim docker image: #14092


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] michaeljmarshall commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-893665031


   > having more images to maintain is very costly because ideally you would have to run tests and security auditing against all the released images.
   
   I don't know if this would be as costly as you're suggesting. If we build the base pulsar image and then extend that base image to build the dev image, the dev image will share the same initial layers. I am not familiar with docker image security scanning tools, but I would think that they should be optimized to not re-scan the same layer within some period of time. This deserves more research, though.
   
   > Should we open an issue to address this on places like setup-guides, testing environment etc.?
   
   @hpvd - can you clarify what setup-guides and testing environments need updated documentation?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hpvd edited a comment on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
hpvd edited a comment on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-876914367


   Perfect. Non root and making minimal images available will be a huge step in security.
   
   The one thing I would like to think about is the future availability of full images in the actual manner including devtools.
   
   Imho one often start with pulsar or a new release version in a dev environment.
   
   Having the possibility directly using ready to use dev images in addition to in sync production ones, would be at least neat and comfortable (and lower any hurdl)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] hpvd commented on issue #11269: [Docker Images] Default Pulsar docker images to run as a non-root user

Posted by GitBox <gi...@apache.org>.
hpvd commented on issue #11269:
URL: https://github.com/apache/pulsar/issues/11269#issuecomment-876914367


   Perfect. Non root and making minimal images available will be a huge step in security.
   
   The one thing I would like to think about is the future availability of full images in the actual manner including devtools.
   
   Imho one often start with with pulsar or a new release version in a dev environment.
   
   Having the possibility directly using ready to start dev images in addition to in sync production ones, would be at least neat and comfortable (and lower any hurdl)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org