[enh] add new api entry point to check for meltdown vulnerability

This commit is contained in:
Laurent Peuch 2018-01-05 12:54:11 +01:00
parent ae6f65141a
commit b60d8ca822
2 changed files with 13 additions and 0 deletions

View file

@ -1460,6 +1460,11 @@ tools:
full: --force full: --force
action: store_true action: store_true
### tools_reboot()
meltdown-spectre-check:
action_help: Check if the server is vulnerable to meltdown/spectre
api: GET /meltdown-spectre-check
subcategories: subcategories:
migrations: migrations:

View file

@ -836,6 +836,14 @@ def tools_migrations_state():
return read_json(MIGRATIONS_STATE_PATH) return read_json(MIGRATIONS_STATE_PATH)
def tools_meltdown_spectre_check():
"""
Check if the installation is vulnerable to meltdown/spectre.
"""
# source https://askubuntu.com/questions/992137/how-to-check-that-kpti-is-enabled-on-my-ubuntu
return {"safe": "cpu_insecure" in open("/proc/cpuinfo")}
def tools_shell(auth, command=None): def tools_shell(auth, command=None):
""" """
Launch an (i)python shell in the YunoHost context. Launch an (i)python shell in the YunoHost context.