Documentation ¶
Index ¶
- Constants
- Variables
- func AuthIntercept(ctx context.Context) (context.Context, error)
- func DecodeChain(chain []byte) ([]*x509.Certificate, error)
- func EncodeCSR(b []byte) (string, error)
- func EncodePKey(key *rsa.PrivateKey) (string, error)
- func Fail(err error)
- func GenerateCSR(key crypto.PrivateKey, cn string, c *Config) ([]byte, error)
- func GeneratePrivateKey(bs int) (*rsa.PrivateKey, error)
- func GetCertSerialNumber(ip string, port string, sn string) (*big.Int, error)
- func ParseIPAddr(ctx context.Context) (string, string, error)
- func ParsePrivateKey(k string) (*rsa.PrivateKey, error)
- func ParsePublicCertificate(c string) (*x509.Certificate, error)
- type AMQP
- type CertParams
- type CheckCertEvent
- type CollectEvent
- type CompleteEnrollEvent
- type Config
- type DB
- type DeleteSubjEvent
- type EmptyEvent
- type EnrollEvent
- type EnrollResponse
- type ErrorResponse
- type Event
- type ExpiringSubjectEvent
- type GRPC
- type GRPCServer
- func (g *GRPCServer) AddNewSubject(ctx context.Context, req *londopb.AddNewSubjectRequest) (*londopb.AddNewSubjectResponse, error)
- func (g *GRPCServer) DeleteSubject(ctx context.Context, req *londopb.DeleteSubjectRequest) (*londopb.DeleteSubjectResponse, error)
- func (g *GRPCServer) GetExpiringSubject(req *londopb.GetExpiringSubjectsRequest, ...) error
- func (g *GRPCServer) GetSubject(ctx context.Context, req *londopb.GetSubjectRequest) (*londopb.GetSubjectResponse, error)
- func (g *GRPCServer) GetSubjectForTarget(req *londopb.ForTargetRequest, ...) error
- func (g *GRPCServer) GetSubjectsByTarget(req *londopb.TargetRequest, ...) error
- func (g *GRPCServer) GetToken(ctx context.Context, req *londopb.GetTokenRequest) (*londopb.GetTokenResponse, error)
- func (g *GRPCServer) RenewSubjects(req *londopb.RenewSubjectRequest, ...) error
- type GetExpiringSubjEvent
- type GetSubjectByTargetEvent
- type GetSubjectEvent
- type JWT
- type Londo
- func (l *Londo) AMQPConnection() *Londo
- func (l *Londo) ConsumeCheck() *Londo
- func (l *Londo) ConsumeCollect() *Londo
- func (l *Londo) ConsumeDbRPC() *Londo
- func (l *Londo) ConsumeEnroll() *Londo
- func (l *Londo) ConsumeGRPCReplies(queue string, ch chan Subject, done chan struct{}, wg *sync.WaitGroup) *Londo
- func (l *Londo) ConsumeRevoke() *Londo
- func (l *Londo) DbService() *Londo
- func (l *Londo) Declare(exchange string, queue string, kind string, args amqp.Table) *Londo
- func (l *Londo) DeclareBindQueue(exchange string, queue string) error
- func (l *Londo) DeclareExchange(exchange string, kind string) *Londo
- func (l *Londo) GRPCServer() *Londo
- func (l *Londo) Publish(exchange string, queue string, reply string, cmd string, e Event) error
- func (l *Londo) PublishGetAllSubjects() *Londo
- func (l *Londo) PublishPeriodically(hours int) *Londo
- func (l *Londo) RestAPIClient() *Londo
- func (l *Londo) Run() error
- type MongoDB
- func (m *MongoDB) DeleteSubject(hexId string, certid int) error
- func (m *MongoDB) Disconnect() error
- func (m *MongoDB) FindAllSubjects() ([]*Subject, error)
- func (m *MongoDB) FindExpiringSubjects(hours int) ([]*Subject, error)
- func (m *MongoDB) FindManySubjects(s []string, filter string) ([]Subject, error)
- func (m *MongoDB) FindSubject(s string) (Subject, error)
- func (m *MongoDB) InsertSubject(s *Subject) error
- func (m *MongoDB) UpdateSubjCert(certId *int, cert *string, na *time.Time, sn *big.Int) error
- func (m *MongoDB) UpdateUnreachable(e *CheckCertEvent) error
- type NewSubjectEvent
- type Rest
- type RestAPI
- type Revoke
- type RevokeEvent
- type Subject
Constants ¶
View Source
const ( CsrType = "CERTIFICATE REQUEST" PrivateKeyType = "PRIVATE KEY" PublicKeyType = "CERTIFICATE" )
View Source
const ( EnrollExchange = "enroll-rpc" EnrollQueue = "enroll" RevokeExchange = "revoke-rpc" RevokeQueue = "revoke" CollectExchange = "collect-rpc" CollectQueue = "collect" CheckExchange = "check-rpc" CheckQueue = "check" DbReplyExchange = "db-rpc" DbReplyQueue = "db-rpc-replies" GRPCServerExchange = "grpc" // Commands // Db DbDeleteSubjCmd = "subj.delete" DbAddSubjCmd = "subj.add" DbUpdateSubjCmd = "subj.update" DbGetSubjectCmd = "subj.get" DbGetAllSubjectsCmd = "subj.get.all" DbGetSubjectByTargetCmd = "subj.get.target" DbGetUpdatedSubjectByTargetCmd = "subj.get.update" DbGetExpiringSubjectsCmd = "subj.get.expiring" DbUpdateCertStatusCmd = "subj.update.status" // Tell consumer to close channel CloseChannelCmd = "stop" ContentType = "application/json" Version = "0.1.0" )
Variables ¶
View Source
var ( Debug bool ScanHours int RevokeHours int CrtFile string Keyfile string DefaultFlags = []cli.Flag{ cli.BoolFlag{ Name: "debug, d", Usage: "enables debug level logging", EnvVar: "LONDO_DEBUG", Destination: &Debug, }, cli.StringFlag{ Name: "config, c", Usage: "load configuration from `FILE`", EnvVar: "LONDO_CONFIG", Destination: &cfgFile, Value: "config/config.yml", }, } )
View Source
var (
SFile string
)
Functions ¶
func EncodePKey ¶
func EncodePKey(key *rsa.PrivateKey) (string, error)
func GenerateCSR ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey(bs int) (*rsa.PrivateKey, error)
func GetCertSerialNumber ¶
func ParsePrivateKey ¶
func ParsePrivateKey(k string) (*rsa.PrivateKey, error)
func ParsePublicCertificate ¶
func ParsePublicCertificate(c string) (*x509.Certificate, error)
Types ¶
type CertParams ¶
type CertParams struct { Country string `yaml:"country"` Province string `yaml:"province"` Locality string `yaml:"locality"` Organization string `yaml:"organization"` StreetAddress string `yaml:"street_address"` PostalCode string `yaml:"postal_code"` OrgUnit string `yaml:"organizational_unit"` OrgId int `yaml:"org_id"` Term int `yaml:"term"` BitSize int `yaml:"bit_size"` FormatType string `yaml:"format_type"` CertType int `yaml:"cert_type"` MultiDomainCertType int `yaml:"multi_domain_cert_type"` Comments string `yaml:"comments"` }
type CheckCertEvent ¶
type CheckCertEvent struct { ID string Subject string CertID int Serial string Port int32 Match bool Targets []string Outdated []string // TODO: it may not be possible to deserialize it and from JSON Unresolvable time.Time }
func (CheckCertEvent) GetMessage ¶
func (CheckCertEvent) GetMessage() amqp.Publishing
type CollectEvent ¶
type CollectEvent struct {
CertID int
}
func (CollectEvent) GetMessage ¶
func (CollectEvent) GetMessage() amqp.Publishing
type CompleteEnrollEvent ¶
func (CompleteEnrollEvent) GetMessage ¶
func (CompleteEnrollEvent) GetMessage() amqp.Publishing
type Config ¶
type Config struct { DB `yaml:"mongodb"` AMQP rabbitmq `yaml:"amqp"` Rest `yaml:"sectigo"` GRPC `yaml:"grpc"` CertParams `yaml:"cert_params"` Debug int `yaml:"debug"` JWT `yaml:"jwt"` }
func ReadConfig ¶
type EmptyEvent ¶
type EmptyEvent struct{}
func (EmptyEvent) GetMessage ¶
func (EmptyEvent) GetMessage() amqp.Publishing
type EnrollEvent ¶
func (EnrollEvent) GetMessage ¶
func (EnrollEvent) GetMessage() amqp.Publishing
type EnrollResponse ¶
type ErrorResponse ¶
type Event ¶
type Event interface {
GetMessage() amqp.Publishing
}
type ExpiringSubjectEvent ¶
func (ExpiringSubjectEvent) GetMessage ¶
func (ExpiringSubjectEvent) GetMessage() amqp.Publishing
type GRPCServer ¶
type GRPCServer struct {
Londo *Londo
}
func (*GRPCServer) AddNewSubject ¶
func (g *GRPCServer) AddNewSubject( ctx context.Context, req *londopb.AddNewSubjectRequest) (*londopb.AddNewSubjectResponse, error)
func (*GRPCServer) DeleteSubject ¶
func (g *GRPCServer) DeleteSubject( ctx context.Context, req *londopb.DeleteSubjectRequest) (*londopb.DeleteSubjectResponse, error)
func (*GRPCServer) GetExpiringSubject ¶
func (g *GRPCServer) GetExpiringSubject( req *londopb.GetExpiringSubjectsRequest, stream londopb.CertService_GetExpiringSubjectServer) error
func (*GRPCServer) GetSubject ¶
func (g *GRPCServer) GetSubject( ctx context.Context, req *londopb.GetSubjectRequest) (*londopb.GetSubjectResponse, error)
func (*GRPCServer) GetSubjectForTarget ¶
func (g *GRPCServer) GetSubjectForTarget( req *londopb.ForTargetRequest, stream londopb.CertService_GetSubjectForTargetServer) error
func (*GRPCServer) GetSubjectsByTarget ¶
func (g *GRPCServer) GetSubjectsByTarget( req *londopb.TargetRequest, stream londopb.CertService_GetSubjectsByTargetServer) error
func (*GRPCServer) GetToken ¶
func (g *GRPCServer) GetToken(ctx context.Context, req *londopb.GetTokenRequest) (*londopb.GetTokenResponse, error)
func (*GRPCServer) RenewSubjects ¶
func (g *GRPCServer) RenewSubjects( req *londopb.RenewSubjectRequest, stream londopb.CertService_RenewSubjectsServer) error
type GetExpiringSubjEvent ¶
type GetExpiringSubjEvent struct {
Days int32
}
func (GetExpiringSubjEvent) GetMessage ¶
func (GetExpiringSubjEvent) GetMessage() amqp.Publishing
type GetSubjectByTargetEvent ¶
type GetSubjectByTargetEvent struct {
Target []string
}
func (GetSubjectByTargetEvent) GetMessage ¶
func (GetSubjectByTargetEvent) GetMessage() amqp.Publishing
type GetSubjectEvent ¶
type GetSubjectEvent struct {
Subject string
}
func (GetSubjectEvent) GetMessage ¶
func (GetSubjectEvent) GetMessage() amqp.Publishing
type Londo ¶
type Londo struct { Name string Db *MongoDB AMQP *AMQP GRPC *GRPCServer RestClient *RestAPI }
func Initialize ¶
func (*Londo) AMQPConnection ¶
func (*Londo) ConsumeCheck ¶
func (*Londo) ConsumeCollect ¶
func (*Londo) ConsumeDbRPC ¶
func (*Londo) ConsumeEnroll ¶
func (*Londo) ConsumeGRPCReplies ¶
func (*Londo) ConsumeRevoke ¶
func (*Londo) DeclareBindQueue ¶
TODO: refactor
func (*Londo) DeclareExchange ¶
TODO: refactor
func (*Londo) GRPCServer ¶
func (*Londo) PublishGetAllSubjects ¶
func (*Londo) PublishPeriodically ¶
TODO: needs to be improved for reusability
func (*Londo) RestAPIClient ¶
type MongoDB ¶
type MongoDB struct { Name string // contains filtered or unexported fields }
func NewDBConnection ¶
func (*MongoDB) Disconnect ¶
func (*MongoDB) FindAllSubjects ¶
func (*MongoDB) FindExpiringSubjects ¶
func (*MongoDB) FindManySubjects ¶
func (*MongoDB) InsertSubject ¶
func (*MongoDB) UpdateSubjCert ¶
func (*MongoDB) UpdateUnreachable ¶
func (m *MongoDB) UpdateUnreachable(e *CheckCertEvent) error
type NewSubjectEvent ¶
type NewSubjectEvent struct { Subject string Port int32 CSR string PrivateKey string CertID int OrderID string AltNames []string Targets []string }
func (NewSubjectEvent) GetMessage ¶
func (NewSubjectEvent) GetMessage() amqp.Publishing
type RestAPI ¶
type RestAPI struct { Client *resty.Client // contains filtered or unexported fields }
func NewRestClient ¶
func (RestAPI) VerifyStatusCode ¶
type RevokeEvent ¶
func (RevokeEvent) GetMessage ¶
func (RevokeEvent) GetMessage() amqp.Publishing
type Subject ¶
type Subject struct { ID primitive.ObjectID `bson:"_id"` Subject string `bson:"subject"` Port int32 `bson:"port"` CSR string `bson:"csr"` PrivateKey string `bson:"private_key"` Certificate string `bson:"certificate,omitempty"` Serial string `bson:"serial"` CertID int `bson:"cert_id"` OrderID string `bson:"order_id"` NotAfter time.Time `bson:"not_after"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` UnresolvableAt time.Time `bson:"unresolvable_at,omitempty"` Targets []string `bson:"targets,omitempty"` AltNames []string `bson:"alt_names,omitempty"` Match bool `bson:"match"` Outdated []string `bson:"outdated,omitempty"` }
func (Subject) GetMessage ¶
func (Subject) GetMessage() amqp.Publishing
Source Files ¶
Click to show internal directories.
Click to hide internal directories.