flask: change default state to enforcing
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Wed, 6 Apr 2016 19:35:59 +0000 (15:35 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 8 Apr 2016 15:35:14 +0000 (11:35 -0400)
The previous default of "permissive" is meant for developing or
debugging a disaggregated system.  However, this default makes it too
easy to accidentally boot a machine in this state, which does not place
any restrictions on guests.  This is not suitable for normal systems
because any guest can perform any operation (including operations like
rebooting the machine, kexec, and reading or writing another domain's
memory).

This change will cause the boot to fail if you do not specify an XSM
policy during boot; if you need to load a policy from dom0, use the
"flask=late" boot parameter.

Original patch by Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>; modified
to also change the default value of flask_enforcing so that the policy
is not still in permissive mode.  This also removes the (no longer
documented) command line argument directly changing that variable since
it has been superseded by the flask= parameter.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
docs/misc/xen-command-line.markdown
docs/misc/xsm-flask.txt
xen/xsm/flask/flask_op.c
xen/xsm/flask/hooks.c

index 5d801b85b8e9be1304bab8aadbdafc880fbf5426..5284334e0d0c8b423f86d55c5c3bb0a2348b61d1 100644 (file)
@@ -681,7 +681,7 @@ to use the default.
 ### flask
 > `= permissive | enforcing | late | disabled`
 
-> Default: `permissive`
+> Default: `enforcing`
 
 Specify how the FLASK security server should be configured.  This option is only
 available if the hypervisor was compiled with XSM support (which can be enabled
index fb2fe9f42fbd27c978a268ed8a7c5965a9a490d5..00a2b132d9db9fe22090c3ab5093c31819c99f51 100644 (file)
@@ -283,12 +283,12 @@ for passthrough, run:
 
 This command must be rerun on each boot or after any policy reload.
 
-The example policy was only tested with simple domain creation and may be
-missing rules allowing accesses by dom0 or domU when a number of hypervisor
-features are used. When first loading or writing a policy, you should run FLASK
-in permissive mode (the default) and check the Xen logs (xl dmesg) for AVC
-denials before using it in enforcing mode (flask_enforcing=1 on the command
-line, or xl setenforce).
+When first loading or writing a policy, you should run FLASK in permissive mode
+(flask=permissive on the command line) and check the Xen logs (xl dmesg) for AVC
+denials before using it in enforcing mode (the default value of the boot
+parameter, which can also be changed using xl setenforce).  When using the
+default types for domains (domU_t), the example policy shipped with Xen should
+allow the same operations on or between domains as when not using FLASK.
 
 
 MLS/MCS policy
index 3c9c99ebacf763bd44cf61d0fb4ff4853303be1c..ea903a768ccdc730c1a2933f35d0593aa042ae44 100644 (file)
 #define _copy_to_guest copy_to_guest
 #define _copy_from_guest copy_from_guest
 
-enum flask_bootparam_t __read_mostly flask_bootparam = FLASK_BOOTPARAM_PERMISSIVE;
+enum flask_bootparam_t __read_mostly flask_bootparam = FLASK_BOOTPARAM_ENFORCING;
 static void parse_flask_param(char *s);
 custom_param("flask", parse_flask_param);
 
-bool_t __read_mostly flask_enforcing = 0;
-boolean_param("flask_enforcing", flask_enforcing);
+bool_t __read_mostly flask_enforcing = 1;
 
 #define MAX_POLICY_SIZE 0x4000000
 
@@ -64,15 +63,9 @@ extern struct xsm_operations *original_ops;
 static void __init parse_flask_param(char *s)
 {
     if ( !strcmp(s, "enforcing") )
-    {
-        flask_enforcing = 1;
         flask_bootparam = FLASK_BOOTPARAM_ENFORCING;
-    }
     else if ( !strcmp(s, "late") )
-    {
-        flask_enforcing = 1;
         flask_bootparam = FLASK_BOOTPARAM_LATELOAD;
-    }
     else if ( !strcmp(s, "disabled") )
         flask_bootparam = FLASK_BOOTPARAM_DISABLED;
     else if ( !strcmp(s, "permissive") )
index 1eaec5839ab941515282ee66649f86fc7d34945f..118c3e6cda5be69f1a0c6e720aae99c82f08bbd0 100644 (file)
@@ -1845,6 +1845,9 @@ static __init void flask_init(void)
         return;
 
     case FLASK_BOOTPARAM_PERMISSIVE:
+        flask_enforcing = 0;
+        break;
+
     case FLASK_BOOTPARAM_ENFORCING:
     case FLASK_BOOTPARAM_LATELOAD:
         break;