-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Don't run docker image as root #1190
Comments
If you start gitea and go through the install page it asks you what user you want to run with. |
The docker image is still run as root. |
And how do you chown the data volume for a new installation? |
You don't. You assume you can write in that dir. Why do you need to chown the data volume? I think I don't understand what you mean, what problems you solve with explicit chmod. |
@lunny, how is that a question? For environments not allowing docker images to be run as root (e.g. openshift origin and also it's hosted variant) it's a showstopper. |
@ibotty any label suggested? |
@ibotty I'm actually in the opposite position, I actually hope the Currently, the # /etc/s6/gitea/run
#!/bin/bash
[[ -f ./setup ]] && source ./setup
pushd /app/gitea > /dev/null
exec su-exec git /app/gitea/gitea web
popd The |
Docker can do port mappings without problems. Why enlarge your attack surface without any reason? Also, some environments just don't allow running docker containers as root. |
Docker can do port mapping for accessing from outside of the docker network, not inside the docker network. In the case of running Say, we have a [server]
APP_DATA_PATH = /data/gitea
SSH_DOMAIN = dev.lab99.org
HTTP_PORT = 3000
ROOT_URL = http://dev.lab99.org/
DISABLE_SSH = false
SSH_PORT = 2222
LFS_START_SERVER = false
OFFLINE_MODE = false And we DO port mapping
drone-server:
image: drone/drone:0.5
ports:
- "8000:8000"
depends_on: [ database ]
environment:
DRONE_OPEN: 'false'
DRONE_GOGS: 'true'
DRONE_GOGS_URL: http://gitea:3000 The I can set an The problem is that the port of Running process as However, I understand minimizing the trusted domain is always the best practise for security. So, I'm thinking a way can make all of us happy. Such as using |
@twang2218 For docker, run as git let's we has |
We are using openSSH with the standard port, so it won't be possible to run Gitea without the root user. |
Let's try |
@twang2218 for your specific problem it must be that dev.lab99.org point to internal ip inside your container. If you point it to the public ip where docker publish you shouldn't have any problem. |
Yes, the dev.lab9.org point to the internal IP, as both |
If gitea is publicly accessible, you should use your public ip from drone also or use a proxy. |
Why? as I said before, both |
Sidetracking a little here .. but the only service expecting Gitea to run on port 80 is Drone? Why can't it access Gitea on another port? I'd have to agree with @sapk on this one, running any service on a power lower than 1024 and thus requiring other capabilities is not considered best practice. I'd even go as far as to say that Drone should be accessing Gitea the same way any other client does (probably a HTTPS enabled endpoint?). |
If you want but that not a problem with docker but with gitea that will use ROOT_URL for displaying links wich is public in your case. One of the good solution could be to allow an internal ROOT_URL. |
Don't forget we already given About the drone, of course, I hope drone can fetch the data through port 3000, however, as I said, because the |
@twang2218 For process running as root, I totally agree with you on that and that is the main problem on this issue. We could use internal ssh (listening on non-priviliged port) in place of openssh alongside. |
@twang2218 We use OpenShift with the default security settings. There's no way our security team will let us downgrade security to run Gitea. I guess it's Gogs or Gitlab for us. |
This issue 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 weeks. Thank you for your contributions. |
We should keep this opened. |
I'm a bit confused: is the rootless image still planned? I see #4749 is closed? Are the |
@alexanderadam still a wip but I reopen it #7129 |
I agree with those who say that we need to run as non-root user. It looks like there is no other light-weight git server out there that can be run in an OpenShift cluster (except for the trivial built-in mechanics). Thus, making gitea able to fill this vacuum would make it the number one choice if gitlab is not wanted for its complexity. This issue is open for more than three years now. Any chance that this will happen soon? |
2020 and things are still the same. init is overcomplicated, root user :( |
Fixed by #10154 |
It would be great for security to let gitea run as non-root, preferably even with an auto-generated uid.
See https://docs.openshift.org/latest/creating_images/guidelines.html#openshift-origin-specific-guidelines
for a rationale and on how to achieve that.
The drawback is, that the container won't be able to bind to port 22.
I have an old gogs container (that is still running in production though) on
https://github.com/ibotty/openshift-gogs
The text was updated successfully, but these errors were encountered: