diff --git a/docs/features.md b/docs/features.md index ba45b6e..1069e46 100644 --- a/docs/features.md +++ b/docs/features.md @@ -64,7 +64,7 @@ always applied. | polkit-omarchy | `polkit-agent` | modifies the polkit agent (replaces Omarchy's omarchy.polkit plugin) | system, user | on | no | | xdg-desktop-portal-omarchy (clipboard portal) | `clipboard-portal` | adds the RemoteDesktop/Clipboard portals (clipboard only, after a shell dialog), so the Bitwarden Flatpak copies natively on Wayland; off, it runs under XWayland | system, user | on | no | | fingerprint-omarchy (fingerprint overlay) | `fingerprint` | adds an overlay from the Omarchy plugin marketplace to enroll, test and delete your fingerprints (fprintd), opened from Setup › Security; removes the fingerprint-omarchy package | system, user | on | no | -| security-key-omarchy (security key overlay) | `security-key` | adds the security-key-omarchy package and an overlay from the Omarchy plugin marketplace to register your FIDO2 keys for sudo/polkit in /etc/fido2/fido2 and import their OpenPGP and SSH keys, opened from Setup › Security; adds pam_u2f to the sudo and polkit PAM stacks, asking for the PIN and a touch of the key | system, user | on | no | +| security-key-omarchy (security key overlay) | `security-key` | adds the security-key-omarchy package and an overlay from the Omarchy plugin marketplace to register your FIDO2 keys for sudo/polkit in /etc/fido2/fido2 and import their OpenPGP and SSH keys, opened from Setup › Security; adds pam_u2f to the sudo and polkit PAM stacks, asking for the PIN and a touch of the key (the overlay's switch can drop the PIN; later runs keep that choice) | system, user | on | no | | openssh with askpass touch notifications | `openssh-askpass` | modifies the openssh package (rebuilt with a patch) | system | on | no | ## Development diff --git a/features.yml b/features.yml index 00bfc2e..5a4310d 100644 --- a/features.yml +++ b/features.yml @@ -275,7 +275,7 @@ features: - id: security-key group: plugins title: security-key-omarchy (security key overlay) - effect: adds the security-key-omarchy package and an overlay from the Omarchy plugin marketplace to register your FIDO2 keys for sudo/polkit in /etc/fido2/fido2 and import their OpenPGP and SSH keys, opened from Setup › Security; adds pam_u2f to the sudo and polkit PAM stacks, asking for the PIN and a touch of the key + effect: adds the security-key-omarchy package and an overlay from the Omarchy plugin marketplace to register your FIDO2 keys for sudo/polkit in /etc/fido2/fido2 and import their OpenPGP and SSH keys, opened from Setup › Security; adds pam_u2f to the sudo and polkit PAM stacks, asking for the PIN and a touch of the key (the overlay's switch can drop the PIN; later runs keep that choice) phases: [system, user] default: true revert: false diff --git a/group_vars/all/main.yml b/group_vars/all/main.yml index 69aab62..d67b384 100644 --- a/group_vars/all/main.yml +++ b/group_vars/all/main.yml @@ -551,7 +551,7 @@ fingerprint_plugin_id: lbssousa.fingerprint # from the Omarchy plugin marketplace at the same tag; bump the ref to deploy # a new release. security_key_plugin_repo: https://github.com/lbssousa/security-key-omarchy.git -security_key_plugin_ref: v0.7.3 +security_key_plugin_ref: v0.8.0 security_key_plugin_checkout_dir: "{{ target_home }}/src/security-key-omarchy" security_key_plugin_verify_commit: false security_key_plugin_signing_keys: "{{ omapin_signing_keys }}" @@ -560,6 +560,9 @@ security_key_plugin_package: security-key-omarchy security_key_plugin_id: lbssousa.security-key security_key_plugin_authfile: /etc/fido2/fido2 security_key_plugin_authfile_helper: /usr/bin/omarchy-security-key-authfile +# Since 0.8.0: sets whether sudo and polkit ask for the key's PIN along with +# the touch (pinverification= on their pam_u2f lines), from the overlay. +security_key_plugin_pam_helper: /usr/bin/omarchy-security-key-pam # Where `just publish` (playbooks/system/shared-checkout.yml) puts the copy # of this repository every user runs `omarchy-setup-user` from. diff --git a/playbooks/system/plugins.yml b/playbooks/system/plugins.yml index 7f499ab..b9fa08f 100644 --- a/playbooks/system/plugins.yml +++ b/playbooks/system/plugins.yml @@ -575,9 +575,10 @@ changed_when: true become: true - # The overlay registers keys but leaves PAM alone, so without these lines - # sudo and polkit never ask for a key. With no key registered pam_u2f - # only falls through to the next module. + # The overlay registers keys and, since 0.8.0, sets whether these lines + # ask for the PIN, but never adds them: without them sudo and polkit never + # ask for a key. With no key registered pam_u2f only falls through to the + # next module. - name: Make sudo and polkit ask for a registered security key ansible.builtin.include_tasks: tasks/pam-u2f-line.yml loop: diff --git a/playbooks/tasks/pam-u2f-line.yml b/playbooks/tasks/pam-u2f-line.yml index ed338e8..bd101a2 100644 --- a/playbooks/tasks/pam-u2f-line.yml +++ b/playbooks/tasks/pam-u2f-line.yml @@ -5,10 +5,12 @@ # but one without authfile= is pointed at that file: earlier runs left keys in # ~/.config/Yubico/u2f_keys, which that play has already moved. # -# A key alone never authenticates: pinverification=1 and userpresence=1 make -# pam_u2f ask for its PIN and a touch, whatever the options on each registered -# credential. A key without a PIN is refused, and the stack goes on to the next -# module. +# A new line asks for the key's PIN and a touch (pinverification=1 +# userpresence=1), whatever the options on each registered credential: a key +# without a PIN is refused, and the stack goes on to the next module. After +# that the PIN is the overlay's switch (security-key-omarchy 0.8.0, +# omarchy-security-key-pam): pinverification= is left as it is, so a run +# doesn't undo the choice. A touch is always required. # # The line goes right after pam_fprintd, the order pam-auth-order pins, and # so also after the clamshell gate, which skips only the next module. Without @@ -73,22 +75,18 @@ backup: true become: true -# Task names are rendered before the loop, so they name both options: the -# output shows each pass's option as its item. -- name: "Drop any other pinverification or userpresence setting from pam_u2f in {{ pam_file }}" +- name: "Drop any other userpresence setting from pam_u2f in {{ pam_file }}" ansible.builtin.replace: path: "{{ pam_file }}" - regexp: '^(\s*auth\s.*pam_u2f\.so.*?)[ \t]+{{ item }}=(?!1(?:\s|$))\S*(.*)$' + regexp: '^(\s*auth\s.*pam_u2f\.so.*?)[ \t]+userpresence=(?!1(?:\s|$))\S*(.*)$' replace: '\1\2' backup: true - loop: [pinverification, userpresence] become: true -- name: "Require pinverification=1 and userpresence=1 from pam_u2f in {{ pam_file }}" +- name: "Require userpresence=1 from pam_u2f in {{ pam_file }}" ansible.builtin.replace: path: "{{ pam_file }}" - regexp: '^(\s*auth\s.*pam_u2f\.so(?:(?!{{ item }}).)*)$' - replace: '\1 {{ item }}=1' + regexp: '^(\s*auth\s.*pam_u2f\.so(?:(?!userpresence).)*)$' + replace: '\1 userpresence=1' backup: true - loop: [pinverification, userpresence] become: true diff --git a/playbooks/user/plugins.yml b/playbooks/user/plugins.yml index 87469ff..560c96f 100644 --- a/playbooks/user/plugins.yml +++ b/playbooks/user/plugins.yml @@ -781,7 +781,7 @@ ansible.builtin.include_tasks: tasks/plugin-code-stamp.yml vars: plugin_stamp_id: "{{ security_key_plugin_id }}" - plugin_stamp_paths: ["{{ security_key_plugin_authfile_helper }}"] + plugin_stamp_paths: ["{{ security_key_plugin_authfile_helper }}", "{{ security_key_plugin_pam_helper }}"] - name: Keep the result under the name the tasks below use ansible.builtin.set_fact: