[systemd-devel] passing additional FDs to service
Andrea Pappacoda
andrea at pappacoda.it
Fri Jul 5 14:19:06 UTC 2024
Hi all!
I'm writing a small FastCGI daemon which, in addition to the socket used
to talk FastCGI to the web server, talks SMTP through another (inet)
socket (as an SMTP client).
The FastCGI socket is created by systemd with a .socket unit and passed
to the service as an fd (which also enables socket activation), while
the SMTP socket is opened and managed by the daemon itself.
What I'm asking here is if there's a way to also pass the SMTP socket as
a file descriptor to the daemon from systemd, so that the daemon doesn't
need to manage sockets itself (as all it does is reading fds passed by
the service manager) and can be further restricted with options like
PrivateNetwork=yes.
Ideally, I'd just get fd 3 and use it to listen for incoming requests,
and get fd 4 and use it to talk TLS + SMTP over TCP to the remote (or
local) SMTP server.
Is this currently possible with systemd? Am I missing something which
would make this a bad idea?
Thanks!
More information about the systemd-devel
mailing list