Skip to content

Commit

Permalink
Fixed contentkeeper firewall sso
Browse files Browse the repository at this point in the history
  • Loading branch information
fdurand committed Feb 24, 2025
1 parent 8e9bed6 commit 3748ed0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions go/firewallsso/contentkeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/inverse-inc/go-radius/rfc2866"
"github.com/inverse-inc/go-radius/rfc2869"
"github.com/inverse-inc/go-utils/log"
"github.com/inverse-inc/go-utils/sharedutils"
"github.com/inverse-inc/packetfence/go/config/pfcrypt"
)

Expand All @@ -25,17 +24,14 @@ type ContentKeeper struct {
// Send an SSO start to the ContentKeeper firewall
// Returns an error unless there is a valid reply from the firewall
func (fw *ContentKeeper) Start(ctx context.Context, info map[string]string, timeout int) (bool, error) {

p := fw.startRadiusPacket(ctx, info, timeout)
client := fw.getRadiusClient(ctx)

var err error
client.Dialer.LocalAddr, err = net.ResolveUDPAddr("udp", fw.getSourceIp(ctx).String()+":0")
sharedutils.CheckError(err)

// Use the background context since we don't want the lib to use our context
ctx2, cancel := fw.RadiusContextWithTimeout()
defer cancel()
_, err = client.Exchange(ctx2, p, fw.PfconfigHashNS+":"+fw.Port)
dst := fw.getDst(ctx, "udp", fw.PfconfigHashNS, fw.Port)
_, err := client.Exchange(ctx2, p, dst)
if err != nil {
log.LoggerWContext(ctx).Error(fmt.Sprintf("Couldn't SSO to the ContentKeeper, got the following error: %s", err))
return false, err
Expand Down

0 comments on commit 3748ed0

Please sign in to comment.