Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/analyze-target.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Analyze (target)"
on:
pull_request_target:
branches: [master]
branches: [master, failover]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "ci"
on:
push:
branches: [master]
branches: [master, failover]
pull_request:
branches: [master]
branches: [master, failover]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
pull_request_target:
branches:
- master
- failover
types:
- labeled
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Static code analysis"
on:
push:
branches: [master]
branches: [master, failover]
pull_request:
branches: [master]
branches: [master, failover]
schedule:
# Everyday at midnight
- cron: '0 0 * * *'
Expand Down
73 changes: 73 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ if HAVE_CMOCKA
test_sbus_message \
test_sbus_opath \
test_fo_srv \
test_failover_server \
pam-srv-tests \
ssh-srv-tests \
test_ipa_subdom_util \
Expand Down Expand Up @@ -422,6 +423,10 @@ sssdlib_LTLIBRARIES += \
$(NULL)
endif

sssdlib_LTLIBRARIES += \
libsss_minimal.la \
$(NULL)

ldblib_LTLIBRARIES = \
memberof.la

Expand Down Expand Up @@ -648,6 +653,24 @@ SSSD_FAILOVER_OBJ = \
src/providers/fail_over_srv.c \
$(SSSD_RESOLV_OBJ)

# Make sure to build new failover code to test compilation even though it is
# not used anywhere yet.
SSSD_NEW_FAILOVER_OBJ = \
src/providers/failover/failover.c \
src/providers/failover/failover_callback.c \
src/providers/failover/failover_refresh_candidates.c \
src/providers/failover/failover_group.c \
src/providers/failover/failover_server_resolve.c \
src/providers/failover/failover_server.c \
src/providers/failover/failover_srv.c \
src/providers/failover/failover_transaction.c \
src/providers/failover/failover_vtable_op.c \
src/providers/failover/failover_vtable.c \
src/providers/failover/ldap/failover_ldap_connect.c \
src/providers/failover/ldap/failover_ldap_kinit.c \
$(SSSD_RESOLV_OBJ) \
$(NULL)

SSSD_LIBS = \
$(TALLOC_LIBS) \
$(TEVENT_LIBS) \
Expand Down Expand Up @@ -840,6 +863,15 @@ dist_noinst_HEADERS = \
src/providers/be_refresh.h \
src/providers/fail_over.h \
src/providers/fail_over_srv.h \
src/providers/failover/failover.h \
src/providers/failover/failover_group.h \
src/providers/failover/failover_refresh_candidates.h \
src/providers/failover/failover_server.h \
src/providers/failover/failover_server_resolve.h \
src/providers/failover/failover_srv.h \
src/providers/failover/failover_transaction.h \
src/providers/failover/failover_vtable.h \
src/providers/failover/failover_vtable_op.h \
src/util/child_common.h \
src/util/child_bootstrap.h \
src/providers/simple/simple_access.h \
Expand Down Expand Up @@ -901,6 +933,7 @@ dist_noinst_HEADERS = \
src/providers/idp/idp_id.h \
src/providers/idp/idp_opts.h \
src/providers/idp/idp_private.h \
src/providers/minimal/minimal_id.h \
src/tools/tools_util.h \
src/resolv/async_resolv.h \
src/tests/common.h \
Expand Down Expand Up @@ -3471,6 +3504,24 @@ test_fo_srv_LDADD = \
libsss_test_common.la \
$(NULL)

test_failover_server_SOURCES = \
src/tests/cmocka/test_failover_server.c \
src/providers/failover/failover_server.c \
$(SSSD_RESOLV_TESTS_OBJ) \
$(NULL)
test_failover_server_CFLAGS = \
$(AM_CFLAGS) \
$(CMOCKA_CFLAGS) \
$(NULL)
test_failover_server_LDADD = \
$(CARES_LIBS) \
$(CMOCKA_LIBS) \
$(POPT_LIBS) \
$(SSSD_INTERNAL_LTLIBS) \
$(TALLOC_LIBS) \
libsss_test_common.la \
$(NULL)

test_sdap_initgr_SOURCES = \
src/tests/cmocka/common_mock_sdap.c \
src/tests/cmocka/common_mock_sysdb_objects.c \
Expand Down Expand Up @@ -4678,6 +4729,28 @@ libsss_idp_la_LDFLAGS = \
-module \
$(NULL)

libsss_minimal_la_SOURCES = \
src/providers/minimal/minimal_init.c \
src/providers/minimal/minimal_id.c \
src/providers/minimal/minimal_id_services.c \
src/providers/minimal/minimal_ldap_auth.c \
$(SSSD_NEW_FAILOVER_OBJ) \
$(NULL)

libsss_minimal_la_CFLAGS = \
$(AM_CFLAGS) \
$(NULL)

libsss_minimal_la_LIBADD = \
$(SSSD_INTERNAL_LTLIBS) \
libsss_ldap_common.la \
$(NULL)

libsss_minimal_la_LDFLAGS = \
-avoid-version \
-module \
$(NULL)

krb5_child_SOURCES = \
src/providers/krb5/krb5_child.c \
src/providers/krb5/krb5_child_share.c \
Expand Down
88 changes: 88 additions & 0 deletions minimal-provider-notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Minimal SSSD provider

This is used as a proof of concept for the new failover implementation. It can
also be used to see what changes are required in order to switch to the new
code, however it really does only minimum amount of changes to get it working.
It would be very good to provide more thorough refactoring in the real
providers.

The minimal provider supports:
- services lookup (getent services)
- user authentication

## Populate LDAP

```
$ vim objects.ldif
dn: ou=users,dc=ldap,dc=test
objectClass: top
objectClass: organizationalUnit
ou: users

# Password is Secret123
dn: cn=user-1,ou=users,dc=ldap,dc=test
uid: user-1
uidNumber: 10000
homeDirectory: /home/user-1
gidNumber: 100000
cn: user-1
objectClass: posixAccount
objectClass: top
userPassword:: e1BCS0RGMi1TSEE1MTJ9MTAwMDAwJEVZU2lqOFgxTTVFZUIrMXlHQzdvZkhwZzd
XZXpYRGJwJG0vTVUyMUIrTGNNb2tkRVcvUFJ6YWlhc21zdlNDeVJWdGxPU3c3c05YbHk2NUxBcUcz
ODJqQUJWUEp2N1ZnOUtRdXhEamVlbmxEV3V5Ylg5UFdKMW5nPT0=

dn: ou=services,dc=ldap,dc=test
objectClass: top
objectClass: organizationalUnit
ou: services

dn: cn=service0,ou=services,dc=ldap,dc=test
objectClass: ipService
cn: service0
ipServiceProtocol: tcp
ipServicePort: 12345

$ ldapadd -D "cn=Directory Manager" -w Secret123 -H ldap://master.ldap.test -f objects.ldif -vv
```

## Verify LDAP contents

```
$ ldapsearch -D "cn=Directory Manager" -w Secret123 -H ldap://master.ldap.test -b dc=ldap,dc=test
```

## Configure SSSD for services lookup

```
[sssd]
domains = minimal

[domain/minimal]
debug_level = 9
id_provider = minimal

$ getent services -s sss service0
service0 12345/tcp
```

## Configure SSSD for user authentication

Note: user lookup is done by id provider

```
[sssd]
services = nss, pam
domains = minimal

[domain/minimal]
debug_level = 9
id_provider = ldap
auth_provider = minimal
ldap_uri = _srv_
dns_discovery_domain = ldap.test
ldap_tls_reqcert = never

$ su user-1
Password: Secret123
```
Loading
Loading