50 lines
1.5 KiB
Markdown
50 lines
1.5 KiB
Markdown
# OpenVPN Profiler API
|
|
|
|
A modern, Python-based REST API for managing OpenVPN servers, Public Key Infrastructure (PKI), and user profiles. This component is located in `APP_PROFILER/`.
|
|
|
|
## Features
|
|
|
|
* **REST API**: Built with FastAPI for robust performance and automatic documentation.
|
|
* **Database Storage**: Configurations and user profiles are stored in SQLite (extensible to other DBs via SQLAlchemy).
|
|
* **PKI Management**: Integrated management of EasyRSA for CA, Server, and Client certificate generation.
|
|
* **Dynamic Configuration**: Templated generation of `server.conf` and client `.ovpn` files using Jinja2.
|
|
|
|
## Quick Start
|
|
|
|
### Prerequisites
|
|
|
|
* Python 3.10 or higher
|
|
* OpenVPN (installed and available in PATH)
|
|
* Easy-RSA 3 (must be present in the `easy-rsa` directory in the project root)
|
|
|
|
### Usage
|
|
|
|
Once the server is running (see [Deployment Guide](../General/Deployment.md)), the full interactive API documentation is available at:
|
|
* **Swagger UI**: `http://<your-server>:8000/docs`
|
|
* **ReDoc**: `http://<your-server>:8000/redoc`
|
|
|
|
### Common Operations
|
|
|
|
**Create a new User Profile:**
|
|
```bash
|
|
curl -X POST "http://localhost:8000/profiles" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"username": "jdoe"}'
|
|
```
|
|
|
|
**Download User Config:**
|
|
```bash
|
|
# Get the ID from the profile creation response or list
|
|
curl -O -J http://localhost:8000/profiles/1/download
|
|
```
|
|
|
|
**Revoke User:**
|
|
```bash
|
|
curl -X DELETE http://localhost:8000/profiles/1
|
|
```
|
|
|
|
**Get System Configuration:**
|
|
```bash
|
|
curl http://localhost:8000/config
|
|
```
|