{
  "id": "CB-UBU-DESK-003",
  "standard": "ubuntu",
  "version": "main",
  "url": "https://baselines.cirsec.org/b/ubuntu/CB-UBU-DESK-003",
  "json": "https://baselines.cirsec.org/b/ubuntu/CB-UBU-DESK-003.json",
  "yaml": "https://baselines.cirsec.org/b/ubuntu/CB-UBU-DESK-003.yml",
  "profiles_effective": [
    "desktop",
    "desktop-hardened"
  ],
  "license": "Text CC BY 4.0, code Apache-2.0",
  "attribution": "CIRSEC Baselines, https://baselines.cirsec.org",
  "control": {
    "id": "CB-UBU-DESK-003",
    "title": "Lock GNOME sessions after a short inactivity delay",
    "finding": {
      "title": "Users can extend or disable the GNOME inactivity lock",
      "description": "An unattended GNOME session stays usable by anyone in front of the screen for as long as the user configured."
    },
    "status": "active",
    "profiles": [
      "desktop"
    ],
    "risk": {
      "severity": "medium"
    },
    "assessment": "automated",
    "tags": [
      "gnome",
      "dconf",
      "session-lock"
    ],
    "applicability": {
      "facts": [
        "desktop-gnome"
      ]
    },
    "description": "Two GNOME keys control when an idle session gets locked:\n\n- `org.gnome.desktop.session idle-delay`: seconds of inactivity before the session is\n  considered idle and the screen blanks;\n- `org.gnome.desktop.screensaver lock-delay`: seconds between the screen blanking and the\n  lock.\n\nBoth are set in the system dconf database `local` and locked. The lock itself requires\n`lock-enabled`, set by CB-UBU-DESK-009.\n",
    "rationale": "A session left open on an unattended machine gives its access to anyone passing by. Locking\nafter a short delay limits that window, and locking the keys stops users from disabling it.\n",
    "impact": "Sessions lock after {{ idle_delay }} seconds of inactivity, plus {{ lock_delay }} seconds.\nUsers cannot change these delays. Presentations and video calls inhibit the idle delay while\nthey run.\n",
    "notes": "Ubuntu's defaults (GNOME 3.36 to 50) are already 300 and 0 seconds, but users can change\nthem. The check expects exactly the configured values. `dconf read` as root reads the system\ndatabase, which wins over user values for locked keys.\n",
    "setting": {
      "location": "/etc/dconf/db/local.d/, keys /org/gnome/desktop/session/idle-delay and /org/gnome/desktop/screensaver/lock-delay",
      "default_value": "300 and 0 seconds, not locked",
      "recommended_value": "idle-delay=uint32 {{ idle_delay }}, lock-delay=uint32 {{ lock_delay }}, locked"
    },
    "parameters": [
      {
        "name": "idle_delay",
        "type": "integer",
        "description": "Seconds of inactivity before the screen blanks. 0 would disable the lock.",
        "unit": "seconds",
        "default": 300,
        "minimum": 1,
        "maximum": 900
      },
      {
        "name": "lock_delay",
        "type": "integer",
        "description": "Seconds between the screen blanking and the lock.",
        "unit": "seconds",
        "default": 0,
        "minimum": 0,
        "maximum": 5
      }
    ],
    "audit": {
      "manual": "1. `dconf read /org/gnome/desktop/session/idle-delay` must print `uint32 {{ idle_delay }}`.\n2. `dconf read /org/gnome/desktop/screensaver/lock-delay` must print `uint32 {{ lock_delay }}`.\n3. Both keys must be listed in a file of `/etc/dconf/db/local.d/locks/`.\n",
      "checks": [
        {
          "id": "idle-delay",
          "engine": "dconf",
          "description": "Inactivity delay before the screen blanks.",
          "facts": [
            "desktop-gnome"
          ],
          "spec": {
            "key": "/org/gnome/desktop/session/idle-delay",
            "value": "uint32 {{ idle_delay }}"
          }
        },
        {
          "id": "lock-delay",
          "engine": "dconf",
          "description": "Delay between blanking and locking.",
          "facts": [
            "desktop-gnome"
          ],
          "spec": {
            "key": "/org/gnome/desktop/screensaver/lock-delay",
            "value": "uint32 {{ lock_delay }}"
          }
        }
      ]
    },
    "remediation": {
      "manual": "1. Make sure `/etc/dconf/profile/user` contains `user-db:user` and `system-db:local`.\n2. Create `/etc/dconf/db/local.d/00-screen-lock`:\n   ```\n   [org/gnome/desktop/session]\n   idle-delay=uint32 {{ idle_delay }}\n\n   [org/gnome/desktop/screensaver]\n   lock-delay=uint32 {{ lock_delay }}\n   ```\n3. List `/org/gnome/desktop/session/idle-delay` and `/org/gnome/desktop/screensaver/lock-delay`\n   in `/etc/dconf/db/local.d/locks/00-screen-lock`.\n4. Run `dconf update`.\n",
      "effects": {
        "restart": "session",
        "disruption": "low",
        "lockout_risk": false
      },
      "rollback": "Delete the files written in `/etc/dconf/db/local.d/` and its `locks/` directory, then run\n`dconf update`.\n",
      "scripts": [
        {
          "id": "idle-delay",
          "from_check": "idle-delay"
        },
        {
          "id": "lock-delay",
          "from_check": "lock-delay"
        }
      ]
    },
    "references": [
      {
        "title": "GNOME System Administration Guide - Lock the screen when the user is idle",
        "url": "https://help.gnome.org/admin/system-admin-guide/stable/desktop-lockscreen.html.en",
        "publisher": "The GNOME Project",
        "kind": "vendor-doc",
        "accessed": "2026-10-19"
      },
      {
        "title": "GNOME System Administration Guide - Lock down specific settings",
        "url": "https://help.gnome.org/admin/system-admin-guide/stable/dconf-lockdown.html.en",
        "publisher": "The GNOME Project",
        "kind": "vendor-doc",
        "accessed": "2026-10-19"
      },
      {
        "title": "ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R32)",
        "url": "https://messervices.cyber.gouv.fr/documents-guides/fr_np_linux_configuration-v2.0.pdf",
        "publisher": "ANSSI",
        "kind": "guide",
        "accessed": "2026-10-19"
      }
    ],
    "mappings": [
      {
        "framework": "anssi-linux",
        "framework_version": "2.0",
        "id": "R32",
        "relation": "partial",
        "note": "R32 covers every local session; this control covers GNOME, CB-UBU-DESK-008 the others."
      },
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "AC-11",
        "relation": "equivalent"
      }
    ],
    "threats": [
      {
        "framework": "cwe",
        "id": "CWE-613"
      }
    ],
    "related_controls": [
      {
        "id": "CB-UBU-DESK-009",
        "type": "requires"
      },
      {
        "id": "CB-UBU-DESK-008",
        "type": "related"
      }
    ],
    "authors": [
      {
        "name": "Alice",
        "github": "Sn0wAlice"
      }
    ],
    "verified": [
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "20.04"
        ],
        "environment": "Proxmox VM with Ubuntu Desktop (GNOME 3.36, gdm3), Ubuntu 20.04.6, kernel 5.4.0-216-generic",
        "notes": "Generated dconf check and fix (desktop-hardened); value and lock confirmed with gsettings get/writable as a user under dbus-run-session (write refused); second remediation reported compliant; state kept after reboot."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "22.04"
        ],
        "environment": "Proxmox VM with Ubuntu Desktop (GNOME 42, gdm3), Ubuntu 22.04.5, kernel 5.15.0-198-generic",
        "notes": "Generated dconf check and fix (desktop-hardened); value and lock confirmed with gsettings get/writable as a user under dbus-run-session (write refused); second remediation reported compliant; state kept after reboot."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "24.04"
        ],
        "environment": "Proxmox VM with Ubuntu Desktop (GNOME 46, gdm3), Ubuntu 24.04.5, kernel 6.8.0-147-generic",
        "notes": "Generated dconf check and fix (desktop-hardened); value and lock confirmed with gsettings get/writable as a user under dbus-run-session (write refused); second remediation reported compliant; state kept after reboot."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "26.04"
        ],
        "environment": "Proxmox VM with Ubuntu Desktop (GNOME 50, gdm3), Ubuntu 26.04.1, kernel 7.0.0-38-generic",
        "notes": "Generated dconf check and fix (desktop-hardened); value and lock confirmed with gsettings get/writable as a user under dbus-run-session (write refused); second remediation reported compliant; state kept after reboot."
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-19",
    "updated": "2026-10-19"
  }
}