7.9 KiB
cis
import "github.com/effective-security/trustyca/server/service/cis"
Package cis implements the Certificate Information Service (pb.CIS): the read-only view of the CA for authenticated callers. It serves the trust anchors, issuer chains, certificate information, revocation status and CRLs of every org over gRPC and the JSON API (POST /pb.CIS/{Method}) of the wfe listener, which admits any authenticated caller to /pb.CIS. The binary routes the issued certificates point at (the issuer certificate, the CRL Distribution Point and the OCSP responder) are the aia service.
The service reads the CA tables and holds no issuer keys. Every lookup needs an IKID, a serial, a SKID, a thumbprint or an ID: the service lists nothing of an org but its trust anchors, and its views carry no tenancy and no client-owned fields.
The service is built by its Factory from the app container; a test wires it directly:
svc, err := cis.New(caReadonlyDb)
if err != nil {
return err
}
svc.RegisterRoute(router)
Index
- Constants
- func Factory(server gserver.GServer) any
- type Service
- func New(caDb db.CaReadonlyDb) (*Service, error)
- func (s *Service) CisHTTPHandler() restserver.Handle
- func (s *Service) Close()
- func (s *Service) GetCRL(ctx context.Context, req *pb.GetCrlRequest) (*pb.CrlResponse, error)
- func (s *Service) GetCertificate(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateResponse, error)
- func (s *Service) GetCertificateStatus(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateStatusResponse, error)
- func (s *Service) GetIssuer(ctx context.Context, req *pb.GetIssuerInfoRequest) (*pb.IssuerInfo, error)
- func (s *Service) GetRoots(ctx context.Context, req *pb.GetRootsRequest) (*pb.RootsResponse, error)
- func (s *Service) IsReady() bool
- func (s *Service) Name() string
- func (s *Service) RegisterGRPC(r *grpc.Server)
- func (s *Service) RegisterRoute(r restserver.Router)
Constants
ServiceName provides the Service Name for this package
const ServiceName = "cis"
func Factory
func Factory(server gserver.GServer) any
Factory returns a factory of the service
type Service
Service defines the Certificate Information Service (pb.CIS): the read-only view of the CA tables (trust anchors, issuer chains, certificates, revocation status and CRLs) served over gRPC and the JSON API to the authenticated callers of the wfe listener. The binary AIA, CRL and OCSP routes the issued certificates point at are the aia service on its own plain HTTP listener; the CIS holds no issuer keys and calls no other service.
type Service struct {
// contains filtered or unexported fields
}
func New
func New(caDb db.CaReadonlyDb) (*Service, error)
New returns the service over the CA tables
func (*Service) CisHTTPHandler
func (s *Service) CisHTTPHandler() restserver.Handle
CisHTTPHandler returns the handler of the JSON API. There is no per-method access check: the methods declare no roles and the views carry no tenancy, so the listener decides who reaches them (the wfe admits authenticated callers under authz.allow_any_role)
func (*Service) Close
func (s *Service) Close()
Close the subservices and its resources
func (*Service) GetCRL
func (s *Service) GetCRL(ctx context.Context, req *pb.GetCrlRequest) (*pb.CrlResponse, error)
GetCRL returns the current CRL of the issuer with the key identifier
func (*Service) GetCertificate
func (s *Service) GetCertificate(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateResponse, error)
GetCertificate returns the public view of a certificate by its ID, its Subject Key Identifier (the newest certificate of the key), its SHA-256 thumbprint, or the key identifier of its issuer and its serial number. The tenancy and the client-owned fields (label, metadata, profile) are not part of the view.
func (*Service) GetCertificateStatus
func (s *Service) GetCertificateStatus(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateStatusResponse, error)
GetCertificateStatus returns the revocation status of a certificate named as in GetCertificate: Active, Expired (an Active certificate whose validity has ended, before the cert_status task marks it) or Revoked with the time and reason of its revocation
func (*Service) GetIssuer
func (s *Service) GetIssuer(ctx context.Context, req *pb.GetIssuerInfoRequest) (*pb.IssuerInfo, error)
GetIssuer returns the public view of the issuer with the key identifier: its chain, status and the AIA, CRL and OCSP URLs of its settings with the key identifier in place of the placeholder. A Pending issuer has no certificate and is not found.
func (*Service) GetRoots
func (s *Service) GetRoots(ctx context.Context, req *pb.GetRootsRequest) (*pb.RootsResponse, error)
GetRoots returns the published trust anchors, newest first: of the platform when the request names no org, else of the org. An unknown org has none.
func (*Service) IsReady
func (s *Service) IsReady() bool
IsReady indicates that the service is ready to serve its end-points
func (*Service) Name
func (s *Service) Name() string
Name returns the service name
func (*Service) RegisterGRPC
func (s *Service) RegisterGRPC(r *grpc.Server)
RegisterGRPC registers gRPC handler
func (*Service) RegisterRoute
func (s *Service) RegisterRoute(r restserver.Router)
RegisterRoute adds the JSON API to the overall URL router
Generated by gomarkdoc