Skip to content

Commit

Permalink
Output IP addresses with %q instead of %s and
Browse files Browse the repository at this point in the history
change ErrorMsgOnFailedPostureCompliance message
  • Loading branch information
gpoul committed Dec 17, 2020
1 parent a1e5abc commit fee5277
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions events/README_ClientVPN.md
Expand Up @@ -26,13 +26,13 @@ func handler(request events.ClientVPNConnectionHandlerRequest) (events.ClientVPN

sourceIP := request.PublicIP
if net.ParseIP(sourceIP) == nil {
return events.ClientVPNConnectionHandlerResponse{}, fmt.Errorf("Invalid parameter PublicIP passed in request: '%s'", sourceIP)
return events.ClientVPNConnectionHandlerResponse{}, fmt.Errorf("Invalid parameter PublicIP passed in request: %q", sourceIP)
}

log.Printf("SOURCE IP: %s", sourceIP)
log.Printf("SOURCE IP: %q", sourceIP)

if allowed, ok := AllowedIPs[sourceIP]; ok && allowed {
log.Printf("Allowing access from: %s", sourceIP)
log.Printf("Allowing access from: %q", sourceIP)
return events.ClientVPNConnectionHandlerResponse{
Allow: true,
ErrorMsgOnFailedPostureCompliance: "",
Expand All @@ -41,10 +41,10 @@ func handler(request events.ClientVPNConnectionHandlerRequest) (events.ClientVPN
}, nil
}

log.Printf("Blocking access from: %s", sourceIP)
log.Printf("Blocking access from: %q", sourceIP)
return events.ClientVPNConnectionHandlerResponse{
Allow: false,
ErrorMsgOnFailedPostureCompliance: "You're accessing from a blocked IP range.",
ErrorMsgOnFailedPostureCompliance: "You're trying to connect from an IP address that is not allowed.",
PostureComplianceStatuses: []string{"BlockedSourceIP"},
SchemaVersion: "v1",
}, nil
Expand Down

0 comments on commit fee5277

Please sign in to comment.