URL:
https://github.com/SSSD/sssd/pull/5407
Title: #5407: kcm: check socket path loaded from configuration
pbrezina commented:
"""
> I have several comments to the code. However, I'm sorry, but
I don't think this is correct way to solve it. This is not a problem of KCM only, but
it affects all responders because all sockets are activated in `activate_unix_sockets()`
so it should be also solved here. Obviously, if the socket path is invalid then `bind()`
should fail, so the question is why it succeeds? I don't know, my guess is that
systemd socket activation is somehow affecting it - maybe because it already created a
socket for us and the socket name is defined in kcm.socket unit file instead of sssd.conf
so the one in sssd.conf is ignored? Probably, because if socket is already created by
systemd, SSSD just skips its creation: (from `set_unix_socket()`:
I think I'm missing something from your point. IIUC, sssd-kcm loads the socket path
from sssd.conf, whilst kcm.socket unit file loads it from its own unit file configuration.
If sssd.conf and unit file path are the same, then both processes should fail because the
path isn't valid. Otherwise, only sssd-kcm should fail because sssd.conf socket path
is invalid. As said, I must be missing something because either sssd-kcm or kcm.socket
unit file should fail.
* If systemd is not available, SSSD will create the socket on its own. If the socket file
cannot be created, it will end up with error (`bind()` will fail).
* If systemd is available, SSSD uses its extra features such as socket activation. Socket
activation means that the socket is created by systemd (`ListenStream` option in
sssd-kcm.socket) and when something writes to this socket systemd will start sssd-kcm.
When sssd-kcm starts it checks if the socket is already created by systemd and binds to
it, ignoring `kcm/socket_path` in sssd.conf. For this reason, it does not fail when
`socket_path` is invalid - it does not use it and does not try to bind to it - it ignores
it.
Therefore on systemd enabled systems, with socket activation (`systemctl enable
sssd-kcm.socket`), `socket_path` is not used.
Does this make sense?
"""
See the full comment at
https://github.com/SSSD/sssd/pull/5407#issuecomment-756115152