Skip to content
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

Any hints on how Systemd Socket Support Might be Added #7

Open
s243a opened this issue Nov 7, 2020 · 1 comment
Open

Any hints on how Systemd Socket Support Might be Added #7

s243a opened this issue Nov 7, 2020 · 1 comment

Comments

@s243a
Copy link

s243a commented Nov 7, 2020

As I discussed elsewhere (see post) this doesn't work with the snap package manager because it doesn't support systemd sockets. I tried to use ncat and socat to create the sockets:

ncat -U /run/snapd.socket  -v --listen --keep-open --exec /usr/lib/snapd/snapd 0666
socat TCP-LISTEN:0666,reuseaddr UNIX-CLIENT:/run/snapd.socket

https://forum.puppylinux.com/viewtopic.php?p=9359#p9359

but I don't really know what I'm doing. I know this project is no longer being maintained but any hints about how I might go about implementing fake systemd sockets via a bash script would be greatly appreciated. :)

@s243a
Copy link
Author

s243a commented Nov 8, 2020

As I discussed elsewhere (see post) this doesn't work with the snap package manager because it doesn't support systemd sockets. I tried to use ncat and socat to create the sockets:

ncat -U /run/snapd.socket  -v --listen --keep-open --exec /usr/lib/snapd/snapd 0666
socat TCP-LISTEN:0666,reuseaddr UNIX-CLIENT:/run/snapd.socket

https://forum.puppylinux.com/viewtopic.php?p=9359#p9359

but I don't really know what I'm doing. I know this project is no longer being maintained but any hints about how I might go about implementing fake systemd sockets via a bash script would be greatly appreciated. :)

One thing I have wrong here is that the 0666 is the socket filesystem premissions rather than the port:

SocketMode=

If listening on a file system socket or FIFO, this option specifies the file system access mode used when creating the file node. Takes an access mode in octal notation. Defaults to 0666.

https://www.freedesktop.org/software/systemd/man/systemd.socket.html

I'm also not sure where the http service gets started because as far as I can tell snap.socket only specifies a Unix domain socket:

ListenStream=, ListenDatagram=, ListenSequentialPacket=

Specifies an address to listen on for a stream (SOCK_STREAM), datagram (SOCK_DGRAM), or sequential packet (SOCK_SEQPACKET) socket, respectively. The address can be written in various formats:

If the address starts with a slash ("/"), it is read as file system socket in the AF_UNIX socket family.

...
Note that SOCK_SEQPACKET (i.e. ListenSequentialPacket=) is only available for AF_UNIX sockets. SOCK_STREAM (i.e. ListenStream=) when used for IP sockets refers to TCP sockets, SOCK_DGRAM (i.e. ListenDatagram=) to UDP.

These options may be specified more than once, in which case incoming traffic on any of the sockets will trigger service activation, and all listed sockets will be passed to the service, regardless of whether there is incoming traffic on them or not. If the empty string is assigned to any of these options, the list of addresses to listen on is reset, all prior uses of any of these options will have no effect.
https://www.freedesktop.org/software/systemd/man/systemd.socket.html

Some other links which may be helpful for understanding this:
https://www.linux.com/training-tutorials/end-road-systemds-socket-units/
http://0pointer.de/blog/projects/socket-activation.html

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

No branches or pull requests

1 participant