From: Petr Lautrbach <lautrbach@redhat.com>
To: selinux@vger.kernel.org
Cc: James Carter <jwcart2@gmail.com>, cgzones@googlemail.com
Subject: Re: [PATCH v2 9/9] libsemanage: respect shell paths with /usr prefix
Date: Wed, 27 Nov 2024 17:32:02 +0100 [thread overview]
Message-ID: <87ttbsvdrx.fsf@redhat.com> (raw)
In-Reply-To: <CAP+JOzRyZWgpnoYO0T97F9zr=-DkSEsD9uvYFv-Av+5SN9NeBA@mail.gmail.com>
James Carter <jwcart2@gmail.com> writes:
> On Tue, Nov 26, 2024 at 5:46 AM Christian Göttsche
> <cgoettsche@seltendoof.de> wrote:
>>
>> From: Christian Göttsche <cgzones@googlemail.com>
>>
>> Consider paths with the prefix /usr for shells by including them in the
>> list of fallback default shells and by extending the check for a nologin
>> shell.
>>
>> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> For these nine patches:
> Acked-by: James Carter <jwcart2@gmail.com>
It's merged now. Thanks!
>> ---
>> libsemanage/src/genhomedircon.c | 32 +++++++++++++++++++++++---------
>> 1 file changed, 23 insertions(+), 9 deletions(-)
>>
>> diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
>> index 19543799..8782e2cb 100644
>> --- a/libsemanage/src/genhomedircon.c
>> +++ b/libsemanage/src/genhomedircon.c
>> @@ -192,15 +192,23 @@ static semanage_list_t *default_shell_list(void)
>> semanage_list_t *list = NULL;
>>
>> if (semanage_list_push(&list, "/bin/csh")
>> + || semanage_list_push(&list, "/usr/bin/csh")
>> || semanage_list_push(&list, "/bin/tcsh")
>> + || semanage_list_push(&list, "/usr/bin/tcsh")
>> || semanage_list_push(&list, "/bin/ksh")
>> + || semanage_list_push(&list, "/usr/bin/ksh")
>> || semanage_list_push(&list, "/bin/bsh")
>> + || semanage_list_push(&list, "/usr/bin/bsh")
>> || semanage_list_push(&list, "/bin/ash")
>> - || semanage_list_push(&list, "/usr/bin/ksh")
>> + || semanage_list_push(&list, "/usr/bin/ash")
>> + || semanage_list_push(&list, "/bin/pdksh")
>> || semanage_list_push(&list, "/usr/bin/pdksh")
>> || semanage_list_push(&list, "/bin/zsh")
>> + || semanage_list_push(&list, "/usr/bin/zsh")
>> || semanage_list_push(&list, "/bin/sh")
>> - || semanage_list_push(&list, "/bin/bash"))
>> + || semanage_list_push(&list, "/usr/bin/sh")
>> + || semanage_list_push(&list, "/bin/bash")
>> + || semanage_list_push(&list, "/usr/bin/bash"))
>> goto fail;
>>
>> return list;
>> @@ -210,6 +218,12 @@ static semanage_list_t *default_shell_list(void)
>> return NULL;
>> }
>>
>> +static bool is_nologin_shell(const char *path)
>> +{
>> + return strcmp(path, PATH_NOLOGIN_SHELL) == 0 ||
>> + strcmp(path, "/usr" PATH_NOLOGIN_SHELL) == 0;
>> +}
>> +
>> static semanage_list_t *get_shell_list(void)
>> {
>> FILE *shells;
>> @@ -223,13 +237,13 @@ static semanage_list_t *get_shell_list(void)
>> return default_shell_list();
>> while ((len = getline(&temp, &buff_len, shells)) > 0) {
>> if (temp[len-1] == '\n') temp[len-1] = 0;
>> - if (strcmp(temp, PATH_NOLOGIN_SHELL)) {
>> - if (semanage_list_push(&list, temp)) {
>> - free(temp);
>> - semanage_list_destroy(&list);
>> - fclose(shells);
>> - return NULL;
>> - }
>> + if (is_nologin_shell(temp))
>> + continue;
>> + if (semanage_list_push(&list, temp)) {
>> + free(temp);
>> + semanage_list_destroy(&list);
>> + fclose(shells);
>> + return NULL;
>> }
>> }
>> free(temp);
>> --
>> 2.45.2
>>
>>
prev parent reply other threads:[~2024-11-27 16:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 11:18 [PATCH v2 1/9] libsemanage: set O_CLOEXEC flag for file descriptors Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 2/9] libsemanage: handle cil_set_handle_unknown() failure Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 3/9] libsemanage: handle shell allocation failure Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 4/9] libsemanage: drop duplicate newlines and error descriptions in error messages Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 5/9] libsemanage: check closing written files Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 6/9] libsemanage: simplify file deletion Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 7/9] libsemanage: optimize policy by default Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 8/9] libsemanage/man: add documentation for command overrides Christian Göttsche
2024-11-25 11:18 ` [PATCH v2 9/9] libsemanage: respect shell paths with /usr prefix Christian Göttsche
2024-11-27 15:57 ` James Carter
2024-11-27 16:32 ` Petr Lautrbach [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ttbsvdrx.fsf@redhat.com \
--to=lautrbach@redhat.com \
--cc=cgzones@googlemail.com \
--cc=jwcart2@gmail.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.