Compare commits

...

35 Commits
master ... main

Author SHA1 Message Date
Petr Lautrbach b124ac62b7 libsemanage-3.5-2
- Include more parameters in the module checksum
2023-03-24 16:39:50 +01:00
Petr Lautrbach 7501bde863 SELinux userspace 3.5 release 2023-02-24 12:47:10 +01:00
Petr Lautrbach 0cc22ed6e1 SELinux userspace 3.5-rc3 release 2023-02-13 16:27:27 +01:00
Fedora Release Engineering 4f790417c9 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 17:25:44 +00:00
Petr Lautrbach 8240afd379 SELinux userspace 3.5-rc2 release 2023-01-16 11:21:26 +01:00
Petr Lautrbach 8ee3e4d757 libsemanage-3.5-0.rc1.1
- SELinux userspace 3.5-rc1 release
2022-12-23 17:12:44 +01:00
Petr Lautrbach bc30cb8b07 libsemanage-3.4-6
Rebase on upstream f56a72ac9e86
2022-11-21 13:50:53 +01:00
Petr Lautrbach b46030c0d0 run tests via TMT/FMF 2022-11-10 17:17:50 +01:00
Petr Lautrbach 052497d4ea Migrate License tag to SPDX
https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1
2022-11-09 17:19:48 +01:00
Petr Lautrbach 8cfbc662c1 libsemanage-3.4-5
- Always write kernel policy when check_ext_changes is specified (#2104935)
2022-07-25 17:54:05 +02:00
Fedora Release Engineering 06dcd7f953 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 18:58:57 +00:00
Python Maint ec2ed1321f Rebuilt for Python 3.11 2022-06-13 15:09:06 +02:00
Petr Lautrbach d7d24db9db Rebuild 2022-05-25 16:43:29 +02:00
Petr Lautrbach beaf31ee23 SELinux userspace 3.4 release 2022-05-19 15:35:13 +02:00
Petr Lautrbach a7dbc2d898 SELinux userspace 3.4-rc3 release 2022-05-10 16:53:36 +02:00
Petr Lautrbach 465b588cae libsemanage-3.4-0.rc2.1
- SELinux userspace 3.4-rc2 release
2022-04-21 18:22:38 +02:00
Petr Lautrbach 8608ca7c33 libsemanage-3.4-0.rc1.1
- SELinux userspace 3.4-rc1 release
2022-04-13 10:57:36 +02:00
Petr Lautrbach 44a4976bab libsemanage-3.3-3
- libsemanage: optionally rebuild policy when modules are changed externally
2022-02-18 10:44:37 +01:00
Fedora Release Engineering 0172c4f53f - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 17:14:34 +00:00
Petr Lautrbach d229f69f1a SELinux userspace 3.3 release 2021-10-22 14:15:37 +02:00
Petr Lautrbach b13a51ab38 SELinux userspace 3.3-rc3 release 2021-10-10 18:54:46 +02:00
Petr Lautrbach 1209cc6458 SELinux userspace 3.3-rc2 release 2021-09-29 17:58:15 +02:00
Petr Lautrbach ce7686077d libsemanage-3.2-4
Rebase on upstream commit 32611aea6543

See
    $ cd SELinuxProject/selinux
    $ git log --pretty=oneline libsepol-3.2..32611aea6543 -- libsepol
2021-07-28 17:23:05 +02:00
Fedora Release Engineering cc46f0a412 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 12:21:47 +00:00
Python Maint 5d0f00bcd6 Rebuilt for Python 3.10 2021-06-04 20:10:05 +02:00
Petr Lautrbach fe45e586c6 SELinux userspace 3.2 release 2021-03-08 16:02:55 +01:00
Petr Lautrbach 567326aaf4 SELinux userspace 3.2-rc2 release 2021-02-05 10:30:54 +01:00
Fedora Release Engineering d374e3c55b - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 17:59:32 +00:00
Petr Lautrbach 814f77e6dd Bring back "Fix RESOURCE_LEAK" patch 2021-01-21 17:51:23 +01:00
Petr Lautrbach ee689c2b4b SELinux userspace 3.2-rc1 release
https://lore.kernel.org/selinux/87a6t36bpp.fsf@redhat.com/T/#u
2021-01-20 17:09:31 +01:00
Robert Scheck 90403a710e Spec file cleanup 2021-01-18 01:20:21 +00:00
Petr Lautrbach 67ade76bde libsemanage-3.1-6.fc34
- Drop "genhomedircon: check usepasswd" patch
- genhomedircon to ignore
  /root;/bin;/boot;/dev;/etc;/lib;/lib64;/proc;/run;/sbin;/sys;/tmp;/usr;/var by default
- Fix usepasswd=False explanation in semanage.conf
2020-12-18 17:50:42 +01:00
Petr Lautrbach 905760acda Drop "genhomedircon: check usepasswd" patch
It tried to fix the correct behavior and broke usage of homedir_template
2020-12-18 17:35:43 +01:00
Petr Lautrbach 0ae5e5f70c semanage.conf - expand list of ignoredirs
It should prevent problems with wrong labels on directories in / after
commands like:

    # useradd -Z unconfined_u -d /var test

    # matchpathcon /var
    /var    unconfined_u:object_r:user_home_dir_t:s0
2020-12-18 17:24:10 +01:00
Petr Lautrbach 6cea6649ba semanage.conf - improve usepasswd=False explanation 2020-12-18 17:23:29 +01:00
13 changed files with 230 additions and 524 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

14
.gitignore vendored
View File

@ -146,3 +146,17 @@ libsemanage-2.0.45.tgz
/libsemanage-3.0-rc1.tar.gz
/libsemanage-3.0.tar.gz
/libsemanage-3.1.tar.gz
/libsemanage-3.2-rc1.tar.gz
/libsemanage-3.2-rc2.tar.gz
/libsemanage-3.2.tar.gz
/libsemanage-3.3-rc2.tar.gz
/libsemanage-3.3-rc3.tar.gz
/libsemanage-3.3.tar.gz
/libsemanage-3.4-rc1.tar.gz
/libsemanage-3.4-rc2.tar.gz
/libsemanage-3.4-rc3.tar.gz
/libsemanage-3.4.tar.gz
/libsemanage-3.5-rc1.tar.gz
/libsemanage-3.5-rc2.tar.gz
/libsemanage-3.5-rc3.tar.gz
/libsemanage-3.5.tar.gz

View File

@ -1,233 +0,0 @@
From b46406de8a93abe10e685c422597516517c0bff3 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Fri, 9 Oct 2020 15:00:50 +0200
Subject: [PATCH] libsemanage: Remove legacy and duplicate symbols
Versioned duplicate symbols cause problems for LTO. These symbols were
introduced during the CIL integration several releases ago and were only
consumed by other SELinux userspace components.
Related: https://github.com/SELinuxProject/selinux/issues/245
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
libsemanage/include/semanage/modules.h | 2 +-
libsemanage/src/libsemanage.map | 5 --
libsemanage/src/modules.c | 100 +------------------------
libsemanage/src/modules.h | 9 +--
libsemanage/src/semanageswig_python.i | 2 -
5 files changed, 4 insertions(+), 114 deletions(-)
diff --git a/libsemanage/include/semanage/modules.h b/libsemanage/include/semanage/modules.h
index ac4039314857..b51f61f033d5 100644
--- a/libsemanage/include/semanage/modules.h
+++ b/libsemanage/include/semanage/modules.h
@@ -33,7 +33,7 @@ typedef struct semanage_module_key semanage_module_key_t;
*/
extern int semanage_module_install(semanage_handle_t *,
- char *module_data, size_t data_len, char *name, char *ext_lang);
+ char *module_data, size_t data_len, const char *name, const char *ext_lang);
extern int semanage_module_install_file(semanage_handle_t *,
const char *module_name);
extern int semanage_module_remove(semanage_handle_t *, char *module_name);
diff --git a/libsemanage/src/libsemanage.map b/libsemanage/src/libsemanage.map
index 1375a8ca0ea7..4bec06aaae27 100644
--- a/libsemanage/src/libsemanage.map
+++ b/libsemanage/src/libsemanage.map
@@ -167,18 +167,13 @@ LIBSEMANAGE_1.0 {
semanage_mls_enabled;
semanage_module_disable;
semanage_module_enable;
- semanage_module_get_enabled;
semanage_module_get_name;
semanage_module_get_version;
semanage_module_info_datum_destroy;
- semanage_module_install;
- semanage_module_install_base;
- semanage_module_install_base_file;
semanage_module_install_file;
semanage_module_list;
semanage_module_list_nth;
semanage_module_remove;
- semanage_module_upgrade;
semanage_module_upgrade_file;
semanage_msg_get_channel;
semanage_msg_get_fname;
diff --git a/libsemanage/src/modules.c b/libsemanage/src/modules.c
index 6d3eb60ae462..8b36801038df 100644
--- a/libsemanage/src/modules.c
+++ b/libsemanage/src/modules.c
@@ -42,70 +42,7 @@
#include "modules.h"
#include "debug.h"
-asm(".symver semanage_module_get_enabled_1_1,semanage_module_get_enabled@@LIBSEMANAGE_1.1");
-asm(".symver semanage_module_get_enabled_1_0,semanage_module_get_enabled@LIBSEMANAGE_1.0");
-asm(".symver semanage_module_install_pp,semanage_module_install@LIBSEMANAGE_1.0");
-asm(".symver semanage_module_install_hll,semanage_module_install@@LIBSEMANAGE_1.1");
-
-/* Takes a module stored in 'module_data' and parses its headers.
- * Sets reference variables 'module_name' to module's name and
- * 'version' to module's version. The caller is responsible for
- * free()ing 'module_name' and 'version'; they will be
- * set to NULL upon entering this function. Returns 0 on success, -1
- * if out of memory, or -2 if data did not represent a module.
- */
-static int parse_module_headers(semanage_handle_t * sh, char *module_data,
- size_t data_len, char **module_name, char **version)
-{
- struct sepol_policy_file *pf;
- int file_type;
- *version = NULL;
-
- if (sepol_policy_file_create(&pf)) {
- ERR(sh, "Out of memory!");
- return -1;
- }
- sepol_policy_file_set_mem(pf, module_data, data_len);
- sepol_policy_file_set_handle(pf, sh->sepolh);
- if (module_data == NULL ||
- data_len == 0 ||
- sepol_module_package_info(pf, &file_type, module_name, version) == -1) {
- sepol_policy_file_free(pf);
- ERR(sh, "Could not parse module data.");
- return -2;
- }
- sepol_policy_file_free(pf);
- if (file_type != SEPOL_POLICY_MOD) {
- ERR(sh, "Data did not represent a pp module. Please upgrade to the latest version of libsemanage to support hll modules.");
- return -2;
- }
-
- return 0;
-}
-
-/* This function is used to preserve ABI compatibility with
- * versions of semodule using LIBSEMANAGE_1.0
- */
-int semanage_module_install_pp(semanage_handle_t * sh,
- char *module_data, size_t data_len)
-{
- char *name = NULL;
- char *version = NULL;
- int status;
-
- if ((status = parse_module_headers(sh, module_data, data_len, &name, &version)) != 0) {
- goto cleanup;
- }
-
- status = semanage_module_install_hll(sh, module_data, data_len, name, "pp");
-
-cleanup:
- free(name);
- free(version);
- return status;
-}
-
-int semanage_module_install_hll(semanage_handle_t * sh,
+int semanage_module_install(semanage_handle_t * sh,
char *module_data, size_t data_len, const char *name, const char *ext_lang)
{
if (sh->funcs->install == NULL) {
@@ -160,16 +97,6 @@ int semanage_module_extract(semanage_handle_t * sh,
return sh->funcs->extract(sh, modkey, extract_cil, mapped_data, data_len, modinfo);
}
-/* Legacy function that remains to preserve ABI
- * compatibility. Please use semanage_module_install instead.
- */
-int semanage_module_upgrade(semanage_handle_t * sh,
- char *module_data, size_t data_len)
-{
- return semanage_module_install_pp(sh, module_data, data_len);
-
-}
-
/* Legacy function that remains to preserve ABI
* compatibility. Please use semanage_module_install_file instead.
*/
@@ -179,24 +106,6 @@ int semanage_module_upgrade_file(semanage_handle_t * sh,
return semanage_module_install_file(sh, module_name);
}
-/* Legacy function that remains to preserve ABI
- * compatibility. Please use semanage_module_install instead.
- */
-int semanage_module_install_base(semanage_handle_t * sh,
- char *module_data, size_t data_len)
-{
- return semanage_module_install_pp(sh, module_data, data_len);
-}
-
-/* Legacy function that remains to preserve ABI
- * compatibility. Please use semanage_module_install_file instead.
- */
-int semanage_module_install_base_file(semanage_handle_t * sh,
- const char *module_name)
-{
- return semanage_module_install_file(sh, module_name);
-}
-
int semanage_module_remove(semanage_handle_t * sh, char *module_name)
{
if (sh->funcs->remove == NULL) {
@@ -780,7 +689,7 @@ int semanage_module_key_set_priority(semanage_handle_t *sh,
}
-int semanage_module_get_enabled_1_1(semanage_handle_t *sh,
+int semanage_module_get_enabled(semanage_handle_t *sh,
const semanage_module_key_t *modkey,
int *enabled)
{
@@ -800,11 +709,6 @@ int semanage_module_get_enabled_1_1(semanage_handle_t *sh,
return sh->funcs->get_enabled(sh, modkey, enabled);
}
-int semanage_module_get_enabled_1_0(semanage_module_info_t *modinfo)
-{
- return modinfo->enabled;
-}
-
int semanage_module_set_enabled(semanage_handle_t *sh,
const semanage_module_key_t *modkey,
int enabled)
diff --git a/libsemanage/src/modules.h b/libsemanage/src/modules.h
index 2d3576fb15df..64d4a157f5ca 100644
--- a/libsemanage/src/modules.h
+++ b/libsemanage/src/modules.h
@@ -26,16 +26,9 @@
#include "semanage/modules.h"
-int semanage_module_install_pp(semanage_handle_t * sh,
- char *module_data, size_t data_len);
-int semanage_module_install_hll(semanage_handle_t * sh,
- char *module_data, size_t data_len, const char *name, const char *ext_lang);
-int semanage_module_upgrade(semanage_handle_t * sh,
- char *module_data, size_t data_len);
+
int semanage_module_upgrade_file(semanage_handle_t * sh,
const char *module_name);
-int semanage_module_install_base(semanage_handle_t * sh,
- char *module_data, size_t data_len);
int semanage_module_install_base_file(semanage_handle_t * sh,
const char *module_name);
diff --git a/libsemanage/src/semanageswig_python.i b/libsemanage/src/semanageswig_python.i
index 8dd79fc24213..5f0113966962 100644
--- a/libsemanage/src/semanageswig_python.i
+++ b/libsemanage/src/semanageswig_python.i
@@ -30,8 +30,6 @@
%}
%include "stdint.i"
-%ignore semanage_module_install_pp;
-%ignore semanage_module_install_hll;
%wrapper %{
--
2.29.0

View File

@ -0,0 +1,103 @@
From a6b472835502d5fc9fc263db07de69527943ac91 Mon Sep 17 00:00:00 2001
From: Ondrej Mosnacek <omosnace@redhat.com>
Date: Wed, 8 Mar 2023 10:46:42 +0100
Subject: [PATCH] libsemanage: include more parameters in the module checksum
Content-type: text/plain
The check_ext_changes option currently assumes that as long as the
module content is unchanged, it is safe to assume that the policy.linked
file doesn't need to be rebuilt. However, there are some additional
parameters that can affect the content of this policy file, namely:
* the disable_dontaudit and preserve_tunables flags
* the target_platform and policyvers configuration values
Include these in the checksum so that the option works correctly when
only some of these input values are changed versus the current state.
Fixes: 286a679fadc4 ("libsemanage: optionally rebuild policy when modules are changed externally")
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
libsemanage/src/direct_api.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
index 7aa081abb3b7..d740070d538e 100644
--- a/libsemanage/src/direct_api.c
+++ b/libsemanage/src/direct_api.c
@@ -863,6 +863,14 @@ static void update_checksum_with_len(Sha256Context *context, size_t s)
Sha256Update(context, buffer, 8);
}
+static void update_checksum_with_bool(Sha256Context *context, bool b)
+{
+ uint8_t byte;
+
+ byte = b ? UINT8_C(1) : UINT8_C(0);
+ Sha256Update(context, &byte, 1);
+}
+
static int semanage_compile_module(semanage_handle_t *sh,
semanage_module_info_t *modinfo,
Sha256Context *context)
@@ -977,13 +985,21 @@ static int modinfo_cmp(const void *a, const void *b)
return strcmp(ma->name, mb->name);
}
+struct extra_checksum_params {
+ int disable_dontaudit;
+ int preserve_tunables;
+ int target_platform;
+ int policyvers;
+};
+
static int semanage_compile_hll_modules(semanage_handle_t *sh,
semanage_module_info_t *modinfos,
int num_modinfos,
+ const struct extra_checksum_params *extra,
char *cil_checksum)
{
/* to be incremented when checksum input data format changes */
- static const size_t CHECKSUM_EPOCH = 1;
+ static const size_t CHECKSUM_EPOCH = 2;
int i, status = 0;
char cil_path[PATH_MAX];
@@ -1000,6 +1016,10 @@ static int semanage_compile_hll_modules(semanage_handle_t *sh,
Sha256Initialise(&context);
update_checksum_with_len(&context, CHECKSUM_EPOCH);
+ update_checksum_with_bool(&context, !!extra->disable_dontaudit);
+ update_checksum_with_bool(&context, !!extra->preserve_tunables);
+ update_checksum_with_len(&context, (size_t)extra->target_platform);
+ update_checksum_with_len(&context, (size_t)extra->policyvers);
/* prefix with module count to avoid collisions */
update_checksum_with_len(&context, num_modinfos);
@@ -1134,6 +1154,7 @@ static int semanage_direct_commit(semanage_handle_t * sh)
mode_t mask = umask(0077);
struct stat sb;
char modules_checksum[CHECKSUM_CONTENT_SIZE + 1 /* '\0' */];
+ struct extra_checksum_params extra;
int do_rebuild, do_write_kernel, do_install;
int fcontexts_modified, ports_modified, seusers_modified,
@@ -1274,8 +1295,14 @@ static int semanage_direct_commit(semanage_handle_t * sh)
goto cleanup;
}
+ extra = (struct extra_checksum_params){
+ .disable_dontaudit = sepol_get_disable_dontaudit(sh->sepolh),
+ .preserve_tunables = sepol_get_preserve_tunables(sh->sepolh),
+ .target_platform = sh->conf->target_platform,
+ .policyvers = sh->conf->policyvers,
+ };
retval = semanage_compile_hll_modules(sh, modinfos, num_modinfos,
- modules_checksum);
+ &extra, modules_checksum);
if (retval < 0) {
ERR(sh, "Failed to compile hll files into cil files.\n");
goto cleanup;
--
2.40.0

View File

@ -1,100 +0,0 @@
From c08b73d7183e2dbab0ba43c3df32f4214abbc9c6 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Fri, 9 Oct 2020 15:00:51 +0200
Subject: [PATCH] libsemanage: Drop deprecated functions
semanage_module_enable() and semanage_module_disable() were deprecated
by commit 9fbc6d14418f ("libsemanage: add back original module
enable/disable functions for ABI compatability") in 2014 in order to
preserve ABI compatibility. As we the libsemanage ABI is changed by the
previous commit, it makes sense to drop them completely.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
libsemanage/src/libsemanage.map | 2 --
libsemanage/src/modules.c | 56 ---------------------------------
2 files changed, 58 deletions(-)
diff --git a/libsemanage/src/libsemanage.map b/libsemanage/src/libsemanage.map
index 4bec06aaae27..3ea7b60f97bb 100644
--- a/libsemanage/src/libsemanage.map
+++ b/libsemanage/src/libsemanage.map
@@ -165,8 +165,6 @@ LIBSEMANAGE_1.0 {
semanage_is_connected;
semanage_is_managed;
semanage_mls_enabled;
- semanage_module_disable;
- semanage_module_enable;
semanage_module_get_name;
semanage_module_get_version;
semanage_module_info_datum_destroy;
diff --git a/libsemanage/src/modules.c b/libsemanage/src/modules.c
index 8b36801038df..b6dd456cac32 100644
--- a/libsemanage/src/modules.c
+++ b/libsemanage/src/modules.c
@@ -734,62 +734,6 @@ int semanage_module_set_enabled(semanage_handle_t *sh,
}
-/* This function exists only for ABI compatibility. It has been deprecated and
- * should not be used. Instead, use semanage_module_set_enabled() */
-int semanage_module_enable(semanage_handle_t *sh, char *module_name)
-{
- int rc = -1;
- semanage_module_key_t *modkey = NULL;
-
- rc = semanage_module_key_create(sh, &modkey);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_key_set_name(sh, modkey, module_name);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_set_enabled(sh, modkey, 1);
- if (rc != 0)
- goto exit;
-
- rc = 0;
-
-exit:
- semanage_module_key_destroy(sh, modkey);
- free(modkey);
-
- return rc;
-}
-
-/* This function exists only for ABI compatibility. It has been deprecated and
- * should not be used. Instead, use semanage_module_set_enabled() */
-int semanage_module_disable(semanage_handle_t *sh, char *module_name)
-{
- int rc = -1;
- semanage_module_key_t *modkey = NULL;
-
- rc = semanage_module_key_create(sh, &modkey);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_key_set_name(sh, modkey, module_name);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_set_enabled(sh, modkey, 0);
- if (rc != 0)
- goto exit;
-
- rc = 0;
-
-exit:
- semanage_module_key_destroy(sh, modkey);
- free(modkey);
-
- return rc;
-}
-
/* Converts a string to a priority
*
* returns -1 if str is not a valid priority.
--
2.29.0

View File

@ -1,45 +0,0 @@
From 6ebb35d261eaa8701b53b9f68184b05de8dfd868 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Fri, 9 Oct 2020 15:00:52 +0200
Subject: [PATCH] libsemanage: Bump libsemanage.so version
Previous commits removed some symbols and broke ABI, therefore we need to change
SONAME.
See the following quotes from distribution guidelines:
https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#run-time-shared-libraries
Every time the shared library ABI changes in a way that may break
binaries linked against older versions of the shared library, the SONAME
of the library and the corresponding name for the binary package
containing the runtime shared library should change.
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_downstream_so_name_versioning
When new versions of the library are released, you should use an ABI
comparison tool to check for ABI differences in the built shared
libraries. If it detects any incompatibilities, bump the n number by
one.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
libsemanage/src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
index a0eb3747d74b..ab6cae51f5c3 100644
--- a/libsemanage/src/Makefile
+++ b/libsemanage/src/Makefile
@@ -32,7 +32,7 @@ YACC = bison
YFLAGS = -d
VERSION = $(shell cat ../VERSION)
-LIBVERSION = 1
+LIBVERSION = 2
LIBA=libsemanage.a
TARGET=libsemanage.so
--
2.29.0

View File

@ -1,66 +0,0 @@
From fc966a746653cc15a14d1e1a80f01fc2f567ee08 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Wed, 7 Nov 2018 18:17:34 +0100
Subject: [PATCH] libsemanage: Fix RESOURCE_LEAK and USE_AFTER_FREE coverity
scan defects
---
libsemanage/src/direct_api.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
index d2b91fb24292..f445cd4d6fb5 100644
--- a/libsemanage/src/direct_api.c
+++ b/libsemanage/src/direct_api.c
@@ -1028,7 +1028,7 @@ static int semanage_direct_write_langext(semanage_handle_t *sh,
fp = NULL;
- ret = 0;
+ return 0;
cleanup:
if (fp != NULL) fclose(fp);
@@ -2184,7 +2184,6 @@ cleanup:
semanage_module_info_destroy(sh, modinfo);
free(modinfo);
- if (fp != NULL) fclose(fp);
return status;
}
@@ -2349,16 +2348,6 @@ static int semanage_direct_get_module_info(semanage_handle_t *sh,
free(tmp);
tmp = NULL;
- if (fclose(fp) != 0) {
- ERR(sh,
- "Unable to close %s module lang ext file.",
- (*modinfo)->name);
- status = -1;
- goto cleanup;
- }
-
- fp = NULL;
-
/* lookup enabled/disabled status */
ret = semanage_module_get_path(sh,
*modinfo,
@@ -2402,7 +2391,13 @@ cleanup:
free(modinfos);
}
- if (fp != NULL) fclose(fp);
+ if (fp != NULL && fclose(fp) != 0) {
+ ERR(sh,
+ "Unable to close %s module lang ext file.",
+ (*modinfo)->name);
+ status = -1;
+ }
+
return status;
}
--
2.29.0

View File

@ -1,35 +0,0 @@
From 511f8bbf779e10152d5af491e8b6a408b8ad666c Mon Sep 17 00:00:00 2001
From: Vit Mojzis <vmojzis@redhat.com>
Date: Fri, 30 Oct 2020 17:42:17 +0100
Subject: [PATCH] libsemanage/genhomedircon: check usepasswd
Only add user homedir contexts when usepasswd = True
Resolves:
# grep usepasswd /etc/selinux/semanage.conf
usepasswd=False
# useradd -Z unconfined_u -d /tmp test
# matchpathcon /tmp
/tmp unconfined_u:object_r:user_home_dir_t:s0
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
libsemanage/src/genhomedircon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index d08c88de99a7..18d3d99a1254 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -1332,7 +1332,7 @@ static int write_context_file(genhomedircon_settings_t * s, FILE * out)
s->fallback->home = NULL;
}
}
- if (user_context_tpl || username_context_tpl) {
+ if ((s->usepasswd) && (user_context_tpl || username_context_tpl)) {
if (write_username_context(s, out, username_context_tpl,
s->fallback) != STATUS_SUCCESS) {
retval = STATUS_ERR;
--
2.29.2

View File

@ -1,20 +1,16 @@
%define libsepolver 3.1-5
%define libselinuxver 3.1-5
%define libsepolver 3.5-1
%define libselinuxver 3.5-1
Summary: SELinux binary policy manipulation library
Name: libsemanage
Version: 3.1
Release: 5%{?dist}
License: LGPLv2+
Source0: https://github.com/SELinuxProject/selinux/releases/download/20200710/libsemanage-3.1.tar.gz
# fedora-selinux/selinux: git format-patch -N libsemanage-3.1 -- libsemanage
Version: 3.5
Release: 2%{?dist}
License: LGPL-2.1-or-later
Source0: https://github.com/SELinuxProject/selinux/releases/download/3.5/libsemanage-3.5.tar.gz
# git format-patch -N 3.5 -- libsemanage
# i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done
# Patch list start
Patch0001: 0001-libsemanage-Remove-legacy-and-duplicate-symbols.patch
Patch0002: 0002-libsemanage-Drop-deprecated-functions.patch
Patch0003: 0003-libsemanage-Bump-libsemanage.so-version.patch
Patch0004: 0004-libsemanage-Fix-RESOURCE_LEAK-and-USE_AFTER_FREE-cov.patch
Patch0005: 0005-libsemanage-genhomedircon-check-usepasswd.patch
Patch0001: 0001-libsemanage-include-more-parameters-in-the-module-ch.patch
# Patch list end
URL: https://github.com/SELinuxProject/selinux/wiki
Source1: semanage.conf
@ -27,6 +23,7 @@ BuildRequires: bison flex bzip2-devel
BuildRequires: python3
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Requires: bzip2-libs audit-libs
Requires: libselinux%{?_isa} >= %{libselinuxver}
@ -79,7 +76,7 @@ The libsemanage-python3 package contains the python 3 bindings for developing
SELinux management applications.
%prep
%autosetup -n libsemanage-%{version} -p 2
%autosetup -p 2 -n libsemanage-%{version}
%build
@ -126,11 +123,10 @@ InstallPythonWrapper \
%{__python3} \
$(python3-config --extension-suffix)
cp %{SOURCE1} ${RPM_BUILD_ROOT}/etc/selinux/semanage.conf
cp %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/selinux/semanage.conf
%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%license LICENSE
%dir %{_sysconfdir}/selinux
%config(noreplace) %{_sysconfdir}/selinux/semanage.conf
%{_libdir}/libsemanage.so.2
@ -159,6 +155,93 @@ cp %{SOURCE1} ${RPM_BUILD_ROOT}/etc/selinux/semanage.conf
%{_libexecdir}/selinux/semanage_migrate_store
%changelog
* Fri Mar 24 2023 Petr Lautrbach <lautrbach@redhat.com> - 3.5-2
- Include more parameters in the module checksum (#2173959)
* Fri Feb 24 2023 Petr Lautrbach <lautrbach@redhat.com> - 3.5-1
- SELinux userspace 3.5 release
* Mon Feb 13 2023 Petr Lautrbach <lautrbach@redhat.com> - 3.5-0.rc3.1
- SELinux userspace 3.5-rc3 release
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.5-0.rc2.1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Jan 16 2023 Petr Lautrbach <lautrbach@redhat.com> - 3.5-0.rc2.1
- SELinux userspace 3.5-rc2 release
* Fri Dec 23 2022 Petr Lautrbach <lautrbach@redhat.com> - 3.5-0.rc1.1
- SELinux userspace 3.5-rc1 release
* Mon Nov 21 2022 Petr Lautrbach <lautrbach@redhat.com> - 3.4-6
- Rebase on upstream f56a72ac9e86
* Mon Jul 25 2022 Petr Lautrbach <plautrba@redhat.com> - 3.4-5
- Always write kernel policy when check_ext_changes is specified (#2104935)
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 3.4-3
- Rebuilt for Python 3.11
* Wed May 25 2022 Petr Lautrbach <plautrba@redhat.com> - 3.4-2
- rebuilt
* Thu May 19 2022 Petr Lautrbach <plautrba@redhat.com> - 3.4-1
- SELinux userspace 3.4 release
* Tue May 10 2022 Petr Lautrbach <plautrba@redhat.com> - 3.4-0.rc3.1
- SELinux userspace 3.4-rc3 release
* Thu Apr 21 2022 Petr Lautrbach <plautrba@redhat.com> - 3.4-0.rc2.1
- SELinux userspace 3.4-rc2 release
* Wed Apr 13 2022 Petr Lautrbach <plautrba@redhat.com> - 3.4-0.rc1.1
- SELinux userspace 3.4-rc1 release
* Tue Feb 15 2022 Petr Lautrbach <plautrba@redhat.com> - 3.3-3
- optionally rebuild policy when modules are changed externally
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Oct 22 2021 Petr Lautrbach <plautrba@redhat.com> - 3.3-1
- SELinux userspace 3.3 release
* Sun Oct 10 2021 Petr Lautrbach <plautrba@redhat.com> - 3.3-0.rc3.1
- SELinux userspace 3.3-rc3 release
* Wed Sep 29 2021 Petr Lautrbach <plautrba@redhat.com> - 3.3-0.rc2.1
- SELinux userspace 3.3-rc2 release
* Wed Jul 28 2021 Petr Lautrbach <plautrba@redhat.com> - 3.2-4
- Rebase on upstream commit 32611aea6543
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 3.2-2
- Rebuilt for Python 3.10
* Mon Mar 8 2021 Petr Lautrbach <plautrba@redhat.com> - 3.2-1
- SELinux userspace 3.2 release
* Fri Feb 5 2021 Petr Lautrbach <plautrba@redhat.com> - 3.2-0.rc2.1
- SELinux userspace 3.2-rc2 release
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-0.rc1.1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jan 20 2021 Petr Lautrbach <plautrba@redhat.com> - 3.2-0.rc1.1
- SELinux userspace 3.2-rc1 release
* Fri Dec 18 2020 Petr Lautrbach <plautrba@redhat.com> - 3.1-6
- Drop "genhomedircon: check usepasswd" patch
- genhomedircon to ignore
/root;/bin;/boot;/dev;/etc;/lib;/lib64;/proc;/run;/sbin;/sys;/tmp;/usr;/var by default
- Fix usepasswd=False explanation in semanage.conf
* Fri Nov 20 2020 Petr Lautrbach <plautrba@redhat.com> - 3.1-5
- Drop and obsolete libsemanage-compat
- genhomedircon: check usepasswd

7
plans/selinux.fmf Normal file
View File

@ -0,0 +1,7 @@
summary: selinux tests - Tier 1 | libsemanage
discover:
how: fmf
url: https://src.fedoraproject.org/tests/selinux
filter: "tier: 1 | component: libsemanage"
execute:
how: tmt

View File

@ -42,14 +42,16 @@ module-store = direct
expand-check=0
# usepasswd check tells semanage to scan all pass word records for home directories
# and setup the labeling correctly. If this is turned off, SELinux will label /home
# correctly only. You will need to use semanage fcontext command.
# and setup the labeling correctly. If this is turned off, SELinux will label only /home
# and home directories of users with SELinux login mappings defined, see
# semanage login -l for the list of such users.
# If you want to use a different home directory, you will need to use semanage fcontext command.
# For example, if you had home dirs in /althome directory you would have to execute
# semanage fcontext -a -e /home /althome
usepasswd=False
bzip-small=true
bzip-blocksize=5
ignoredirs=/root
ignoredirs=/root;/bin;/boot;/dev;/etc;/lib;/lib64;/proc;/run;/sbin;/sys;/tmp;/usr;/var
optimize-policy=true
[sefcontext_compile]

View File

@ -1 +1 @@
SHA512 (libsemanage-3.1.tar.gz) = 8609ca7d13b5c603677740f2b14558fea3922624af182d20d618237ba11fcf2559fab82fc68d1efa6ff118f064d426f005138521652c761de92cd66150102197
SHA512 (libsemanage-3.5.tar.gz) = 959fbd0d6bc6849da6caa13dc41c3f8818cbbd29f04b5d2ac7246c4b395b4f370f113a04cc9cfcb52be2afebfa636013ac4ad4011384c58c7ce066a45cae2751

View File

@ -1,25 +0,0 @@
---
# Tests that run in all contexts
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/tests/selinux.git"
dest: "selinux"
fmf_filter: "tier: 1 | component: libsemanage & tags: generic"
required_packages:
- libsemanage # Required for sanity-tests
- libsemanage-devel # Required for sanity-tests
- glibc # Required for sanity-tests
- gcc # Required for sanity-tests
- CUnit-devel # Required for sanity-tests
- libselinux # Required for verify-options-in-semanage-conf
- libselinux-utils # Required for verify-options-in-semanage-conf
- policycoreutils # Required for verify-options-in-semanage-conf
- policycoreutils-python-utils # Required for verify-options-in-semanage-conf
- selinux-policy # Required for verify-options-in-semanage-conf
- selinux-policy-devel # Required for verify-options-in-semanage-conf
- lksctp-tools # sctp_test
- psmisc # sctp_test