summaryrefslogtreecommitdiffstats
path: root/sys/security/mac
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-04-22 15:31:22 +0000
committerrwatson <rwatson@FreeBSD.org>2007-04-22 15:31:22 +0000
commitd1196975a07260e588b5270931563e7fe7d7e672 (patch)
tree1c8d3b15d3ba425f41f9ad0bc9e628b32aba6083 /sys/security/mac
parentdb8dcec8015c6fbc747411dcd0f933d6e0a5f81e (diff)
downloadFreeBSD-src-d1196975a07260e588b5270931563e7fe7d7e672.zip
FreeBSD-src-d1196975a07260e588b5270931563e7fe7d7e672.tar.gz
Remove MAC Framework access control check entry points made redundant with
the introduction of priv(9) and MAC Framework entry points for privilege checking/granting. These entry points exactly aligned with privileges and provided no additional security context: - mac_check_sysarch_ioperm() - mac_check_kld_unload() - mac_check_settime() - mac_check_system_nfsd() Add mpo_priv_check() implementations to Biba and LOMAC policies, which, for each privilege, determine if they can be granted to processes considered unprivileged by those two policies. These mostly, but not entirely, align with the set of privileges granted in jails. Obtained from: TrustedBSD Project
Diffstat (limited to 'sys/security/mac')
-rw-r--r--sys/security/mac/mac_framework.h4
-rw-r--r--sys/security/mac/mac_policy.h8
-rw-r--r--sys/security/mac/mac_system.c63
3 files changed, 16 insertions, 59 deletions
diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h
index f127456..98b04c0 100644
--- a/sys/security/mac/mac_framework.h
+++ b/sys/security/mac/mac_framework.h
@@ -282,7 +282,6 @@ int mac_check_kenv_set(struct ucred *cred, char *name, char *value);
int mac_check_kenv_unset(struct ucred *cred, char *name);
int mac_check_kld_load(struct ucred *cred, struct vnode *vp);
int mac_check_kld_stat(struct ucred *cred);
-int mac_check_kld_unload(struct ucred *cred);
int mac_check_mount_stat(struct ucred *cred, struct mount *mp);
int mac_check_pipe_ioctl(struct ucred *cred, struct pipepair *pp,
unsigned long cmd, void *data);
@@ -335,14 +334,11 @@ int mac_check_socket_receive(struct ucred *cred, struct socket *so);
int mac_check_socket_send(struct ucred *cred, struct socket *so);
int mac_check_socket_stat(struct ucred *cred, struct socket *so);
int mac_check_socket_visible(struct ucred *cred, struct socket *so);
-int mac_check_sysarch_ioperm(struct ucred *cred);
int mac_check_system_acct(struct ucred *cred, struct vnode *vp);
int mac_check_system_audit(struct ucred *cred, void *record, int length);
int mac_check_system_auditctl(struct ucred *cred, struct vnode *vp);
int mac_check_system_auditon(struct ucred *cred, int cmd);
-int mac_check_system_nfsd(struct ucred *cred);
int mac_check_system_reboot(struct ucred *cred, int howto);
-int mac_check_system_settime(struct ucred *cred);
int mac_check_system_swapon(struct ucred *cred, struct vnode *vp);
int mac_check_system_swapoff(struct ucred *cred, struct vnode *vp);
int mac_check_system_sysctl(struct ucred *cred, struct sysctl_oid *oidp,
diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h
index ade77f6..451633f 100644
--- a/sys/security/mac/mac_policy.h
+++ b/sys/security/mac/mac_policy.h
@@ -420,7 +420,6 @@ typedef int (*mpo_check_kenv_unset_t)(struct ucred *cred, char *name);
typedef int (*mpo_check_kld_load_t)(struct ucred *cred, struct vnode *vp,
struct label *vlabel);
typedef int (*mpo_check_kld_stat_t)(struct ucred *cred);
-typedef int (*mpo_check_kld_unload_t)(struct ucred *cred);
typedef int (*mpo_mpo_placeholder19_t)(void);
typedef int (*mpo_mpo_placeholder20_t)(void);
typedef int (*mpo_check_mount_stat_t)(struct ucred *cred,
@@ -505,7 +504,6 @@ typedef int (*mpo_check_socket_stat_t)(struct ucred *cred,
struct socket *so, struct label *socketlabel);
typedef int (*mpo_check_socket_visible_t)(struct ucred *cred,
struct socket *so, struct label *socketlabel);
-typedef int (*mpo_check_sysarch_ioperm_t)(struct ucred *cred);
typedef int (*mpo_check_system_acct_t)(struct ucred *cred,
struct vnode *vp, struct label *vlabel);
typedef int (*mpo_check_system_audit_t)(struct ucred *cred, void *record,
@@ -513,9 +511,7 @@ typedef int (*mpo_check_system_audit_t)(struct ucred *cred, void *record,
typedef int (*mpo_check_system_auditctl_t)(struct ucred *cred,
struct vnode *vp, struct label *vplabel);
typedef int (*mpo_check_system_auditon_t)(struct ucred *cred, int cmd);
-typedef int (*mpo_check_system_nfsd_t)(struct ucred *cred);
typedef int (*mpo_check_system_reboot_t)(struct ucred *cred, int howto);
-typedef int (*mpo_check_system_settime_t)(struct ucred *cred);
typedef int (*mpo_check_system_swapon_t)(struct ucred *cred,
struct vnode *vp, struct label *label);
typedef int (*mpo_check_system_swapoff_t)(struct ucred *cred,
@@ -817,7 +813,6 @@ struct mac_policy_ops {
mpo_check_kenv_unset_t mpo_check_kenv_unset;
mpo_check_kld_load_t mpo_check_kld_load;
mpo_check_kld_stat_t mpo_check_kld_stat;
- mpo_check_kld_unload_t mpo_check_kld_unload;
mpo_placeholder_t _mpo_placeholder19;
mpo_placeholder_t _mpo_placeholder20;
mpo_check_mount_stat_t mpo_check_mount_stat;
@@ -862,14 +857,11 @@ struct mac_policy_ops {
mpo_check_socket_send_t mpo_check_socket_send;
mpo_check_socket_stat_t mpo_check_socket_stat;
mpo_check_socket_visible_t mpo_check_socket_visible;
- mpo_check_sysarch_ioperm_t mpo_check_sysarch_ioperm;
mpo_check_system_acct_t mpo_check_system_acct;
mpo_check_system_audit_t mpo_check_system_audit;
mpo_check_system_auditctl_t mpo_check_system_auditctl;
mpo_check_system_auditon_t mpo_check_system_auditon;
- mpo_check_system_nfsd_t mpo_check_system_nfsd;
mpo_check_system_reboot_t mpo_check_system_reboot;
- mpo_check_system_settime_t mpo_check_system_settime;
mpo_check_system_swapon_t mpo_check_system_swapon;
mpo_check_system_swapoff_t mpo_check_system_swapoff;
mpo_check_system_sysctl_t mpo_check_system_sysctl;
diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c
index 32a9b79..07a975c 100644
--- a/sys/security/mac/mac_system.c
+++ b/sys/security/mac/mac_system.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2002, 2003 Networks Associates Technology, Inc.
+ * Copyright (c) 2007 Robert N. M. Watson
* All rights reserved.
*
* This software was developed for the FreeBSD Project in part by Network
@@ -7,6 +8,9 @@
* Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
* as part of the DARPA CHATS research program.
*
+ * Portions of this software were developed by Robert Watson for the
+ * TrustedBSD Project.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -29,6 +33,16 @@
* SUCH DAMAGE.
*/
+/*
+ * MAC Framework entry points relating to overall operation of system,
+ * including global services such as the kernel environment and loadable
+ * modules.
+ *
+ * System checks often align with existing privilege checks, but provide
+ * additional security context that may be relevant to policies, such as the
+ * specific object being operated on.
+ */
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -48,12 +62,6 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_internal.h>
#include <security/mac/mac_policy.h>
-/*
- * XXXRW: Some of these checks now duplicate privilege checks. However,
- * others provide additional security context that may be useful to policies.
- * We need to review these and remove ones that are pure duplicates.
- */
-
int
mac_check_kenv_dump(struct ucred *cred)
{
@@ -117,25 +125,6 @@ mac_check_kld_stat(struct ucred *cred)
}
int
-mac_check_kld_unload(struct ucred *cred)
-{
- int error;
-
- MAC_CHECK(check_kld_unload, cred);
-
- return (error);
-}
-
-int
-mac_check_sysarch_ioperm(struct ucred *cred)
-{
- int error;
-
- MAC_CHECK(check_sysarch_ioperm, cred);
- return (error);
-}
-
-int
mac_check_system_acct(struct ucred *cred, struct vnode *vp)
{
int error;
@@ -151,16 +140,6 @@ mac_check_system_acct(struct ucred *cred, struct vnode *vp)
}
int
-mac_check_system_nfsd(struct ucred *cred)
-{
- int error;
-
- MAC_CHECK(check_system_nfsd, cred);
-
- return (error);
-}
-
-int
mac_check_system_reboot(struct ucred *cred, int howto)
{
int error;
@@ -171,16 +150,6 @@ mac_check_system_reboot(struct ucred *cred, int howto)
}
int
-mac_check_system_settime(struct ucred *cred)
-{
- int error;
-
- MAC_CHECK(check_system_settime, cred);
-
- return (error);
-}
-
-int
mac_check_system_swapon(struct ucred *cred, struct vnode *vp)
{
int error;
@@ -203,8 +172,8 @@ mac_check_system_swapoff(struct ucred *cred, struct vnode *vp)
}
int
-mac_check_system_sysctl(struct ucred *cred, struct sysctl_oid *oidp, void *arg1,
- int arg2, struct sysctl_req *req)
+mac_check_system_sysctl(struct ucred *cred, struct sysctl_oid *oidp,
+ void *arg1, int arg2, struct sysctl_req *req)
{
int error;
OpenPOWER on IntegriCloud