Skip to content

gRPC:PipeSecurity for Named Pipes #35691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 4, 2025
Merged

Conversation

wadepickett
Copy link
Contributor

@wadepickett wadepickett commented Jul 1, 2025

Fixes #31489

Added section and code example on Configuring PipeSecurity for Named Pipes.


Internal previews

📄 File 🔗 Preview link
aspnetcore/grpc/interprocess-namedpipes.md Inter-process communication with gRPC and Named pipes

@wadepickett wadepickett self-assigned this Jul 1, 2025
@wadepickett wadepickett requested a review from JamesNK July 1, 2025 23:52
@wadepickett wadepickett marked this pull request as ready for review July 1, 2025 23:52
@JamesNK
Copy link
Member

JamesNK commented Jul 2, 2025

It's also possible to customize security using CreateNamedPipeServerStream API added in .NET 9: https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-9.0?view=aspnetcore-9.0#customize-kestrel-named-pipe-endpoints

CreateNamedPipeServerStream allows different security settings per-endpoint.

@wadepickett wadepickett requested a review from tdykstra August 1, 2025 22:25
@wadepickett
Copy link
Contributor Author

Sorry to get back to this one so late.

@JamesNK I added your content on CreateNamedPipeServerStream per your suggestion. Does this look OK?

Copy link
Contributor

@tdykstra tdykstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one nit for you to consider.

Co-authored-by: Tom Dykstra <tdykstra@microsoft.com>
@wadepickett wadepickett requested a review from tdykstra August 2, 2025 02:01
Comment on lines 97 to 119
```csharp

var builder = WebApplication.CreateBuilder();

builder.WebHost.ConfigureKestrel(options =>
{
options.ListenNamedPipe("pipe1");
options.ListenNamedPipe("pipe2");
});

builder.WebHost.UseNamedPipes(options =>
{
options.CreateNamedPipeServerStream = (context) =>
{
var pipeSecurity = CreatePipeSecurity(context.NamedPipeEndpoint.PipeName);

return NamedPipeServerStreamAcl.Create(context.NamedPipeEndpoint.PipeName, PipeDirection.InOut,
NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Byte,
context.PipeOptions, inBufferSize: 0, outBufferSize: 0, pipeSecurity);
};
});

```
Copy link
Member

@JamesNK JamesNK Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty lines at beginning and end of code block

Copy link
Contributor

@tdykstra tdykstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Co-authored-by: James Newton-King <james@newtonking.com>
@wadepickett wadepickett merged commit 74a8eff into main Aug 4, 2025
3 checks passed
@wadepickett wadepickett deleted the wadepickett/31489gRPCnamedPipes branch August 4, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gRPC Inter-process: mention NamedPipeTransportOptions configuration of Pipe Security
3 participants