Compare commits
No commits in common. "master" and "f25" have entirely different histories.
7
.gitignore
vendored
7
.gitignore
vendored
@ -23,10 +23,3 @@ mcstrans-0.3.0.6.tgz
|
|||||||
mcstrans-0.3.1.tgz
|
mcstrans-0.3.1.tgz
|
||||||
/mcstrans-0.3.2.tgz
|
/mcstrans-0.3.2.tgz
|
||||||
/mcstrans-0.3.4.tgz
|
/mcstrans-0.3.4.tgz
|
||||||
/mcstrans-2.8.tar.gz
|
|
||||||
/mcstrans-2.9-rc1.tar.gz
|
|
||||||
/mcstrans-2.9-rc2.tar.gz
|
|
||||||
/mcstrans-2.9.tar.gz
|
|
||||||
/mcstrans-3.0-rc1.tar.gz
|
|
||||||
/mcstrans-3.0.tar.gz
|
|
||||||
/mcstrans-3.1.tar.gz
|
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
From a9eae01e435c2d6f13f3672a50f545bab03e9992 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Petr Lautrbach <plautrba@redhat.com>
|
|
||||||
Date: Wed, 28 Nov 2018 18:28:05 +0100
|
|
||||||
Subject: [PATCH] mcstrans: Fir RESOURCE_LEAK and USE_AFTER_FREE coverity scan
|
|
||||||
defects
|
|
||||||
|
|
||||||
---
|
|
||||||
mcstrans/src/mcstrans.c | 21 +++++++++++++++++++--
|
|
||||||
mcstrans/src/mcstransd.c | 4 +++-
|
|
||||||
2 files changed, 22 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
|
|
||||||
index 96bdbdff7d8b..0d9d0f3e25b7 100644
|
|
||||||
--- a/mcstrans/src/mcstrans.c
|
|
||||||
+++ b/mcstrans/src/mcstrans.c
|
|
||||||
@@ -633,16 +633,23 @@ add_cache(domain_t *domain, char *raw, char *trans) {
|
|
||||||
|
|
||||||
map->raw = strdup(raw);
|
|
||||||
if (!map->raw) {
|
|
||||||
+ free(map);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
map->trans = strdup(trans);
|
|
||||||
if (!map->trans) {
|
|
||||||
+ free(map->raw);
|
|
||||||
+ free(map);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_debug(" add_cache (%s,%s)\n", raw, trans);
|
|
||||||
- if (add_to_hashtable(domain->raw_to_trans, map->raw, map) < 0)
|
|
||||||
+ if (add_to_hashtable(domain->raw_to_trans, map->raw, map) < 0) {
|
|
||||||
+ free(map->trans);
|
|
||||||
+ free(map->raw);
|
|
||||||
+ free(map);
|
|
||||||
goto err;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (add_to_hashtable(domain->trans_to_raw, map->trans, map) < 0)
|
|
||||||
goto err;
|
|
||||||
@@ -1519,6 +1526,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
|
|
||||||
trans = compute_trans_from_raw(range, domain);
|
|
||||||
if (trans)
|
|
||||||
if (add_cache(domain, range, trans) < 0) {
|
|
||||||
+ free(trans);
|
|
||||||
free(range);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
@@ -1530,6 +1538,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
|
|
||||||
ltrans = compute_trans_from_raw(lrange, domain);
|
|
||||||
if (ltrans) {
|
|
||||||
if (add_cache(domain, lrange, ltrans) < 0) {
|
|
||||||
+ free(ltrans);
|
|
||||||
free(range);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
@@ -1548,6 +1557,7 @@ trans_context(const security_context_t incon, security_context_t *rcon) {
|
|
||||||
utrans = compute_trans_from_raw(urange, domain);
|
|
||||||
if (utrans) {
|
|
||||||
if (add_cache(domain, urange, utrans) < 0) {
|
|
||||||
+ free(utrans);
|
|
||||||
free(ltrans);
|
|
||||||
free(range);
|
|
||||||
return -1;
|
|
||||||
@@ -1647,14 +1657,19 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
|
|
||||||
canonical = compute_trans_from_raw(raw, domain);
|
|
||||||
if (canonical && strcmp(canonical, range))
|
|
||||||
if (add_cache(domain, raw, canonical) < 0) {
|
|
||||||
+ free(canonical);
|
|
||||||
free(range);
|
|
||||||
+ free(raw);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- if (canonical)
|
|
||||||
+ if (canonical) {
|
|
||||||
free(canonical);
|
|
||||||
+ free(raw);
|
|
||||||
+ }
|
|
||||||
if (add_cache(domain, raw, range) < 0) {
|
|
||||||
free(range);
|
|
||||||
+ free(raw);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
@@ -1672,6 +1687,7 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
|
|
||||||
canonical = compute_trans_from_raw(lraw, domain);
|
|
||||||
if (canonical)
|
|
||||||
if (add_cache(domain, lraw, canonical) < 0) {
|
|
||||||
+ free(canonical);
|
|
||||||
free(lraw);
|
|
||||||
free(range);
|
|
||||||
return -1;
|
|
||||||
@@ -1703,6 +1719,7 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
|
|
||||||
canonical = compute_trans_from_raw(uraw, domain);
|
|
||||||
if (canonical)
|
|
||||||
if (add_cache(domain, uraw, canonical) < 0) {
|
|
||||||
+ free(canonical);
|
|
||||||
free(uraw);
|
|
||||||
free(lraw);
|
|
||||||
free(range);
|
|
||||||
diff --git a/mcstrans/src/mcstransd.c b/mcstrans/src/mcstransd.c
|
|
||||||
index 858994932e4f..a1ec81acb3c8 100644
|
|
||||||
--- a/mcstrans/src/mcstransd.c
|
|
||||||
+++ b/mcstrans/src/mcstransd.c
|
|
||||||
@@ -335,6 +335,7 @@ process_events(struct pollfd **ufds, int *nfds)
|
|
||||||
/* Setup pollfd for deletion later. */
|
|
||||||
(*ufds)[ii].fd = -1;
|
|
||||||
close(connfd);
|
|
||||||
+ connfd = -1;
|
|
||||||
/* So we don't get bothered later */
|
|
||||||
revents = revents & ~(POLLHUP);
|
|
||||||
}
|
|
||||||
@@ -348,10 +349,11 @@ process_events(struct pollfd **ufds, int *nfds)
|
|
||||||
/* Set the pollfd up for deletion later. */
|
|
||||||
(*ufds)[ii].fd = -1;
|
|
||||||
close(connfd);
|
|
||||||
+ connfd = -1;
|
|
||||||
|
|
||||||
revents = revents & ~(POLLHUP);
|
|
||||||
}
|
|
||||||
- if (revents) {
|
|
||||||
+ if (revents && connfd != -1) {
|
|
||||||
syslog(LOG_ERR, "Unknown/error events (%x) encountered"
|
|
||||||
" for fd (%d)\n", revents, connfd);
|
|
||||||
|
|
||||||
--
|
|
||||||
2.23.0
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
From d09b54cfffaa3923c22bb3ff7818cb4a19325905 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Petr Lautrbach <plautrba@redhat.com>
|
|
||||||
Date: Thu, 9 May 2019 16:44:43 +0200
|
|
||||||
Subject: [PATCH] mcstrans: Fix USER_AFTER_FREE problem
|
|
||||||
|
|
||||||
---
|
|
||||||
mcstrans/src/mcstrans.c | 4 +---
|
|
||||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
|
|
||||||
index 0d9d0f3e25b7..29cadb78b62c 100644
|
|
||||||
--- a/mcstrans/src/mcstrans.c
|
|
||||||
+++ b/mcstrans/src/mcstrans.c
|
|
||||||
@@ -1663,10 +1663,8 @@ untrans_context(const security_context_t incon, security_context_t *rcon) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- if (canonical) {
|
|
||||||
+ if (canonical)
|
|
||||||
free(canonical);
|
|
||||||
- free(raw);
|
|
||||||
- }
|
|
||||||
if (add_cache(domain, raw, range) < 0) {
|
|
||||||
free(range);
|
|
||||||
free(raw);
|
|
||||||
--
|
|
||||||
2.23.0
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
From 0173a950563b23080fd40433f55efcb1d6b77923 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Petr Lautrbach <plautrba@redhat.com>
|
|
||||||
Date: Mon, 15 Apr 2019 15:22:51 +0200
|
|
||||||
Subject: [PATCH] mcstrans: Do not accept incomplete contexts
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Fixes:
|
|
||||||
$ python3
|
|
||||||
> import selinux
|
|
||||||
> selinux.selinux_raw_context_to_color("xyz_u:xyz_r:xyz_t:")
|
|
||||||
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File "<stdin>", line 2, in <module>
|
|
||||||
OSError: [Errno 0] Error
|
|
||||||
|
|
||||||
:: [ 10:25:45 ] :: [ BEGIN ] :: Running 'service mcstransd status'
|
|
||||||
Redirecting to /bin/systemctl status mcstransd.service
|
|
||||||
● mcstrans.service - Translates SELinux MCS/MLS labels to human readable form
|
|
||||||
Loaded: loaded (/usr/lib/systemd/system/mcstrans.service; disabled; vendor preset: disabled)
|
|
||||||
Active: failed (Result: core-dump) since Fri 2019-04-12 10:25:44 EDT; 1s ago
|
|
||||||
Process: 16681 ExecStart=/sbin/mcstransd -f (code=dumped, signal=SEGV)
|
|
||||||
Main PID: 16681 (code=dumped, signal=SEGV)
|
|
||||||
|
|
||||||
systemd[1]: mcstrans.service: Main process exited, code=dumped, status=11/SEGV
|
|
||||||
systemd[1]: mcstrans.service: Failed with result 'core-dump'.
|
|
||||||
|
|
||||||
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
|
|
||||||
---
|
|
||||||
mcstrans/src/mcscolor.c | 12 ++++++++----
|
|
||||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/mcstrans/src/mcscolor.c b/mcstrans/src/mcscolor.c
|
|
||||||
index 4ee0db507ef2..3a3a6de9a02b 100644
|
|
||||||
--- a/mcstrans/src/mcscolor.c
|
|
||||||
+++ b/mcstrans/src/mcscolor.c
|
|
||||||
@@ -272,10 +272,14 @@ static const unsigned precedence[N_COLOR][N_COLOR - 1] = {
|
|
||||||
static const secolor_t default_color = { 0x000000, 0xffffff };
|
|
||||||
|
|
||||||
static int parse_components(context_t con, char **components) {
|
|
||||||
- components[COLOR_USER] = (char *)context_user_get(con);
|
|
||||||
- components[COLOR_ROLE] = (char *)context_role_get(con);
|
|
||||||
- components[COLOR_TYPE] = (char *)context_type_get(con);
|
|
||||||
- components[COLOR_RANGE] = (char *)context_range_get(con);
|
|
||||||
+ if ((components[COLOR_USER] = (char *)context_user_get(con)) == NULL)
|
|
||||||
+ return -1;
|
|
||||||
+ if ((components[COLOR_ROLE] = (char *)context_role_get(con)) == NULL)
|
|
||||||
+ return -1;
|
|
||||||
+ if ((components[COLOR_TYPE] = (char *)context_type_get(con)) == NULL)
|
|
||||||
+ return -1;
|
|
||||||
+ if ((components[COLOR_RANGE] = (char *)context_range_get(con)) == NULL)
|
|
||||||
+ return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.23.0
|
|
||||||
|
|
51
mcstrans-0.3.2-writepid.patch
Normal file
51
mcstrans-0.3.2-writepid.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
diff -up mcstrans-0.3.2/src/mcstransd.c.writepid mcstrans-0.3.2/src/mcstransd.c
|
||||||
|
--- mcstrans-0.3.2/src/mcstransd.c.writepid 2011-01-05 10:32:25.000000000 -0500
|
||||||
|
+++ mcstrans-0.3.2/src/mcstransd.c 2012-02-01 16:14:02.085806490 -0500
|
||||||
|
@@ -4,6 +4,7 @@
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
#include <sys/un.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
@@ -556,6 +557,30 @@ void dropprivs(void)
|
||||||
|
cap_free(new_caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static const char *pidfile = "/var/run/mcstransd.pid";
|
||||||
|
+
|
||||||
|
+static int write_pid_file(void)
|
||||||
|
+{
|
||||||
|
+ int pidfd, len;
|
||||||
|
+ char val[16];
|
||||||
|
+
|
||||||
|
+ len = snprintf(val, sizeof(val), "%u\n", getpid());
|
||||||
|
+ if (len < 0) {
|
||||||
|
+ syslog(LOG_ERR, "Pid error (%s)", strerror(errno));
|
||||||
|
+ pidfile = 0;
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ pidfd = open(pidfile, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY, 0644);
|
||||||
|
+ if (pidfd < 0) {
|
||||||
|
+ syslog(LOG_ERR, "Unable to set pidfile (%s)", strerror(errno));
|
||||||
|
+ pidfile = 0;
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ (void)write(pidfd, val, (unsigned int)len);
|
||||||
|
+ close(pidfd);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
main(int UNUSED(argc), char *argv[])
|
||||||
|
{
|
||||||
|
@@ -582,6 +607,8 @@ main(int UNUSED(argc), char *argv[])
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+ write_pid_file();
|
||||||
|
+
|
||||||
|
syslog(LOG_NOTICE, "%s initialized", argv[0]);
|
||||||
|
process_connections();
|
||||||
|
|
294
mcstrans-0.3.3-inotify.patch
Normal file
294
mcstrans-0.3.3-inotify.patch
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
diff -up mcstrans-0.3.3/src/mcstrans.c.inotify mcstrans-0.3.3/src/mcstrans.c
|
||||||
|
--- mcstrans-0.3.3/src/mcstrans.c.inotify 2011-12-06 08:45:02.000000000 -0500
|
||||||
|
+++ mcstrans-0.3.3/src/mcstrans.c 2013-02-08 08:48:08.343787003 -0500
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
|
||||||
|
/* Copyright (c) 2008-2009 Nall Design Works
|
||||||
|
- Copyright 2006 Trusted Computer Solutions, Inc. */
|
||||||
|
+ Copyright 2006 Trusted Computer Solutions, Inc.
|
||||||
|
+ Copyright 2013 Red Hat, Inc.
|
||||||
|
+*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Exported Interface
|
||||||
|
@@ -12,6 +14,7 @@
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include <dirent.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <glob.h>
|
||||||
|
#include <values.h>
|
||||||
|
@@ -30,7 +33,7 @@
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
-
|
||||||
|
+#include <sys/inotify.h>
|
||||||
|
|
||||||
|
#include "mls_level.h"
|
||||||
|
#include "mcstrans.h"
|
||||||
|
@@ -166,6 +169,30 @@ err:
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
+remove_from_hashtable(context_map_node_t **table, char *key) {
|
||||||
|
+ unsigned int bucket = hash(key) % N_BUCKETS;
|
||||||
|
+ context_map_node_t **n;
|
||||||
|
+ context_map_node_t **p = NULL;
|
||||||
|
+ context_map_node_t *next = NULL;
|
||||||
|
+ for (n = &table[bucket]; *n; n = &(*n)->next) {
|
||||||
|
+ if (!strcmp((*n)->key, key))
|
||||||
|
+ break;
|
||||||
|
+ p = n;
|
||||||
|
+ }
|
||||||
|
+ if (! *n)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ next = (*n)->next;
|
||||||
|
+ free(*n);
|
||||||
|
+ if (p)
|
||||||
|
+ (*p)->next = next;
|
||||||
|
+ else
|
||||||
|
+ table[bucket] = next;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
numdigits(unsigned int n)
|
||||||
|
{
|
||||||
|
int count = 1;
|
||||||
|
@@ -665,6 +692,26 @@ find_in_table(context_map_node_t **table
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+remove_cache(domain_t *domain, char *raw) {
|
||||||
|
+ context_map_t *map=find_in_table(domain->raw_to_trans, raw);
|
||||||
|
+ if (!map) {
|
||||||
|
+ log_error("Failed to remove_cache (%s) does not exist\n", raw);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ log_debug(" remove_cache (%s,%s)\n", raw, map->trans);
|
||||||
|
+ if (remove_from_hashtable(domain->trans_to_raw, map->trans) < 0) {
|
||||||
|
+ log_error(" Failed to remove %s from trans_to_raw\n", map->trans);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (remove_from_hashtable(domain->raw_to_trans, raw) < 0) {
|
||||||
|
+ log_error(" Failed to remove %s from raw_to_trans\n", raw);
|
||||||
|
+ }
|
||||||
|
+ free(map->raw);
|
||||||
|
+ free(map->trans);
|
||||||
|
+ free(map);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
char *
|
||||||
|
trim(char *str, const char *whitespace) {
|
||||||
|
char *p = str + strlen(str);
|
||||||
|
@@ -1760,3 +1809,113 @@ finish_context_translations(void) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+#define INOTIFY_WATCHDIR "/run/setrans"
|
||||||
|
+
|
||||||
|
+/* size of the event structure, not counting name */
|
||||||
|
+#define EVENT_SIZE (sizeof (struct inotify_event))
|
||||||
|
+/* reasonable guess as to size of 1024 events */
|
||||||
|
+#define BUF_LEN (1024 * (EVENT_SIZE + 16))
|
||||||
|
+static domain_t *inotify_domain;
|
||||||
|
+
|
||||||
|
+int add_inotify_cache(char *raw) {
|
||||||
|
+ char trans[BUF_LEN+1];
|
||||||
|
+ char path[PATH_MAX];
|
||||||
|
+ FILE *f;
|
||||||
|
+ size_t len;
|
||||||
|
+ domain_t *domain = domains;
|
||||||
|
+ for (;domain; domain = domain->next) {
|
||||||
|
+ context_map_t *map=find_in_table(domain->raw_to_trans, raw);
|
||||||
|
+ if (map) {
|
||||||
|
+ log_error("Failed to add translation %s to cache (%s,%s) already exists\n", raw, raw, map->trans);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ memset(trans,0, sizeof(trans));
|
||||||
|
+ memset(path,0, sizeof(path));
|
||||||
|
+ len = snprintf(path, sizeof(path), "%s/%s", INOTIFY_WATCHDIR, raw);
|
||||||
|
+ if (len >= sizeof(path)) {
|
||||||
|
+ log_error("Failed to open %s/%s, too large for buffer\n", INOTIFY_WATCHDIR, raw);
|
||||||
|
+ }
|
||||||
|
+ f = fopen(path, "r");
|
||||||
|
+ if(! f) {
|
||||||
|
+ log_error("Failed to open %s %s\n", path, strerror(errno));
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ fread(trans, 1, BUF_LEN, f);
|
||||||
|
+ fclose(f);
|
||||||
|
+ return add_cache(inotify_domain, raw, trans);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int process_inotify(int inotifyfd) {
|
||||||
|
+ int i = 0;
|
||||||
|
+ char buf[BUF_LEN+1];
|
||||||
|
+ int len;
|
||||||
|
+ memset(buf,0, BUF_LEN);
|
||||||
|
+ len = read(inotifyfd, buf, BUF_LEN);
|
||||||
|
+ if (len < 0) {
|
||||||
|
+ return -1;
|
||||||
|
+ } else if (!len)
|
||||||
|
+ /* BUF_LEN too small? */
|
||||||
|
+ return -1;
|
||||||
|
+ while (i < len) {
|
||||||
|
+ struct inotify_event *event;
|
||||||
|
+ event = (struct inotify_event *)&buf[i];
|
||||||
|
+ if (event->mask & IN_DELETE) {
|
||||||
|
+ if (event->len && event->name[0] != '.') {
|
||||||
|
+ remove_cache(inotify_domain, event->name);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (event->mask & IN_CREATE) {
|
||||||
|
+ if (event->len && event->name[0] != '.') {
|
||||||
|
+ (void) add_inotify_cache(event->name);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ i += EVENT_SIZE + event->len;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Watch INOTIFY_WATCHDIR for file creaton and deletion, then attempt to
|
||||||
|
+ add/remove the contents of these files to the cache. The name of the
|
||||||
|
+ file is the raw MLS/MCS label, while the contents are the Translation name.
|
||||||
|
+*/
|
||||||
|
+int init_inotify(void) {
|
||||||
|
+ DIR *dir;
|
||||||
|
+ struct dirent *entry;
|
||||||
|
+ int fd = inotify_init1(IN_CLOEXEC);
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ syslog(LOG_ERR, "socket() failed: %m");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (inotify_add_watch(fd, INOTIFY_WATCHDIR, IN_CREATE | IN_DELETE) < 0)
|
||||||
|
+ {
|
||||||
|
+ syslog(LOG_ERR, "inotify_add_watch( %s ) failed: %m", INOTIFY_WATCHDIR);
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+ inotify_domain = create_domain("inotify");
|
||||||
|
+ if (!inotify_domain) {
|
||||||
|
+ syslog(LOG_ERR, "create_domain(inotify) failed: %m");
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* read all existing files in the INOTIFY_WATCHDIR and add them to the
|
||||||
|
+ cache.
|
||||||
|
+ */
|
||||||
|
+ if ((dir = opendir(INOTIFY_WATCHDIR)) == NULL) {
|
||||||
|
+ syslog(LOG_ERR, "opendirs(%s) failed: %m", INOTIFY_WATCHDIR);
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+ while ((entry = readdir(dir)) != NULL) {
|
||||||
|
+ if (entry->d_name[0] != '.')
|
||||||
|
+ (void) add_inotify_cache(entry->d_name);
|
||||||
|
+ }
|
||||||
|
+ closedir(dir);
|
||||||
|
+
|
||||||
|
+ return fd;
|
||||||
|
+
|
||||||
|
+err:
|
||||||
|
+ close(fd);
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
diff -up mcstrans-0.3.3/src/mcstransd.c.inotify mcstrans-0.3.3/src/mcstransd.c
|
||||||
|
--- mcstrans-0.3.3/src/mcstransd.c.inotify 2013-02-08 08:37:32.772422371 -0500
|
||||||
|
+++ mcstrans-0.3.3/src/mcstransd.c 2013-02-08 08:37:32.784422421 -0500
|
||||||
|
@@ -60,6 +60,7 @@ extern int raw_color(const security_cont
|
||||||
|
#define SETRANSD_PROGNAME "mcstransd"
|
||||||
|
|
||||||
|
static int sockfd = -1; /* socket we are listening on */
|
||||||
|
+static int inotifyfd = -1; /* inotify socket we are listening on */
|
||||||
|
|
||||||
|
static volatile int restart_daemon = 0;
|
||||||
|
static void cleanup_exit(int ret) __attribute__ ((noreturn));
|
||||||
|
@@ -354,19 +355,23 @@ process_events(struct pollfd **ufds, int
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
- ret = service_request(connfd);
|
||||||
|
- if (ret) {
|
||||||
|
- if (ret < 0) {
|
||||||
|
- syslog(LOG_ERR,
|
||||||
|
- "Servicing of request "
|
||||||
|
- "failed for fd (%d)\n",
|
||||||
|
- connfd);
|
||||||
|
+ if (connfd == inotifyfd) {
|
||||||
|
+ process_inotify(inotifyfd);
|
||||||
|
+ } else {
|
||||||
|
+ ret = service_request(connfd);
|
||||||
|
+ if (ret) {
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ syslog(LOG_ERR,
|
||||||
|
+ "Servicing of request "
|
||||||
|
+ "failed for fd (%d)\n",
|
||||||
|
+ connfd);
|
||||||
|
+ }
|
||||||
|
+ /* Setup pollfd for deletion later. */
|
||||||
|
+ (*ufds)[ii].fd = -1;
|
||||||
|
+ close(connfd);
|
||||||
|
+ /* So we don't get bothered later */
|
||||||
|
+ revents = revents & ~(POLLHUP);
|
||||||
|
}
|
||||||
|
- /* Setup pollfd for deletion later. */
|
||||||
|
- (*ufds)[ii].fd = -1;
|
||||||
|
- close(connfd);
|
||||||
|
- /* So we don't get bothered later */
|
||||||
|
- revents = revents & ~(POLLHUP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
revents = revents & ~(POLLIN | POLLPRI);
|
||||||
|
@@ -406,9 +411,9 @@ static void
|
||||||
|
process_connections(void)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
- int nfds = 1;
|
||||||
|
+ int nfds = 2;
|
||||||
|
|
||||||
|
- struct pollfd *ufds = (struct pollfd *)malloc(sizeof(struct pollfd));
|
||||||
|
+ struct pollfd *ufds = (struct pollfd *)malloc(sizeof(struct pollfd)*nfds);
|
||||||
|
if (!ufds) {
|
||||||
|
syslog(LOG_ERR, "Failed to allocate a pollfd");
|
||||||
|
cleanup_exit(1);
|
||||||
|
@@ -417,6 +422,10 @@ process_connections(void)
|
||||||
|
ufds[0].events = POLLIN|POLLPRI;
|
||||||
|
ufds[0].revents = 0;
|
||||||
|
|
||||||
|
+ ufds[1].fd = inotifyfd;
|
||||||
|
+ ufds[1].events = POLLIN|POLLPRI;
|
||||||
|
+ ufds[1].revents = 0;
|
||||||
|
+
|
||||||
|
while (1) {
|
||||||
|
if (restart_daemon) {
|
||||||
|
syslog(LOG_NOTICE, "Reload Translations");
|
||||||
|
@@ -516,6 +525,11 @@ initialize(void)
|
||||||
|
cleanup_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ inotifyfd = init_inotify();
|
||||||
|
+ if (inotifyfd < 0) {
|
||||||
|
+ cleanup_exit(1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
memset(&addr, 0, sizeof(addr));
|
||||||
|
addr.sun_family = AF_UNIX;
|
||||||
|
strncpy(addr.sun_path, SETRANS_UNIX_SOCKET, sizeof(addr.sun_path) - 1);
|
||||||
|
diff -up mcstrans-0.3.3/src/mcstrans.h.inotify mcstrans-0.3.3/src/mcstrans.h
|
||||||
|
--- mcstrans-0.3.3/src/mcstrans.h.inotify 2011-12-06 08:45:02.000000000 -0500
|
||||||
|
+++ mcstrans-0.3.3/src/mcstrans.h 2013-02-08 08:37:32.784422421 -0500
|
||||||
|
@@ -6,4 +6,5 @@ extern int init_translations(void);
|
||||||
|
extern void finish_context_translations(void);
|
||||||
|
extern int trans_context(const security_context_t, security_context_t *);
|
||||||
|
extern int untrans_context(const security_context_t, security_context_t *);
|
||||||
|
-
|
||||||
|
+extern int init_inotify(void);
|
||||||
|
+extern int process_inotify(int inotifyfd);
|
197
mcstrans-0.3.3-man.patch
Normal file
197
mcstrans-0.3.3-man.patch
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
diff -up mcstrans-0.3.3/man/man8/mcstransd.8.man mcstrans-0.3.3/man/man8/mcstransd.8
|
||||||
|
--- mcstrans-0.3.3/man/man8/mcstransd.8.man 2011-12-06 08:45:02.000000000 -0500
|
||||||
|
+++ mcstrans-0.3.3/man/man8/mcstransd.8 2013-03-26 12:54:30.653747835 -0400
|
||||||
|
@@ -11,7 +11,8 @@ This manual page describes the
|
||||||
|
.BR mcstransd
|
||||||
|
program.
|
||||||
|
.P
|
||||||
|
-This daemon reads /etc/selinux/{SELINUXTYPE}/setrans.conf configuration file, and communicates with libselinux via a socket in /var/run/setrans.
|
||||||
|
+This daemon reads /etc/selinux/{SELINUXTYPE}/setrans.conf and /etc/selinux/{SELINUXTYPE}/secolors.conf configuration files, and communicates with libselinux via a socket in /var/run/setrans.
|
||||||
|
+It also watches for files created in /var/run/setrans and uses the contents of these files to generate translations to the names. For example writing a file /var/run/setrans/mydomain with content of s0:c1,c2 will cause mcstrans to translate s0:c1,c2 to mydomain.
|
||||||
|
|
||||||
|
.SH "AUTHOR"
|
||||||
|
This man page was written by Dan Walsh <dwalsh@redhat.com>.
|
||||||
|
diff -up mcstrans-0.3.3/man/man8/secolor.conf.8.man mcstrans-0.3.3/man/man8/secolor.conf.8
|
||||||
|
--- mcstrans-0.3.3/man/man8/secolor.conf.8.man 2013-03-26 12:51:30.505001415 -0400
|
||||||
|
+++ mcstrans-0.3.3/man/man8/secolor.conf.8 2013-03-26 12:51:30.504001411 -0400
|
||||||
|
@@ -0,0 +1,180 @@
|
||||||
|
+.TH "secolor.conf" "8" "08 April 2011" "SELinux API documentation"
|
||||||
|
+.SH "NAME"
|
||||||
|
+secolor.conf \- The SELinux color configuration file
|
||||||
|
+.
|
||||||
|
+.SH "DESCRIPTION"
|
||||||
|
+The
|
||||||
|
+.I /etc/selinux/{SELINUXTYPE}/secolor.conf
|
||||||
|
+configuation file controls the color to be associated to the context components associated to the
|
||||||
|
+.I raw
|
||||||
|
+context passed by
|
||||||
|
+.BR selinux_raw_context_to_color "(3),"
|
||||||
|
+when context related information is to be displayed in color by an SELinux-aware application.
|
||||||
|
+.sp
|
||||||
|
+.BR selinux_raw_context_to_color "(3)"
|
||||||
|
+obtains this color information from the active policy
|
||||||
|
+.B secolor.conf
|
||||||
|
+file as returned by
|
||||||
|
+.BR selinux_colors_path "(3)."
|
||||||
|
+.
|
||||||
|
+.SH "FILE FORMAT"
|
||||||
|
+The file format is as follows:
|
||||||
|
+.RS
|
||||||
|
+.B color
|
||||||
|
+.I color_name
|
||||||
|
+.BI "= #"color_mask
|
||||||
|
+.br
|
||||||
|
+[...]
|
||||||
|
+.sp
|
||||||
|
+.I context_component string
|
||||||
|
+.B =
|
||||||
|
+.I fg_color_name bg_color_name
|
||||||
|
+.br
|
||||||
|
+[...]
|
||||||
|
+.sp
|
||||||
|
+.RE
|
||||||
|
+
|
||||||
|
+Where:
|
||||||
|
+.br
|
||||||
|
+.B color
|
||||||
|
+.RS
|
||||||
|
+The color keyword. Each color entry is on a new line.
|
||||||
|
+.RE
|
||||||
|
+.I color_name
|
||||||
|
+.RS
|
||||||
|
+A single word name for the color (e.g. red).
|
||||||
|
+.RE
|
||||||
|
+.I color_mask
|
||||||
|
+.RS
|
||||||
|
+A color mask starting with a hash (#) that describes the hexadecimal RGB colors with black being #000000 and white being #ffffff.
|
||||||
|
+.RE
|
||||||
|
+.I context_component
|
||||||
|
+.RS
|
||||||
|
+The context component name that must be one of the following:
|
||||||
|
+.br
|
||||||
|
+.RS
|
||||||
|
+user, role, type or range
|
||||||
|
+.RE
|
||||||
|
+Each
|
||||||
|
+.IR context_component " " string " ..."
|
||||||
|
+entry is on a new line.
|
||||||
|
+.RE
|
||||||
|
+.I string
|
||||||
|
+.RS
|
||||||
|
+This is the
|
||||||
|
+.I context_component
|
||||||
|
+string that will be matched with the
|
||||||
|
+.I raw
|
||||||
|
+context component passed by
|
||||||
|
+.BR selinux_raw_context_to_color "(3)."
|
||||||
|
+.br
|
||||||
|
+A wildcard '*' may be used to match any undefined string for the user, role and type
|
||||||
|
+.I context_component
|
||||||
|
+entries only.
|
||||||
|
+.RE
|
||||||
|
+
|
||||||
|
+.I fg_color_name
|
||||||
|
+.RS
|
||||||
|
+The color_name string that will be used as the foreground color.
|
||||||
|
+A
|
||||||
|
+.I color_mask
|
||||||
|
+may also be used.
|
||||||
|
+.RE
|
||||||
|
+.I bg_color_name
|
||||||
|
+.RS
|
||||||
|
+The color_name string that will be used as the background color.
|
||||||
|
+A
|
||||||
|
+.I color_mask
|
||||||
|
+may also be used.
|
||||||
|
+.RE
|
||||||
|
+.
|
||||||
|
+.SH "EXAMPLES"
|
||||||
|
+Example 1 entries are:
|
||||||
|
+.RS
|
||||||
|
+color black = #000000
|
||||||
|
+.br
|
||||||
|
+color green = #008000
|
||||||
|
+.br
|
||||||
|
+color yellow = #ffff00
|
||||||
|
+.br
|
||||||
|
+color blue = #0000ff
|
||||||
|
+.br
|
||||||
|
+color white = #ffffff
|
||||||
|
+.br
|
||||||
|
+color red = #ff0000
|
||||||
|
+.br
|
||||||
|
+color orange = #ffa500
|
||||||
|
+.br
|
||||||
|
+color tan = #D2B48C
|
||||||
|
+.sp
|
||||||
|
+user * = black white
|
||||||
|
+.br
|
||||||
|
+role * = white black
|
||||||
|
+.br
|
||||||
|
+type * = tan orange
|
||||||
|
+.br
|
||||||
|
+range s0\-s0:c0.c1023 = black green
|
||||||
|
+.br
|
||||||
|
+range s1\-s1:c0.c1023 = white green
|
||||||
|
+.br
|
||||||
|
+range s3\-s3:c0.c1023 = black tan
|
||||||
|
+.br
|
||||||
|
+range s5\-s5:c0.c1023 = white blue
|
||||||
|
+.br
|
||||||
|
+range s7\-s7:c0.c1023 = black red
|
||||||
|
+.br
|
||||||
|
+range s9\-s9:c0.c1023 = black orange
|
||||||
|
+.br
|
||||||
|
+range s15:c0.c1023 = black yellow
|
||||||
|
+.RE
|
||||||
|
+
|
||||||
|
+.sp
|
||||||
|
+Example 2 entries are:
|
||||||
|
+.RS
|
||||||
|
+color black = #000000
|
||||||
|
+.br
|
||||||
|
+color green = #008000
|
||||||
|
+.br
|
||||||
|
+color yellow = #ffff00
|
||||||
|
+.br
|
||||||
|
+color blue = #0000ff
|
||||||
|
+.br
|
||||||
|
+color white = #ffffff
|
||||||
|
+.br
|
||||||
|
+color red = #ff0000
|
||||||
|
+.br
|
||||||
|
+color orange = #ffa500
|
||||||
|
+.br
|
||||||
|
+color tan = #d2b48c
|
||||||
|
+.sp
|
||||||
|
+user unconfined_u = #ff0000 green
|
||||||
|
+.br
|
||||||
|
+role unconfined_r = red #ffffff
|
||||||
|
+.br
|
||||||
|
+type unconfined_t = red orange
|
||||||
|
+.br
|
||||||
|
+user user_u = black green
|
||||||
|
+.br
|
||||||
|
+role user_r = white black
|
||||||
|
+.br
|
||||||
|
+type user_t = tan red
|
||||||
|
+.br
|
||||||
|
+user xguest_u = black yellow
|
||||||
|
+.br
|
||||||
|
+role xguest_r = black red
|
||||||
|
+.br
|
||||||
|
+type xguest_t = black green
|
||||||
|
+.br
|
||||||
|
+user sysadm_u = white black
|
||||||
|
+.br
|
||||||
|
+range s0:c0.c1023 = black white
|
||||||
|
+.br
|
||||||
|
+user * = black white
|
||||||
|
+.br
|
||||||
|
+role * = black white
|
||||||
|
+.br
|
||||||
|
+type * = black white
|
||||||
|
+.RE
|
||||||
|
+.
|
||||||
|
+.SH "SEE ALSO"
|
||||||
|
+.BR mcstransd "(8), " selinux_raw_context_to_color "(3), " selinux_colors_path "(3)"
|
115
mcstrans.spec
115
mcstrans.spec
@ -1,26 +1,21 @@
|
|||||||
Summary: SELinux Translation Daemon
|
Summary: SELinux Translation Daemon
|
||||||
Name: mcstrans
|
Name: mcstrans
|
||||||
Version: 3.1
|
Version: 0.3.4
|
||||||
Release: 3%{?dist}
|
Release: 8%{?dist}
|
||||||
License: GPL+
|
License: GPL+
|
||||||
Url: https://github.com/SELinuxProject/selinux/wiki
|
Group: System Environment/Daemons
|
||||||
Source: https://github.com/SELinuxProject/selinux/releases/download/20200710/mcstrans-3.1.tar.gz
|
Source: http://fedora.redhat.com/projects/%{name}-%{version}.tgz
|
||||||
Source2: secolor.conf.8
|
Source1: mcstransd.service
|
||||||
# fedora-selinux/selinux: git format-patch -N mcstrans-3.1 -- mcstrans
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
# i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done
|
BuildRequires: libselinux-devel >= 1.30.3-1
|
||||||
# Patch list start
|
|
||||||
Patch0001: 0001-mcstrans-Fir-RESOURCE_LEAK-and-USE_AFTER_FREE-coveri.patch
|
|
||||||
Patch0002: 0002-mcstrans-Fix-USER_AFTER_FREE-problem.patch
|
|
||||||
Patch0003: 0003-mcstrans-Do-not-accept-incomplete-contexts.patch
|
|
||||||
# Patch list end
|
|
||||||
BuildRequires: gcc
|
|
||||||
BuildRequires: libselinux-devel >= %{version}
|
|
||||||
BuildRequires: libcap-devel pcre-devel libsepol-devel libsepol-static
|
BuildRequires: libcap-devel pcre-devel libsepol-devel libsepol-static
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd-units
|
||||||
Requires: pcre
|
Requires: pcre
|
||||||
%{?systemd_requires}
|
Requires(pre): systemd-units
|
||||||
|
Requires(post):systemd-units
|
||||||
Provides: setransd
|
Provides: setransd
|
||||||
Provides: libsetrans
|
Provides: libsetrans
|
||||||
|
Obsoletes: libsetrans
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Security-enhanced Linux is a feature of the Linux® kernel and a number
|
Security-enhanced Linux is a feature of the Linux® kernel and a number
|
||||||
@ -37,12 +32,11 @@ mcstrans provides an translation daemon to translate SELinux categories
|
|||||||
from internal representations to user defined representation.
|
from internal representations to user defined representation.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -p 2 -n mcstrans-%{version}
|
%setup -q
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%set_build_flags
|
make clean
|
||||||
|
make LIBDIR="%{_libdir}" LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" CFLAGS="%{optflags} -fPIE" %{?_smp_mflags}
|
||||||
%make_build LIBDIR="%{_libdir}"
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
@ -51,34 +45,41 @@ mkdir -p %{buildroot}/%{_libdir}
|
|||||||
mkdir -p %{buildroot}%{_usr}/share/mcstrans
|
mkdir -p %{buildroot}%{_usr}/share/mcstrans
|
||||||
mkdir -p %{buildroot}%{_sysconfdir}/selinux/mls/setrans.d
|
mkdir -p %{buildroot}%{_sysconfdir}/selinux/mls/setrans.d
|
||||||
|
|
||||||
%make_install LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" SBINDIR="%{_sbindir}"
|
make DESTDIR="%{buildroot}" LIBDIR="%{buildroot}%{_libdir}" SHLIBDIR="%{buildroot}/%{_lib}" SBINDIR="%{buildroot}%{_sbindir}" install
|
||||||
rm -f %{buildroot}%{_libdir}/*.a
|
rm -f %{buildroot}%{_libdir}/*.a
|
||||||
cp -r share/* %{buildroot}%{_usr}/share/mcstrans/
|
cp -r share/* %{buildroot}%{_usr}/share/mcstrans/
|
||||||
# Systemd
|
# Systemd
|
||||||
mkdir -p %{buildroot}%{_unitdir}
|
mkdir -p %{buildroot}%{_unitdir}
|
||||||
ln -s %{_unitdir}/mcstrans.service %{buildroot}/%{_unitdir}/mcstransd.service
|
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
|
||||||
rm -rf %{buildroot}/%{_sysconfdir}/rc.d/init.d/mcstrans
|
rm -rf %{buildroot}/%{_sysconfdir}/rc.d/init.d/mcstrans
|
||||||
install -m644 %{SOURCE2} %{buildroot}%{_mandir}/man8/
|
|
||||||
|
%clean
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%systemd_post mcstransd.service
|
if [ $1 -eq 1 ] ; then
|
||||||
|
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%systemd_preun mcstransd.service
|
if [ $1 -eq 0 ]; then
|
||||||
|
/usr/bin/systemctl --no-reload mcstransd.service >/dev/null 2>&1 || :
|
||||||
|
/usr/bin/systemctl stop mcstransd.service > /dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%systemd_postun mcstransd.service
|
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
if [ $1 -ge 1 ]; then
|
||||||
|
/usr/bin/systemctl try-restart mcstransd.service >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
%files
|
%files
|
||||||
|
%defattr(-,root,root,0755)
|
||||||
%{_mandir}/man8/mcs.8.gz
|
%{_mandir}/man8/mcs.8.gz
|
||||||
%{_mandir}/man8/mcstransd.8.gz
|
%{_mandir}/man8/mcstransd.8.gz
|
||||||
%{_mandir}/man5/setrans.conf.5.gz
|
%{_mandir}/man8/setrans.conf.8.gz
|
||||||
%{_mandir}/ru/man8/mcs.8.gz
|
|
||||||
%{_mandir}/ru/man8/mcstransd.8.gz
|
|
||||||
%{_mandir}/ru/man5/setrans.conf.5.gz
|
|
||||||
%{_mandir}/man8/secolor.conf.8.gz
|
%{_mandir}/man8/secolor.conf.8.gz
|
||||||
/usr/sbin/mcstransd
|
/usr/sbin/mcstransd
|
||||||
%{_unitdir}/mcstrans.service
|
|
||||||
%{_unitdir}/mcstransd.service
|
%{_unitdir}/mcstransd.service
|
||||||
%dir %{_sysconfdir}/selinux/mls/setrans.d
|
%dir %{_sysconfdir}/selinux/mls/setrans.d
|
||||||
|
|
||||||
@ -93,58 +94,6 @@ install -m644 %{SOURCE2} %{buildroot}%{_mandir}/man8/
|
|||||||
%{_usr}/share/mcstrans/util/*
|
%{_usr}/share/mcstrans/util/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Tue Jul 28 2020 Tom Stellard <tstellar@redhat.com> - 3.1-3
|
|
||||||
- Use make macros
|
|
||||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
|
||||||
|
|
||||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Jul 16 2020 Petr Lautrbach <plautrba@redhat.com> - 3.1-1
|
|
||||||
- SELinux userspace 3.1 release
|
|
||||||
|
|
||||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Dec 6 2019 Petr Lautrbach <plautrba@redhat.com> - 3.0-1
|
|
||||||
- SELinux userspace 3.0 release
|
|
||||||
|
|
||||||
* Mon Nov 11 2019 Petr Lautrbach <plautrba@redhat.com> - 3.0-0.rc1.1
|
|
||||||
- SELinux userspace 3.0-rc1 release candidate
|
|
||||||
|
|
||||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
|
||||||
|
|
||||||
* Tue Mar 19 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-1
|
|
||||||
- SELinux userspace 2.9 release
|
|
||||||
|
|
||||||
* Mon Mar 11 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-0.rc2.1
|
|
||||||
- SELinux userspace 2.9-rc2 release
|
|
||||||
|
|
||||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-0.rc1.1.1
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
|
||||||
|
|
||||||
* Wed Jan 30 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-0.rc1.1
|
|
||||||
- Update to mcstrans-2.9-rc1
|
|
||||||
|
|
||||||
* Tue Oct 2 2018 Petr Lautrbach <plautrba@redhat.com> - 2.8-1
|
|
||||||
- Update to mcstrans-2.8
|
|
||||||
|
|
||||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-13
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-12
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-11
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
|
||||||
|
|
||||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-10
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-9
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-8
|
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.4-8
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||||
|
|
||||||
|
180
secolor.conf.8
180
secolor.conf.8
@ -1,180 +0,0 @@
|
|||||||
.TH "secolor.conf" "8" "08 April 2011" "SELinux API documentation"
|
|
||||||
.SH "NAME"
|
|
||||||
secolor.conf \- The SELinux color configuration file
|
|
||||||
.
|
|
||||||
.SH "DESCRIPTION"
|
|
||||||
The
|
|
||||||
.I /etc/selinux/{SELINUXTYPE}/secolor.conf
|
|
||||||
configuation file controls the color to be associated to the context components associated to the
|
|
||||||
.I raw
|
|
||||||
context passed by
|
|
||||||
.BR selinux_raw_context_to_color "(3),"
|
|
||||||
when context related information is to be displayed in color by an SELinux-aware application.
|
|
||||||
.sp
|
|
||||||
.BR selinux_raw_context_to_color "(3)"
|
|
||||||
obtains this color information from the active policy
|
|
||||||
.B secolor.conf
|
|
||||||
file as returned by
|
|
||||||
.BR selinux_colors_path "(3)."
|
|
||||||
.
|
|
||||||
.SH "FILE FORMAT"
|
|
||||||
The file format is as follows:
|
|
||||||
.RS
|
|
||||||
.B color
|
|
||||||
.I color_name
|
|
||||||
.BI "= #"color_mask
|
|
||||||
.br
|
|
||||||
[...]
|
|
||||||
.sp
|
|
||||||
.I context_component string
|
|
||||||
.B =
|
|
||||||
.I fg_color_name bg_color_name
|
|
||||||
.br
|
|
||||||
[...]
|
|
||||||
.sp
|
|
||||||
.RE
|
|
||||||
|
|
||||||
Where:
|
|
||||||
.br
|
|
||||||
.B color
|
|
||||||
.RS
|
|
||||||
The color keyword. Each color entry is on a new line.
|
|
||||||
.RE
|
|
||||||
.I color_name
|
|
||||||
.RS
|
|
||||||
A single word name for the color (e.g. red).
|
|
||||||
.RE
|
|
||||||
.I color_mask
|
|
||||||
.RS
|
|
||||||
A color mask starting with a hash (#) that describes the hexadecimal RGB colors with black being #000000 and white being #ffffff.
|
|
||||||
.RE
|
|
||||||
.I context_component
|
|
||||||
.RS
|
|
||||||
The context component name that must be one of the following:
|
|
||||||
.br
|
|
||||||
.RS
|
|
||||||
user, role, type or range
|
|
||||||
.RE
|
|
||||||
Each
|
|
||||||
.IR context_component " " string " ..."
|
|
||||||
entry is on a new line.
|
|
||||||
.RE
|
|
||||||
.I string
|
|
||||||
.RS
|
|
||||||
This is the
|
|
||||||
.I context_component
|
|
||||||
string that will be matched with the
|
|
||||||
.I raw
|
|
||||||
context component passed by
|
|
||||||
.BR selinux_raw_context_to_color "(3)."
|
|
||||||
.br
|
|
||||||
A wildcard '*' may be used to match any undefined string for the user, role and type
|
|
||||||
.I context_component
|
|
||||||
entries only.
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.I fg_color_name
|
|
||||||
.RS
|
|
||||||
The color_name string that will be used as the foreground color.
|
|
||||||
A
|
|
||||||
.I color_mask
|
|
||||||
may also be used.
|
|
||||||
.RE
|
|
||||||
.I bg_color_name
|
|
||||||
.RS
|
|
||||||
The color_name string that will be used as the background color.
|
|
||||||
A
|
|
||||||
.I color_mask
|
|
||||||
may also be used.
|
|
||||||
.RE
|
|
||||||
.
|
|
||||||
.SH "EXAMPLES"
|
|
||||||
Example 1 entries are:
|
|
||||||
.RS
|
|
||||||
color black = #000000
|
|
||||||
.br
|
|
||||||
color green = #008000
|
|
||||||
.br
|
|
||||||
color yellow = #ffff00
|
|
||||||
.br
|
|
||||||
color blue = #0000ff
|
|
||||||
.br
|
|
||||||
color white = #ffffff
|
|
||||||
.br
|
|
||||||
color red = #ff0000
|
|
||||||
.br
|
|
||||||
color orange = #ffa500
|
|
||||||
.br
|
|
||||||
color tan = #D2B48C
|
|
||||||
.sp
|
|
||||||
user * = black white
|
|
||||||
.br
|
|
||||||
role * = white black
|
|
||||||
.br
|
|
||||||
type * = tan orange
|
|
||||||
.br
|
|
||||||
range s0\-s0:c0.c1023 = black green
|
|
||||||
.br
|
|
||||||
range s1\-s1:c0.c1023 = white green
|
|
||||||
.br
|
|
||||||
range s3\-s3:c0.c1023 = black tan
|
|
||||||
.br
|
|
||||||
range s5\-s5:c0.c1023 = white blue
|
|
||||||
.br
|
|
||||||
range s7\-s7:c0.c1023 = black red
|
|
||||||
.br
|
|
||||||
range s9\-s9:c0.c1023 = black orange
|
|
||||||
.br
|
|
||||||
range s15:c0.c1023 = black yellow
|
|
||||||
.RE
|
|
||||||
|
|
||||||
.sp
|
|
||||||
Example 2 entries are:
|
|
||||||
.RS
|
|
||||||
color black = #000000
|
|
||||||
.br
|
|
||||||
color green = #008000
|
|
||||||
.br
|
|
||||||
color yellow = #ffff00
|
|
||||||
.br
|
|
||||||
color blue = #0000ff
|
|
||||||
.br
|
|
||||||
color white = #ffffff
|
|
||||||
.br
|
|
||||||
color red = #ff0000
|
|
||||||
.br
|
|
||||||
color orange = #ffa500
|
|
||||||
.br
|
|
||||||
color tan = #d2b48c
|
|
||||||
.sp
|
|
||||||
user unconfined_u = #ff0000 green
|
|
||||||
.br
|
|
||||||
role unconfined_r = red #ffffff
|
|
||||||
.br
|
|
||||||
type unconfined_t = red orange
|
|
||||||
.br
|
|
||||||
user user_u = black green
|
|
||||||
.br
|
|
||||||
role user_r = white black
|
|
||||||
.br
|
|
||||||
type user_t = tan red
|
|
||||||
.br
|
|
||||||
user xguest_u = black yellow
|
|
||||||
.br
|
|
||||||
role xguest_r = black red
|
|
||||||
.br
|
|
||||||
type xguest_t = black green
|
|
||||||
.br
|
|
||||||
user sysadm_u = white black
|
|
||||||
.br
|
|
||||||
range s0:c0.c1023 = black white
|
|
||||||
.br
|
|
||||||
user * = black white
|
|
||||||
.br
|
|
||||||
role * = black white
|
|
||||||
.br
|
|
||||||
type * = black white
|
|
||||||
.RE
|
|
||||||
.
|
|
||||||
.SH "SEE ALSO"
|
|
||||||
.BR mcstransd "(8), " selinux_raw_context_to_color "(3), " selinux_colors_path "(3)"
|
|
Loading…
Reference in New Issue
Block a user