# matiya/freeradius-google-authenticator architecture

> Architecture diagram of the GitHub repository matiya/freeradius-google-authenticator, 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/matiya/freeradius-google-authenticator
- Repository: https://github.com/matiya/freeradius-google-authenticator

## Overview

##### Container Architecture Layer
- FreeRADIUS Container
- PostgreSQL Container
- Django Container

##### Authentication Flow Layer
- External Client Zone (RADIUS clients)
- Authentication Services Layer
- Database Layer

##### Top Level (Client Interface)
- Primary authentication entry point

##### Middle Level (Service Layer)
- FreeRADIUS Container:
- Core RADIUS Server
- Google Authenticator Module
- PAM Integration
- EAP Modules
- Django Container:
- Admin Interface
- REST API
- User Management
- Batch User Creation

##### Bottom Level (Data Layer)
- PostgreSQL Container:
- RADIUS Database
- User Store
- Configuration Storage

Key Relationships to Show:

- Client → FreeRADIUS (Primary authentication request)
- FreeRADIUS → Google Authenticator (2FA verification)
- FreeRADIUS → PostgreSQL (User verification)
- Django → PostgreSQL (User management)

- Admin Users → Django Admin Interface
- Django → PostgreSQL (CRUD operations)

- Blue: External interfaces
- Green: Authentication services
- Yellow: Management services
- Gray: Database services
- Red: Security boundaries

Special Elements to Include:

##### Security Zones
- SSL/TLS connections
- Certificate locations

##### Configuration Elements
- Location of key configuration files
- Certificate paths
- Volume mounts

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef external fill:#6495ED,stroke:#333,stroke-width:2px
    classDef auth fill:#98FB98,stroke:#333,stroke-width:2px
    classDef management fill:#FFD700,stroke:#333,stroke-width:2px
    classDef database fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef security fill:#FF6B6B,stroke:#333,stroke-width:2px

    %% External Clients
    Client["RADIUS Clients"]:::external
    AdminUser["Admin Users"]:::external

    %% Container Boundary
    subgraph DockerEnvironment["Containerized Environment"]
        %% FreeRADIUS Container
        subgraph FreeRADIUS["FreeRADIUS Container"]
            RadiusCore["RADIUS Core Server"]:::auth
            GoogleAuth["Google Authenticator"]:::auth
            PAM["PAM Integration"]:::auth
            EAP["EAP Modules"]:::auth
            RadCerts["Certificates"]:::security
        end

        %% Django Container
        subgraph DjangoApp["Django Container"]
            AdminInterface["Admin Interface"]:::management
            RestAPI["REST API"]:::management
            UserMgmt["User Management"]:::management
            BatchCreate["Batch User Creation"]:::management
        end

        %% PostgreSQL Container
        subgraph PostgreSQL["PostgreSQL Container"]
            RadiusDB["RADIUS Database"]:::database
            UserStore["User Store"]:::database
            ConfigStore["Configuration Storage"]:::database
        end
    end

    %% Relationships
    Client --> RadiusCore
    RadiusCore --> GoogleAuth
    RadiusCore --> RadiusDB
    AdminUser --> AdminInterface
    AdminInterface --> UserStore
    RestAPI --> UserStore
    UserMgmt --> UserStore
    BatchCreate --> UserStore

    %% Click Events
    click RadiusCore "https://github.com/matiya/freeradius-google-authenticator/blob/master/raddb/radiusd.conf"
    click Client "https://github.com/matiya/freeradius-google-authenticator/blob/master/raddb/clients.conf"
    click EAP "https://github.com/matiya/freeradius-google-authenticator/tree/master/raddb/mods-available/eap"
    click RadiusDB "https://github.com/matiya/freeradius-google-authenticator/blob/master/compose/postgres/init/schema.sql"
    click PostgreSQL "https://github.com/matiya/freeradius-google-authenticator/blob/master/compose/postgres/init/init-user-db.sh"
    click DjangoApp "https://github.com/matiya/freeradius-google-authenticator/tree/master/compose/django/Dockerfile"
    click RadCerts "https://github.com/matiya/freeradius-google-authenticator/tree/master/certs/freeradius/"
    click PAM "https://github.com/matiya/freeradius-google-authenticator/tree/master/raddb/mods-enabled/"
    click RadiusCore "https://github.com/matiya/freeradius-google-authenticator/tree/master/raddb/sites-available/"
    click RadiusDB "https://github.com/matiya/freeradius-google-authenticator/tree/master/raddb/mods-config/sql/main/postgresql/"
    click DockerEnvironment "https://github.com/matiya/freeradius-google-authenticator/blob/master/docker-compose.yml"
    click BatchCreate "https://github.com/matiya/freeradius-google-authenticator/blob/master/scripts/users.csv"
    click RadiusCore "https://github.com/matiya/freeradius-google-authenticator/blob/master/scripts/start.sh"
    click UserStore "https://github.com/matiya/freeradius-google-authenticator/blob/master/compose/postgres/init/schema.sql"

    %% Legend
    subgraph Legend
        L1["External Interface"]:::external
        L2["Authentication Service"]:::auth
        L3["Management Service"]:::management
        L4["Database Service"]:::database
        L5["Security Component"]:::security
    end
```
