Skip to content

Unable to connect to namedpipe server running in a Windows service #7

@gplwhite

Description

@gplwhite

In the scenario that you want to host a NamedPipe based GRPC service in a windows service, you cannot subsequently connect to the service from a client running under a standard user account. This is because the NamedPipe is created with default security permissions.

The ACLs in the default security descriptor for a named pipe grant full control to the LocalSystem account, administrators, and the creator owner. They also grant read access to members of the Everyone group and the anonymous account.
https://learn.microsoft.com/en-us/windows/win32/ipc/named-pipe-security-and-access-rights

While the default ACLs do give read access to Everyone, I think the client also needs Write access to allow it to send GRPC messages to the service.

It seems like a good solution would be to allow the creator of the service to specify the security ACLs to apply to the internally created NamedPipe stream.

Activity

gplwhite

gplwhite commented on Jan 23, 2025

@gplwhite
Author

Using the changes I've submitted in PR #8 I can successfully connect to the server when the server is initialised as below:

var pipeSecurity = new PipeSecurity();
pipeSecurity.AddAccessRule(new PipeAccessRule(new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null), PipeAccessRights.FullControl, AccessControlType.Allow));
pipeSecurity.AddAccessRule(new PipeAccessRule(new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null), PipeAccessRights.ReadWrite | PipeAccessRights.CreateNewInstance, AccessControlType.Allow));

server.ListenAsync(ConnectionFactory.ListenNamedPipe("MyPipe", pipeSecurity));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @gplwhite

      Issue actions

        Unable to connect to namedpipe server running in a Windows service · Issue #7 · protobuf-net/protobuf-net.GrpcLite