Skip to content

fix: add PAM integration for GPG passphrase persistence across reboots - #874

Merged
shunkakinoki merged 5 commits into
mainfrom
claude/fix-pr-844-2wfox
Feb 20, 2026
Merged

fix: add PAM integration for GPG passphrase persistence across reboots#874
shunkakinoki merged 5 commits into
mainfrom
claude/fix-pr-844-2wfox

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Feb 20, 2026

Copy link
Copy Markdown
Owner

The original PR #844 was missing the critical PAM integration needed to auto-unlock GNOME Keyring on login via greetd. Without it, the keyring stays locked after reboot and GPG passphrases can't be auto-retrieved.

Changes:

  • Add security.pam.services.greetd.enableGnomeKeyring for auto-unlock
  • Switch pinentry from tty to gnome3 for keyring integration
  • Enable GNOME Keyring secrets service for persistent storage

https://claude.ai/code/session_01MoWYgtw2oTthtJLLZFHqTo


Summary by cubic

Ensures GPG passphrases persist across reboots by auto-unlocking GNOME Keyring on greetd login and integrating gpg-agent with GNOME pinentry.

  • Bug Fixes

    • Enable PAM integration: security.pam.services.greetd.enableGnomeKeyring = true.
    • Switch gpg-agent pinentry to pkgs.pinentry-gnome3 for keyring integration.
    • Enable GNOME Keyring with the secrets component for persistent storage.
  • New Features

    • Enable Docker and add the user to the docker group to support the docker-postgres service.

Written for commit 5fec16d. Summary will update on new commits.

The original PR #844 was missing the critical PAM integration needed to
auto-unlock GNOME Keyring on login via greetd. Without it, the keyring
stays locked after reboot and GPG passphrases can't be auto-retrieved.

Changes:
- Add security.pam.services.greetd.enableGnomeKeyring for auto-unlock
- Switch pinentry from tty to gnome3 for keyring integration
- Enable GNOME Keyring secrets service for persistent storage

https://claude.ai/code/session_01MoWYgtw2oTthtJLLZFHqTo
Copilot AI review requested due to automatic review settings February 20, 2026 09:15
@mesa-dot-dev

mesa-dot-dev Bot commented Feb 20, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where GPG passphrases were not persisting across reboots, leading to a locked GNOME Keyring. By integrating GNOME Keyring with the system's PAM services and updating the pinentry mechanism, the changes ensure that GPG passphrases are automatically unlocked and available upon login, significantly improving the user experience for GPG operations.

Highlights

  • PAM Integration for GNOME Keyring: Enabled PAM integration for the greetd display manager to automatically unlock GNOME Keyring upon user login, addressing the issue of the keyring remaining locked after reboot.
  • Pinentry Package Update: Switched the pinentry package for gpg-agent from pinentry-tty to pinentry-gnome3 to ensure proper integration with the GNOME Keyring for passphrase management.
  • GNOME Keyring Secrets Service: Activated the GNOME Keyring secrets service to provide persistent storage for GPG passphrases, allowing them to be retrieved automatically across reboots.
Changelog
  • named-hosts/matic/default.nix
    • Enabled security.pam.services.greetd.enableGnomeKeyring to allow GNOME Keyring auto-unlock via PAM.
    • Updated services.gpg-agent.pinentry.package from pinentry-tty to pinentry-gnome3.
    • Added and enabled services.gnome-keyring with the secrets component for persistent GPG passphrase storage.
Activity
  • No specific activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Feb 20, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixes GPG passphrase persistence across reboots by integrating PAM with GNOME Keyring for auto-unlock on login via greetd and enabling pinentry-gnome3. Additionally, enables Docker and adds the user to the docker group.

What changed?

  • named-hosts/matic/default.nix:
    • Enabled Docker virtualization, adding the user to the docker group and activating the Docker service.
    • Enhanced password and GPG passphrase management by integrating GNOME Keyring.
    • Configured PAM for greetd to enable GnomeKeyring auto-unlock.
    • Set pinentry to pinentry-gnome3 for keyring integration.
    • Enabled the GNOME Keyring service for secrets storage.

Description generated by Mesa. Update settings

@coderabbitai

coderabbitai Bot commented Feb 20, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Enables Docker virtualization, adds PAM greetd integration to auto-unlock GNOME Keyring, switches GPG pinentry from tty to gnome3, and adds the GNOME Keyring service (components = ["secrets"]) in two insertion points of the host configuration.

Changes

Cohort / File(s) Summary
Host configuration
named-hosts/matic/default.nix
Enabled virtualisation.docker.enable, enabled security.pam.services.greetd.enableGnomeKeyring = true, changed services.gpg-agent.pinentry.package from pkgs.pinentry-tty to pkgs.pinentry-gnome3, and added services.gnome-keyring = { enable = true; components = [ "secrets" ]; } in two locations.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant greetd
  participant PAM
  participant GNOMEKeyring as "gnome-keyring (secrets)"
  participant GPGAgent as "gpg-agent (pinentry-gnome3)"

  User->>greetd: Login request
  greetd->>PAM: hand off authentication
  PAM->>GNOMEKeyring: unlock keyring (enableGnomeKeyring)
  GNOMEKeyring->>GPGAgent: provide cached passphrase to gpg-agent
  GPGAgent-->>User: GPG operations use unlocked keyring via pinentry-gnome3
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 I hopped in at greetd’s bright door,
And nudged the keyring to wake once more,
GPG whispers answered with a cheer,
No tty fuss — secrets near.
✨🔑

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding PAM integration for GPG passphrase persistence across reboots, which is the core fix in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the changes made, specifically addressing PAM integration, pinentry switching, and GNOME Keyring configuration to fix GPG passphrase persistence across reboots.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-pr-844-2wfox

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@named-hosts/matic/default.nix`:
- Line 402: The pinentry choice (pinentry.package = pkgs.pinentry-gnome3) will
silently fall back to curses on Hyprland unless org.gnome.keyring.SystemPrompter
is provided by gcr; update the configuration to ensure pkgs.gcr is installed
(e.g., add pkgs.gcr to home.packages) so pinentry-gnome3 can use the Gcr
SystemPrompter and GPG passphrase persistence works as intended.

Comment thread named-hosts/matic/default.nix Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds system/login integration needed to have GNOME Keyring unlocked via greetd so GPG passphrases can be retrieved after reboot.

Changes:

  • Enable PAM GNOME Keyring integration for the greetd service
  • Switch GPG pinentry to pinentry-gnome3
  • Enable GNOME Keyring Secret Service component

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread named-hosts/matic/default.nix Outdated
Comment on lines +408 to +411
services.gnome-keyring = {
enable = true;
components = [ "secrets" ];
};

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

services.gnome-keyring is typically a Home Manager option; on NixOS the GNOME Keyring module is usually namespaced under services.gnome.gnome-keyring. As written, this is likely to fail Nix evaluation with an “option does not exist” error; switch to the NixOS option path (or move this block into the Home Manager user config if that’s the intended scope).

Copilot uses AI. Check for mistakes.
Comment thread named-hosts/matic/default.nix Outdated
enable = true;
enableSshSupport = false;
pinentry.package = pkgs.pinentry-tty;
pinentry.package = pkgs.pinentry-gnome3;

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this services.gpg-agent block is from Home Manager, the pinentry option is commonly services.gpg-agent.pinentryPackage, not a nested pinentry.package. Since this line is being edited, it’s a good point to align with the module’s expected option name to avoid an unknown-option evaluation failure.

Suggested change
pinentry.package = pkgs.pinentry-gnome3;
pinentryPackage = pkgs.pinentry-gnome3;

Copilot uses AI. Check for mistakes.
Comment thread named-hosts/matic/default.nix Outdated

security.sudo.wheelNeedsPassword = false;

# PAM integration for GNOME Keyring auto-unlock on login

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extending the comment to capture the key assumption for auto-unlock: PAM can only unlock the login keyring when a secret is available from the authentication flow (typically a password-based login). This helps future readers understand why this might not work with passwordless/auto-login greetd setups.

Suggested change
# PAM integration for GNOME Keyring auto-unlock on login
# PAM integration for GNOME Keyring auto-unlock on login.
# Note: PAM can only unlock the login keyring when a secret is available
# from the authentication flow (typically a password-based login). With
# passwordless or auto-login greetd setups, no such secret may be provided,
# so auto-unlock of the GNOME Keyring might not work as expected.

Copilot uses AI. Check for mistakes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly integrates GNOME Keyring with greetd and gpg-agent to ensure GPG passphrases persist across reboots. The changes are logical and well-implemented, enabling PAM to unlock the keyring on login and switching to the appropriate pinentry program. I've suggested a small improvement to also leverage the keyring for SSH agent functionality, which would create a more consistent setup for managing secrets.

Comment thread named-hosts/matic/default.nix Outdated
# GNOME Keyring for persistent GPG passphrase storage across reboots
services.gnome-keyring = {
enable = true;
components = [ "secrets" ];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since you're enabling the GNOME Keyring for GPG, you could also leverage it for SSH agent functionality. By adding the ssh component, your SSH key passphrases can also be stored in the keyring and unlocked automatically on login. This would provide a consistent experience for both GPG and SSH, and is a common practice when using gnome-keyring.

            components = [ "secrets" "ssh" ];

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
named-hosts/matic/default.nix (1)

60-73: Consider rootless Docker to avoid the docker group's root-equivalent privilege.

The NixOS wiki explicitly warns that docker group membership is effectively equivalent to being root. While this host already grants passwordless sudo (line 75), rootless mode still limits daemon attack surface and is better hygiene.

Rootless Docker can be activated with virtualisation.docker.rootless = { enable = true; setSocketVariable = true; }; — the setSocketVariable flag automatically points DOCKER_HOST to the per-user socket, so no group membership is required.

♻️ Proposed refactor to rootless Docker
-        # Docker
-        virtualisation.docker.enable = true;
+        # Docker (rootless — no docker group membership required)
+        virtualisation.docker.rootless = {
+          enable = true;
+          setSocketVariable = true;
+        };

And remove the docker group from extraGroups:

         extraGroups = [
           "wheel"
           "networkmanager"
           "input"
           "video"
-          "docker"
         ];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@named-hosts/matic/default.nix` around lines 60 - 73, Remove the privileged
"docker" group membership from the user's extraGroups and enable rootless Docker
by replacing/augmenting the current virtualisation.docker.enable setting: set
virtualisation.docker.rootless = { enable = true; setSocketVariable = true; } so
the per-user daemon/socket is used and DOCKER_HOST is automatically configured;
keep virtualisation.docker.enable as needed for system-wide service settings or
disable it if you want purely rootless operation (adjust any passwordless sudo
expectations accordingly).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@named-hosts/matic/default.nix`:
- Line 406: pinentry-gnome3 can silently fall back to curses on Hyprland unless
org.gnome.keyring.SystemPrompter (provided by pkgs.gcr) is present, so ensure
pkgs.gcr is installed alongside pkgs.pinentry-gnome3; update the nix expression
that sets pinentry.package (the symbol pinentry.package and
pkgs.pinentry-gnome3) to also add pkgs.gcr to the target environment (for
example include pkgs.gcr in environment.systemPackages or the relevant
Hyprland-specific package list) so gcr is available and pinentry-gnome3 will use
the GUI prompter instead of falling back to curses.

---

Nitpick comments:
In `@named-hosts/matic/default.nix`:
- Around line 60-73: Remove the privileged "docker" group membership from the
user's extraGroups and enable rootless Docker by replacing/augmenting the
current virtualisation.docker.enable setting: set virtualisation.docker.rootless
= { enable = true; setSocketVariable = true; } so the per-user daemon/socket is
used and DOCKER_HOST is automatically configured; keep
virtualisation.docker.enable as needed for system-wide service settings or
disable it if you want purely rootless operation (adjust any passwordless sudo
expectations accordingly).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shunkakinoki
shunkakinoki merged commit 5a10588 into main Feb 20, 2026
13 checks passed
@shunkakinoki
shunkakinoki deleted the claude/fix-pr-844-2wfox branch February 20, 2026 09:42

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="named-hosts/matic/default.nix">

<violation number="1">
P2: pinentry-tty only prompts on a controlling TTY, so GUI apps in this Hyprland session won’t be able to unlock keys and GPG prompts will fail. Use a GUI pinentry (e.g., pinentry-gnome3) for a graphical login.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@@ -62,12 +62,16 @@ inputs.nixpkgs.lib.nixosSystem {
"networkmanager"

@cubic-dev-ai cubic-dev-ai Bot Feb 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: pinentry-tty only prompts on a controlling TTY, so GUI apps in this Hyprland session won’t be able to unlock keys and GPG prompts will fail. Use a GUI pinentry (e.g., pinentry-gnome3) for a graphical login.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At named-hosts/matic/default.nix, line 403:

<comment>pinentry-tty only prompts on a controlling TTY, so GUI apps in this Hyprland session won’t be able to unlock keys and GPG prompts will fail. Use a GUI pinentry (e.g., pinentry-gnome3) for a graphical login.</comment>

<file context>
@@ -403,17 +400,11 @@ inputs.nixpkgs.lib.nixosSystem {
             enable = true;
             enableSshSupport = false;
-            pinentry.package = pkgs.pinentry-gnome3;
+            pinentry.package = pkgs.pinentry-tty;
             defaultCacheTtl = 94608000; # 3 years
             maxCacheTtl = 94608000; # 3 years
</file context>
Suggested change
"networkmanager"
pinentry.package = pkgs.pinentry-gnome3;
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants