# 61131/nginx-http-est architecture

> Architecture diagram of the GitHub repository 61131/nginx-http-est, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/61131/nginx-http-est
- Repository: https://github.com/61131/nginx-http-est

## Overview

##### Main Components

a. Client Layer:
- EST Clients (devices/systems requiring certificates)
- Both initial enrollment and re-enrollment paths
- TLS connection

b. Nginx Server Layer:
- Main Nginx Server (with SSL/TLS termination)
- EST Module Components (group the following as submodules):
- Authentication Handler (ngx_http_est_auth.c)
- Certificate Operations (ngx_http_est_x509.c)
- PKCS7 Processing (ngx_http_est_pkcs7.c)
- TLS Operations (ngx_http_est_tls.c)
- Private Key Management (ngx_http_est_privkey.c)
- ASN.1 Processing (ngx_http_est_asn1.c)

c. External Components:
- Authentication Backend (for HTTP-based authentication)
- Certificate Authority (CA) Storage:
- CA Root Certificate
- CA Private Key
- Serial Number Storage
- CSR Attributes Store

##### Flow Directions

a. Primary Operations:
- /cacerts (CA certificate distribution)
- /csrattrs (CSR attributes request)
- /simpleenroll (Initial enrollment)
- /simplereenroll (Certificate renewal)
- /serverkeygen (Server-side key generation)

b. Authentication Flows:
- TLS Client Authentication path
- HTTP Basic Authentication path to backend
- Proof-of-Possession validation flow

##### Additional Notes

- Version/RFC compliance indicators
- Optional components (like HTTP authentication)
- Where POP validation occurs
- Certificate lifecycle flows

Remember to include a clear title: "Nginx EST Module System Architecture" and appropriate metadata (version, date, author).

## Diagram (Mermaid)

```mermaid
flowchart TB
    title[Nginx EST Module System Architecture]
    style title fill:#f5f5f5,stroke:#333,stroke-width:2px
    
    subgraph Clients
        EST_Client["EST Client"]:::client
        EST_Client_Renew["EST Client (Renewal)"]:::client
    end
    
    subgraph "Nginx Server"
        Nginx["Nginx Core Server"]:::nginx
        
        subgraph "EST Module Components"
            MainModule["Main EST Module"]:::module
            click MainModule "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est.c"
            
            AuthHandler["Authentication Handler"]:::module
            click AuthHandler "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est_auth.c"
            
            CertOps["Certificate Operations"]:::module
            click CertOps "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est_x509.c"
            
            PKCS7["PKCS7 Processing"]:::module
            click PKCS7 "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est_pkcs7.c"
            
            TLSOps["TLS Operations"]:::module
            click TLSOps "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est_tls.c"
            
            PrivKey["Private Key Management"]:::module
            click PrivKey "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est_privkey.c"
            
            ASN1["ASN.1 Processing"]:::module
            click ASN1 "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est_asn1.c"
            
            ReqHandler["Request Handler"]:::module
            click ReqHandler "https://github.com/61131/nginx-http-est/blob/main/ngx_http_est_request.c"
        end
    end
    
    subgraph "External Components"
        AuthBackend["Authentication Backend"]:::external
        
        subgraph "CA Storage"
            CARootCert["CA Root Certificate"]:::storage
            CAPrivKey["CA Private Key"]:::storage
            SerialStore["Serial Number Storage"]:::storage
            CSRAttrs["CSR Attributes Store"]:::storage
            click CSRAttrs "https://github.com/61131/nginx-http-est/blob/main/csrattrs.der"
        end
    end
    
    %% Connections
    EST_Client --> |"TLS"| Nginx
    EST_Client_Renew --> |"TLS"| Nginx
    
    Nginx --> MainModule
    MainModule --> AuthHandler
    MainModule --> ReqHandler
    
    ReqHandler --> CertOps
    ReqHandler --> PKCS7
    ReqHandler --> TLSOps
    ReqHandler --> PrivKey
    ReqHandler --> ASN1
    
    AuthHandler --> AuthBackend
    CertOps --> CARootCert
    PrivKey --> CAPrivKey
    CertOps --> SerialStore
    ReqHandler --> CSRAttrs
    
    %% Styles
    classDef client fill:#e1f5fe,stroke:#01579b
    classDef nginx fill:#b2dfdb,stroke:#004d40
    classDef module fill:#c8e6c9,stroke:#1b5e20
    classDef external fill:#fff3e0,stroke:#e65100
    classDef storage fill:#f3e5f5,stroke:#4a148c
    
    %% Legend
    subgraph Legend
        Client["Client"]:::client
        NginxComp["Nginx Component"]:::nginx
        ModuleComp["Module Component"]:::module
        ExtComp["External Component"]:::external
        StorageComp["Storage"]:::storage
    end
```
