ready for public

This commit is contained in:
2025-04-01 12:13:39 -04:00
parent eb5d9bc3f9
commit 0754f332c9
12 changed files with 36 additions and 31 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.env
*.pyc
__pycache__/
*.log
/app/logs/
instance/
.env.*

View File

@@ -20,16 +20,21 @@ A lightweight web UI to manage MAC address-based FreeRADIUS configurations backe
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 `rad_description` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` char(12) DEFAULT NULL,
`description` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE IF NOT EXISTS mac_vendor_cache (
mac_prefix VARCHAR(6) PRIMARY KEY,
vendor_name VARCHAR(255),
last_updated TIMESTAMP
);
CREATE TABLE `mac_vendor_cache` (
`mac_prefix` varchar(6) NOT NULL,
`vendor_name` varchar(255) DEFAULT NULL,
`status` enum('found','not_found') DEFAULT 'found',
`last_checked` datetime DEFAULT current_timestamp(),
`last_updated` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`mac_prefix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
```
---

View File

@@ -4,15 +4,11 @@ from views.user_views import user
from views.group_views import group
from config import app_config
from database import init_app
import logging
import os, 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)
if app.config['LOG_TO_FILE']:
handler = RotatingFileHandler(app.config['LOG_FILE_PATH'], maxBytes=1000000, backupCount=3)
handler.setLevel(logging.INFO)
app.logger.addHandler(handler)

View File

@@ -1,11 +1,16 @@
import os
class Config:
"""Base configuration."""
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.getenv('FLASK_SECRET_KEY', 'default-insecure-key')
# Logging
LOG_TO_FILE = os.getenv('LOG_TO_FILE', 'false').lower() == 'true'
LOG_FILE_PATH = os.getenv('LOG_FILE_PATH', '/app/logs/app.log')
# MAC Lookup API
OUI_API_URL = os.getenv('OUI_API_URL', 'https://api.maclookup.app/v2/macs/{}')
OUI_API_KEY = os.getenv('OUI_API_KEY', '')
OUI_API_LIMIT_PER_SEC = int(os.getenv('OUI_API_LIMIT_PER_SEC', '2'))

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
app/static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -228,9 +228,9 @@ def refresh_vendors():
db = get_db()
cursor = db.cursor(dictionary=True)
api_url = os.getenv('MACLOOKUP_API_URL', 'https://api.maclookup.app/v2/macs/{}').strip('"')
api_key = os.getenv('MACLOOKUP_API_KEY', '').strip('"')
limit = int(os.getenv('MACLOOKUP_RATE_LIMIT', 2))
api_url = os.getenv('OUI_API_API_URL', 'https://api.maclookup.app/v2/macs/{}').strip('"')
api_key = os.getenv('OUI_API_API_KEY', '').strip('"')
limit = int(os.getenv('OUI_API_RATE_LIMIT', 2))
headers = {'Authorization': f'Bearer {api_key}'} if api_key else {}
cursor.execute("""

View File

@@ -7,20 +7,12 @@ services:
dockerfile: Dockerfile
volumes:
- ./app:/app
env_file:
- .env
environment:
- FLASK_APP=app.py
- FLASK_ENV=development
- MYSQL_HOST=192.168.60.150
- MYSQL_USER=user_92z0Kj
- MYSQL_PASSWORD=5B3UXZV8vyrB
- MYSQL_DATABASE=radius_NIaIuT
- FLASK_SECRET_KEY=default-insecure-key
- PYTHONPATH=/app
- 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: