mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-02 11:39:06 +02:00
Add transparent proxy inspection engine with envoy sidecar support
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/netbirdio/netbird/client/iface/device"
|
||||
nbnetstack "github.com/netbirdio/netbird/client/iface/netstack"
|
||||
"github.com/netbirdio/netbird/client/iface/udpmux"
|
||||
"github.com/netbirdio/netbird/client/inspect"
|
||||
"github.com/netbirdio/netbird/client/internal/acl"
|
||||
"github.com/netbirdio/netbird/client/internal/debug"
|
||||
"github.com/netbirdio/netbird/client/internal/dns"
|
||||
@@ -136,6 +137,12 @@ type EngineConfig struct {
|
||||
|
||||
MTU uint16
|
||||
|
||||
// InspectionCACertPath is a local CA cert for transparent proxy MITM.
|
||||
// Takes priority over management-pushed CA.
|
||||
InspectionCACertPath string
|
||||
// InspectionCAKeyPath is the corresponding private key.
|
||||
InspectionCAKeyPath string
|
||||
|
||||
// for debug bundle generation
|
||||
ProfileConfig *profilemanager.Config
|
||||
|
||||
@@ -222,6 +229,10 @@ type Engine struct {
|
||||
latestSyncResponse *mgmProto.SyncResponse
|
||||
flowManager nftypes.FlowManager
|
||||
|
||||
// transparentProxy is the transparent forward proxy for traffic inspection.
|
||||
transparentProxy *inspect.Proxy
|
||||
udpInspectionHookID string
|
||||
|
||||
// auto-update
|
||||
updateManager *updater.Manager
|
||||
|
||||
@@ -1272,6 +1283,9 @@ func (e *Engine) updateNetworkMap(networkMap *mgmProto.NetworkMap) error {
|
||||
fwdEntries := toRouteDomains(e.config.WgPrivateKey.PublicKey().String(), routes)
|
||||
e.updateDNSForwarder(dnsRouteFeatureFlag, fwdEntries)
|
||||
|
||||
// Transparent proxy
|
||||
e.updateTransparentProxy(networkMap.GetTransparentProxyConfig())
|
||||
|
||||
// Ingress forward rules
|
||||
forwardingRules, err := e.updateForwardRules(networkMap.GetForwardingRules())
|
||||
if err != nil {
|
||||
@@ -1695,6 +1709,8 @@ func (e *Engine) parseNATExternalIPMappings() []string {
|
||||
func (e *Engine) close() {
|
||||
log.Debugf("removing Netbird interface %s", e.config.WgIfaceName)
|
||||
|
||||
e.stopTransparentProxy()
|
||||
|
||||
if e.wgInterface != nil {
|
||||
if err := e.wgInterface.Close(); err != nil {
|
||||
log.Errorf("failed closing Netbird interface %s %v", e.config.WgIfaceName, err)
|
||||
|
||||
Reference in New Issue
Block a user