Make sure to validate the client's ip address

This commit is contained in:
Bolke de Bruin 2020-07-25 21:00:58 +02:00
parent 5fc75ef877
commit 0b299619ff
6 changed files with 70 additions and 10 deletions

View file

@ -5,6 +5,7 @@ import (
"context"
"encoding/binary"
"errors"
"github.com/bolkedebruin/rdpgw/client"
"io"
"log"
"net"
@ -96,7 +97,7 @@ func (h *Handler) Process(ctx context.Context) error {
_, cookie := readCreateTunnelRequest(pkt)
if h.VerifyTunnelCreate != nil {
if ok, _ := h.VerifyTunnelCreate(ctx, cookie); !ok {
log.Printf("Invalid PAA cookie received")
log.Printf("Invalid PAA cookie received from client %s", client.GetClientIp(ctx))
return errors.New("invalid PAA cookie")
}
}