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

Commit

Permalink
Merge pull request #13 from rupor-github/std_pin
Browse files Browse the repository at this point in the history
Alternative PR to avoid gui.pinentry configuration key
  • Loading branch information
rupor-github authored Oct 31, 2021
2 parents 92fcf44 + d763f90 commit 5ebda0e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endif()
# Project version number
set(PRJ_VERSION_Major "1")
set(PRJ_VERSION_Minor "4")
set(PRJ_VERSION_Patch "0")
set(PRJ_VERSION_Patch "1")

if (EXISTS "${PROJECT_SOURCE_DIR}/.git" AND IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/cmake/githash.sh ${GIT_EXECUTABLE}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Full list of configuration keys:
* `gpg.install_path` - installation directory of GnuPG suite
* `gpg.homedir` - will be supplied to gpg-agent on start as --homedir
* `gpg.socketdir` - gnupg 2.3+ [(T5537)](https://dev.gnupg.org/T5537) being installed in non-portable mode creates sockets in directory, different from homedir. To be exact default home directory continues to be `${APPDATA}\gnupg`, but sockets are now created in `${LOCALAPPDATA}\gnupg`. Changing `gpg.homedir` to `${LOCALAPPDATA}\gnupg` does not help - gnupg will use subdirectory of `${LOCALAPPDATA}\gnupg` deriving name of sha1 hash with "d." prepended to it. This configuration allows to compensate this - if set it will be used by win-gpg-agent to locate sockets created by gpg-agent proper while keeping home directory unchanged. Make sure that `gpg.socketdir` and `gui.homedir` are not pointing to the same location or socket names for gpg-agent and agent-gui will overlap causing havoc. If explicitly set to empty string `gpg.homedir` value will be used instead
* `gpg.use_standard_pinentry` - if absent or set to `false` (default) pinentry supplied with win-gpg-agent will be used no matter what is specified in gnupg gpg-agent configuration. If set to `true` win-gpg-agent would not force command line overwrite allowing you to use gpg-agent.conf instead.
* `gpg.gpg_agent_conf` - if defined will be supplied to gpg-agent on start
* `gpg.gpg_agent_args` - array of additional arguments to be passed to gpg-agent on start. No checking is performed
* `gui.debug` - turn on debug logging. Uses `OutputDebugStringW` - use Sysinternals [debugview](https://docs.microsoft.com/en-us/sysinternals/downloads/debugview) to see
Expand Down
4 changes: 3 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ func (a *Agent) Start() error {
"--use-standard-socket", // in case we are dealing with older versions
"--enable-ssh-support", // presently useless under Windows
"--enable-putty-support", // so we have to use this instead, but it does not work in 64 bits builds under Windows...
"--pinentry-program", filepath.Join(filepath.Dir(expath), "pinentry.exe"),
"--daemon",
}
if !a.Cfg.GPG.StdPin {
args = append(args, "--pinentry-program", filepath.Join(filepath.Dir(expath), "pinentry.exe"))
}
if len(a.Cfg.GPG.Config) > 0 && util.FileExists(a.Cfg.GPG.Config) {
args = append(args, "--options", a.Cfg.GPG.Config)
}
Expand Down
1 change: 1 addition & 0 deletions config/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type GPGConfig struct {
Path string `yaml:"install_path,omitempty"`
Home string `yaml:"homedir,omitempty"`
Sockets string `yaml:"socketdir,omitempty"`
StdPin bool `yaml:"use_standard_pinentry,omitempty"`
Config string `yaml:"gpg_agent_conf,omitempty"`
Args []string `yaml:"gpg_agent_args,omitempty"`
}
Expand Down

0 comments on commit 5ebda0e

Please sign in to comment.