CADDY_PFX_CERTIFICATES

package module
v0.0.0-...-60fe4b3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 17 Imported by: 0

README

Build Static Releases

Caddy PFX Certificates

This repository contains a CaddyServer module for loading PFX certificates on-demand.

Installation and Configuration

Using Docker
  • Pull the Docker image from the GitHub Container Registry:
    docker pull ghcr.io/quix-labs/caddy-pfx-certificates:latest
    
Using xcaddy
  • Before building the module, ensure you have xcaddy installed on your system. You can install it using the following command:

    go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
    
  • To build this module into Caddy, run the following command:

    CGO_ENABLED=1 xcaddy build --with github.com/quix-labs/caddy-pfx-certificates
    

    This command compiles Caddy with the image processing module included.

Using prebuilt assets
  • You can also install the tool using release assets.

    Download the appropriate package from the Releases page, and then follow the instructions provided for your specific platform.

Usage

Using Docker
docker run -p 80:80 -p 443:443 \
  -v $PWD/Caddyfile:/etc/caddy/Caddyfile -d \
  -v $PWD/test.pfx:/srv/test.pfx -d \
  ghcr.io/quix-labs/caddy-pfx-certificates:latest

Your can see more information in the official docker documentation for caddy

Using xcaddy build / prebuilt assets
/path/to/your/caddy run --config /etc/caddy/Caddyfile

Your can see more information in the official documentation for caddy

Example Caddyfile


https://your-domain {
    tls {
        get_certificate pfx {
            path test.pfx
            password password
            
            # If set to false, only the certificates from the .pfx file will be sent. 
            # If set to true (default), all the intermediate certificates will be downloaded, including those up to the root CA.
            fetch_full_chain true 
        }
        
        # Or shortcut -> get_certificate pfx test.pfx password
    }
    encode zstd gzip
    root * /var/www/html
    file_server
}

Development

To contribute to the development of this module, follow these steps:

  1. Make sure you have Go installed on your system.

  2. Clone this repository to your local machine:

    git clone https://github.com/quix-labs/caddy-pfx-certificates.git
    
  3. Navigate to the project directory:

  4. Install xcaddy if you haven't already:

    go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
    
  5. Make your changes in the source code.

  6. Run tests to ensure your changes haven't introduced any issues:

    make test
    
  7. If tests pass, you can build the project:

    make build
    
  8. To run the project in development mode, use the following command:

    make run
    
  9. Once you're satisfied with your changes, create a pull request to the main branch of the repository for review.

Credits

License

The MIT License (MIT). Please see License File for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertificateState

type CertificateState struct {
	SubjectKeyId           string
	AuthorityKeyId         string
	Resolved               bool
	IssuingCertificateURLs []string
}

type PfxCertGetter

type PfxCertGetter struct {
	// Path to your .pfx file.
	Path string `json:"path,omitempty"`
	// Password used to decode pfx file. Required.
	Password string `json:"password,omitempty"`
	// FetchFullChain allows Caddy server to automatically download the certificate chain.
	FetchFullChain *bool `json:"fetch_full_chain,omitempty"`

	CacheCertName string
	// contains filtered or unexported fields
}

PfxCertGetter allow user to set path to .pfx file to load TLS certificate

func (*PfxCertGetter) CaddyModule

func (*PfxCertGetter) CaddyModule() caddy.ModuleInfo

func (*PfxCertGetter) GenerateFullPEM

func (getter *PfxCertGetter) GenerateFullPEM(ctx context.Context) error

func (*PfxCertGetter) GetCertificate

func (getter *PfxCertGetter) GetCertificate(ctx context.Context, hello *tls.ClientHelloInfo) (*tls.Certificate, error)

func (*PfxCertGetter) Provision

func (getter *PfxCertGetter) Provision(ctx caddy.Context) error

func (*PfxCertGetter) UnmarshalCaddyfile

func (getter *PfxCertGetter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

Jump to

Keyboard shortcuts

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