mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-15 20:09:18 -05:00
docker https fails with web_graceful [E] Failed to load https cert file 0.0.0.0:3000 : open : no such file or directory #1906
Closed
opened 2025-11-02 04:17:25 -06:00 by GiteaMirror
·
21 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.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rc3
v1.4.0-rc2
v1.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#1906
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @r-pufky on GitHub (Jun 9, 2018).
8786c15(docker gitea/gitea:latest)[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.
@techknowlogick commented on GitHub (Jun 9, 2018):
Can you try
in your app.ini?
@r-pufky commented on GitHub (Jun 10, 2018):
It's the same relative path error, as in case #2 above. I reconfirmed state from original submission as well.
conf/cert.pem case:
Additionally, following the current instructions: https://docs.gitea.io/en-us/https-setup/
I get the same file error:
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.
@lafriks commented on GitHub (Jun 19, 2018):
Seams to be problem resolving relative paths
@canit00 commented on GitHub (Oct 10, 2018):
@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.
@stale[bot] commented on GitHub (Jan 7, 2019):
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.
@felix-exon commented on GitHub (Jan 7, 2019):
I'm having the same problem !
@techknowlogick commented on GitHub (Jan 7, 2019):
ping @0x5c as they had problems with relative paths for HTTPS certs, perhaps they could post their solution.
@0x5c commented on GitHub (Jan 7, 2019):
Aaah, yes
The docker image is one hell of a picky boi, and refuses anything else than
/data/gitea/key.pem(or cert), the path itself seemingly needing to exactly match the path in theGITEA_CUSTOMenvironment variable.@stale[bot] commented on GitHub (Mar 8, 2019):
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.
@r-pufky commented on GitHub (Mar 8, 2019):
FYI,
Before 0x5c's post, I ended up using nginx as a reverse proxy to serve gitea over https.
@0x5c commented on GitHub (Mar 8, 2019):
It would make sense to keep the issue open, though, since the bug remain no-less present.
@zeripath commented on GitHub (Jun 22, 2019):
OK the problem is here:
baefea311f/cmd/web.go (L176)Which calls:
baefea311f/cmd/web_graceful.go (L35)The path of the cert and key file will be resolved against the current working directory - not against the GITEA_CUSTOM directory.
Now,
https://github.com/go-gitea/gitea/blame/master/docs/content/doc/advanced/config-cheat-sheet.en-us.md#L138-L139
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?
@djagoo commented on GitHub (Jan 18, 2020):
Same problem here. I already tried any location and config variable possible.
The pem files are copied to:
/ , /app/gitea/ , /data/, /data/gitea/ , /data/gitea/conf
I tried any of these values in app.ini:
cert.pem , /cert.pem , conf/cert.pem , /conf/cert.pem, /data/gitea/cert.pem , /data/gitea/conf/cert.pem
Can anyone please supply a workaround till this is fixed?
@zeripath commented on GitHub (Jan 19, 2020):
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.
@djagoo commented on GitHub (Jan 19, 2020):
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
@zeripath commented on GitHub (Jan 19, 2020):
Hmm now that is odd...
@zeripath commented on GitHub (Jan 19, 2020):
So the error report is unhelpful in the extreme here. I actually suspect the issue is the
key.pemis not being loaded.What user is running gitea?
@djagoo commented on GitHub (Jan 19, 2020):
It's running as user git. But even if I tried to run it as root the error is the same.
@djagoo commented on GitHub (Jan 19, 2020):
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.
@djagoo commented on GitHub (Jan 19, 2020):
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.
Sorry for me being that blind.
@zeripath commented on GitHub (Jan 19, 2020):
Nah it's not your fault. The error report was just totally unhelpful. I've put a PR up to fix this for you.