Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion group_vars/all/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions playbooks/system/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 11 additions & 13 deletions playbooks/tasks/pam-u2f-line.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion playbooks/user/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading