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

Fix the Let's Encrypt handler by listening on a valid address #5525

Merged
merged 3 commits into from
Dec 11, 2018

Conversation

gregkare
Copy link
Contributor

Also handle errors in the HTTP server go routine, return a fatal error when something goes wrong.

Thanks to @gbl08ma for finding the actual bug

Here is an example of the error handling:

2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to
start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind:
permission denied

Closes #5280, replaces #5524 (pushed to the wrong organization)

Edit: This is my first Go pull request so I am open to suggestions about the error handling

Also handle errors in the HTTP server go routine, return a fatal error
when something goes wrong.

Thanks to @gbl08ma for finding the actual bug

Here is an example of the error handling:

    2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to
    start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind:
    permission denied

Closes go-gitea#5280
Copy link
Member

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

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

LGTM, one question though that I’m sure you’ve probably already answered but I’m on mobile so it’s hard for me to see: why remove listenAddr from LE handler and just use setting.HTTPAddr?

@bkcsoft bkcsoft added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Dec 11, 2018
@gbl08ma
Copy link

gbl08ma commented Dec 11, 2018

@techknowlogick because listenAddr already contains a port number and we need to use a different one for this handler. It's the whole point of the bug that's being fixed, see my reply on the issue.

@techknowlogick
Copy link
Member

Ah yes, thanks for clarification 😄

@bkcsoft bkcsoft added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 11, 2018
@codecov-io
Copy link

Codecov Report

Merging #5525 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5525      +/-   ##
==========================================
+ Coverage   37.58%   37.59%   +0.01%     
==========================================
  Files         318      318              
  Lines       46928    46928              
==========================================
+ Hits        17638    17643       +5     
+ Misses      26778    26774       -4     
+ Partials     2512     2511       -1
Impacted Files Coverage Δ
models/repo_list.go 64.55% <0%> (+1.26%) ⬆️
modules/process/manager.go 81.15% <0%> (+4.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9681c83...0f7a5b7. Read the comment docs.

@techknowlogick techknowlogick merged commit 15d6cf1 into go-gitea:master Dec 11, 2018
@techknowlogick
Copy link
Member

Thanks for the PR @gregkare. Now that this has been merged, would you be able to send a backport PR to the release/v1.6 branch?

@gregkare gregkare deleted the bugfix/5280-fix_letsencrypt branch December 11, 2018 16:37
gregkare added a commit to 67P/gitea that referenced this pull request Dec 11, 2018
* Fix the Let's Encrypt handler by listening on a valid address

Also handle errors in the HTTP server go routine, return a fatal error
when something goes wrong.

Thanks to @gbl08ma for finding the actual bug

Here is an example of the error handling:

    2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to
    start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind:
    permission denied

Closes go-gitea#5280

* Fix a typo
techknowlogick pushed a commit that referenced this pull request Dec 11, 2018
* Fix the Let's Encrypt handler by listening on a valid address

Also handle errors in the HTTP server go routine, return a fatal error
when something goes wrong.

Thanks to @gbl08ma for finding the actual bug

Here is an example of the error handling:

    2018/12/11 14:23:07 [....io/gitea/cmd/web.go:87 func1()] [E] Failed to
    start the Let's Encrypt handler on port 30: listen tcp 0.0.0.0:30: bind:
    permission denied

Closes #5280

* Fix a typo
@lafriks lafriks added the backport/done All backports for this PR have been created label Dec 11, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server only listening to HTTP_PORT with TLS when Let's Encrypt is enabled
8 participants