# ahmetyasarnet/strongswantoken architecture

> Architecture diagram of the GitHub repository ahmetyasarnet/strongswantoken, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmetyasarnet/strongswantoken
- Repository: https://github.com/ahmetyasarnet/strongswantoken

## Overview

This repository provides a small FortiToken-enabled IPsec connection workflow for Ubuntu: a user enters a one-time code, the connect script stages it for the patched strongSwan plugin, and strongSwan completes XAuth with the FortiGate and establishes the tunnel. The example swanctl configuration supplies connection and credential settings; a separate script closes the connection. The graph follows relationships documented in the README; source excerpts were not available, so implementation details beyond those statements are omitted.

Main entry points: [`bin/forti-baglan`](https://github.com/ahmetyasarnet/strongswantoken/blob/main/bin/forti-baglan) (Connect script), [`bin/forti-kes`](https://github.com/ahmetyasarnet/strongswantoken/blob/main/bin/forti-kes) (Disconnect script), [`config/forti.conf.example`](https://github.com/ahmetyasarnet/strongswantoken/blob/main/config/forti.conf.example) (swanctl configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["User commands"]
  node_connect["Connect script"]
  node_disconnect["Disconnect script"]
end

subgraph group_auth["XAuth integration"]
  node_otp["One-time code file"]
  node_plugin["Patched XAuth plugin"]
end

subgraph group_vpn["VPN connection"]
  node_swanctl["swanctl configuration<br/>[forti.conf.example]"]
  node_daemon["strongSwan daemon"]
  node_tunnel["Established VPN tunnel"]
end

node_user(("Administrator"))
node_gateway["FortiGate"]

node_user -->|"enters code"| node_connect
node_connect -->|"writes code"| node_otp
node_connect -->|"initiates via swanctl"| node_daemon
node_swanctl -->|"configures"| node_daemon
node_gateway -->|"requests X_CODE"| node_daemon
node_daemon -->|"dispatches X_CODE"| node_plugin
node_plugin -->|"reads and deletes"| node_otp
node_daemon -->|"authenticates with code"| node_gateway
node_daemon -->|"establishes"| node_tunnel
node_user -->|"requests disconnect"| node_disconnect
node_disconnect -->|"closes connection"| node_daemon

click node_connect "https://github.com/ahmetyasarnet/strongswantoken/blob/main/bin/forti-baglan"
click node_disconnect "https://github.com/ahmetyasarnet/strongswantoken/blob/main/bin/forti-kes"
click node_swanctl "https://github.com/ahmetyasarnet/strongswantoken/blob/main/config/forti.conf.example"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_connect,node_disconnect toneBlue
class node_otp,node_plugin toneAmber
class node_swanctl,node_daemon,node_tunnel toneMint
class node_user,node_gateway toneIndigo
```

## Components

### User commands

- [Connect script](https://github.com/ahmetyasarnet/strongswantoken/blob/main/bin/forti-baglan): `bin/forti-baglan`
- [Disconnect script](https://github.com/ahmetyasarnet/strongswantoken/blob/main/bin/forti-kes): `bin/forti-kes`

### XAuth integration

- **One-time code file**
- **Patched XAuth plugin**

### VPN connection

- [swanctl configuration](https://github.com/ahmetyasarnet/strongswantoken/blob/main/config/forti.conf.example): `config/forti.conf.example`
- **strongSwan daemon**
- **Established VPN tunnel**

### Other components

- **Administrator**
- **FortiGate**

## Connections

- Administrator → Connect script: enters code (evidence: `README.md`)
- Connect script → One-time code file: writes code (evidence: `README.md`)
- Connect script → strongSwan daemon: initiates via swanctl (evidence: `README.md`)
- swanctl configuration → strongSwan daemon: configures (evidence: `README.md`)
- FortiGate → strongSwan daemon: requests X_CODE (evidence: `README.md`)
- strongSwan daemon → Patched XAuth plugin: dispatches X_CODE (evidence: `README.md`)
- Patched XAuth plugin → One-time code file: reads and deletes (evidence: `README.md`)
- strongSwan daemon → FortiGate: authenticates with code (evidence: `README.md`)
- strongSwan daemon → Established VPN tunnel: establishes (evidence: `README.md`)
- Administrator → Disconnect script: requests disconnect (evidence: `README.md`)
- Disconnect script → strongSwan daemon: closes connection (evidence: `README.md`)
