Go to file
Urko 0bf7b63286 feat: test coverage more than 85% 2023-03-05 00:05:00 +01:00
cmd feat: fix misspell 2023-02-15 19:49:25 +01:00
internal feat: test coverage more than 85% 2023-03-05 00:05:00 +01:00
pkg feat: test coverage more than 85% 2023-03-05 00:05:00 +01:00
.env.example feat: add .env.example 2023-02-15 19:34:48 +01:00
.gitignore feat: update gitignore 2023-03-03 22:30:56 +01:00
LICENSE feat: add license 2023-03-03 22:45:40 +01:00
Makefile feat: add tests 2023-03-03 22:31:10 +01:00
README.md feat: update README 2023-03-03 22:46:10 +01:00
go.mod feat: add tests 2023-03-03 22:31:10 +01:00
go.sum feat: use viper and cobra to parameterize creation values with viper yaml 2023-02-15 19:30:05 +01:00
main.go feat: use viper and cobra to parameterize creation values with viper yaml 2023-02-15 19:30:05 +01:00
viper.example.yaml fix: duration 2023-02-20 21:35:19 +01:00

README.md

go-gen-cert

Preamble

I've decided to create this project based on this example but with some improvements, which I would like to give thanks.

I had some trouble during TLS communication between both of my gRPC server and client. I've decided to create a tool to generate SSL certificates following a little of this guide.

TODO:

  • Create intermediate authority to sign certificates on behalf CA to add more security. If intermediate is hacked then you can revoke from CA and generate new intermediates keeping CA isolated from beeing hacked.

  • Complete tests

Configuration

If you are on dev environment, like I've been doing, you must create .env file similar as .env.example in this repo:

VIPER_CONFIG=your-viper-file-name-without-extension
VIPER_CONFIG_TYPE=yaml
ENV=dev

Then add viper configuration file, yaml for example, in your root directory:

export_dir: "/home"
ca:
    serial_number: 12152 # serial number
    subject:
        organization: "yourdomain.com"
        common_name: "*.yourdomain.com"
    key_usage: 1
    ext_key_usage: 
        - 1
        - 2
        duration: "8760h0m0s" #1 year
client:
    serial_number: 12151232 # serial number
    subject:
        organization: "yourdomain.com"
        country: "RM"
        province: "REML"
        locality: ""
        street_address: ""
        postal_code: ""
    subject_key_id:
        - 1
        - 2
        - 3
        - 4
        - 6
    key_usage: 1
    ext_key_usage: 
        - 1
        - 2
    duration: "8760h0m0s"

Execution

Then you can just run

go run main.go

goreportcard

make goreportcard

output:

➜  go-cert-gen git:(main) goreportcard-cli -v
Grade .......... A+ 100.0%
Files ................. 12
Issues ................. 0
gofmt ............... 100%
go_vet .............. 100%
gocyclo ............. 100%
ineffassign ......... 100%
license ............. 100%
misspell ............ 100%