diff options
Diffstat (limited to 'dynamic-layers/networking-layer')
9 files changed, 599 insertions, 0 deletions
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/CVE-2021-3621.patch b/dynamic-layers/networking-layer/recipes-security/sssd/files/CVE-2021-3621.patch new file mode 100644 index 0000000..7a59df9 --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/CVE-2021-3621.patch | |||
@@ -0,0 +1,288 @@ | |||
1 | Backport patch to fix CVE-2021-3621. | ||
2 | |||
3 | Upstream-Status: Backport [https://github.com/SSSD/sssd/commit/7ab83f9] | ||
4 | CVE: CVE-2021-3621 | ||
5 | |||
6 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
7 | |||
8 | From 7ab83f97e1cbefb78ece17232185bdd2985f0bbe Mon Sep 17 00:00:00 2001 | ||
9 | From: Alexey Tikhonov <atikhono@redhat.com> | ||
10 | Date: Fri, 18 Jun 2021 13:17:19 +0200 | ||
11 | Subject: [PATCH] TOOLS: replace system() with execvp() to avoid execution of | ||
12 | user supplied command | ||
13 | MIME-Version: 1.0 | ||
14 | Content-Type: text/plain; charset=UTF-8 | ||
15 | Content-Transfer-Encoding: 8bit | ||
16 | |||
17 | :relnote: A flaw was found in SSSD, where the sssctl command was | ||
18 | vulnerable to shell command injection via the logs-fetch and | ||
19 | cache-expire subcommands. This flaw allows an attacker to trick | ||
20 | the root user into running a specially crafted sssctl command, | ||
21 | such as via sudo, to gain root access. The highest threat from this | ||
22 | vulnerability is to confidentiality, integrity, as well as system | ||
23 | availability. | ||
24 | This patch fixes a flaw by replacing system() with execvp(). | ||
25 | |||
26 | :fixes: CVE-2021-3621 | ||
27 | |||
28 | Reviewed-by: Pavel Březina <pbrezina@redhat.com> | ||
29 | --- | ||
30 | src/tools/sssctl/sssctl.c | 39 ++++++++++++++++------- | ||
31 | src/tools/sssctl/sssctl.h | 2 +- | ||
32 | src/tools/sssctl/sssctl_data.c | 57 +++++++++++----------------------- | ||
33 | src/tools/sssctl/sssctl_logs.c | 32 +++++++++++++++---- | ||
34 | 4 files changed, 73 insertions(+), 57 deletions(-) | ||
35 | |||
36 | diff --git a/src/tools/sssctl/sssctl.c b/src/tools/sssctl/sssctl.c | ||
37 | index 2997dbf968..8adaf30910 100644 | ||
38 | --- a/src/tools/sssctl/sssctl.c | ||
39 | +++ b/src/tools/sssctl/sssctl.c | ||
40 | @@ -97,22 +97,36 @@ sssctl_prompt(const char *message, | ||
41 | return SSSCTL_PROMPT_ERROR; | ||
42 | } | ||
43 | |||
44 | -errno_t sssctl_run_command(const char *command) | ||
45 | +errno_t sssctl_run_command(const char *const argv[]) | ||
46 | { | ||
47 | int ret; | ||
48 | + int wstatus; | ||
49 | |||
50 | - DEBUG(SSSDBG_TRACE_FUNC, "Running %s\n", command); | ||
51 | + DEBUG(SSSDBG_TRACE_FUNC, "Running '%s'\n", argv[0]); | ||
52 | |||
53 | - ret = system(command); | ||
54 | + ret = fork(); | ||
55 | if (ret == -1) { | ||
56 | - DEBUG(SSSDBG_CRIT_FAILURE, "Unable to execute %s\n", command); | ||
57 | ERROR("Error while executing external command\n"); | ||
58 | return EFAULT; | ||
59 | - } else if (WEXITSTATUS(ret) != 0) { | ||
60 | - DEBUG(SSSDBG_CRIT_FAILURE, "Command %s failed with [%d]\n", | ||
61 | - command, WEXITSTATUS(ret)); | ||
62 | + } | ||
63 | + | ||
64 | + if (ret == 0) { | ||
65 | + /* cast is safe - see | ||
66 | + https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html | ||
67 | + "The statement about argv[] and envp[] being constants ... " | ||
68 | + */ | ||
69 | + execvp(argv[0], discard_const_p(char * const, argv)); | ||
70 | ERROR("Error while executing external command\n"); | ||
71 | - return EIO; | ||
72 | + _exit(1); | ||
73 | + } else { | ||
74 | + if (waitpid(ret, &wstatus, 0) == -1) { | ||
75 | + ERROR("Error while executing external command '%s'\n", argv[0]); | ||
76 | + return EFAULT; | ||
77 | + } else if (WEXITSTATUS(wstatus) != 0) { | ||
78 | + ERROR("Command '%s' failed with [%d]\n", | ||
79 | + argv[0], WEXITSTATUS(wstatus)); | ||
80 | + return EIO; | ||
81 | + } | ||
82 | } | ||
83 | |||
84 | return EOK; | ||
85 | @@ -132,11 +146,14 @@ static errno_t sssctl_manage_service(enum sssctl_svc_action action) | ||
86 | #elif defined(HAVE_SERVICE) | ||
87 | switch (action) { | ||
88 | case SSSCTL_SVC_START: | ||
89 | - return sssctl_run_command(SERVICE_PATH" sssd start"); | ||
90 | + return sssctl_run_command( | ||
91 | + (const char *[]){SERVICE_PATH, "sssd", "start", NULL}); | ||
92 | case SSSCTL_SVC_STOP: | ||
93 | - return sssctl_run_command(SERVICE_PATH" sssd stop"); | ||
94 | + return sssctl_run_command( | ||
95 | + (const char *[]){SERVICE_PATH, "sssd", "stop", NULL}); | ||
96 | case SSSCTL_SVC_RESTART: | ||
97 | - return sssctl_run_command(SERVICE_PATH" sssd restart"); | ||
98 | + return sssctl_run_command( | ||
99 | + (const char *[]){SERVICE_PATH, "sssd", "restart", NULL}); | ||
100 | } | ||
101 | #endif | ||
102 | |||
103 | diff --git a/src/tools/sssctl/sssctl.h b/src/tools/sssctl/sssctl.h | ||
104 | index 0115b2457c..599ef65196 100644 | ||
105 | --- a/src/tools/sssctl/sssctl.h | ||
106 | +++ b/src/tools/sssctl/sssctl.h | ||
107 | @@ -47,7 +47,7 @@ enum sssctl_prompt_result | ||
108 | sssctl_prompt(const char *message, | ||
109 | enum sssctl_prompt_result defval); | ||
110 | |||
111 | -errno_t sssctl_run_command(const char *command); | ||
112 | +errno_t sssctl_run_command(const char *const argv[]); /* argv[0] - command */ | ||
113 | bool sssctl_start_sssd(bool force); | ||
114 | bool sssctl_stop_sssd(bool force); | ||
115 | bool sssctl_restart_sssd(bool force); | ||
116 | diff --git a/src/tools/sssctl/sssctl_data.c b/src/tools/sssctl/sssctl_data.c | ||
117 | index 8d79b977fd..bf22913416 100644 | ||
118 | --- a/src/tools/sssctl/sssctl_data.c | ||
119 | +++ b/src/tools/sssctl/sssctl_data.c | ||
120 | @@ -105,15 +105,15 @@ static errno_t sssctl_backup(bool force) | ||
121 | } | ||
122 | } | ||
123 | |||
124 | - ret = sssctl_run_command("sss_override user-export " | ||
125 | - SSS_BACKUP_USER_OVERRIDES); | ||
126 | + ret = sssctl_run_command((const char *[]){"sss_override", "user-export", | ||
127 | + SSS_BACKUP_USER_OVERRIDES, NULL}); | ||
128 | if (ret != EOK) { | ||
129 | ERROR("Unable to export user overrides\n"); | ||
130 | return ret; | ||
131 | } | ||
132 | |||
133 | - ret = sssctl_run_command("sss_override group-export " | ||
134 | - SSS_BACKUP_GROUP_OVERRIDES); | ||
135 | + ret = sssctl_run_command((const char *[]){"sss_override", "group-export", | ||
136 | + SSS_BACKUP_GROUP_OVERRIDES, NULL}); | ||
137 | if (ret != EOK) { | ||
138 | ERROR("Unable to export group overrides\n"); | ||
139 | return ret; | ||
140 | @@ -158,8 +158,8 @@ static errno_t sssctl_restore(bool force_start, bool force_restart) | ||
141 | } | ||
142 | |||
143 | if (sssctl_backup_file_exists(SSS_BACKUP_USER_OVERRIDES)) { | ||
144 | - ret = sssctl_run_command("sss_override user-import " | ||
145 | - SSS_BACKUP_USER_OVERRIDES); | ||
146 | + ret = sssctl_run_command((const char *[]){"sss_override", "user-import", | ||
147 | + SSS_BACKUP_USER_OVERRIDES, NULL}); | ||
148 | if (ret != EOK) { | ||
149 | ERROR("Unable to import user overrides\n"); | ||
150 | return ret; | ||
151 | @@ -167,8 +167,8 @@ static errno_t sssctl_restore(bool force_start, bool force_restart) | ||
152 | } | ||
153 | |||
154 | if (sssctl_backup_file_exists(SSS_BACKUP_USER_OVERRIDES)) { | ||
155 | - ret = sssctl_run_command("sss_override group-import " | ||
156 | - SSS_BACKUP_GROUP_OVERRIDES); | ||
157 | + ret = sssctl_run_command((const char *[]){"sss_override", "group-import", | ||
158 | + SSS_BACKUP_GROUP_OVERRIDES, NULL}); | ||
159 | if (ret != EOK) { | ||
160 | ERROR("Unable to import group overrides\n"); | ||
161 | return ret; | ||
162 | @@ -296,40 +296,19 @@ errno_t sssctl_cache_expire(struct sss_cmdline *cmdline, | ||
163 | void *pvt) | ||
164 | { | ||
165 | errno_t ret; | ||
166 | - char *cmd_args = NULL; | ||
167 | - const char *cachecmd = SSS_CACHE; | ||
168 | - char *cmd = NULL; | ||
169 | - int i; | ||
170 | - | ||
171 | - if (cmdline->argc == 0) { | ||
172 | - ret = sssctl_run_command(cachecmd); | ||
173 | - goto done; | ||
174 | - } | ||
175 | |||
176 | - cmd_args = talloc_strdup(tool_ctx, ""); | ||
177 | - if (cmd_args == NULL) { | ||
178 | - ret = ENOMEM; | ||
179 | - goto done; | ||
180 | + const char **args = talloc_array_size(tool_ctx, | ||
181 | + sizeof(char *), | ||
182 | + cmdline->argc + 2); | ||
183 | + if (!args) { | ||
184 | + return ENOMEM; | ||
185 | } | ||
186 | + memcpy(&args[1], cmdline->argv, sizeof(char *) * cmdline->argc); | ||
187 | + args[0] = SSS_CACHE; | ||
188 | + args[cmdline->argc + 1] = NULL; | ||
189 | |||
190 | - for (i = 0; i < cmdline->argc; i++) { | ||
191 | - cmd_args = talloc_strdup_append(cmd_args, cmdline->argv[i]); | ||
192 | - if (i != cmdline->argc - 1) { | ||
193 | - cmd_args = talloc_strdup_append(cmd_args, " "); | ||
194 | - } | ||
195 | - } | ||
196 | - | ||
197 | - cmd = talloc_asprintf(tool_ctx, "%s %s", cachecmd, cmd_args); | ||
198 | - if (cmd == NULL) { | ||
199 | - ret = ENOMEM; | ||
200 | - goto done; | ||
201 | - } | ||
202 | - | ||
203 | - ret = sssctl_run_command(cmd); | ||
204 | - | ||
205 | -done: | ||
206 | - talloc_free(cmd_args); | ||
207 | - talloc_free(cmd); | ||
208 | + ret = sssctl_run_command(args); | ||
209 | |||
210 | + talloc_free(args); | ||
211 | return ret; | ||
212 | } | ||
213 | diff --git a/src/tools/sssctl/sssctl_logs.c b/src/tools/sssctl/sssctl_logs.c | ||
214 | index 9ff2be05b6..ebb2c4571c 100644 | ||
215 | --- a/src/tools/sssctl/sssctl_logs.c | ||
216 | +++ b/src/tools/sssctl/sssctl_logs.c | ||
217 | @@ -31,6 +31,7 @@ | ||
218 | #include <ldb.h> | ||
219 | #include <popt.h> | ||
220 | #include <stdio.h> | ||
221 | +#include <glob.h> | ||
222 | |||
223 | #include "util/util.h" | ||
224 | #include "tools/common/sss_process.h" | ||
225 | @@ -230,6 +231,7 @@ errno_t sssctl_logs_remove(struct sss_cmdline *cmdline, | ||
226 | { | ||
227 | struct sssctl_logs_opts opts = {0}; | ||
228 | errno_t ret; | ||
229 | + glob_t globbuf; | ||
230 | |||
231 | /* Parse command line. */ | ||
232 | struct poptOption options[] = { | ||
233 | @@ -253,8 +255,20 @@ errno_t sssctl_logs_remove(struct sss_cmdline *cmdline, | ||
234 | |||
235 | sss_signal(SIGHUP); | ||
236 | } else { | ||
237 | + globbuf.gl_offs = 4; | ||
238 | + ret = glob(LOG_PATH"/*.log", GLOB_ERR|GLOB_DOOFFS, NULL, &globbuf); | ||
239 | + if (ret != 0) { | ||
240 | + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to expand log files list\n"); | ||
241 | + return ret; | ||
242 | + } | ||
243 | + globbuf.gl_pathv[0] = discard_const_p(char, "truncate"); | ||
244 | + globbuf.gl_pathv[1] = discard_const_p(char, "--no-create"); | ||
245 | + globbuf.gl_pathv[2] = discard_const_p(char, "--size"); | ||
246 | + globbuf.gl_pathv[3] = discard_const_p(char, "0"); | ||
247 | + | ||
248 | PRINT("Truncating log files...\n"); | ||
249 | - ret = sssctl_run_command("truncate --no-create --size 0 " LOG_FILES); | ||
250 | + ret = sssctl_run_command((const char * const*)globbuf.gl_pathv); | ||
251 | + globfree(&globbuf); | ||
252 | if (ret != EOK) { | ||
253 | ERROR("Unable to truncate log files\n"); | ||
254 | return ret; | ||
255 | @@ -269,8 +283,8 @@ errno_t sssctl_logs_fetch(struct sss_cmdline *cmdline, | ||
256 | void *pvt) | ||
257 | { | ||
258 | const char *file; | ||
259 | - const char *cmd; | ||
260 | errno_t ret; | ||
261 | + glob_t globbuf; | ||
262 | |||
263 | /* Parse command line. */ | ||
264 | ret = sss_tool_popt_ex(cmdline, NULL, SSS_TOOL_OPT_OPTIONAL, NULL, NULL, | ||
265 | @@ -280,13 +294,19 @@ errno_t sssctl_logs_fetch(struct sss_cmdline *cmdline, | ||
266 | return ret; | ||
267 | } | ||
268 | |||
269 | - cmd = talloc_asprintf(tool_ctx, "tar -czf %s %s", file, LOG_FILES); | ||
270 | - if (cmd == NULL) { | ||
271 | - ERROR("Out of memory!"); | ||
272 | + globbuf.gl_offs = 3; | ||
273 | + ret = glob(LOG_PATH"/*.log", GLOB_ERR|GLOB_DOOFFS, NULL, &globbuf); | ||
274 | + if (ret != 0) { | ||
275 | + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to expand log files list\n"); | ||
276 | + return ret; | ||
277 | } | ||
278 | + globbuf.gl_pathv[0] = discard_const_p(char, "tar"); | ||
279 | + globbuf.gl_pathv[1] = discard_const_p(char, "-czf"); | ||
280 | + globbuf.gl_pathv[2] = discard_const_p(char, file); | ||
281 | |||
282 | PRINT("Archiving log files into %s...\n", file); | ||
283 | - ret = sssctl_run_command(cmd); | ||
284 | + ret = sssctl_run_command((const char * const*)globbuf.gl_pathv); | ||
285 | + globfree(&globbuf); | ||
286 | if (ret != EOK) { | ||
287 | ERROR("Unable to archive log files\n"); | ||
288 | return ret; | ||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/drop_ntpdate_chk.patch b/dynamic-layers/networking-layer/recipes-security/sssd/files/drop_ntpdate_chk.patch new file mode 100644 index 0000000..338af5d --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/drop_ntpdate_chk.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | nsupdate path is needed for various exec call | ||
2 | but don't run natvie tests on it. | ||
3 | |||
4 | |||
5 | Upstream-Status: Inappropriate [OE specific] | ||
6 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
7 | |||
8 | Index: sssd-2.5.0/src/external/nsupdate.m4 | ||
9 | =================================================================== | ||
10 | --- sssd-2.5.0.orig/src/external/nsupdate.m4 | ||
11 | +++ sssd-2.5.0/src/external/nsupdate.m4 | ||
12 | @@ -3,16 +3,4 @@ AC_MSG_CHECKING(for executable nsupdate) | ||
13 | if test -x "$NSUPDATE"; then | ||
14 | AC_DEFINE_UNQUOTED([NSUPDATE_PATH], ["$NSUPDATE"], [The path to nsupdate]) | ||
15 | AC_MSG_RESULT(yes) | ||
16 | - | ||
17 | - AC_MSG_CHECKING(for nsupdate 'realm' support') | ||
18 | - if AC_RUN_LOG([echo realm |$NSUPDATE >&2]); then | ||
19 | - AC_MSG_RESULT([yes]) | ||
20 | - else | ||
21 | - AC_MSG_RESULT([no]) | ||
22 | - AC_MSG_ERROR([nsupdate does not support 'realm']) | ||
23 | - fi | ||
24 | - | ||
25 | -else | ||
26 | - AC_MSG_RESULT([no]) | ||
27 | - AC_MSG_ERROR([nsupdate is not available]) | ||
28 | fi | ||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/fix-ldblibdir.patch b/dynamic-layers/networking-layer/recipes-security/sssd/files/fix-ldblibdir.patch new file mode 100644 index 0000000..e350baf --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/fix-ldblibdir.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | When calculate value of ldblibdir, it checks whether the directory of | ||
2 | $ldblibdir exists. If not, it assigns ldblibdir with ${libdir}/ldb. It is not | ||
3 | suitable for cross compile. Fix it that only re-assign ldblibdir when its value | ||
4 | is empty. | ||
5 | |||
6 | Upstream-Status: Inappropriate [cross compile specific] | ||
7 | |||
8 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
9 | --- | ||
10 | src/external/libldb.m4 | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/src/external/libldb.m4 b/src/external/libldb.m4 | ||
14 | index c400add..5e5f06d 100644 | ||
15 | --- a/src/external/libldb.m4 | ||
16 | +++ b/src/external/libldb.m4 | ||
17 | @@ -19,7 +19,7 @@ if test x"$with_ldb_lib_dir" != x; then | ||
18 | ldblibdir=$with_ldb_lib_dir | ||
19 | else | ||
20 | ldblibdir="`$PKG_CONFIG --variable=modulesdir ldb`" | ||
21 | - if ! test -d $ldblibdir; then | ||
22 | + if test -z $ldblibdir; then | ||
23 | ldblibdir="${libdir}/ldb" | ||
24 | fi | ||
25 | fi | ||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/fix_gid.patch b/dynamic-layers/networking-layer/recipes-security/sssd/files/fix_gid.patch new file mode 100644 index 0000000..9b481cc --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/fix_gid.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | from ../sssd-2.5.0/src/util/sss_pam_data.c:27: | ||
2 | | ../sssd-2.5.0/src/util/debug.h:88:44: error: unknown type name 'uid_t'; did you mean 'uint_t'? | ||
3 | | 88 | int chown_debug_file(const char *filename, uid_t uid, gid_t gid); | ||
4 | | | ^~~~~ | ||
5 | | | uint_t | ||
6 | | ../sssd-2.5.0/src/util/debug.h:88:55: error: unknown type name 'gid_t' | ||
7 | | 88 | int chown_debug_file(const char *filename, uid_t uid, gid_t gid); | ||
8 | | | ^~~~~ | ||
9 | | make[2]: *** [Makefile:22529: src/util/libsss_iface_la-sss_pam_data.lo] Error 1 | ||
10 | | make[2]: *** Waiting for unfinished jobs.... | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
14 | |||
15 | Index: sssd-2.5.0/src/util/debug.h | ||
16 | =================================================================== | ||
17 | --- sssd-2.5.0.orig/src/util/debug.h | ||
18 | +++ sssd-2.5.0/src/util/debug.h | ||
19 | @@ -24,6 +24,8 @@ | ||
20 | #include "config.h" | ||
21 | |||
22 | #include <stdio.h> | ||
23 | +#include <unistd.h> | ||
24 | +#include <sys/types.h> | ||
25 | #include <stdbool.h> | ||
26 | |||
27 | #include "util/util_errors.h" | ||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/musl_fixup.patch b/dynamic-layers/networking-layer/recipes-security/sssd/files/musl_fixup.patch new file mode 100644 index 0000000..68f267c --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/musl_fixup.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | fix musl build failures | ||
2 | |||
3 | Missing _PATH_HOSTS and some NETDB defines when musl is enabled. | ||
4 | |||
5 | These are work arounds for now while we figure out where the real fix should reside (musl, gcompact, sssd): | ||
6 | |||
7 | ./sssd-2.5.1/src/providers/fail_over.c:1199:19: error: '_PATH_HOSTS' undeclared (first use in this function) | ||
8 | | 1199 | _PATH_HOSTS); | ||
9 | | | ^~~~~~~~~~~ | ||
10 | |||
11 | and | ||
12 | |||
13 | i./sssd-2.5.1/src/sss_client/nss_ipnetworks.c:415:21: error: 'NETDB_INTERNAL' undeclared (first use in this function) | ||
14 | | 415 | *h_errnop = NETDB_INTERNAL; | ||
15 | |||
16 | |||
17 | Upstream-Status: Pending | ||
18 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
19 | |||
20 | Index: sssd-2.5.1/src/providers/fail_over.c | ||
21 | =================================================================== | ||
22 | --- sssd-2.5.1.orig/src/providers/fail_over.c | ||
23 | +++ sssd-2.5.1/src/providers/fail_over.c | ||
24 | @@ -31,6 +31,10 @@ | ||
25 | #include <talloc.h> | ||
26 | #include <netdb.h> | ||
27 | |||
28 | +#if !defined(_PATH_HOSTS) | ||
29 | +#define _PATH_HOSTS "/etc/hosts" | ||
30 | +#endif | ||
31 | + | ||
32 | #include "util/dlinklist.h" | ||
33 | #include "util/refcount.h" | ||
34 | #include "util/util.h" | ||
35 | Index: sssd-2.5.1/src/sss_client/sss_cli.h | ||
36 | =================================================================== | ||
37 | --- sssd-2.5.1.orig/src/sss_client/sss_cli.h | ||
38 | +++ sssd-2.5.1/src/sss_client/sss_cli.h | ||
39 | @@ -44,6 +44,14 @@ typedef int errno_t; | ||
40 | #define EOK 0 | ||
41 | #endif | ||
42 | |||
43 | +#ifndef NETDB_INTERNAL | ||
44 | +# define NETDB_INTERNAL (-1) | ||
45 | +#endif | ||
46 | + | ||
47 | +#ifndef NETDB_SUCCESS | ||
48 | +# define NETDB_SUCCESS (0) | ||
49 | +#endif | ||
50 | + | ||
51 | #define SSS_NSS_PROTOCOL_VERSION 1 | ||
52 | #define SSS_PAM_PROTOCOL_VERSION 3 | ||
53 | #define SSS_SUDO_PROTOCOL_VERSION 1 | ||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/no_gen.patch b/dynamic-layers/networking-layer/recipes-security/sssd/files/no_gen.patch new file mode 100644 index 0000000..5c83777 --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/no_gen.patch | |||
@@ -0,0 +1,19 @@ | |||
1 | don't run generate-sbus-code | ||
2 | |||
3 | Upstream-Status: Inappropriate [OE Specific] | ||
4 | |||
5 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
6 | |||
7 | Index: sssd-2.5.0/Makefile.am | ||
8 | =================================================================== | ||
9 | --- sssd-2.5.0.orig/Makefile.am | ||
10 | +++ sssd-2.5.0/Makefile.am | ||
11 | @@ -1033,8 +1033,6 @@ generate-sbus-code: | ||
12 | |||
13 | .PHONY: generate-sbus-code | ||
14 | |||
15 | -BUILT_SOURCES += generate-sbus-code | ||
16 | - | ||
17 | EXTRA_DIST += \ | ||
18 | sbus_generate.sh.in \ | ||
19 | src/sbus/codegen/dbus.xml \ | ||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/sssd.conf b/dynamic-layers/networking-layer/recipes-security/sssd/files/sssd.conf new file mode 100644 index 0000000..1709a7a --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/sssd.conf | |||
@@ -0,0 +1,8 @@ | |||
1 | [sssd] | ||
2 | services = nss, pam | ||
3 | config_file_version = 2 | ||
4 | |||
5 | [nss] | ||
6 | |||
7 | [pam] | ||
8 | |||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/volatiles.99_sssd b/dynamic-layers/networking-layer/recipes-security/sssd/files/volatiles.99_sssd new file mode 100644 index 0000000..2a82413 --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/volatiles.99_sssd | |||
@@ -0,0 +1 @@ | |||
d root root 0750 /var/log/sssd none | |||
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.5.2.bb b/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.5.2.bb new file mode 100644 index 0000000..9f1d627 --- /dev/null +++ b/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.5.2.bb | |||
@@ -0,0 +1,150 @@ | |||
1 | SUMMARY = "system security services daemon" | ||
2 | DESCRIPTION = "SSSD is a system security services daemon" | ||
3 | HOMEPAGE = "https://pagure.io/SSSD/sssd/" | ||
4 | SECTION = "base" | ||
5 | LICENSE = "GPL-3.0-or-later" | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | ||
7 | |||
8 | DEPENDS = "acl attr openldap cyrus-sasl libtdb ding-libs libpam c-ares krb5 autoconf-archive" | ||
9 | DEPENDS:append = " libldb dbus libtalloc libpcre glib-2.0 popt e2fsprogs libtevent bind p11-kit" | ||
10 | |||
11 | DEPENDS:append:libc-musl = " musl-nscd" | ||
12 | |||
13 | # If no crypto has been selected, default to DEPEND on nss, since that's what | ||
14 | # sssd will pick if no active choice is made during configure | ||
15 | DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'nss', '', \ | ||
16 | bb.utils.contains('PACKAGECONFIG', 'crypto', '', 'nss', d), d)}" | ||
17 | |||
18 | SRC_URI = "https://github.com/SSSD/sssd/releases/download/${PV}/sssd-${PV}.tar.gz \ | ||
19 | file://sssd.conf \ | ||
20 | file://volatiles.99_sssd \ | ||
21 | file://no_gen.patch \ | ||
22 | file://fix_gid.patch \ | ||
23 | file://drop_ntpdate_chk.patch \ | ||
24 | file://fix-ldblibdir.patch \ | ||
25 | file://musl_fixup.patch \ | ||
26 | file://CVE-2021-3621.patch \ | ||
27 | " | ||
28 | |||
29 | SRC_URI[sha256sum] = "5e21b3c7b4a2f1063d0fbdd3216d29886b6eaba153b44fb5961698367f399a0f" | ||
30 | |||
31 | inherit autotools pkgconfig gettext python3-dir features_check systemd | ||
32 | |||
33 | REQUIRED_DISTRO_FEATURES = "pam" | ||
34 | |||
35 | SSSD_UID ?= "root" | ||
36 | SSSD_GID ?= "root" | ||
37 | |||
38 | CACHED_CONFIGUREVARS = "ac_cv_member_struct_ldap_conncb_lc_arg=no \ | ||
39 | ac_cv_prog_HAVE_PYTHON3=${PYTHON_DIR} \ | ||
40 | " | ||
41 | |||
42 | PACKAGECONFIG ?="nss nscd autofs sudo infopipe" | ||
43 | PACKAGECONFIG += "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)}" | ||
44 | PACKAGECONFIG += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" | ||
45 | |||
46 | PACKAGECONFIG[autofs] = "--with-autofs, --with-autofs=no" | ||
47 | PACKAGECONFIG[crypto] = ", , libcrypto" | ||
48 | PACKAGECONFIG[curl] = "--with-kcm, --without-kcm, curl jansson" | ||
49 | PACKAGECONFIG[infopipe] = "--with-infopipe, --with-infopipe=no, " | ||
50 | PACKAGECONFIG[manpages] = "--with-manpages, --with-manpages=no, libxslt-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" | ||
51 | PACKAGECONFIG[nl] = "--with-libnl, --with-libnl=no, libnl" | ||
52 | PACKAGECONFIG[nscd] = "--with-nscd=${sbindir}, --with-nscd=no " | ||
53 | PACKAGECONFIG[nss] = ", ,nss," | ||
54 | PACKAGECONFIG[python3] = "--with-python3-bindings, --without-python3-bindings" | ||
55 | PACKAGECONFIG[samba] = "--with-samba, --with-samba=no, samba" | ||
56 | PACKAGECONFIG[selinux] = "--with-selinux, --with-selinux=no --with-semanage=no, libselinux" | ||
57 | PACKAGECONFIG[ssh] = "--with-ssh, --with-ssh=no, " | ||
58 | PACKAGECONFIG[sudo] = "--with-sudo, --with-sudo=no, " | ||
59 | PACKAGECONFIG[systemd] = "--with-initscript=systemd,--with-initscript=sysv" | ||
60 | |||
61 | EXTRA_OECONF += " \ | ||
62 | --disable-cifs-idmap-plugin \ | ||
63 | --without-nfsv4-idmapd-plugin \ | ||
64 | --without-ipa-getkeytab \ | ||
65 | --without-python2-bindings \ | ||
66 | --enable-pammoddir=${base_libdir}/security \ | ||
67 | --without-python2-bindings \ | ||
68 | --without-secrets \ | ||
69 | --with-xml-catalog-path=${STAGING_ETCDIR_NATIVE}/xml/catalog \ | ||
70 | --with-pid-path=/run \ | ||
71 | " | ||
72 | |||
73 | do_configure:prepend() { | ||
74 | mkdir -p ${AUTOTOOLS_AUXDIR}/build | ||
75 | cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/build/ | ||
76 | |||
77 | # libresove has host path, remove it | ||
78 | sed -i -e "s#\$sss_extra_libdir##" ${S}/src/external/libresolv.m4 | ||
79 | } | ||
80 | |||
81 | do_compile:prepend () { | ||
82 | echo '#define NSUPDATE_PATH "${bindir}"' >> ${B}/config.h | ||
83 | } | ||
84 | do_install () { | ||
85 | oe_runmake install DESTDIR="${D}" | ||
86 | rmdir --ignore-fail-on-non-empty "${D}/${bindir}" | ||
87 | install -d ${D}/${sysconfdir}/${BPN} | ||
88 | install -m 600 ${WORKDIR}/${BPN}.conf ${D}/${sysconfdir}/${BPN} | ||
89 | |||
90 | # /var/log/sssd needs to be created in runtime. Use rmdir to catch if | ||
91 | # upstream stops creating /var/log/sssd, or adds something else in | ||
92 | # /var/log. | ||
93 | rmdir ${D}${localstatedir}/log/${BPN} ${D}${localstatedir}/log | ||
94 | rmdir --ignore-fail-on-non-empty ${D}${localstatedir} | ||
95 | |||
96 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
97 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
98 | echo "d /var/log/sssd 0750 - - - -" > ${D}${sysconfdir}/tmpfiles.d/sss.conf | ||
99 | fi | ||
100 | |||
101 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then | ||
102 | install -d ${D}${sysconfdir}/default/volatiles | ||
103 | echo "d ${SSSD_UID}:${SSSD_GID} 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN} | ||
104 | fi | ||
105 | |||
106 | # Remove /run as it is created on startup | ||
107 | rm -rf ${D}/run | ||
108 | |||
109 | rm -f ${D}${systemd_system_unitdir}/sssd-secrets.* | ||
110 | } | ||
111 | |||
112 | pkg_postinst_ontarget:${PN} () { | ||
113 | if [ -e /etc/init.d/populate-volatile.sh ] ; then | ||
114 | ${sysconfdir}/init.d/populate-volatile.sh update | ||
115 | fi | ||
116 | chown ${SSSD_UID}:${SSSD_GID} ${sysconfdir}/${BPN}/${BPN}.conf | ||
117 | } | ||
118 | |||
119 | FILES:${PN} += "${nonarch_libdir}/tmpfiles.d" | ||
120 | |||
121 | CONFFILES:${PN} = "${sysconfdir}/${BPN}/${BPN}.conf" | ||
122 | |||
123 | INITSCRIPT_NAME = "sssd" | ||
124 | INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." | ||
125 | SYSTEMD_SERVICE:${PN} = " \ | ||
126 | ${@bb.utils.contains('PACKAGECONFIG', 'autofs', 'sssd-autofs.service sssd-autofs.socket', '', d)} \ | ||
127 | ${@bb.utils.contains('PACKAGECONFIG', 'curl', 'sssd-kcm.service sssd-kcm.socket', '', d)} \ | ||
128 | ${@bb.utils.contains('PACKAGECONFIG', 'infopipe', 'sssd-ifp.service ', '', d)} \ | ||
129 | ${@bb.utils.contains('PACKAGECONFIG', 'ssh', 'sssd-ssh.service sssd-ssh.socket', '', d)} \ | ||
130 | ${@bb.utils.contains('PACKAGECONFIG', 'sudo', 'sssd-sudo.service sssd-sudo.socket', '', d)} \ | ||
131 | sssd-nss.service \ | ||
132 | sssd-nss.socket \ | ||
133 | sssd-pam-priv.socket \ | ||
134 | sssd-pam.service \ | ||
135 | sssd-pam.socket \ | ||
136 | sssd.service \ | ||
137 | " | ||
138 | SYSTEMD_AUTO_ENABLE = "disable" | ||
139 | |||
140 | PACKAGES =+ "libsss-sudo" | ||
141 | ALLOW_EMPTY:libsss-sudo = "1" | ||
142 | |||
143 | FILES:${PN} += "${base_libdir}/security/pam_sss*.so \ | ||
144 | ${datadir}/dbus-1/system-services/*.service \ | ||
145 | ${libdir}/krb5/* \ | ||
146 | ${libdir}/ldb/* \ | ||
147 | " | ||
148 | FILES:libsss-sudo = "${libdir}/libsss_sudo.so" | ||
149 | |||
150 | RDEPENDS:${PN} = "bind bind-utils dbus libldb libpam libsss-sudo" | ||