certmgr icon indicating copy to clipboard operation
certmgr copied to clipboard

docs: building and readme outdated

Open ChrisChoke opened this issue 3 years ago • 2 comments

hey there,

i did playing around with certmgr and cfssl to build internal CA for my homelab, and my first impression is : wow, what great toolset! but i got a bit confusing while reading docs and making own experience with certmgr.

Can anybody explain how to build the binary of certmgr with go tools?! i am using golang 1.18.2. go get is deprecated and replaced by go install. but go install github.com/cloudflare/certmgr/cmd/...@latest only build version 1.6.5 how to see here.

since i am using the newest version, the "ca" key in my specs.json works fine and a deprecated info will show if i use the "ca" setting under "authority" like here: https://github.com/cloudflare/certmgr/blob/4af0d7701d7500080ddc53bebb9c3d85977df3e4/README.md?plain=1#L152-L156 so is there a reason why it still in readme.md at the newest version?! it confused me while get started with this really nice peace of application.

i think the docs thing is not much important, but how to build can help me and other people a lot. hoping for a short explanation.

Chris

ChrisChoke avatar May 20 '22 16:05 ChrisChoke

is it possible that v3.0.3 has some issues?! i downloaded the prebuilded binarys from the release, unzip it and tried to initialize the config directorys with certmgr genconfig but this is not possible. in v1.6.5 it is possible.

root@sslca:/opt# ./certmgr-linux-amd64-v3.0.3 genconfig 
FATA[0000] Config File "certmgr" Not Found in "[/etc/certmgr]"

edit:

i have playing around and compare some things with version 1.6.5. in version 1.6.5 in root.go:

https://github.com/cloudflare/certmgr/blob/e872f72a15e84a73a509dde1d3b15369da206ed0/cli/root.go#L115-L117

and on version 3.0.3 and master:

https://github.com/cloudflare/certmgr/blob/4af0d7701d7500080ddc53bebb9c3d85977df3e4/certmgr/cmd/root.go#L171-L173

if i change it to:

if err := viper.ReadInConfig(); err == nil { 
 	log.Fatal(err) 
 } 

the fatal error is gone and i can execute certmgr version, genconfig, help without having the configdir and configfile create before.

i can build binary with:

GOFLAGS=-mod=vendor go build -o /opt/certmgr -gcflags="-trimpath=/home/user/gopath" -ldflags="-X github.com/cloudflare/certmgr/certmgr/cmd.currentVersion=$(git describe --tags)" ./certmgr/

if i changed directory to repo's root dir.

so i am not sure if its right. my progamming knowledge isnt much great :-) because of that i dont know if i should create a PR.

edit:

okay it is not so much easy :-) after creating configdir and configfile, no command can execute successful

root@sslca:/opt# ./certmgr help
FATA[0000] <nil>                                        
root@sslca:/opt# ./certmgr version
FATA[0000] <nil>                                        
root@sslca:/opt# ./certmgr check
FATA[0000] <nil>                                        
root@sslca:/opt# ./certmgr ensure
FATA[0000] <nil>                                        
root@sslca:/opt# ./certmgr
FATA[0000] <nil>

that is not the solution alone :-)

Chris

ChrisChoke avatar May 22 '22 16:05 ChrisChoke

can this a way to fix that issue?!

https://github.com/ChrisChoke/certmgr/commit/428234d17bb1159d8a5eebf576b0ad958af1604f

ChrisChoke avatar May 23 '22 17:05 ChrisChoke