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

Allow st2web container to be runable as Non-Root #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jk464
Copy link
Contributor

@jk464 jk464 commented Feb 5, 2024

It is good security practice to run containers without root and minimal privileges.

However, the st2web container attempts to expose on port 80 and 443, which are both <1000 privileged ports.

This PR changes the exposed ports to 8080 / 8443, non-privileged ports.

It also edits permissions on NGINX files, to allow nginx to run as the nginx user.

Copy link
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

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

Looking good. Just a couple qusetions.

st2web/files/st2.conf-http.patch Outdated Show resolved Hide resolved
st2web/Dockerfile Show resolved Hide resolved
st2web/files/st2.conf-http.patch Outdated Show resolved Hide resolved
@jk464 jk464 force-pushed the feature/non-root-st2web branch from 9e9b36c to 4d28a30 Compare May 8, 2024 10:13
@jk464
Copy link
Contributor Author

jk464 commented May 8, 2024

@cognifloyd I've hopefully actioned all your items - also added in some updates to the st2web README, and also note the latest nginx packages on ubuntu change the nginx user to have 999:999 uid/gid instead of 101:101 - so I've had to update that.

We probably want to pin the nginx version so it doesn't change on arbitrary image builds?

@jk464 jk464 requested a review from cognifloyd May 8, 2024 10:43
- proxy_pass http://127.0.0.1:9100/;
+ proxy_pass ${ST2_AUTH_URL};
proxy_read_timeout 90;
proxy_connect_timeout 90;
proxy_redirect off;
+ proxy_ssl_verify off;
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of disabling this? disabling SSL verification is a last-resort--something to do when all other solutions (like regenerating the cert) have failed to fix an issue.

}
-}
+}
\ No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Please re-add the NL at EOF

@cognifloyd
Copy link
Member

@cognifloyd I've hopefully actioned all your items - also added in some updates to the st2web README, and also note the latest nginx packages on ubuntu change the nginx user to have 999:999 uid/gid instead of 101:101 - so I've had to update that.

We probably want to pin the nginx version so it doesn't change on arbitrary image builds?

I don't like to manually pin versions most of the time because then someone has to manage that pin. Most of the time (in my experience at least) pins are not well documented, so no one dares to update it until there is a CVE or some other bug or missing feature that forces an update. So, I hesitate to add pinning here without a good plan for how we'll manage that.

st2web/Dockerfile Outdated Show resolved Hide resolved
@jk464
Copy link
Contributor Author

jk464 commented May 15, 2024

@cognifloyd that should be all the issues resolved

@jk464 jk464 requested a review from cognifloyd May 15, 2024 11:11
Copy link
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

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

I have 2 comments left to address:

  • proxy_ssl_verify off maybe this should be configurable? Or allow people to inject lines into the st2api, st2stream, and st2auth blocks?
  • re-add newline at end of file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants