Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bobycx/bobvpn2_restapi
https://github.com/bobycx/bobvpn2_restapi
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bobycx/bobvpn2_restapi
- Owner: bobycx
- Created: 2023-06-10T14:10:54.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-06-12T13:34:25.000Z (over 1 year ago)
- Last Synced: 2024-11-12T17:20:41.522Z (2 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### How I deployed on my Ubuntu server
**Set up NGINX + Firewall rules**
1. `apt install nginx`
2. `vim /etc/nginx/sites-enabled/fastapi_nginx````
server {
listen 80;
server_name MYSERVERIP;
location / {
proxy_pass http://127.0.0.1:8003;
}
}
```3. `sudo ufw allow 'Nginx HTTP'`
4. `sudo ufw enable`
5. `sudo service nginx restart`**Prep the config database directory**
1. `mkdir ~/ovpn-client-configs/`**Start the API service**
1. `sudo chmod +x ./generate_config`
2. `uvicorn bobvpnAPI:app --port 8003`or with [pm2](https://pm2.keymetrics.io/): `pm2 start "uvicorn bobvpnAPI:app --port 8003" --name bobapi`
## API Reference
### Generate Config [POST]
Generates an OpenVPN config file for a client.
- **URL**: `/generate_config`
- **Method**: `POST`
- **Headers**:
- `Content-Type: application/json`
- `Authorization: Bearer {api-key}`
- **Parameters**:
- `client_name` (string): The name of the client for whom to generate the config file.
- **Response**:
- **200 OK**:
- Content-Type: application/octet-stream
- Body: The generated OpenVPN config file.
- **401 Unauthorized**:
- Body: Invalid or missing API Key.#### Example
```http
POST /generate_config HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Authorization: Bearer BOBVPNISTHEBEST{
"client_name": "john_doe"
}
```Response:
```http
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="john_doe.ovpn"```
or
```http
HTTP/1.1 401 Unauthorized
Content-Type: application/json{
"detail": "Invalid or missing API Key"
}
```