-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
allow binding gitea to privileged port, gated behind environment variable #6081
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
Conversation
As the project aims to eventually have the docker run rootless and so I am hesitant to approve this PR as it’d soon be have to be removed. A possibility for you is building a docker imagine using the official one as a base then injecting these changes. However I am just one approver and others may feel differently so I’ll leave this PR as open. With that being said we do appreciate your contribution to the project |
Wouldn't these changes be required to make Gitea run rootless under docker in any case? I've restarted the build - it looks like it failed for an unrelated reason. |
@zeripath no because currently the binary is not run as root (hence the changes being made in this PR), these changes are only required to bind to a privileged port. Thanks to the |
Is the goal to have no daemons run as root in the container, or is the goal to have nothing run as root in the container, even for setup purposes. I think the latter is going to make a pretty bad experience for the user, because without a setup script to make sure the git user owns the data directory, the user will have to manually do that before starting the container. This is even more difficult if a user turns on UID namespaces and can't know what the UID of the git user will be in the container. If you want to avoid forcing the user to manually set permissions on the gitea volume, I think there will always need to be some setup commands running as root in the entrypoint. If those commands move out of the s6 run command and into |
Hmm... I think this is a relatively minor change. I'm not sure what they status of the rootless pr is, it looks a bit dead at present. In any case this PR needs some documentation. @clinta could you add changes to the documentation too... It might be that instead of adding the option to the docker we should just add documentation on how to set capabilities. |
…able Signed-off-by: Clint Armstrong <[email protected]>
8daa2d7
to
eb57c94
Compare
@zeripath, I added the documentation. I don't think a documentation only fix is reasonable, because s6 changes permissions on the gitea binary, the setcap needs to be done after this step, but before the gitea binary is started. My ugly workaround right now is overriding the docker command with |
Codecov Report
@@ Coverage Diff @@
## master #6081 +/- ##
=========================================
Coverage ? 38.86%
=========================================
Files ? 345
Lines ? 49508
Branches ? 0
=========================================
Hits ? 19241
Misses ? 27485
Partials ? 2782 Continue to review full report at Codecov.
|
Hmm is there anyway not to have setcap unless you actually need it? |
That's what the environment variable is for. If you do not run the container with |
I was meaning not to download it in the first place. We shouldn't have setcap downloaded or installed in the docker if we don't need it. |
Downloading packages at runtime instead of build time is an unexpected behavior for docker. The normal expectation is that a specific docker image contains all the dependencies at a specific version. Having a package downloaded at runtime means you could run a docker image one day, then restart the same image and get a different version of a piece of software. It breaks the concept of an image being an immutable snapshot of all dependent software. |
Rootless containers (as in you don't need to have root permissions to run the container), are starting to be more commonplace with platforms such as Openshift and k8s. The rootless image PR failed due to our SSH implementation not being as robust as openssh, however there is a PR that improves our SSH implementation. That will also allow us to remove s6. |
Is there a solution for managing the permissions on the data volume without root? The setup that is currently done here: gitea/docker/etc/s6/gitea/setup Lines 42 to 46 in eb57c94
|
Since #4749 has been closed as stale, is the rootless work still ongoing? |
Yes, as mentioned rootless is blocked by improvements needed for internal SSH server. |
Is the permissions setup in gitea/docker/etc/s6/gitea/setup considered a blocker too? |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
This pull request has been automatically closed because of inactivity. You can re-open it if needed. |
This is in reference to some issues documented in #1190 and hopefully a more acceptable method of accomplishing what #2183 was trying to do.
This allows the gitea service to run on a privileged port if the container is run with the environment variable
ALLOW_PRIVILEGED_PORT
is set to 1.This means the security of the image is unchanged for users who do not run the container with this environment variable, but it gives those who choose to the ability to run gitea on a privileged port.
This is important in our environment because we run docker with a custom network plugin and with docker's iptables integration disabled.