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

Add a non-root image? #172

Closed
axkng opened this issue Oct 24, 2019 · 3 comments · Fixed by #186
Closed

Add a non-root image? #172

axkng opened this issue Oct 24, 2019 · 3 comments · Fixed by #186
Labels
discussion This issue requires further input from the community. enhancement The issue describes an enhancement that we would like to implement in the future. help wanted We seek out help for implementing this issue. pr There is a PR targeting this issue.
Milestone

Comments

@axkng
Copy link

axkng commented Oct 24, 2019

Hi,
I initially asked in slack why netbox runs as root in the container.
You can find my message and the related thread here: https://networktocode.slack.com/archives/CD23LP8BC/p1571897479036500

TL;DR:
Netbox runs as root inside the container, which is a security risk. Docker can remap host user-id's to container user-id's, via user namespaces. But Kubernetes (which is most likely used in production) does not support this at the moment.

Because of that @cimnine proposed to start a variant of the netbox-container, like with -ldap.

This issue should be seen as a feature-request for the netbox-container.

Also, @cimnine and me wanted to see if this is interesting for more people, to see if it is worth it.

@axkng axkng changed the title Add a non-root Image? Add a non-root image? Oct 24, 2019
@cimnine cimnine added discussion This issue requires further input from the community. enhancement The issue describes an enhancement that we would like to implement in the future. labels Oct 24, 2019
@kakurpiel
Copy link

I had to work around this when deploying to a corporate Kubernetes that would not allow images to run as root. Fortunately it was relatively easy to build an image that ran as non-root, and the only issues I ran in to were file system permissions (as mentioned in slack). The first part of fixing it was changing the owner of the netbox folders in /opt and /etc. The only other adjustment I had to make was where the error log was pointing to in the gunicorn configuration file. Rather than deal with any unintended consequences of changing the ownership of /var/log, I moved this to a different location.

I'd definitely be interested in an official build for this as it would streamline things immensely in more restrictive environments.

@cimnine cimnine mentioned this issue Nov 17, 2019
@cimnine cimnine added help wanted We seek out help for implementing this issue. pr There is a PR targeting this issue. labels Nov 17, 2019
@axkng
Copy link
Author

axkng commented Nov 18, 2019

Really happy to see that more people want this.

I see @cimnine is also already working on the topic. Thanks a lot for that!

@cimnine cimnine added this to the 0.16.0 milestone Nov 26, 2019
@TheKangaroo
Copy link

Same problem here. A simple Dockerfile like

FROM netboxcommunity/netbox:latest

RUN adduser -D -u 1000 netbox \
    && chown -R 1000 /opt/netbox/ \
    && chown -R 1000 /etc/netbox/

USER 1000

did the trick for me.
Of course, you have to add a non-root nginx image and bind it to a low port.
I just created a MVP helm chart update of https://github.com/bootc/netbox-chart and deployed it successfully to our kubernetes cluster :)
I'll keep you updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issue requires further input from the community. enhancement The issue describes an enhancement that we would like to implement in the future. help wanted We seek out help for implementing this issue. pr There is a PR targeting this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants