From d3d2c05b08d8bc0a28f64c24ac7b32b4aa1ec247 Mon Sep 17 00:00:00 2001 From: Alexander Gama Espinosa Date: Wed, 2 Aug 2023 15:56:52 -0700 Subject: [PATCH] Add Sign and Renew to NodeAgent certificates --- .../moc_nodeagent_certificate.proto | 42 ++- .../security/moc_nodeagent_certificate.pb.go | 272 +++++++++++++++--- 2 files changed, 269 insertions(+), 45 deletions(-) diff --git a/rpc/nodeagent/security/certificate/moc_nodeagent_certificate.proto b/rpc/nodeagent/security/certificate/moc_nodeagent_certificate.proto index 4317dc2f..1d199a55 100644 --- a/rpc/nodeagent/security/certificate/moc_nodeagent_certificate.proto +++ b/rpc/nodeagent/security/certificate/moc_nodeagent_certificate.proto @@ -19,23 +19,39 @@ message CertificateRequest { message CertificateResponse { repeated Certificate Certificates = 1; google.protobuf.BoolValue Result = 2; - string Error = 3; + string Error = 3; } message Certificate { - string name = 1; - string id = 2; - int64 notBefore = 3; - int64 notAfter = 4; - string certificate = 5 [(sensitive) = true]; - Status status = 6; - CertificateType type = 7; - Entity entity = 8; - Tags tags = 9; + string name = 1; + string id = 2; + int64 notBefore = 3; + int64 notAfter = 4; + string certificate = 5 [(sensitive) = true]; + Status status = 6; + CertificateType type = 7; + Entity entity = 8; + Tags tags = 9; +} + +message CSRRequest { + repeated CertificateSigningRequest CSRs = 1; +} + +message CertificateSigningRequest { + string name = 1; + string csr = 2 [(sensitive) = true]; + string oldCertificate = 3 [(sensitive) = true]; + Status status = 4; + string caName = 5; + int64 validity = 6; + google.protobuf.BoolValue serverAuth = 7; } service CertificateAgent { - rpc CreateOrUpdate(CertificateRequest) returns (CertificateResponse) {} - rpc Get(CertificateRequest) returns (CertificateResponse) {} - rpc Delete(CertificateRequest) returns (CertificateResponse) {} + rpc CreateOrUpdate(CertificateRequest) returns (CertificateResponse) {} + rpc Get(CertificateRequest) returns (CertificateResponse) {} + rpc Delete(CertificateRequest) returns (CertificateResponse) {} + rpc Sign(CSRRequest) returns (CertificateResponse) {} + rpc Renew(CSRRequest) returns (CertificateResponse) {} } diff --git a/rpc/nodeagent/security/moc_nodeagent_certificate.pb.go b/rpc/nodeagent/security/moc_nodeagent_certificate.pb.go index 8242f467..507f5d83 100644 --- a/rpc/nodeagent/security/moc_nodeagent_certificate.pb.go +++ b/rpc/nodeagent/security/moc_nodeagent_certificate.pb.go @@ -248,48 +248,184 @@ func (m *Certificate) GetTags() *common.Tags { return nil } +type CSRRequest struct { + CSRs []*CertificateSigningRequest `protobuf:"bytes,1,rep,name=CSRs,proto3" json:"CSRs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CSRRequest) Reset() { *m = CSRRequest{} } +func (m *CSRRequest) String() string { return proto.CompactTextString(m) } +func (*CSRRequest) ProtoMessage() {} +func (*CSRRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ae3bff7543638e48, []int{3} +} + +func (m *CSRRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CSRRequest.Unmarshal(m, b) +} +func (m *CSRRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CSRRequest.Marshal(b, m, deterministic) +} +func (m *CSRRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CSRRequest.Merge(m, src) +} +func (m *CSRRequest) XXX_Size() int { + return xxx_messageInfo_CSRRequest.Size(m) +} +func (m *CSRRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CSRRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CSRRequest proto.InternalMessageInfo + +func (m *CSRRequest) GetCSRs() []*CertificateSigningRequest { + if m != nil { + return m.CSRs + } + return nil +} + +type CertificateSigningRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Csr string `protobuf:"bytes,2,opt,name=csr,proto3" json:"csr,omitempty"` + OldCertificate string `protobuf:"bytes,3,opt,name=oldCertificate,proto3" json:"oldCertificate,omitempty"` + Status *common.Status `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + CaName string `protobuf:"bytes,5,opt,name=caName,proto3" json:"caName,omitempty"` + Validity int64 `protobuf:"varint,6,opt,name=validity,proto3" json:"validity,omitempty"` + ServerAuth *wrappers.BoolValue `protobuf:"bytes,7,opt,name=serverAuth,proto3" json:"serverAuth,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CertificateSigningRequest) Reset() { *m = CertificateSigningRequest{} } +func (m *CertificateSigningRequest) String() string { return proto.CompactTextString(m) } +func (*CertificateSigningRequest) ProtoMessage() {} +func (*CertificateSigningRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ae3bff7543638e48, []int{4} +} + +func (m *CertificateSigningRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CertificateSigningRequest.Unmarshal(m, b) +} +func (m *CertificateSigningRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CertificateSigningRequest.Marshal(b, m, deterministic) +} +func (m *CertificateSigningRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CertificateSigningRequest.Merge(m, src) +} +func (m *CertificateSigningRequest) XXX_Size() int { + return xxx_messageInfo_CertificateSigningRequest.Size(m) +} +func (m *CertificateSigningRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CertificateSigningRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CertificateSigningRequest proto.InternalMessageInfo + +func (m *CertificateSigningRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *CertificateSigningRequest) GetCsr() string { + if m != nil { + return m.Csr + } + return "" +} + +func (m *CertificateSigningRequest) GetOldCertificate() string { + if m != nil { + return m.OldCertificate + } + return "" +} + +func (m *CertificateSigningRequest) GetStatus() *common.Status { + if m != nil { + return m.Status + } + return nil +} + +func (m *CertificateSigningRequest) GetCaName() string { + if m != nil { + return m.CaName + } + return "" +} + +func (m *CertificateSigningRequest) GetValidity() int64 { + if m != nil { + return m.Validity + } + return 0 +} + +func (m *CertificateSigningRequest) GetServerAuth() *wrappers.BoolValue { + if m != nil { + return m.ServerAuth + } + return nil +} + func init() { proto.RegisterEnum("moc.nodeagent.security.CertificateType", CertificateType_name, CertificateType_value) proto.RegisterType((*CertificateRequest)(nil), "moc.nodeagent.security.CertificateRequest") proto.RegisterType((*CertificateResponse)(nil), "moc.nodeagent.security.CertificateResponse") proto.RegisterType((*Certificate)(nil), "moc.nodeagent.security.Certificate") + proto.RegisterType((*CSRRequest)(nil), "moc.nodeagent.security.CSRRequest") + proto.RegisterType((*CertificateSigningRequest)(nil), "moc.nodeagent.security.CertificateSigningRequest") } func init() { proto.RegisterFile("moc_nodeagent_certificate.proto", fileDescriptor_ae3bff7543638e48) } var fileDescriptor_ae3bff7543638e48 = []byte{ - // 493 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xae, 0x93, 0xd4, 0xbf, 0x66, 0xf2, 0x53, 0x88, 0x16, 0x04, 0xab, 0x88, 0x3f, 0x51, 0x2a, - 0x41, 0x28, 0x92, 0x2d, 0xc2, 0x91, 0x53, 0x13, 0xaa, 0x1e, 0x91, 0xb6, 0x85, 0x03, 0x12, 0x2a, - 0xce, 0x66, 0x62, 0x2c, 0x6c, 0x8f, 0xd9, 0x1d, 0x83, 0xf2, 0x06, 0x3c, 0x0a, 0x2f, 0xc0, 0x81, - 0x17, 0xe0, 0xb9, 0x90, 0xd7, 0x69, 0xea, 0x22, 0x0e, 0x39, 0xd0, 0x93, 0x77, 0xbf, 0xef, 0x9b, - 0xef, 0xf3, 0x8c, 0xc7, 0xf0, 0x28, 0x23, 0x7d, 0x91, 0xd3, 0x12, 0xa3, 0x18, 0x73, 0xbe, 0xd0, - 0x68, 0x38, 0x59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 0x87, - 0x19, 0xe9, 0xd0, 0x14, 0x3a, 0xdc, 0x1a, 0x85, 0x97, 0x46, 0x0b, 0xdf, 0xfd, 0x14, 0x2f, 0x7e, - 0x07, 0x00, 0x00, 0xff, 0xff, 0x9c, 0xed, 0x94, 0xfc, 0x67, 0x04, 0x00, 0x00, + // 622 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x53, 0xdd, 0x6e, 0xd3, 0x4c, + 0x10, 0xad, 0x13, 0xd7, 0x5f, 0x33, 0xf9, 0x14, 0xaa, 0x05, 0x15, 0x13, 0xf1, 0x13, 0xb9, 0x12, + 0x84, 0x82, 0x6c, 0x35, 0xdc, 0xc1, 0x55, 0x13, 0xaa, 0xde, 0x81, 0xb4, 0x29, 0x48, 0x54, 0x42, + 0xc5, 0xdd, 0x4c, 0x5c, 0x0b, 0x7b, 0xd7, 0xec, 0xae, 0x5b, 0xe5, 0x0d, 0x10, 0x4f, 0xc2, 0x0b, + 0x70, 0xc1, 0xc3, 0x21, 0x21, 0xaf, 0x9d, 0xd4, 0xad, 0x5a, 0x14, 0x24, 0x72, 0x65, 0xcf, 0xcc, + 0x99, 0x33, 0xbb, 0xe7, 0xcc, 0xc2, 0xa3, 0x54, 0xb0, 0x63, 0x2e, 0x26, 0x18, 0x46, 0xc8, 0xf5, + 0x31, 0x43, 0xa9, 0xe3, 0x69, 0xcc, 0x42, 0x8d, 0x7e, 0x26, 0x85, 0x16, 0x64, 0x2b, 0x15, 0xcc, + 0x5f, 0x00, 0x7c, 0x85, 0x2c, 0x97, 0xb1, 0x9e, 0x75, 0x1f, 0x46, 0x42, 0x44, 0x09, 0x06, 0x06, + 0x75, 0x92, 0x4f, 0x83, 0x73, 0x19, 0x66, 0x19, 0x4a, 0x55, 0xf6, 0x75, 0xef, 0x16, 0xc4, 0x4c, + 0xa4, 0xa9, 0xe0, 0xd5, 0xa7, 0x2c, 0x78,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0x9d, 0x91, 0xc4, 0x50, 0xe3, 0x5b, 0xf9, 0x2e, 0x9b, 0x14, 0xd7, 0xdc, 0x59, 0xe6, 0xb1, 0x95, + 0x62, 0x77, 0x9f, 0x2d, 0x85, 0x2d, 0xdf, 0xb6, 0xb7, 0x46, 0x3e, 0x41, 0xf3, 0x00, 0xf5, 0x2a, + 0x27, 0x30, 0x70, 0x5e, 0x63, 0x82, 0xab, 0xbd, 0xc6, 0x07, 0xb0, 0x8b, 0xa5, 0x23, 0xde, 0x8d, + 0x6d, 0x8b, 0x9d, 0xff, 0x5b, 0xea, 0x23, 0x58, 0xa7, 0xc8, 0xf1, 0x7c, 0x05, 0xdc, 0xc3, 0xdd, + 0xa3, 0x20, 0x8a, 0xf5, 0x69, 0x7e, 0xe2, 0x33, 0x91, 0x06, 0x69, 0xcc, 0xa4, 0x50, 0x62, 0xaa, + 0x83, 0x54, 0xb0, 0x40, 0x66, 0x2c, 0x58, 0x10, 0x05, 0x73, 0xa2, 0x13, 0xc7, 0x6c, 0xdf, 0x8b, + 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x92, 0x9f, 0xcb, 0x80, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -307,6 +443,8 @@ type CertificateAgentClient interface { CreateOrUpdate(ctx context.Context, in *CertificateRequest, opts ...grpc.CallOption) (*CertificateResponse, error) Get(ctx context.Context, in *CertificateRequest, opts ...grpc.CallOption) (*CertificateResponse, error) Delete(ctx context.Context, in *CertificateRequest, opts ...grpc.CallOption) (*CertificateResponse, error) + Sign(ctx context.Context, in *CSRRequest, opts ...grpc.CallOption) (*CertificateResponse, error) + Renew(ctx context.Context, in *CSRRequest, opts ...grpc.CallOption) (*CertificateResponse, error) } type certificateAgentClient struct { @@ -344,11 +482,31 @@ func (c *certificateAgentClient) Delete(ctx context.Context, in *CertificateRequ return out, nil } +func (c *certificateAgentClient) Sign(ctx context.Context, in *CSRRequest, opts ...grpc.CallOption) (*CertificateResponse, error) { + out := new(CertificateResponse) + err := c.cc.Invoke(ctx, "/moc.nodeagent.security.CertificateAgent/Sign", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *certificateAgentClient) Renew(ctx context.Context, in *CSRRequest, opts ...grpc.CallOption) (*CertificateResponse, error) { + out := new(CertificateResponse) + err := c.cc.Invoke(ctx, "/moc.nodeagent.security.CertificateAgent/Renew", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CertificateAgentServer is the server API for CertificateAgent service. type CertificateAgentServer interface { CreateOrUpdate(context.Context, *CertificateRequest) (*CertificateResponse, error) Get(context.Context, *CertificateRequest) (*CertificateResponse, error) Delete(context.Context, *CertificateRequest) (*CertificateResponse, error) + Sign(context.Context, *CSRRequest) (*CertificateResponse, error) + Renew(context.Context, *CSRRequest) (*CertificateResponse, error) } // UnimplementedCertificateAgentServer can be embedded to have forward compatible implementations. @@ -364,6 +522,12 @@ func (*UnimplementedCertificateAgentServer) Get(ctx context.Context, req *Certif func (*UnimplementedCertificateAgentServer) Delete(ctx context.Context, req *CertificateRequest) (*CertificateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } +func (*UnimplementedCertificateAgentServer) Sign(ctx context.Context, req *CSRRequest) (*CertificateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sign not implemented") +} +func (*UnimplementedCertificateAgentServer) Renew(ctx context.Context, req *CSRRequest) (*CertificateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Renew not implemented") +} func RegisterCertificateAgentServer(s *grpc.Server, srv CertificateAgentServer) { s.RegisterService(&_CertificateAgent_serviceDesc, srv) @@ -423,6 +587,42 @@ func _CertificateAgent_Delete_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _CertificateAgent_Sign_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CSRRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateAgentServer).Sign(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/moc.nodeagent.security.CertificateAgent/Sign", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateAgentServer).Sign(ctx, req.(*CSRRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CertificateAgent_Renew_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CSRRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CertificateAgentServer).Renew(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/moc.nodeagent.security.CertificateAgent/Renew", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CertificateAgentServer).Renew(ctx, req.(*CSRRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _CertificateAgent_serviceDesc = grpc.ServiceDesc{ ServiceName: "moc.nodeagent.security.CertificateAgent", HandlerType: (*CertificateAgentServer)(nil), @@ -439,6 +639,14 @@ var _CertificateAgent_serviceDesc = grpc.ServiceDesc{ MethodName: "Delete", Handler: _CertificateAgent_Delete_Handler, }, + { + MethodName: "Sign", + Handler: _CertificateAgent_Sign_Handler, + }, + { + MethodName: "Renew", + Handler: _CertificateAgent_Renew_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "moc_nodeagent_certificate.proto",