Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…orage into b1
  • Loading branch information
eiichiro-oiwa committed Mar 27, 2023
2 parents eedd49e + db025d1 commit 0d5d015
Show file tree
Hide file tree
Showing 19 changed files with 675 additions and 527 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Your syslog client will get Immutable Storage functions without adding codes if
The Immutable Storage Docker image can be installed to your registry with the following command as root or through sudo.

```sh
ctr i import imms-1.6.0.tar
ctr i push REGISTRY/imms:1.6.0 localhost:32000/imms:1.6.0
ctr i import imms-1.6.1.tar
ctr i push REGISTRY/imms:1.6.1 localhost:32000/imms:1.6.1
```

REGISTRY is your registry. For example, local registry is "localhost:32000" on microk8s. ctr command may be replaced by microk8s.ctr on microk8s. By default, this "localhost:32000" is an insecure registry. To push the Immutable Storage image to an insecure registry, you need to add the option --plain-http with the "ctr i push" command.
Expand All @@ -56,7 +56,7 @@ To configure resources for Immutable Storage service, you need to edit some line

If, for example, your registry is localhost:32000, the line defined image is the following:
```yaml
- image: localhost:32000/imms:1.6.0
- image: localhost:32000/imms:1.6.1
```
You must define an organization name for Immutable Storage service. This organization name will be also used as domain name in hostname.
Expand Down
2 changes: 1 addition & 1 deletion app/rsyslogconfig/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ replace fabric/protos/token => ../../server/fabric/protos/token
replace google.golang.org/grpc => ../../web/grpc

require (
google.golang.org/protobuf v1.29.0
google.golang.org/protobuf v1.29.1
immadmin v0.0.0-00010101000000-000000000000
immblock v0.0.0-00010101000000-000000000000
immclient v0.0.0-00010101000000-000000000000
Expand Down
2 changes: 2 additions & 0 deletions app/rsyslogconfig/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0=
google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM=
google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
7 changes: 0 additions & 7 deletions app/st2login/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
module st2loginweb

go 1.19

require (
google.golang.org/protobuf v1.29.0
st2do v0.0.0-00010101000000-000000000000
)

replace st2do => ../../web/st2do
8 changes: 0 additions & 8 deletions app/st2login/go.sum

This file was deleted.

2 changes: 1 addition & 1 deletion app/workflow/general/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.29.0 // indirect
google.golang.org/protobuf v1.29.1 // indirect
immclient v0.0.0-00010101000000-000000000000 // indirect
immcommon v0.0.0-00010101000000-000000000000 // indirect
immop v0.0.0-00010101000000-000000000000 // indirect
Expand Down
6 changes: 4 additions & 2 deletions app/workflow/general/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488 h1:QQF+HdiI4iocoxU
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0=
google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM=
google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
2 changes: 1 addition & 1 deletion imms-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:

spec:
containers:
- image: localhost:32000/imms:1.6.0
- image: localhost:32000/imms:1.6.1
env:
- name: IMMS_ORG
value: example.com
Expand Down
39 changes: 22 additions & 17 deletions immutil/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,26 @@ func GenerateKeyPairWithCAFlag(subj *pkix.Name, dnsNames []string, isCA bool) (p
return
}

func CreateCertWithParameters(pubKey *ecdsa.PublicKey, subj *pkix.Name, caPrivPem, caCertPem []byte, certTempl *x509.Certificate) (certPem []byte, retErr error) {
caCert, _, retErr := ReadCertificate(caCertPem)
if retErr != nil {
return
}

caPrivKey, retErr := ReadPrivateKey(caPrivPem)
if retErr != nil {
return
}

cert, err := x509.CreateCertificate(rand.Reader, certTempl, caCert, pubKey, caPrivKey)
if err != nil {
retErr = fmt.Errorf("Failed to create a certificate: %s", err)
return
}
certPem = pem.EncodeToMemory( &pem.Block{Type: "CERTIFICATE", Bytes: cert})
return
}

func CreateCertificate(subj *pkix.Name, caPrivPem, caCertPem []byte, dnsNames []string) (privPem, certPem []byte, retErr error) {
// generate a private key
privKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
Expand All @@ -180,7 +200,7 @@ func CreateCertificate(subj *pkix.Name, caPrivPem, caCertPem []byte, dnsNames []

ski := sha256.Sum256( elliptic.Marshal(privKey.Curve, privKey.X, privKey.Y) )

// generate a public key
// set certificate parameters
serial, _ := rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), 128))
nowT := time.Now().UTC()
certTempl := &x509.Certificate{
Expand All @@ -204,22 +224,7 @@ func CreateCertificate(subj *pkix.Name, caPrivPem, caCertPem []byte, dnsNames []
}
}

caCert, _, retErr := ReadCertificate(caCertPem)
if retErr != nil {
return
}

caPrivKey, retErr := ReadPrivateKey(caPrivPem)
if retErr != nil {
return
}

cert, err := x509.CreateCertificate(rand.Reader, certTempl, caCert, privKey.Public(), caPrivKey)
if err != nil {
retErr = fmt.Errorf("Failed to create a certificate: %s", err)
return
}
certPem = pem.EncodeToMemory( &pem.Block{Type: "CERTIFICATE", Bytes: cert})
certPem, retErr = CreateCertWithParameters(&privKey.PublicKey, subj, caPrivPem, caCertPem, certTempl)
return
}

Expand Down
4 changes: 2 additions & 2 deletions immutil/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ const (
CouchDBImg = "library/couchdb:2.3.1"
ImmHttpdImg = "library/httpd:2.4.54"
ImmSrvBaseImg = "library/ubuntu:22.04"
ImmSrvImg = "immsrv:1.6.0"
ImmSrvImg = "immsrv:1.6.1"
EnvoyImg = "envoyproxy/envoy:v1.22.0"

ContRuntimeBaseImg = "library/alpine:3.17"
ContRuntimeImg = "immplugin:runtime1"
ImmPluginSrvImg = "immpluginsrv:1.1"
RsyslogBaseImg = "library/alpine:3.17"
RsyslogImg = "rsyslog:immst1"
ImmGRPCProxyImg = "immgrpcproxy:1"
ImmGRPCProxyImg = "immgrpcproxy:1.1"
ImmGRPCProxyBaseImg = "library/alpine:3.17"

ST2AuthBaseImg = "stackstorm/st2auth:3.8.0"
Expand Down
Loading

0 comments on commit 0d5d015

Please sign in to comment.