-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
docker https fails with web_graceful [E] Failed to load https cert file 0.0.0.0:3000 : open : no such file or directory #4196
Comments
Can you try
in your app.ini? |
It's the same relative path error, as in case #2 above. I reconfirmed state from original submission as well. conf/cert.pem case: CERT_FILE = conf/cert.pem
CERT_KEY = conf/key.pem
Additionally, following the current instructions: https://docs.gitea.io/en-us/https-setup/ CERT_FILE = cert.pem
CERT_KEY = key.pem
This seems like a regression? I'd additionally recommend updating the documentation to explicitly state:
I'm happy to submit a CL to update the documentation once this is figured out. |
Seams to be problem resolving relative paths |
@lafriks we are using :1 build-date: 2018-10-09 container image having the exact problem. Any chance this will be resolved anytime soon? It doesn't matter how one configures/loads the certs this is brorken. |
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. |
I'm having the same problem !
|
ping @0x5c as they had problems with relative paths for HTTPS certs, perhaps they could post their solution. |
Aaah, yes The docker image is one hell of a picky boi, and refuses anything else than |
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. |
FYI, Before 0x5c's post, I ended up using nginx as a reverse proxy to serve gitea over https. |
It would make sense to keep the issue open, though, since the bug remain no-less present. |
OK the problem is here: Line 176 in baefea3
Which calls: Line 35 in baefea3
The path of the cert and key file will be resolved against the current working directory - not against the GITEA_CUSTOM directory. Now, Although it doesn't make this clear, those default paths are consistent with being relative to the working directory. So I guess the question is: To where should these files be relative? Clearly it appears that the working directory isn't quite what people expect. Should it be GITEA_CUSTOM? |
Same problem here. I already tried any location and config variable possible. The pem files are copied to: I tried any of these values in app.ini: Can anyone please supply a workaround till this is fixed? |
Just put an absolute file name in. I'll put a breaking PR up today to change this to be relative to the custom path. |
Thats what I already tried... Right now I have in app.ini:
which results in:
It's a fresh container, created just yesterday from gitea/gitea:latest |
The current code will absolute CertFile and KeyFile against the current working directory. This is quite unexpected for users. This code makes relative paths absolute against the CustomPath. Fix go-gitea#4196
Hmm now that is odd... |
So the error report is unhelpful in the extreme here. I actually suspect the issue is the What user is running gitea? |
It's running as user git. But even if I tried to run it as root the error is the same. |
Just tried again on another machine.
The result is the same as on my main docker host. Don't know if it helps but I ran strace to look if the path is correct:
It reads cert.pem and then tries to read "" so the path of the keyfile is empty. |
Just found the error. The variable is named KEY_FILE and not CERT_KEY. I copied it every time wrong from the posts above. It's correct in the docs and the cheat sheet. |
Nah it's not your fault. The error report was just totally unhelpful. I've put a PR up to fix this for you. |
* Make CertFile and KeyFile relative to CustomPath The current code will absolute CertFile and KeyFile against the current working directory. This is quite unexpected for users. This code makes relative paths absolute against the CustomPath. Fix #4196 * Improve error reporting when reading certificates * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Make CertFile and KeyFile relative to CustomPath The current code will absolute CertFile and KeyFile against the current working directory. This is quite unexpected for users. This code makes relative paths absolute against the CustomPath. Fix go-gitea#4196 * Improve error reporting when reading certificates * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Make CertFile and KeyFile relative to CustomPath The current code will absolute CertFile and KeyFile against the current working directory. This is quite unexpected for users. This code makes relative paths absolute against the CustomPath. Fix #4196 * Improve error reporting when reading certificates * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
[x]
):2018/06/09 12:46:58 [.../cmd/web_graceful.go:37 runHTTPS()] [E] Failed to load https cert file 0.0.0.0:3000: open : no such file or directory
Description
It looks like CERT_FILE and CERT_KEY are not being resolved / loaded properly.
When specifying CERT_FILE/CERT_KEY with absolute container paths, the cert files are not found and no cert file is specified in the error:
cert creation done inside docker
app.ini
cert.pem is 0644
key.pem is 0600
both are owned by the docker container and can be read inside the docker container fine:
Relative paths expose cert file in error
However, if I use relative paths for the certificate, the log message changes, exposing the actual relative path for the requested cert:
cert creation done inside docker
app.ini
cert.pem is 0644
key.pem is 0600
both are owned by the docker container and can be read inside the docker container fine:
Disabling https, gitea works fine.
Something has changed within gitea which is resulting in these certs not being loaded properly.
The text was updated successfully, but these errors were encountered: