Check permissions

Former-commit-id: 0f8c6b2e17
This commit is contained in:
Owen
2025-12-04 21:39:20 -05:00
parent c25fb02f1e
commit 2ddb4a5645

View File

@@ -12,6 +12,7 @@ import (
"time"
"github.com/fosrl/newt/bind"
"github.com/fosrl/newt/clients/permissions"
"github.com/fosrl/newt/holepunch"
"github.com/fosrl/newt/logger"
"github.com/fosrl/newt/network"
@@ -99,6 +100,13 @@ func Init(ctx context.Context, config GlobalConfig) {
logger.GetLogger().SetLevel(util.ParseLogLevel(config.LogLevel))
logger.Debug("Checking permissions for native interface")
err := permissions.CheckNativeInterfacePermissions()
if err != nil {
logger.Fatal("Insufficient permissions to create native TUN interface: %v", err)
return
}
if config.HTTPAddr != "" {
apiServer = api.NewAPI(config.HTTPAddr)
} else if config.SocketPath != "" {