Closed dmlo closed 1 year ago
I think what is happening here is:
op
, in this case) to determine whether it is allowed to connect to the server (the 1Password app, in this case).op
from connecting to the 1Password server when op
is executed by chezmoi.The evidence I have to support this belief is;
op
when run by chezmoi includes connecting to desktop app: read: connection reset
implying that the connection is made and then immediately dropped.I use 1Password myself for my own secrets, and chezmoi works fine on Ubuntu 22.04 and Ubuntu 22.10. I vaguely recall seeing the same issue as you see when I briefly experimented with Pop_OS!. I did not investigate further at the time however.
I think you need to configure polkit on your machine to allow chezmoi to connect to 1Password. For reference, here is the content of /usr/share/polkit-1/actions/com.1password.1Password.policy
on my Ubuntu 22.10 machine where chezmoi is allowed to talk to 1Password:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<action id="com.1password.1Password.unlock">
<description>Unlock 1Password</description>
<message>Authenticate to unlock 1Password</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
</action>
<action id="com.1password.1Password.authorizeCLI">
<description>Authorize CLI</description>
<message>1Password CLI is trying to access your 1Password account.</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:twp </annotate>
</action>
<action id="com.1password.1Password.authorizeSshAgent">
<description>Authorize SSH Agent</description>
<message>1Password SSH Agent is trying to access your 1Password account.</message>
<defaults>
<allow_any>auth_self</allow_any>
<allow_inactive>auth_self</allow_inactive>
<allow_active>auth_self</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.owner">unix-user:twp </annotate>
</action>
</policyconfig>
Note that my username is twp
. You will need to replace twp
with dan
in the above.
Hope this helps as a starting point. This is a 1Password/Pop_OS! issue, not a chezmoi issue.
@twpayne thank you very much for your prompt and detailed reply!
I diffed your com.1password.1Password.policy file against my own and the only difference was the username.
On a hunch I set up a Ubuntu VM and ran through my repro steps above and got the same error.
That in turn got me thinking that there must be something different about my installation to yours.
Back on Pop_OS! I uninstalled my copy of chezmoi (installed via asdf) and instead used the direct binary install, and the command succeeded.
So the actual problem is something to do with the way asdf does things.
Thank you again for your time. Closing as my problem is resolved.
Describe the bug
Chezmoi template command
onepasswordRead
cannot connect to 1password's CLI interface on Pop_OS! 22.04:To reproduce
op
commandchezmoi execute-template '{{ onepasswordRead "op://private/<snip>/username" }}'
Expected behavior
Chezmoi should connect to 1password's CLI command
op
and retrieve the requested token.Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
Debug output:
Executing
op signin --raw
executes correctly (no output).Thank you for your time.