From 907ed7c016f7f6e25ab596f85f8f12424afd1767 Mon Sep 17 00:00:00 2001 From: wadepickett Date: Tue, 1 Jul 2025 14:59:30 -0700 Subject: [PATCH 1/6] gRPC:PipeSecurity for Named Pipes --- aspnetcore/grpc/interprocess-namedpipes.md | 42 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/aspnetcore/grpc/interprocess-namedpipes.md b/aspnetcore/grpc/interprocess-namedpipes.md index 70e046df7e58..062c7d9f1964 100644 --- a/aspnetcore/grpc/interprocess-namedpipes.md +++ b/aspnetcore/grpc/interprocess-namedpipes.md @@ -4,7 +4,7 @@ author: jamesnk description: Learn how to use gRPC for inter-process communication with Named pipes. monikerRange: '>= aspnetcore-8.0' ms.author: wpickett -ms.date: 01/18/2023 +ms.date: 07/01/2025 uid: grpc/interprocess-namedpipes --- # Inter-process communication with gRPC and Named pipes @@ -47,6 +47,46 @@ The preceding example: * Calls `ListenNamedPipe` to listen to a named pipe with the specified name. * Creates a named pipe endpoint that isn't configured to use HTTPS. For information about enabling HTTPS, see [Kestrel HTTPS endpoint configuration](xref:fundamentals/servers/kestrel/endpoints#listenoptionsusehttps). +### Configuring PipeSecurity for Named Pipes + +To customize the security of the named pipe, for example, to control which users or groups can connect, use the [`NamedPipeTransportOptions`](xref:Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.NamedPipeTransportOptions) class. This allows you to specify a custom [`PipeSecurity`](xref:System.IO.Pipes.PipeSecurity) object. + +Example: + +```csharp +using Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes; +using System.IO.Pipes; +using System.Security.AccessControl; + +var builder = WebApplication.CreateBuilder(args); +builder.WebHost.ConfigureKestrel(serverOptions => +{ + serverOptions.ListenNamedPipe("MyPipeName", listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http2; + + // Configure PipeSecurity + listenOptions.UseNamedPipes(options => + { + var pipeSecurity = new PipeSecurity(); + // Grant read/write access to the Users group + pipeSecurity.AddAccessRule(new PipeAccessRule( + "Users", + PipeAccessRights.ReadWrite, + AccessControlType.Allow)); + // Add additional rules as needed + + options.PipeSecurity = pipeSecurity; + }); + }); +}); + +The preceding example: + +* Uses to access and configure . +* Sets the property to control which users or groups can connect to the named pipe. +* Grants read/write access to the `Users` group. Additional security rules can be added as needed for the scenario. + ## Client configuration `GrpcChannel` supports making gRPC calls over custom transports. When a channel is created, it can be configured with a that has a custom . The callback allows the client to make connections over custom transports and then send HTTP requests over that transport. From 34d6fd7fa4c8a6f6e218debdfcd6a3b54ab3d50f Mon Sep 17 00:00:00 2001 From: wadepickett Date: Tue, 1 Jul 2025 15:06:38 -0700 Subject: [PATCH 2/6] Update metadata tags --- aspnetcore/grpc/interprocess-namedpipes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/aspnetcore/grpc/interprocess-namedpipes.md b/aspnetcore/grpc/interprocess-namedpipes.md index 062c7d9f1964..03e1e00549b1 100644 --- a/aspnetcore/grpc/interprocess-namedpipes.md +++ b/aspnetcore/grpc/interprocess-namedpipes.md @@ -4,6 +4,7 @@ author: jamesnk description: Learn how to use gRPC for inter-process communication with Named pipes. monikerRange: '>= aspnetcore-8.0' ms.author: wpickett +ai-usage: ai-assisted ms.date: 07/01/2025 uid: grpc/interprocess-namedpipes --- From 784f6ff364b3d8ced36a1b7b69bc9504b0c85da4 Mon Sep 17 00:00:00 2001 From: wadepickett Date: Tue, 1 Jul 2025 15:13:06 -0700 Subject: [PATCH 3/6] Corrected code fencing. --- aspnetcore/grpc/interprocess-namedpipes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aspnetcore/grpc/interprocess-namedpipes.md b/aspnetcore/grpc/interprocess-namedpipes.md index 03e1e00549b1..4d7d2c02ac65 100644 --- a/aspnetcore/grpc/interprocess-namedpipes.md +++ b/aspnetcore/grpc/interprocess-namedpipes.md @@ -50,7 +50,7 @@ The preceding example: ### Configuring PipeSecurity for Named Pipes -To customize the security of the named pipe, for example, to control which users or groups can connect, use the [`NamedPipeTransportOptions`](xref:Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.NamedPipeTransportOptions) class. This allows you to specify a custom [`PipeSecurity`](xref:System.IO.Pipes.PipeSecurity) object. +To customize the security of the named pipe, for example, to control which users or groups can connect, use the [`NamedPipeTransportOptions`](xref:Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.NamedPipeTransportOptions) class. This allows a custom [`PipeSecurity`](xref:System.IO.Pipes.PipeSecurity) object to be specified. Example: @@ -81,6 +81,7 @@ builder.WebHost.ConfigureKestrel(serverOptions => }); }); }); +``` The preceding example: From dd35fc7f964aeabea9b0ae4727374d741a981486 Mon Sep 17 00:00:00 2001 From: wadepickett Date: Tue, 1 Jul 2025 15:18:38 -0700 Subject: [PATCH 4/6] Fixed xref --- aspnetcore/grpc/interprocess-namedpipes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/grpc/interprocess-namedpipes.md b/aspnetcore/grpc/interprocess-namedpipes.md index 4d7d2c02ac65..f301f98c86a2 100644 --- a/aspnetcore/grpc/interprocess-namedpipes.md +++ b/aspnetcore/grpc/interprocess-namedpipes.md @@ -85,7 +85,7 @@ builder.WebHost.ConfigureKestrel(serverOptions => The preceding example: -* Uses to access and configure . +* Uses to access and configure . * Sets the property to control which users or groups can connect to the named pipe. * Grants read/write access to the `Users` group. Additional security rules can be added as needed for the scenario. From 208c9d18d0901519fcb52ff38e1c7c2aa286f7f8 Mon Sep 17 00:00:00 2001 From: wadepickett Date: Tue, 1 Jul 2025 16:09:46 -0700 Subject: [PATCH 5/6] fix xref --- aspnetcore/grpc/interprocess-namedpipes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/grpc/interprocess-namedpipes.md b/aspnetcore/grpc/interprocess-namedpipes.md index f301f98c86a2..c8ca4964c130 100644 --- a/aspnetcore/grpc/interprocess-namedpipes.md +++ b/aspnetcore/grpc/interprocess-namedpipes.md @@ -85,7 +85,7 @@ builder.WebHost.ConfigureKestrel(serverOptions => The preceding example: -* Uses to access and configure . +* Uses to access and configure . * Sets the property to control which users or groups can connect to the named pipe. * Grants read/write access to the `Users` group. Additional security rules can be added as needed for the scenario. From d02423e5b707c049e2c4612190824658b233f7fb Mon Sep 17 00:00:00 2001 From: wadepickett Date: Tue, 1 Jul 2025 16:45:33 -0700 Subject: [PATCH 6/6] xref fix again --- aspnetcore/grpc/interprocess-namedpipes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/grpc/interprocess-namedpipes.md b/aspnetcore/grpc/interprocess-namedpipes.md index c8ca4964c130..7b70bd77200c 100644 --- a/aspnetcore/grpc/interprocess-namedpipes.md +++ b/aspnetcore/grpc/interprocess-namedpipes.md @@ -85,7 +85,7 @@ builder.WebHost.ConfigureKestrel(serverOptions => The preceding example: -* Uses to access and configure . +* Uses `UseNamedPipes` to access and configure . * Sets the property to control which users or groups can connect to the named pipe. * Grants read/write access to the `Users` group. Additional security rules can be added as needed for the scenario.