Browse code

sssd: update to latest v2.9.4 and add patch for CVE-2023-3758

Both simpleifp and files provider have been deprecated,
so remove these. New passkey package can be built if needed,
but leaving that out for now. (Optional build in the upstream
spec file)

Change-Id: I475a3dc11a67232a3f3f25c6e2a5f875b0e26ee2
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/c/photon/+/23821
Reviewed-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Tested-by: gerrit-photon <photon-checkins@vmware.com>

Brennan Lamoreaux authored on 2024/04/27 02:17:08
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,215 @@
0
+From f4ebe1408e0bc67abfbfb5f0ca2ea13803b36726 Mon Sep 17 00:00:00 2001
1
+From: Sumit Bose <sbose@redhat.com>
2
+Date: Wed, 8 Nov 2023 14:50:24 +0100
3
+Subject: [PATCH] ad-gpo: use hash to store intermediate results
4
+MIME-Version: 1.0
5
+Content-Type: text/plain; charset=UTF-8
6
+Content-Transfer-Encoding: 8bit
7
+
8
+Currently after the evaluation of a single GPO file the intermediate
9
+results are stored in the cache and this cache entry is updated until
10
+all applicable GPO files are evaluated. Finally the data in the cache is
11
+used to make the decision of access is granted or rejected.
12
+
13
+If there are two or more access-control request running in parallel one
14
+request might overwrite the cache object with intermediate data while
15
+another request reads the cached data for the access decision and as a
16
+result will do this decision based on intermediate data.
17
+
18
+To avoid this the intermediate results are not stored in the cache
19
+anymore but in hash tables which are specific to the request. Only the
20
+final result is written to the cache to have it available for offline
21
+authentication.
22
+
23
+Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
24
+Reviewed-by: Tomáš Halman <thalman@redhat.com>
25
+(cherry picked from commit d7db7971682da2dbf7642ac94940d6b0577ec35a)
26
+---
27
+ src/providers/ad/ad_gpo.c | 116 +++++++++++++++++++++++++++++++++-----
28
+ 1 file changed, 102 insertions(+), 14 deletions(-)
29
+
30
+diff --git a/src/providers/ad/ad_gpo.c b/src/providers/ad/ad_gpo.c
31
+index 4d12ef7806..f272131059 100644
32
+--- a/src/providers/ad/ad_gpo.c
33
+@@ -1356,6 +1356,33 @@ ad_gpo_extract_policy_setting(TALLOC_CTX *mem_ctx,
34
+     return ret;
35
+ }
36
+ 
37
++static errno_t
38
++add_result_to_hash(hash_table_t *hash, const char *key, char *value)
39
++{
40
++    int hret;
41
++    hash_key_t k;
42
++    hash_value_t v;
43
++
44
++    if (hash == NULL || key == NULL || value == NULL) {
45
++        return EINVAL;
46
++    }
47
++
48
++    k.type = HASH_KEY_CONST_STRING;
49
++    k.c_str = key;
50
++
51
++    v.type = HASH_VALUE_PTR;
52
++    v.ptr = value;
53
++
54
++    hret = hash_enter(hash, &k, &v);
55
++    if (hret != HASH_SUCCESS) {
56
++        DEBUG(SSSDBG_OP_FAILURE, "Failed to add [%s][%s] to hash: [%s].\n",
57
++                                 key, value, hash_error_string(hret));
58
++        return EIO;
59
++    }
60
++
61
++    return EOK;
62
++}
63
++
64
+ /*
65
+  * This function parses the cse-specific (GP_EXT_GUID_SECURITY) filename,
66
+  * and stores the allow_key and deny_key of all of the gpo_map_types present
67
+@@ -1363,6 +1390,7 @@ ad_gpo_extract_policy_setting(TALLOC_CTX *mem_ctx,
68
+  */
69
+ static errno_t
70
+ ad_gpo_store_policy_settings(struct sss_domain_info *domain,
71
++                             hash_table_t *allow_maps, hash_table_t *deny_maps,
72
+                              const char *filename)
73
+ {
74
+     struct ini_cfgfile *file_ctx = NULL;
75
+@@ -1496,14 +1524,14 @@ ad_gpo_store_policy_settings(struct sss_domain_info *domain,
76
+                 goto done;
77
+             } else if (ret != ENOENT) {
78
+                 const char *value = allow_value ? allow_value : empty_val;
79
+-                ret = sysdb_gpo_store_gpo_result_setting(domain,
80
+-                                                         allow_key,
81
+-                                                         value);
82
++                ret = add_result_to_hash(allow_maps, allow_key,
83
++                                         talloc_strdup(allow_maps, value));
84
+                 if (ret != EOK) {
85
+-                    DEBUG(SSSDBG_CRIT_FAILURE,
86
+-                          "sysdb_gpo_store_gpo_result_setting failed for key:"
87
+-                          "'%s' value:'%s' [%d][%s]\n", allow_key, allow_value,
88
+-                          ret, sss_strerror(ret));
89
++                    DEBUG(SSSDBG_CRIT_FAILURE, "Failed to add key: [%s] "
90
++                                               "value: [%s] to allow maps "
91
++                                               "[%d][%s].\n",
92
++                                               allow_key, value, ret,
93
++                                               sss_strerror(ret));
94
+                     goto done;
95
+                 }
96
+             }
97
+@@ -1523,14 +1551,14 @@ ad_gpo_store_policy_settings(struct sss_domain_info *domain,
98
+                 goto done;
99
+             } else if (ret != ENOENT) {
100
+                 const char *value = deny_value ? deny_value : empty_val;
101
+-                ret = sysdb_gpo_store_gpo_result_setting(domain,
102
+-                                                         deny_key,
103
+-                                                         value);
104
++                ret = add_result_to_hash(deny_maps, deny_key,
105
++                                         talloc_strdup(deny_maps, value));
106
+                 if (ret != EOK) {
107
+-                    DEBUG(SSSDBG_CRIT_FAILURE,
108
+-                          "sysdb_gpo_store_gpo_result_setting failed for key:"
109
+-                          "'%s' value:'%s' [%d][%s]\n", deny_key, deny_value,
110
+-                          ret, sss_strerror(ret));
111
++                    DEBUG(SSSDBG_CRIT_FAILURE, "Failed to add key: [%s] "
112
++                                               "value: [%s] to deny maps "
113
++                                               "[%d][%s].\n",
114
++                                               deny_key, value, ret,
115
++                                               sss_strerror(ret));
116
+                     goto done;
117
+                 }
118
+             }
119
+@@ -1825,6 +1853,8 @@ struct ad_gpo_access_state {
120
+     int num_cse_filtered_gpos;
121
+     int cse_gpo_index;
122
+     const char *ad_domain;
123
++    hash_table_t *allow_maps;
124
++    hash_table_t *deny_maps;
125
+ };
126
+ 
127
+ static void ad_gpo_connect_done(struct tevent_req *subreq);
128
+@@ -1946,6 +1976,19 @@ ad_gpo_access_send(TALLOC_CTX *mem_ctx,
129
+         goto immediately;
130
+     }
131
+ 
132
++    ret = sss_hash_create(state, 0, &state->allow_maps);
133
++    if (ret != EOK) {
134
++        DEBUG(SSSDBG_FATAL_FAILURE, "Could not create allow maps "
135
++              "hash table [%d]: %s\n", ret, sss_strerror(ret));
136
++        goto immediately;
137
++    }
138
++
139
++    ret = sss_hash_create(state, 0, &state->deny_maps);
140
++    if (ret != EOK) {
141
++        DEBUG(SSSDBG_FATAL_FAILURE, "Could not create deny maps "
142
++              "hash table [%d]: %s\n", ret, sss_strerror(ret));
143
++        goto immediately;
144
++    }
145
+ 
146
+     subreq = sdap_id_op_connect_send(state->sdap_op, state, &ret);
147
+     if (subreq == NULL) {
148
+@@ -2632,6 +2675,43 @@ ad_gpo_cse_step(struct tevent_req *req)
149
+     return EAGAIN;
150
+ }
151
+ 
152
++static errno_t
153
++store_hash_maps_in_cache(struct sss_domain_info *domain,
154
++                         hash_table_t *allow_maps, hash_table_t *deny_maps)
155
++{
156
++    int ret;
157
++    struct hash_iter_context_t *iter;
158
++    hash_entry_t *entry;
159
++    size_t c;
160
++    hash_table_t *hash_list[] = { allow_maps, deny_maps, NULL};
161
++
162
++
163
++    for (c = 0; hash_list[c] != NULL; c++) {
164
++        iter = new_hash_iter_context(hash_list[c]);
165
++        if (iter == NULL) {
166
++            DEBUG(SSSDBG_OP_FAILURE, "Failed to create hash iterator.\n");
167
++            return EINVAL;
168
++        }
169
++
170
++        while ((entry = iter->next(iter)) != NULL) {
171
++            ret = sysdb_gpo_store_gpo_result_setting(domain,
172
++                                                     entry->key.c_str,
173
++                                                     entry->value.ptr);
174
++            if (ret != EOK) {
175
++                free(iter);
176
++                DEBUG(SSSDBG_OP_FAILURE,
177
++                      "sysdb_gpo_store_gpo_result_setting failed for key:"
178
++                      "[%s] value:[%s] [%d][%s]\n", entry->key.c_str,
179
++                      (char *) entry->value.ptr, ret, sss_strerror(ret));
180
++                return ret;
181
++            }
182
++        }
183
++        talloc_free(iter);
184
++    }
185
++
186
++    return EOK;
187
++}
188
++
189
+ /*
190
+  * This cse-specific function (GP_EXT_GUID_SECURITY) increments the
191
+  * cse_gpo_index until the policy settings for all applicable GPOs have been
192
+@@ -2673,6 +2753,7 @@ ad_gpo_cse_done(struct tevent_req *subreq)
193
+      * (as part of the GPO Result object in the sysdb cache).
194
+      */
195
+     ret = ad_gpo_store_policy_settings(state->host_domain,
196
++                                       state->allow_maps, state->deny_maps,
197
+                                        cse_filtered_gpo->policy_filename);
198
+     if (ret != EOK && ret != ENOENT) {
199
+         DEBUG(SSSDBG_OP_FAILURE,
200
+@@ -2686,6 +2767,13 @@ ad_gpo_cse_done(struct tevent_req *subreq)
201
+ 
202
+     if (ret == EOK) {
203
+         /* ret is EOK only after all GPO policy files have been downloaded */
204
++        ret = store_hash_maps_in_cache(state->host_domain,
205
++                                       state->allow_maps, state->deny_maps);
206
++        if (ret != EOK) {
207
++            DEBUG(SSSDBG_OP_FAILURE, "Failed to store evaluated GPO maps "
208
++                                     "[%d][%s].\n", ret, sss_strerror(ret));
209
++            goto done;
210
++        }
211
+         ret = ad_gpo_perform_hbac_processing(state,
212
+                                              state->gpo_mode,
213
+                                              state->gpo_map_type,
... ...
@@ -24,8 +24,8 @@
24 24
 
25 25
 Name:           sssd
26 26
 Summary:        System Security Services Daemon
27
-Version:        2.8.2
28
-Release:        13%{?dist}
27
+Version:        2.9.4
28
+Release:        1%{?dist}
29 29
 URL:            http://github.com/SSSD/sssd
30 30
 License:        GPLv3+
31 31
 Group:          System Environment/Kernel
... ...
@@ -33,11 +33,12 @@ Vendor:         VMware, Inc.
33 33
 Distribution:   Photon
34 34
 
35 35
 Source0: https://github.com/SSSD/sssd/releases/download/%{version}/%{name}-%{version}.tar.gz
36
-%define sha512 sssd=10b7a641823aefb43e30bff9e5f309a1f48446ffff421a06f86496db24ba1fbd384733b5690864507ef9b2f04c91e563fe9820536031f83f1bd6e93edfedee55
36
+%define sha512 sssd=9546cf074628f32137b16ca0c763988785271124244b645d1e786762e8578f10d983793a29bffcc004b064452fe8d465476a3041688d2f3c11c2751fb5bec3e2
37 37
 
38 38
 Source1: sssd.conf
39 39
 
40 40
 Patch0: 0001-replace-python-with-python3-in-sss_obfuscate.patch
41
+Patch1: CVE-2023-3758.patch
41 42
 
42 43
 Requires: sssd-ad = %{version}-%{release}
43 44
 Requires: sssd-common = %{version}-%{release}
... ...
@@ -128,6 +129,9 @@ the existing back ends.
128 128
 %package common
129 129
 Summary: Common files for the SSSD
130 130
 License: GPLv3+
131
+# libsss_simpleifp is removed starting 2.9.0
132
+Obsoletes: libsss_simpleifp < 2.9.0
133
+Obsoletes: libsss_simpleifp-debuginfo < 2.9.0
131 134
 # Requires
132 135
 Requires: samba-client >= %{ldb_version}
133 136
 Requires: sssd-client = %{version}-%{release}
... ...
@@ -316,6 +320,7 @@ identity data from and authenticate against an Active Directory server.
316 316
 Summary: The proxy back end of the SSSD
317 317
 License: GPLv3+
318 318
 Requires: sssd-common = %{version}-%{release}
319
+Requires: libsss_certmap = %{version}-%{release}
319 320
 
320 321
 %description proxy
321 322
 Provides the proxy back end which can be used to wrap an existing NSS and/or
... ...
@@ -407,24 +412,6 @@ Requires: sssd-common = %{version}-%{release}
407 407
 Provides rules for polkit integration with SSSD. This is required
408 408
 for smartcard support.
409 409
 
410
-%package -n libsss_simpleifp
411
-Summary: The SSSD D-Bus responder helper library
412
-License: GPLv3+
413
-Requires: sssd-dbus = %{version}-%{release}
414
-Requires: libcap
415
-
416
-%description -n libsss_simpleifp
417
-Provides library that simplifies D-Bus API for the SSSD InfoPipe responder.
418
-
419
-%package -n libsss_simpleifp-devel
420
-Summary: The SSSD D-Bus responder helper library
421
-License: GPLv3+
422
-Requires: dbus-devel
423
-Requires: libsss_simpleifp = %{version}-%{release}
424
-
425
-%description -n libsss_simpleifp-devel
426
-Provides library that simplifies D-Bus API for the SSSD InfoPipe responder.
427
-
428 410
 %package winbind_idmap
429 411
 Summary: SSSD's idmap_sss Backend for Winbind
430 412
 License: GPLv3+ and LGPLv3+
... ...
@@ -728,8 +715,6 @@ fi
728 728
 %{_libexecdir}/%{servicename}/sssd_check_socket_activated_responders
729 729
 
730 730
 %dir %{_libdir}/%{name}
731
-# The files provider is intentionally packaged in -common
732
-%{_libdir}/%{name}/libsss_files.so
733 731
 %{_libdir}/%{name}/libsss_simple.so
734 732
 
735 733
 #Internal shared libraries
... ...
@@ -785,7 +770,6 @@ fi
785 785
 %{_mandir}/man1/sss_ssh_authorizedkeys.1*
786 786
 %{_mandir}/man1/sss_ssh_knownhostsproxy.1*
787 787
 %{_mandir}/man5/sssd.conf.5*
788
-%{_mandir}/man5/sssd-files.5*
789 788
 %{_mandir}/man5/sssd-simple.5*
790 789
 %{_mandir}/man5/sssd-sudo.5*
791 790
 %{_mandir}/man5/sssd-session-recording.5*
... ...
@@ -862,20 +846,9 @@ fi
862 862
 %{_mandir}/man5/sssd-ifp.5*
863 863
 %{_unitdir}/sssd-ifp.service
864 864
 # InfoPipe DBus plumbing
865
-%{_sysconfdir}/dbus-1/system.d/org.freedesktop.sssd.infopipe.conf
865
+%{_datadir}/dbus-1/system.d/org.freedesktop.sssd.infopipe.conf
866 866
 %{_datadir}/dbus-1/system-services/org.freedesktop.sssd.infopipe.service
867 867
 
868
-%files -n libsss_simpleifp
869
-%defattr(-,root,root)
870
-%{_libdir}/libsss_simpleifp.so.*
871
-
872
-%files -n libsss_simpleifp-devel
873
-%defattr(-,root,root)
874
-%{_includedir}/sss_sifp.h
875
-%{_includedir}/sss_sifp_dbus.h
876
-%{_libdir}/libsss_simpleifp.so
877
-%{_libdir}/pkgconfig/sss_simpleifp.pc
878
-
879 868
 %files client -f sssd_client.lang
880 869
 %defattr(-,root,root)
881 870
 %license src/sss_client/COPYING src/sss_client/COPYING.LESSER
... ...
@@ -1024,6 +997,8 @@ fi
1024 1024
 %config(noreplace) %{_sysconfdir}/krb5.conf.d/sssd_enable_idp
1025 1025
 
1026 1026
 %changelog
1027
+* Fri Apr 26 2024 Brennan Lamoreaux <brennan.lamoreaux@broadcom.com> 2.9.4-1
1028
+- Upgrade to latest 2.9.4 and add patch for CVE-2023-3758
1027 1029
 * Tue Apr 16 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 2.8.2-13
1028 1030
 - Bump version as a part of dbus upgrade
1029 1031
 * Tue Apr 02 2024 Brennan Lamoreaux <brennan.lamoreaux@broadcom.com> 2.8.2-12