mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-08 17:16:36 +01:00
caddytls: Relax the warning for on-demand (#5384)
This commit is contained in:
parent
79de6df93d
commit
be53e432fc
1 changed files with 12 additions and 1 deletions
|
@ -22,6 +22,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -259,7 +260,17 @@ func (t *TLS) Start() error {
|
||||||
if t.Automation.OnDemand == nil ||
|
if t.Automation.OnDemand == nil ||
|
||||||
(t.Automation.OnDemand.Ask == "" && t.Automation.OnDemand.RateLimit == nil) {
|
(t.Automation.OnDemand.Ask == "" && t.Automation.OnDemand.RateLimit == nil) {
|
||||||
for _, ap := range t.Automation.Policies {
|
for _, ap := range t.Automation.Policies {
|
||||||
if ap.OnDemand {
|
isWildcardOrDefault := false
|
||||||
|
if len(ap.Subjects) == 0 {
|
||||||
|
isWildcardOrDefault = true
|
||||||
|
}
|
||||||
|
for _, sub := range ap.Subjects {
|
||||||
|
if strings.HasPrefix(sub, "*") {
|
||||||
|
isWildcardOrDefault = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ap.OnDemand && isWildcardOrDefault {
|
||||||
t.logger.Warn("YOUR SERVER MAY BE VULNERABLE TO ABUSE: on-demand TLS is enabled, but no protections are in place",
|
t.logger.Warn("YOUR SERVER MAY BE VULNERABLE TO ABUSE: on-demand TLS is enabled, but no protections are in place",
|
||||||
zap.String("docs", "https://caddyserver.com/docs/automatic-https#on-demand-tls"))
|
zap.String("docs", "https://caddyserver.com/docs/automatic-https#on-demand-tls"))
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue