Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Need to document how to share keys between Win and WSL #5

@jamiehankins

Description

@jamiehankins

If I follow your example, I get a WSL GnuPG configuration that redirects the Cygwin sockets at %APPDATA%\gnupg to %LOCALAPPDATA%\gnupg as UDS. It sets the WSL GNUPGHOME to the LOCALAPPDATA one. At that point, a simple command like gpg --card-status will work. However, anything that needs keys won't. This, for example: gpg --list-secret-keys --keyid-format LONG jamie.hankins@gmail.com.

gpg-agent has the ability to redirect the sockets. That would give us the ability to share the home directory without the two kinds of sockets stepping on each other. Unfortunately, that code is excluded by this in assuan-socket.c in libassuan: #ifndef HAVE_W32_SYSTEM. That means that the key information has to be in the same directory as the Cygwin sockets.

The way I got around this was by creating directory symlinks for openpgp-revocs.d and private-keys-v1.d, and by hard-linking trustdb.gpg and pubring.kbx.

Here's what I put together to do this:
set LOCALGNUPG=%LOCALAPPDATA%\gnupg if not exist %LOCALGNUPG% mkdir %LOCALGNUPG% cd %LOCALGNUPG% mklink /D .\openpgp-revocs.d %APPDATA%\gnupg\openpgp-revocs.d mklink /D .\private-keys-v1.d %APPDATA%\gnupg\private-keys-v1.d mklink /H .\trustdb.gpg %APPDATA%\gnupg\trustdb.gpg mklink /H .\pubring.kbx %APPDATA%\gnupg\pubring.kbx

I'm firmly in the "knows enough to be dangerous" camp on this. If possible a little guidance in the readme on how this really should be configured would be helpful.

Also, gpg commands on WSL show this warning:
gpg: WARNING: unsafe permissions on homedir '/mnt/c/users/jamie.hankins/AppData/Local/gnupg'

A little digging says I can fix this by applying some permissions. That doesn't seem to do it. I'm guessing that "chmod" on a Windows directory doesn't do much. Is there a known way to fix this?

Apologies for the long rambling ticket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions