square / certstrap

Tools to bootstrap CAs, certificate requests, and signed certificates.
Apache License 2.0
2.31k stars 207 forks source link

Get CA key error: permission denied #144

Closed kacpekwasny closed 2 years ago

kacpekwasny commented 2 years ago

I am following the instructions step by step, I am on Windows 10:

$ git clone https://github.com/square/certstrap  
$ cd certstrap
$ go build 
$ ./certstrap.exe init --common-name CertAuth
$ ./certstrap.exe request-cert --common-name Alice
$ ./certstrap.exe sign Alice --CA CertAuth
Enter passphrase for CA key (empty for no passphrase): [all passwords are empty]
Get CA key error:  permission denied

I am on windows in powershell. I also tried this fully on WSL debian but with following error: Get certificate request error: permission denied

kacpekwasny commented 2 years ago

Did this on a VPS running debian and it worked. I don't know if this is a reason to close this issue as it isn't really fixed.

ekremparlak commented 2 years ago

Same error happening to me on Debian 11 but i am using binary from release page.

EDIT: same error when building with master branch

jdtw commented 2 years ago

I can't repro on Mac OS master branch. What are the permissions for the key and CSR files?

aperez456-nobody commented 2 years ago

I think the issue has to do with the version of go you are using to build. I tried to build project with go version 1.16.7, then I tried the precompiled binary and was able to resolve this. https://github.com/square/certstrap/releases/tag/v1.2.0

isemaya-square commented 2 years ago

I also built the project with go version 1.16.7, and used https://github.com/square/certstrap/releases/tag/v1.2.0 and was able to sign.

isemaya-square commented 2 years ago

I was also able to built the project with go version 1.18.1 (latest version), and used https://github.com/square/certstrap/releases/tag/v1.2.0 and was able to sign.

isemaya-square commented 2 years ago

Hi kacpekwasny. Thanks again for for flagging this. The issue should be fixed in https://github.com/square/certstrap/pull/155 - can you try cloning the latest version of certstrap in windows and running the steps again?