Added experimental acme renew from Let's Encrypt

This commit is contained in:
Toby Chui
2023-06-23 23:09:10 +08:00
parent 594f75da97
commit 23eca5afae
24 changed files with 3470 additions and 30 deletions

View File

@@ -8,6 +8,7 @@ import (
"strings"
"time"
"imuslab.com/zoraxy/mod/acme"
"imuslab.com/zoraxy/mod/auth"
"imuslab.com/zoraxy/mod/database"
"imuslab.com/zoraxy/mod/dynamicproxy/redirection"
@@ -95,13 +96,14 @@ func startupSequence() {
}
/*
Path Blocker
Path Rules
This section of starutp script start the pathblocker
from file.
This section of starutp script start the path rules where
user can define their own routing logics
*/
pathRuleHandler = pathrule.NewPathBlocker(&pathrule.Options{
pathRuleHandler = pathrule.NewPathRuleHandler(&pathrule.Options{
Enabled: false,
ConfigFolder: "./rules/pathrules",
})
@@ -188,6 +190,17 @@ func startupSequence() {
//Create an analytic loader
AnalyticLoader = analytic.NewDataLoader(sysdb, statisticCollector)
/*
ACME API
Obtaining certificates from ACME Server
*/
acmeHandler = initACME()
acmeAutoRenewer, err = acme.NewAutoRenewer("./rules/acme_conf.json", "./certs/", int64(*acmeAutoRenewInterval), acmeHandler)
if err != nil {
log.Fatal(err)
}
}
// This sequence start after everything is initialized