[systemd-devel] udp socket-activation "fake-service"

Reindl Harald h.reindl at thelounge.net
Fri Mar 22 11:52:42 UTC 2019



Am 18.03.19 um 17:29 schrieb Reindl Harald:
> Am 18.03.19 um 11:31 schrieb Reindl Harald:
>> Am 18.03.19 um 10:54 schrieb Lennart Poettering:
>>> I am not fully grokking what you are trying to do, but to recv UDP
>>> dgrams you'd have to write a tiny program that calls recvfrom() (or a
>>> similar syscall) on the sockets passed, and then replies to it with
>>> sendto() (or a similar syscall), using the address of the source
>>> (i.e. the struct sockaddr recvfrom() returns) to respond to the dgram.
>>
>> listen on UDP 1-1024 with socket activation to NMAP scan over ac omplete
>> network (the dummy machine has all ip addresses from 2-254 in the /24)
>> and verify a firewall setup which goes so 1:1 into production
>>
>> in other words: i don't care what process after socket activation does,
>> i just need to see in NMAP if the port is open cor closed through the
>> firewall

FWIW attached the c-code, a sample socket/service and php code which
deals with the fact that systemd activation obviously don't buffer and
forward already received packets after spawn up the service

that "RuntimeMaxSec=1" has no option to not fail but just stop the
service isn't that funny but it works for the usecase
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check.php
Type: application/x-php
Size: 612 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190322/fba27833/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo-udp-systemd-activation.c
Type: text/x-csrc
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190322/fba27833/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: systemd-demo-udp-172.16.0.4-53.service
Type: text/x-dbus-service
Size: 749 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190322/fba27833/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: systemd-demo-udp-172.16.0.4-53.socket
Type: text/x-systemd-unit
Size: 165 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190322/fba27833/attachment-0005.bin>


More information about the systemd-devel mailing list