Skip to content

[FEATURE] Bind to file descriptor of unix socket #4078

@septatrix

Description

@septatrix

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

#3986 already added support to bind PTB to a unix socket though for security purposes it is common to pass the socket via a file descriptor to the service instead of it opening it manually.

Describe the solution you'd like

It would be great if run_webhook would be expanded to take a socket_fd parameter or if its unix= paramter would support file values in addition to Path/str.

Describe alternatives you've considered

No response

Additional context

The reason to supply the socket as a file descriptor instead of having the service create it on its own is that it allows restricting the capabilities of the service and permissions of the socket further for improved security. Furthermore it allows for socket activation, i.e. a service manager can start listening on the socket and only once the first requests is received does PTB have to be started which saves server resources.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions