mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #3214 from akhilmhdh/fix/gateway-cert-error
feat: changed to permission check
This commit is contained in:
@@ -189,7 +189,7 @@ func (g *Gateway) Listen(ctx context.Context) error {
|
|||||||
|
|
||||||
log.Printf("Listener started on %s", quicListener.Addr())
|
log.Printf("Listener started on %s", quicListener.Addr())
|
||||||
|
|
||||||
g.registerRelayIsActive(ctx, quicListener.Addr().String(), errCh)
|
g.registerRelayIsActive(ctx, errCh)
|
||||||
|
|
||||||
log.Info().Msg("Gateway started successfully")
|
log.Info().Msg("Gateway started successfully")
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ func (g *Gateway) createPermissionForStaticIps(staticIps string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Gateway) registerRelayIsActive(ctx context.Context, addr string, errCh chan error) error {
|
func (g *Gateway) registerRelayIsActive(ctx context.Context, errCh chan error) error {
|
||||||
ticker := time.NewTicker(15 * time.Second)
|
ticker := time.NewTicker(15 * time.Second)
|
||||||
maxFailures := 3
|
maxFailures := 3
|
||||||
failures := 0
|
failures := 0
|
||||||
@@ -341,13 +341,7 @@ func (g *Gateway) registerRelayIsActive(ctx context.Context, addr string, errCh
|
|||||||
return
|
return
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
log.Debug().Msg("Performing relay connection health check")
|
log.Debug().Msg("Performing relay connection health check")
|
||||||
ctxTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
|
err := g.createPermissionForStaticIps(g.config.InfisicalStaticIp)
|
||||||
defer cancel()
|
|
||||||
// Try to establish a QUIC connection
|
|
||||||
conn, err := quic.DialAddr(ctxTimeout, addr, &tls.Config{
|
|
||||||
InsecureSkipVerify: false, // Skip certificate verification
|
|
||||||
NextProtos: []string{"infisical-gateway"},
|
|
||||||
}, nil)
|
|
||||||
if err != nil && !strings.Contains(err.Error(), "tls:") {
|
if err != nil && !strings.Contains(err.Error(), "tls:") {
|
||||||
failures++
|
failures++
|
||||||
log.Warn().Err(err).Int("failures", failures).Msg("Failed to refresh TURN permissions")
|
log.Warn().Err(err).Int("failures", failures).Msg("Failed to refresh TURN permissions")
|
||||||
@@ -357,9 +351,6 @@ func (g *Gateway) registerRelayIsActive(ctx context.Context, addr string, errCh
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if conn != nil {
|
|
||||||
defer conn.CloseWithError(0, "All good")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
Reference in New Issue
Block a user