Log IP address that we're matching against allowFrom values stored in the DB (#46)

* Add logging for IP matching

* Fix typo
This commit is contained in:
Joona Hoikkala 2018-03-01 16:53:38 +02:00 committed by GitHub
parent 11c852ee91
commit 9a908d7d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"net"
"github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
)
// ACMETxt is the default structure for the user controlled record
@ -47,6 +48,7 @@ func (a ACMETxt) allowedFrom(ip string) bool {
if len(a.AllowFrom.ValidEntries()) == 0 {
return true
}
log.WithFields(log.Fields{"ip": remoteIP}).Debug("Checking if update is permitted from IP")
for _, v := range a.AllowFrom.ValidEntries() {
_, vnet, _ := net.ParseCIDR(v)
if vnet.Contains(remoteIP) {