kitchen-salt icon indicating copy to clipboard operation
kitchen-salt copied to clipboard

[Windows] gpg --import is not supported

Open wappam opened this issue 5 years ago • 1 comments

Hi, I have been scratching my head for a bit to make the pillar decryption work on windows. Then to find out that gpg import (contain in gpgkey.sh) is not ran for windows_os.

I got kitchen-salt running on a git runner where I got the gpg key, the key get properly export to the guest instance, but its never being imported again.

salt_solo.rb

if windows_os?
          salt_config_path = config[:salt_config]
          cmd << "(get-content #{os_join(config[:root_path], salt_config_path, 'minion')}) -replace '\\$env:TEMP', $env:TEMP | set-content #{os_join(config[:root_path], salt_config_path, 'minion')} ;"
          RUN GPG IMPORT HERE
        else
          # install/update dependencies
          cmd << sudo("chmod +x #{config[:root_path]}/*.sh;")
          cmd << sudo("#{config[:root_path]}/dependencies.sh;")
          cmd << sudo("#{config[:root_path]}/gpgkey.sh;") if config[:gpg_key]
          salt_config_path = config[:salt_config]
end

Let say that if gpg for windows is install then run the import (or pretty much what is in the gpgkey.erb):

 gpg.exe --allow-secret-key-import --no-default-keyring --homedir "$GPGKEY_DIR" --import <"#{config[:root_path]}/gpgkey.txt"

Regards,

wappam avatar Sep 18 '19 05:09 wappam

Feel free to open a PR to implement this for windows. I did not have a windows machine to test this feature on windows, so I didn't implement it.

gtmanfred avatar Sep 19 '19 18:09 gtmanfred