Skip to content

Commit

Permalink
RESPONDER: check that configured sockets match
Browse files Browse the repository at this point in the history
Check if the sockets defined in systemd unit and sssd.conf match. If
they don't, then print a warning message.

Moreover, change man page regarding socket_path option to indicate that
it will be overwritten by systemd's unit file.

Resolves: #5406

Reviewed-by: Pavel Březina <[email protected]>
  • Loading branch information
ikerexxe authored and pbrezina committed Feb 19, 2021
1 parent fd7ce7b commit f890fc4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/man/sssd-kcm.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ systemctl restart sssd-kcm.service
<para>
Default: <replaceable>/var/run/.heim_org.h5l.kcm-socket</replaceable>
</para>
<para>
<phrase condition="have_systemd">
Note: on platforms where systemd is supported, the
socket path is overwritten by the one defined in
the sssd-kcm.socket unit file.
</phrase>
</para>
</listitem>
</varlistentry>
<varlistentry>
Expand Down
11 changes: 11 additions & 0 deletions src/responder/common/responder_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@ int activate_unix_sockets(struct resp_ctx *rctx,
connection_setup_t conn_setup)
{
int ret;
struct sockaddr_un sockaddr;
socklen_t sockaddr_len = sizeof(sockaddr);

#ifdef HAVE_SYSTEMD
if (rctx->lfd == -1 && rctx->priv_lfd == -1) {
Expand Down Expand Up @@ -1032,6 +1034,15 @@ int activate_unix_sockets(struct resp_ctx *rctx,
goto done;
}

ret = getsockname(rctx->lfd, (struct sockaddr *) &sockaddr, &sockaddr_len);
if (ret == EOK) {
if (memcmp(rctx->sock_name, sockaddr.sun_path, strlen(rctx->sock_name)) != 0) {
DEBUG(SSSDBG_CONF_SETTINGS,
"Warning: socket path defined in systemd unit (%s) and sssd.conf (%s) don't match\n",
sockaddr.sun_path, rctx->sock_name);
}
}

ret = sss_fd_nonblocking(rctx->lfd);
if (ret != EOK) goto done;
if (numfds == 2) {
Expand Down

0 comments on commit f890fc4

Please sign in to comment.