getting ready to public
This commit is contained in:
77
README.md
77
README.md
@@ -1 +1,76 @@
|
||||
This is a project that allows me to simplify freeradius user management with mac address authentication as it's primary focus.
|
||||
|
||||
```markdown
|
||||
# FreeRADIUS Manager (Phase 1)
|
||||
|
||||
A lightweight web UI to manage MAC address-based FreeRADIUS configurations backed by a MariaDB/MySQL database.
|
||||
|
||||
## Features
|
||||
- Add/edit/delete MAC-based users and VLAN assignments
|
||||
- View Access-Accept and Access-Reject logs
|
||||
- Lookup MAC vendors using maclookup.app API
|
||||
- Dynamically populate vendor cache to reduce API usage
|
||||
|
||||
---
|
||||
|
||||
## Requirements (Phase 1)
|
||||
- Existing FreeRADIUS installation
|
||||
- Existing MariaDB or MySQL server with access credentials
|
||||
|
||||
### Required Tables
|
||||
Add the following tables to your RADIUS database:
|
||||
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS rad_description (
|
||||
username VARCHAR(64) PRIMARY KEY,
|
||||
description TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mac_vendor_cache (
|
||||
mac_prefix VARCHAR(6) PRIMARY KEY,
|
||||
vendor_name VARCHAR(255),
|
||||
last_updated TIMESTAMP
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
### 1. Clone this repo
|
||||
```bash
|
||||
git clone https://github.com/yourname/freeradius-manager.git
|
||||
cd freeradius-manager
|
||||
```
|
||||
|
||||
### 2. Configure environment
|
||||
Create a `.env` file or configure environment variables:
|
||||
|
||||
```env
|
||||
FLASK_SECRET_KEY=super-secret-key
|
||||
MYSQL_HOST=192.168.1.100
|
||||
MYSQL_USER=radiususer
|
||||
MYSQL_PASSWORD=yourpassword
|
||||
MYSQL_DATABASE=radius
|
||||
OUI_API_KEY= (leave empty for free tier)
|
||||
OUI_API_LIMIT_PER_SEC=2
|
||||
OUI_API_DAILY_LIMIT=10000
|
||||
```
|
||||
|
||||
### 3. Run using Docker Compose
|
||||
```bash
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
- The MAC vendor database will auto-populate as addresses are discovered
|
||||
- Only MAC-based users are supported in this release
|
||||
|
||||
---
|
||||
|
||||
## Phase 2 Goals
|
||||
- Integrate FreeRADIUS server into Docker Compose
|
||||
- Optional MariaDB container
|
||||
- Provide self-contained stack for local or cloud deployment
|
||||
```
|
||||
@@ -1,13 +1,23 @@
|
||||
FROM python:3.9-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
# Create logs directory
|
||||
RUN mkdir -p /app/logs
|
||||
|
||||
# Install dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN apt-get update && apt-get install -y iputils-ping telnet # Add these lines
|
||||
# Optional tools (useful for debugging)
|
||||
RUN apt-get update && apt-get install -y iputils-ping telnet && apt-get clean
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
CMD ["python", "app.py"]
|
||||
# Expose port (optional, for documentation)
|
||||
EXPOSE 8080
|
||||
|
||||
# Default command to run app with Gunicorn
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "wsgi:app"]
|
||||
|
||||
BIN
app/__pycache__/app.cpython-39.pyc
Normal file
BIN
app/__pycache__/app.cpython-39.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/wsgi.cpython-39.pyc
Normal file
BIN
app/__pycache__/wsgi.cpython-39.pyc
Normal file
Binary file not shown.
13
app/app.py
13
app/app.py
@@ -4,6 +4,19 @@ from views.user_views import user
|
||||
from views.group_views import group
|
||||
from config import app_config
|
||||
from database import init_app
|
||||
import logging
|
||||
from logging.handlers import RotatingFileHandler
|
||||
import os
|
||||
|
||||
log_to_file = os.getenv('LOG_TO_FILE', 'false').lower() == 'true'
|
||||
log_file_path = os.getenv('LOG_FILE_PATH', '/app/logs/app.log')
|
||||
|
||||
if log_to_file:
|
||||
handler = RotatingFileHandler(log_file_path, maxBytes=1000000, backupCount=3)
|
||||
handler.setLevel(logging.INFO)
|
||||
app.logger.addHandler(handler)
|
||||
|
||||
app.logger.setLevel(logging.INFO)
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(app_config)
|
||||
|
||||
@@ -2,4 +2,5 @@ Flask
|
||||
mysql-connector-python
|
||||
requests
|
||||
BeautifulSoup4
|
||||
lxml
|
||||
lxml
|
||||
gunicorn
|
||||
@@ -1,6 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
|
||||
<meta name="description" content="FreeRADIUS Web Manager">
|
||||
<meta name="author" content="Simon Cloutier">
|
||||
<meta property="og:title" content="FreeRADIUS Manager">
|
||||
<meta property="og:description" content="Manage FreeRADIUS MAC authentication visually">
|
||||
<meta property="og:type" content="website">
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{% block title %}FreeRADIUS Manager{% endblock %}</title>
|
||||
|
||||
4
app/wsgi.py
Normal file
4
app/wsgi.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from app import app
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
@@ -19,6 +19,8 @@ services:
|
||||
- MACLOOKUP_RATE_LIMIT=2
|
||||
- MACLOOKUP_API_KEY="" # if using a key later
|
||||
- MACLOOKUP_API_URL="https://api.maclookup.app/v2/macs/{}"
|
||||
- LOG_TO_FILE=true
|
||||
- LOG_FILE_PATH=/app/logs/app.log
|
||||
restart: no
|
||||
|
||||
nginx:
|
||||
|
||||
Reference in New Issue
Block a user