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

Support custom ACME provider #18340

Merged
merged 18 commits into from
Feb 8, 2022
Merged

Support custom ACME provider #18340

merged 18 commits into from
Feb 8, 2022

Conversation

LecrisUT
Copy link
Contributor

Closes #18306
Tested with self-hosted Smallstep CA.

A few points:

  1. I think the options should be renamed to not be limited to Let'sEncrypt
  2. The function could be simplified to not pass domain, directory, etc. since other options are derived from settings inside anyway

Let me know of any naming conventions that I should adhere to here.

Signed-off-by: Cristian Le [email protected]

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

The documents and app.example.ini need to be updated.

modules/setting/setting.go Outdated Show resolved Hide resolved
cmd/web_letsencrypt.go Outdated Show resolved Hide resolved
cmd/web_letsencrypt.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 20, 2022
@silverwind
Copy link
Member

We should refactor all references to LetsEncrypt to ACME, e.g. rename web_letsencrypt.go to web_acme.go.

@LecrisUT
Copy link
Contributor Author

LecrisUT commented Jan 21, 2022

Please advise if 6344684 is ok. The documentation for LetsEncrypt settings was not present in app.example.ini, I've added it to the current names, and deprecated the old configuration names.

For web doc documentations, where can I find that? Nvm, found them and updated the documentation.

@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2022

Codecov Report

Merging #18340 (d21a5f3) into main (9712f7d) will increase coverage by 0.32%.
The diff coverage is 21.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #18340      +/-   ##
==========================================
+ Coverage   46.31%   46.63%   +0.32%     
==========================================
  Files         846      846              
  Lines      121244   121313      +69     
==========================================
+ Hits        56155    56577     +422     
+ Misses      58271    57862     -409     
- Partials     6818     6874      +56     
Impacted Files Coverage Δ
cmd/web.go 0.00% <0.00%> (ø)
cmd/web_acme.go 0.00% <0.00%> (ø)
models/migrate.go 40.00% <ø> (+0.73%) ⬆️
models/unittest/testdb.go 15.87% <0.00%> (-0.26%) ⬇️
modules/context/context.go 64.48% <ø> (-0.39%) ⬇️
routers/install/install.go 0.67% <0.00%> (+0.01%) ⬆️
routers/web/repo/blame.go 0.00% <0.00%> (ø)
routers/web/repo/issue_content_history.go 0.00% <0.00%> (ø)
services/forms/repo_form.go 42.10% <ø> (ø)
modules/setting/setting.go 46.11% <2.04%> (-2.44%) ⬇️
... and 30 more

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 a60e8be...d21a5f3. Read the comment docs.

cmd/web_acme.go Outdated Show resolved Hide resolved
@silverwind silverwind added the pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! label Jan 21, 2022
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 21, 2022
@lunny lunny added this to the 1.17.0 milestone Jan 22, 2022
Copy link
Contributor

@Gusted Gusted left a comment

Choose a reason for hiding this comment

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

Just some code styling.

cmd/web_acme.go Outdated Show resolved Hide resolved
cmd/web_acme.go Outdated Show resolved Hide resolved
cmd/web_acme.go Outdated Show resolved Hide resolved
custom/conf/app.example.ini Outdated Show resolved Hide resolved
custom/conf/app.example.ini Outdated Show resolved Hide resolved
modules/setting/setting.go Outdated Show resolved Hide resolved
modules/setting/setting.go Outdated Show resolved Hide resolved
@silverwind silverwind added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Jan 24, 2022
cmd/web_acme.go Outdated Show resolved Hide resolved
Co-authored-by: Gusted <[email protected]>
@LecrisUT
Copy link
Contributor Author

Did you guys just pushed commits from github interface? Got woken up by a barage of notifications. Anyway there's still documentation to be fixed around the ACME_TOS and implement the required code upstream.

@wxiaoguang
Copy link
Contributor

Did you guys just pushed commits from github interface? Got woken up by a barage of notifications. Anyway there's still documentation to be fixed around the ACME_TOS and implement the required code upstream.

Sorry to wake you up .... I just committed some small suggested changes from GitHub web. I would leave it next time.

@LecrisUT
Copy link
Contributor Author

Sorry to wake you up .... I just committed some small suggested changes from GitHub web. I would leave it next time.

No sweat, just condense them into a single commit next time.

@LecrisUT
Copy link
Contributor Author

I have a stashed changes waiting on caddyserver/certmagic#165. The difference is that, the user does not need to explicitly add any settings of ACME_ACCEPTTOS, instead the user will be prompted at the account creation with the relevant TOS and accept/not accept. Then gitea will use the cached acceptance over the ACME_ACCEPTTOS settings. (We can also cache the TOS link so that when it is changed, the user should confirm once again)

Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
@GiteaBot GiteaBot 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 Feb 2, 2022
@wxiaoguang
Copy link
Contributor

No more changes? Prepare to merge ~~~

@LecrisUT
Copy link
Contributor Author

LecrisUT commented Feb 8, 2022

Sure, when the changes to certmagic are merged, I will create a new PR.

@LecrisUT
Copy link
Contributor Author

LecrisUT commented Feb 8, 2022

Uhm, checking back on the drone build, it is stuck in some infinite loop. @wxiaoguang how about triggering it again?

@wxiaoguang
Copy link
Contributor

No worry, maintainers can handle it

@wxiaoguang wxiaoguang merged commit 60f2033 into go-gitea:main Feb 8, 2022
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 8, 2022
* giteaofficial/main: (28 commits)
  Added auto-save whitespace behavior if it changed manually (go-gitea#15566)
  Support custom ACME provider (go-gitea#18340)
  Refactor i18n, use Locale to provide i18n/translation related functions (go-gitea#18648)
  Only request write when necessary (go-gitea#18657)
  [skip ci] Updated translations via Crowdin
  Add separate SSH_USER config option (go-gitea#17584)
  Be more lenient with label colors (go-gitea#17752)
  remove redundant call to UpdateRepoStats during migration (go-gitea#18591)
  more repo dump/restore tests, including pull requests (go-gitea#18621)
  No longer show the db-downgrade SQL in production (go-gitea#18653)
  Fix the missing i18n key for update checker (go-gitea#18646)
  Update gitea-vet (go-gitea#18640)
  Future proof for 1.18 (go-gitea#18644)
  Add `contrib/upgrade.sh` (go-gitea#18286)
  If rendering has failed due to a net.OpError stop rendering (go-gitea#18642)
  Delete old git.NewCommand() and use it as git.NewCommandContext() (go-gitea#18552)
  Update JS dependencies (go-gitea#18636)
  fix commits_list_small.tmpl (go-gitea#18641)
  Fix `make fmt` and `make fmt-check` (go-gitea#18633)
  Frontport of changelog for v1.16.1 (go-gitea#18615)
  ...
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
* Added ACMECAURL option to support custom ACME provider. Closes go-gitea#18306
* Refactor setting.go https settings, renamed options and variables, and documented app.example.ini
* Refactored runLetsEncrypt to runACME
* Improved documentation
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom ACME Provider Support
8 participants