Skip to content

Commit

Permalink
Update certs
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Mar 1, 2024
1 parent 11333d4 commit ad50368
Show file tree
Hide file tree
Showing 41 changed files with 73 additions and 619 deletions.
8 changes: 2 additions & 6 deletions cmds/create_ca_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ func NewCmdCreateCA(certDir string) *cobra.Command {
Short: "Create CA cert/key pair",
DisableAutoGenTag: true,
Run: func(cmd *cobra.Command, args []string) {
store, err := certstore.New(blobfs.New("file:///"), certDir, org...)
if err != nil {
fmt.Printf("Failed to create certificate store. Reason: %v.", err)
os.Exit(1)
}
store := certstore.New(blobfs.New("file:///"), certDir, 0, org...)

var p []string
if prefix != "" {
Expand All @@ -51,7 +47,7 @@ func NewCmdCreateCA(certDir string) *cobra.Command {
os.Exit(1)
}

err = store.NewCA(p...)
err := store.NewCA(p...)
if err != nil {
fmt.Printf("Failed to init ca. Reason: %v.", err)
os.Exit(1)
Expand Down
6 changes: 1 addition & 5 deletions cmds/create_client_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ func NewCmdCreateClient(certDir string) *cobra.Command {
Organization: org,
}

store, err := certstore.New(blobfs.New("file:///"), certDir)
if err != nil {
fmt.Printf("Failed to create certificate store. Reason: %v.", err)
os.Exit(1)
}
store := certstore.New(blobfs.New("file:///"), certDir, 0)

var p []string
if prefix != "" {
Expand Down
8 changes: 2 additions & 6 deletions cmds/create_peer_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ func NewCmdCreatePeer(certDir string) *cobra.Command {
AltNames: sans,
}

store, err := certstore.New(blobfs.New("file:///"), certDir, org...)
if err != nil {
fmt.Printf("Failed to create certificate store. Reason: %v.", err)
os.Exit(1)
}
store := certstore.New(blobfs.New("file:///"), certDir, 0, org...)

var p []string
if prefix != "" {
Expand All @@ -69,7 +65,7 @@ func NewCmdCreatePeer(certDir string) *cobra.Command {
os.Exit(1)
}

if err = store.LoadCA(p...); err != nil {
if err := store.LoadCA(p...); err != nil {
fmt.Printf("CA certificates not found in %s. Run `init ca`", store.Location())
os.Exit(1)
}
Expand Down
8 changes: 2 additions & 6 deletions cmds/create_server_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ func NewCmdCreateServer(certDir string) *cobra.Command {
AltNames: sans,
}

store, err := certstore.New(blobfs.New("file:///"), certDir, org...)
if err != nil {
fmt.Printf("Failed to create certificate store. Reason: %v.", err)
os.Exit(1)
}
store := certstore.New(blobfs.New("file:///"), certDir, 0, org...)

var p []string
if prefix != "" {
Expand All @@ -70,7 +66,7 @@ func NewCmdCreateServer(certDir string) *cobra.Command {
os.Exit(1)
}

if err = store.LoadCA(p...); err != nil {
if err := store.LoadCA(p...); err != nil {
fmt.Printf("CA certificates not found in %s. Run `init ca`", store.Location())
os.Exit(1)
}
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.bytebuilders.dev/offline-license-server

go 1.21.5
go 1.22.0

require (
github.com/avct/uasurfer v0.0.0-20191028135549-26b5daa857f1
Expand Down Expand Up @@ -28,7 +28,7 @@ require (
golang.org/x/net v0.21.0
golang.org/x/text v0.14.0
gomodules.xyz/blobfs v0.1.14
gomodules.xyz/cert v1.5.2
gomodules.xyz/cert v1.6.0
gomodules.xyz/email-providers v0.1.4
gomodules.xyz/encoding v0.0.7
gomodules.xyz/errors v0.1.0
Expand All @@ -41,7 +41,7 @@ require (
gomodules.xyz/password-generator v0.2.9
gomodules.xyz/pointer v0.1.0
gomodules.xyz/sets v0.2.1
gomodules.xyz/x v0.0.15
gomodules.xyz/x v0.0.17
gomodules.xyz/zoom-lib-golang v0.0.0-20230924092137-92156e0a6cc9
google.golang.org/api v0.164.0
gopkg.in/macaron.v1 v1.5.0
Expand Down Expand Up @@ -88,6 +88,7 @@ require (
github.com/oschwald/maxminddb-golang v1.11.0 // indirect
github.com/rickb777/plural v1.4.1 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/smarty/assertions v1.15.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/tchap/go-patricia v2.3.0+incompatible // indirect
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e // indirect
Expand Down
15 changes: 8 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,16 @@ github.com/siddontang/go-snappy v0.0.0-20140704025258-d8f7bb82a96d/go.mod h1:vq0
github.com/siddontang/ledisdb v0.0.0-20190202134119-8ceb77e66a92/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/smarty/assertions v1.15.1 h1:812oFiXI+G55vxsFf+8bIZ1ux30qtkdqzKbEFwyX3Tk=
github.com/smarty/assertions v1.15.1/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v1.8.0 h1:Oi49ha/2MURE0WexF052Z0m+BNSGirfjg5RL+JXWq3w=
github.com/smartystreets/goconvey v1.8.0/go.mod h1:EdX8jtrTIj26jmjCOVNMVSIYAtgexqXKHOXW2Dx9JLg=
github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY=
github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
Expand Down Expand Up @@ -620,8 +621,8 @@ golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSm
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
gomodules.xyz/blobfs v0.1.14 h1:8Iq62ojIi1JNY5iMcebJj45D2oMVvphpJ/T0sCybwI8=
gomodules.xyz/blobfs v0.1.14/go.mod h1:DIon2nI14qPceQ3ShZi6lAQGFjUzpeXUdjHnqwu6ryg=
gomodules.xyz/cert v1.5.2 h1:Zwf2Pp1q0XCIr08SiPQLqLBUebJ6O4Vf0gUckvpEGlE=
gomodules.xyz/cert v1.5.2/go.mod h1:1aow5qFa+ViP3cSAF54DUVAdmdFgtooN2mVowPhc6Zs=
gomodules.xyz/cert v1.6.0 h1:IzeWRoCFAZrHozsMh94+05R6vtY9zSMB2eZ/NpE/ySI=
gomodules.xyz/cert v1.6.0/go.mod h1:RGLh9tSem4k43LTsS0wXwmvzJs09lDR19BTtCYhMsHE=
gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f h1:hTyhR4r+tj1Uq7/PpFxLTzbeA0LhMVp7bEYfhkzFjdY=
gomodules.xyz/clock v0.0.0-20200817085942-06523dba733f/go.mod h1:K3m7N+nBOlf91/tpv8REUGwsAgaKFwElQCuiLhm12AQ=
gomodules.xyz/email v0.1.0 h1:Zm/SkyaOmuxzvAitwRdxC0YOszUO0gkudzZwvNA86Iw=
Expand Down Expand Up @@ -659,8 +660,8 @@ gomodules.xyz/sets v0.2.1 h1:vK3oUWoGVrZKLDKO/bzEo/ucHFdCE7+DxWPeWxK72KQ=
gomodules.xyz/sets v0.2.1/go.mod h1:jKgNp01/iDs+svOWXaPk5cKP3VXy0mWUoTF/ore+aMc=
gomodules.xyz/wait v0.2.0 h1:HnRIh+cvIrrKIFaXoYznCVVirv2/2xu3KzjSzsQmYAY=
gomodules.xyz/wait v0.2.0/go.mod h1:g/epKzZQuCqgvhzhaoG4cSBNGHqnOrhFR4Q7szDJ1JM=
gomodules.xyz/x v0.0.15 h1:n2aGD3cnpvNTvUALUE30sJMqT5g/G6BS5EnZojzw0tw=
gomodules.xyz/x v0.0.15/go.mod h1:M4tV13Y/0ZxrKEkmUcLkPdh8C4TjCAc5uXchDcqGYrw=
gomodules.xyz/x v0.0.17 h1:Ik3wf0suCMiYPY0miFUh+q8BpjsUHc/7zvANbFViBQA=
gomodules.xyz/x v0.0.17/go.mod h1:7R5182LvgWj1ZGlnpbhfSLsxM3lFN7LBettztpX+A2I=
gomodules.xyz/zoom-lib-golang v0.0.0-20230924092137-92156e0a6cc9 h1:33SAJJedCw2aVb6qwzc4H+5707/1sRrR+dWXxNRE0rQ=
gomodules.xyz/zoom-lib-golang v0.0.0-20230924092137-92156e0a6cc9/go.mod h1:b2SerMfMfoq1bybWhJtbgbh31jZZibX80llxc5usX+4=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
Expand Down
7 changes: 2 additions & 5 deletions pkg/server/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ func GetCertStore(fs blobfs.Interface, issuer string) (*certstore.CertStore, err
caCertPath = path.Join(CACertificatesPath(), issuer)
issuerName = issuer
}
certs, err := certstore.New(fs, caCertPath, issuerName)
if err != nil {
return nil, err
}
err = certs.InitCA()
certs := certstore.New(fs, caCertPath, 0, issuerName)
err := certs.InitCA()
if err != nil {
return nil, err
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ad50368

Please sign in to comment.