uploadcert_tencentcloud

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 16 Imported by: 0

README

uploadcert_tencentcloud

Overview

uploadcert_tencentcloud is an event handler module for Caddy that automatically uploads newly obtained certificates to Tencent Cloud SSL service and supports automatic certificate updates. The module supports whitelist and blacklist rules for certificates, allowing flexible control over which certificates should be uploaded.

Features

  • Listens for Caddy's cert_obtained event.
  • Automatically uploads new certificates to Tencent Cloud SSL.
  • Automatically updates existing certificates.
  • Supports whitelist (AllowList) and blacklist (BlockList) rules for certificate uploads.
  • Logs the upload and update processes.

Usage

Caddyfile Configuration Example
{
    events {
        on cert_obtained upload_cert_tencentcloud {
            secret_id {$TENCENTCLOUD_SECRET_ID}
            secret_key {$TENCENTCLOUD_SECRET_KEY}
            allow_list example.com www.example.com
            block_list test.example.com
            try_delete_old_cert
        }
    }
}
  • secret_id and secret_key: Tencent Cloud API credentials.
  • allow_list:Only upload certificates for the domains in this list (optional).
  • block_list:Do not upload certificates for the domains in this list (optional).
  • try_delete_old_cert:Try to delete the old certificate when the certificate is updated (optional).

Development & Contribution

Contributions through issues and pull requests are welcome to improve this module.

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	CertificateId  string   `json:"CertificateId,omitempty"`
	SubjectAltName []string `json:"SubjectAltName,omitempty"`
}

type DeleteCertificateRequest

type DeleteCertificateRequest struct {
	CertificateId   string `json:"CertificateId,omitempty"`
	IsCheckResource bool   `json:"IsCheckResource,omitempty"`
}

type DeleteCertificateResponse

type DeleteCertificateResponse struct {
	Response struct {
		ResponseMeta
		DeleteResult bool   `json:"DeleteResult,omitempty"`
		TaskId       string `json:"TaskId,omitempty"`
	}
}

type DescribeCertificatesRequest

type DescribeCertificatesRequest struct {
	SearchKey       string `json:"SearchKey,omitempty"`
	CertificateType string `json:"CertificateType,omitempty"`
	FilterSource    string `json:"FilterSource,omitempty"`
}

type DescribeCertificatesResponse

type DescribeCertificatesResponse struct {
	Response struct {
		ResponseMeta
		TotalCount   uint64        `json:"TotalCount,omitempty"`
		Certificates []Certificate `json:"Certificates,omitempty"`
	}
}

type Error

type Error struct {
	Code    string `json:"Code,omitempty"`
	Message string `json:"Message,omitempty"`
}

type ResponseMeta

type ResponseMeta struct {
	Error     *Error `json:"Error,omitempty"`
	RequestId string `json:"RequestId,omitempty"`
}

type TencentCloudCertHandler

type TencentCloudCertHandler struct {
	// SecretId is the Tencent Cloud API access key ID for authentication
	SecretId string `json:"secret_id"`
	// SecretKey is the Tencent Cloud API access key for signature verification
	SecretKey string `json:"secret_key"`
	// AllowList specifies which domains are allowed to upload certificates
	AllowList []string `json:"allow_list,omitempty"`
	// BlockList specifies which domains are blocked from uploading certificates
	BlockList []string `json:"block_list,omitempty"`
	// TryDeleteOldCert determines whether to delete old certificates when updating
	TryDeleteOldCert bool `json:"try_delete_old_cert,omitempty"`
	// contains filtered or unexported fields
}

TencentCloudCertHandler handles automatic certificate upload to Tencent Cloud

func (TencentCloudCertHandler) CaddyModule

func (*TencentCloudCertHandler) DeleteCertificate

func (h *TencentCloudCertHandler) DeleteCertificate(ctx context.Context, id string) error

func (*TencentCloudCertHandler) DescribeCertificates

func (h *TencentCloudCertHandler) DescribeCertificates(ctx context.Context, domain string) (string, error)

func (*TencentCloudCertHandler) Handle

func (*TencentCloudCertHandler) Provision

func (h *TencentCloudCertHandler) Provision(ctx caddy.Context) error

func (*TencentCloudCertHandler) UnmarshalCaddyfile

func (h *TencentCloudCertHandler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (*TencentCloudCertHandler) UpdateCertificateInstance

func (h *TencentCloudCertHandler) UpdateCertificateInstance(ctx context.Context, publicKey, privateKey, id string, DeployRecordId *uint64) error

func (*TencentCloudCertHandler) UploadCertificate

func (h *TencentCloudCertHandler) UploadCertificate(ctx context.Context, publicKey, privateKey string) error

type UpdateCertificateInstanceRequest

type UpdateCertificateInstanceRequest struct {
	OldCertificateId           string   `json:"OldCertificateId,omitempty"`
	ResourceTypes              []string `json:"ResourceTypes,omitempty"`
	CertificatePublicKey       string   `json:"CertificatePublicKey,omitempty"`
	CertificatePrivateKey      string   `json:"CertificatePrivateKey,omitempty"`
	ExpiringNotificationSwitch uint64   `json:"ExpiringNotificationSwitch,omitempty"`
	Repeatable                 *bool    `json:"Repeatable,omitempty"`
	AllowDownload              *bool    `json:"AllowDownload,omitempty"`
}

type UpdateCertificateInstanceResponse

type UpdateCertificateInstanceResponse struct {
	Response struct {
		ResponseMeta
		DeployRecordId     uint64               `json:"DeployRecordId,omitempty"`
		DeployStatus       int64                `json:"DeployStatus,omitempty"`
		UpdateSyncProgress []UpdateSyncProgress `json:"UpdateSyncProgress,omitempty"`
	}
}

type UpdateSyncProgress

type UpdateSyncProgress struct {
	ResourceType              string                     `json:"ResourceType,omitempty"`
	UpdateSyncProgressRegions []UpdateSyncProgressRegion `json:"UpdateSyncProgressRegions,omitempty"`
	Status                    int64                      `json:"Status,omitempty"`
}

type UpdateSyncProgressRegion

type UpdateSyncProgressRegion struct {
	Region      string `json:"Region,omitempty"`
	TotalCount  int64  `json:"TotalCount,omitempty"`
	OffsetCount int64  `json:"OffsetCount,omitempty"`
	Status      int64  `json:"Status,omitempty"`
}

type UploadCertificateRequest

type UploadCertificateRequest struct {
	CertificatePublicKey  string `json:"CertificatePublicKey,omitempty"`
	CertificatePrivateKey string `json:"CertificatePrivateKey,omitempty"`
	CertificateType       string `json:"CertificateType,omitempty"`
	Repeatable            *bool  `json:"Repeatable,omitempty"`
}

type UploadCertificateResponse

type UploadCertificateResponse struct {
	Response struct {
		ResponseMeta
		CertificateId string `json:"CertificateId,omitempty"`
		RepeatCertId  string `json:"RepeatCertId,omitempty"`
	}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL