Skip to content

eBPF-based security platform

status: Remove the mode field

Michi Mutsuzakib85b4af85bfe
diff --git a/Documentation/operate/deploy/boot-integration.rst b/Documentation/operate/deploy/boot-integration.rst
index 68fc5746..325dfcfc 100644
--- a/Documentation/operate/deploy/boot-integration.rst
+++ b/Documentation/operate/deploy/boot-integration.rst
@@ -431,7 +431,6 @@ Boot and verify
target# shirudo status
Host: docs
Roles: target
- Mode: production
Status: ok
Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9
@@ -459,9 +458,10 @@ Boot and verify
Folded: keyrings, TPM measurement, assets (--show-full)
- Check for ``Mode: production``, ``Status: ok`` and six ``OK``
- conditions. ``ConfigActive`` names the first 12 hex digits of the
- active config root. ``shirudo status --show-full`` prints the folded
+ Check for ``Status: ok`` and six ``OK`` conditions. The
+ ``LsmAttached`` condition confirms the LSM link is pinned.
+ ``ConfigActive`` names the first 12 hex digits of the active config
+ root. ``shirudo status --show-full`` prints the folded
TPM measurement section, whose ``Bound in:`` line must read
``initrd``. :doc:`/operate/run/read-status` explains every section.
diff --git a/Documentation/operate/deploy/initialize.rst b/Documentation/operate/deploy/initialize.rst
index 2413d461..4bef31f6 100644
--- a/Documentation/operate/deploy/initialize.rst
+++ b/Documentation/operate/deploy/initialize.rst
@@ -66,7 +66,6 @@ Check that init worked
target# shirudo status
Host: docs
Roles: target
- Mode: production
Status: ok
Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9
@@ -142,8 +141,6 @@ Check that init worked
- Value after a good boot
* - ``status``
- ``"ok"``
- * - ``mode``
- - ``"production"``
* - ``keyring_mode``
- ``"bpf"``
* - ``tpm.bound_in``
diff --git a/Documentation/operate/run/read-status.rst b/Documentation/operate/run/read-status.rst
index 9868833c..b0d194d3 100644
--- a/Documentation/operate/run/read-status.rst
+++ b/Documentation/operate/run/read-status.rst
@@ -37,7 +37,6 @@ Print the report
target# shirudo status
Host: docs
Roles: target
- Mode: production
Status: ok
Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9
@@ -90,7 +89,6 @@ line; a section unfolds on its own when its condition is not ``OK``.
target# shirudo status --show-full
Host: docs
Roles: target
- Mode: production
Status: ok
Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9
@@ -190,11 +188,6 @@ Header
operator and target split: remove it and treat the key as exposed,
see :doc:`/operate/maintain/keys`.
-``Mode``
- ``production`` when the ``lsm/bpf`` link is pinned in the private
- bpffs, ``inactive`` otherwise. ``Mode`` does not look at the keyring
- or the register. Read the conditions for those.
-
``Status``
The verdict, followed by the reason in parentheses when it is not
``ok``. :ref:`status-verdicts` explains each verdict.
@@ -744,8 +737,6 @@ The fields that matter for monitoring:
- It is not ``ok``.
* - ``conditions[].status``
- Any condition is ``ALERT``.
- * - ``mode``
- - It is not ``production``.
* - ``tamper_attempts.total``
- It rises beyond your baseline. It is ``null`` before ``init``.
* - ``config.activation_pending``
diff --git a/Documentation/operate/troubleshoot/troubleshooting.rst b/Documentation/operate/troubleshoot/troubleshooting.rst
index 87261079..5f1aec27 100644
--- a/Documentation/operate/troubleshoot/troubleshooting.rst
+++ b/Documentation/operate/troubleshoot/troubleshooting.rst
@@ -32,7 +32,6 @@ Before you begin
target# shirudo status
Host: docs
Roles: target
- Mode: production
Status: ok
Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9
diff --git a/Documentation/reference/cli/status.rst b/Documentation/reference/cli/status.rst
index 42b1a4b0..718c0dc3 100644
--- a/Documentation/reference/cli/status.rst
+++ b/Documentation/reference/cli/status.rst
@@ -35,10 +35,6 @@ report. The roles come from what is present:
``init`` froze
- operator: ``/var/lib/shirudo/keys/signing_key.pem``
-``Mode`` is ``production`` when the LSM link is pinned and ``inactive``
-otherwise. It says nothing about the keyring. The ``KeyringSealed``
-condition does.
-
The report shows six conditions, each ``OK``, ``WARN`` or ``ALERT``:
``LsmAttached``, ``KeyringSealed``, ``ChainIntact``,
``UpatchesMeasured``, ``TpmMeasured`` and ``ConfigActive``. The verdict is the first of these that applies:
@@ -174,7 +170,6 @@ Show the state of a target:
target# shirudo status
Host: docs
Roles: target
- Mode: production
Status: ok
Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9
@@ -210,7 +205,6 @@ system as well:
target# shirudo status --show-full
Host: docs
Roles: target
- Mode: production
Status: ok
Version ID: d0d7aa800303439023907d1979d917d46a21bec21f816689c138728a28e84af9
diff --git a/Documentation/reference/files.rst b/Documentation/reference/files.rst
index 4b2d382f..5e74c7ba 100644
--- a/Documentation/reference/files.rst
+++ b/Documentation/reference/files.rst
@@ -318,7 +318,7 @@ by ``BPF_OBJ_GET`` (``ObjGet``). Directories stay listable.
- Content
* - ``lsm_link``
- Link of ``lsm/bpf``, the ``bpf()`` admission hook. Its presence
- makes ``status`` report ``Mode: production``.
+ makes the ``LsmAttached`` condition report ``OK``.
* - ``bpf2_bpf_map_link``, ``bpf2_bpf_prog_load_link``,
``bpf2_inode_unlink_link``, ``bpf2_inode_setxattr_link``,
``bpf2_inode_removexattr_link``, ``bpf2_key_permission_link``,
diff --git a/Documentation/reference/formats/status-json.rst b/Documentation/reference/formats/status-json.rst
index f101f74d..1fc009f9 100644
--- a/Documentation/reference/formats/status-json.rst
+++ b/Documentation/reference/formats/status-json.rst
@@ -67,10 +67,6 @@ determined, as noted.
* - ``lsm_attached``
- boolean
- ``true`` when the pin ``/run/shirudo/bpffs/lsm_link`` opens.
- * - ``mode``
- - string
- - ``production`` when ``lsm_attached`` is ``true``, else
- ``inactive``.
* - ``keyring_mode``
- string
- ``bpf`` when the ``.bpf`` keyring is present, else ``none``.
@@ -785,7 +781,6 @@ indented here:
}
],
"lsm_attached": true,
- "mode": "production",
"keyring_mode": "bpf",
"keyring_present": true,
"keyring_serial": 272801410,
diff --git a/Documentation/start/install.rst b/Documentation/start/install.rst
index 258e1463..6f5779c9 100644
--- a/Documentation/start/install.rst
+++ b/Documentation/start/install.rst
@@ -240,8 +240,8 @@ enforces once it boots through the shirudo initrd with everything that
not write drop-ins for them.
:doc:`/operate/deploy/boot-integration` sets these up. After the reboot,
-``shirudo status`` on the target shows ``Status: ok`` and ``Mode:
-production``, and ``shirudo status --show-full`` shows ``Bound in:
+``shirudo status`` on the target shows ``Status: ok`` with every
+condition ``OK``, and ``shirudo status --show-full`` shows ``Bound in:
initrd``.
Next steps
diff --git a/Documentation/start/quickstart.rst b/Documentation/start/quickstart.rst
index aab127df..6622d25c 100644
--- a/Documentation/start/quickstart.rst
+++ b/Documentation/start/quickstart.rst
@@ -150,7 +150,6 @@ Check enforcement
target# shirudo status
Host: quickstart
Roles: target
- Mode: production
Status: ok
Version ID: 414d0c75238fcc31b1d60ce78b4943a8b450f49556a5cb255d62392061b87ccf
@@ -182,7 +181,7 @@ Check enforcement
from ``shirudo status --json``: the command exits with 0 whatever
the verdict is, unless ``--check`` makes it exit with 1 on
``tampered``.
- - ``Mode: production``: the LSM link is pinned.
+ - The ``LsmAttached`` condition is ``OK``: the LSM link is pinned.
- The tamper attempts: calls the policy refused since boot. Other
software on the guest has already made some.
- The last line names the sections the report folds while their
diff --git a/Documentation/upatches/test/testing.rst b/Documentation/upatches/test/testing.rst
index 99c6b1db..ad0ceab0 100644
--- a/Documentation/upatches/test/testing.rst
+++ b/Documentation/upatches/test/testing.rst
@@ -55,7 +55,6 @@ Boot the test VM
target# shirudo-runtime status
Host: upatch-dev
Roles: target
- Mode: production
Status: ok
...
diff --git a/builtin-status.c b/builtin-status.c
index 16f2f102..558f049f 100644
--- a/builtin-status.c
+++ b/builtin-status.c
@@ -819,7 +819,7 @@ int cmd_status(int argc, const char **argv)
char reason[160];
bool lsm_attached, keyring_present, is_operator, cert_present, is_target;
key_serial_t keyring_serial, keyring_pinned;
- const char *keyring_mode, *mode;
+ const char *keyring_mode;
struct sysinfo sysi = {};
struct trusted_set certs = {};
int certs_enrolled = -1;
@@ -940,7 +940,6 @@ int cmd_status(int argc, const char **argv)
dmv.serial = dmv.pinned >= 1 ? keyring_dm_verity_serial() :
-ENOKEY;
keyring_view_dm_verity(&dmv, &ident);
- mode = lsm_attached ? "production" : "inactive";
is_operator = access(SIGNING_KEY_PATH, F_OK) == 0;
cert_present = access(get_cert_path(), F_OK) == 0;
is_target = cert_present || lsm_attached || keyring_present;
@@ -1091,7 +1090,6 @@ int cmd_status(int argc, const char **argv)
json_arr_close(&e);
}
json_kv_bool(&e, "lsm_attached", lsm_attached);
- json_kv_string(&e, "mode", mode);
json_kv_string(&e, "keyring_mode", keyring_mode);
json_kv_bool(&e, "keyring_present", keyring_present);
if (keyring_present)
@@ -1318,7 +1316,6 @@ int cmd_status(int argc, const char **argv)
printf("%-22s %s\n", "Host:", hostname);
printf("%-22s %s\n", "Roles:",
roles_str(is_target, is_operator));
- printf("%-22s %s\n", "Mode:", mode);
if (reason[0])
printf("%-22s %s (%s)\n", "Status:", verdict,
reason);
diff --git a/testing/functional/tpm/t4101-initrd.sh b/testing/functional/tpm/t4101-initrd.sh
index 7390d0f3..bdfe47cc 100755
--- a/testing/functional/tpm/t4101-initrd.sh
+++ b/testing/functional/tpm/t4101-initrd.sh
@@ -33,8 +33,9 @@ PHASE_BEFORE=$(status_field tpm.phase_before)
PHASE_MEASURED=1
[ "$PHASE_BEFORE" != "$(printf '%064d' 0)" ] || PHASE_MEASURED=0
-test_expect_success 'status reports the production configuration' '
- [ "$(status_field mode)" = production ] &&
+test_expect_success 'status reports an attached LSM and a BPF keyring' '
+ [ -z "$(status_field mode)" ] &&
+ [ "$(status_field lsm_attached)" = True ] &&
[ "$(status_field keyring_mode)" = bpf ]
'
diff --git a/testing/vm/guest.sh b/testing/vm/guest.sh
index bec39bec..9d7a3a39 100755
--- a/testing/vm/guest.sh
+++ b/testing/vm/guest.sh
@@ -395,7 +395,7 @@ if [[ "$VM_INITRD" == 1 ]]; then
"$SHIRUDO_BIN" status --json | python3 -c '
import json, sys
d = json.load(sys.stdin)
-assert d["mode"] == "production", d["mode"]
+assert d["lsm_attached"] is True, d["lsm_attached"]
assert d["tpm"]["bound_in"] == "initrd", d["tpm"]
'
test ! -e /run/shirudo/eventlog.pending