Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
inetd/xinetd functionality with systemd?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Voltago
Advocate
Advocate


Joined: 02 Sep 2003
Posts: 2584
Location: userland

PostPosted: Sun Feb 05, 2017 8:04 pm    Post subject: inetd/xinetd functionality with systemd? Reply with quote

Hi all,

I'm thinking of dipping my toe into the systemd pool, but I'm a bit hazy as to its capabilities nowadays. One thing I'd like to find out whether or not it can replace [x]inetd in some or most cases. More specifically, xinetd can define a service to connect process stdio to a listening network port, like so

Code:
service myservice
{
        disable     = no
        wait        = no
        user        = myuser
        group       = mygroup
        socket_type = stream
        protocol    = tcp
        port        = 22222
        server      = /path/to/executable
        type        = UNLISTED
}


Can systemd do the same thing out of the box? Does systemd allow to add restrictions and limit the number of network connections? Googling suggests it might, but I haven't found a definitive answer. (And since proof of the pudding is in the eating, pointers to examples are appreciated.)
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 480
Location: Estonia

PostPosted: Mon Feb 06, 2017 12:51 am    Post subject: Reply with quote

Systemd has a builtin equivalent functionality for this, called socket units. You can have systemd listen on a port and then when something connects to it, it'll only then launch up the service and pass the socket to it.
Various services also ship with these, so you can e.g enable the sshd.socket unit instead of sshd.service, and it'll launch up sshd only when something connects to it, and keep sshd closed otherwise.
You can even have these sockets spin up a container and pass it into there.

https://www.freedesktop.org/software/systemd/man/systemd.socket.html
http://0pointer.de/blog/projects/socket-activation.html
http://0pointer.de/blog/projects/socket-activated-containers.html
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
Voltago
Advocate
Advocate


Joined: 02 Sep 2003
Posts: 2584
Location: userland

PostPosted: Mon Feb 06, 2017 11:42 am    Post subject: Reply with quote

Thanks Leio, much appreciated!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum