Commit graph

17 commits

Author SHA1 Message Date
b54bf87d59
feat: enhance SubnetField to support non-strict IP parsing
Updated SubnetField methods to use `ip_network` with `strict=False`, allowing for more lenient IP address parsing. Added `value_to_string` method to improve serialization of SubnetField values. This enhances flexibility and ensures robust handling of various IP formats.
2024-07-12 14:17:51 +02:00
245f50d0fd
fix: increase max_length of SubnetField for IPv6 subnets
Increased the max_length attribute of SubnetField from 43 to 45 to properly accommodate the longest possible IPv6 subnet representation. This adjustment ensures that all valid IPv6 subnets can be correctly stored, preventing potential data truncation issues.
2024-07-12 14:17:14 +02:00
eb50798b14
feat(vpn): enhance setup form with IP address fields
- Added IPv4 and IPv6 address fields to the device setup form.
- Display VPN name in the header for clarity.
- Modified configuration generation to use inputted IP addresses.
- Updated server details and endpoints with dynamic data from VPN context.
- Implemented CSRF-secured device addition via API call.

These changes improve user input flexibility and streamline device configuration setup.
2024-07-12 14:12:19 +02:00
0bfde0841e
feat(vpn): add setup device UI with Wireguard config generator
Introduced a new HTML template for setting up VPN devices. This template includes a form to input the device name, generating Wireguard configuration and displaying it both in text and as a QR code. Utilizes Wireguard Crypto library for key generation and QRCode.js for QR code generation.

This enhancement streamlines the VPN setup process for users by providing an automated way to generate necessary configuration and an easy-to-scan QR code for mobile devices.
2024-07-12 14:11:28 +02:00
72d23e4c33
fix: improve port assignment for VPN instances
Modified the port assignment logic to avoid potential collisions by pre-filtering used ports before selecting from the available pool. This ensures each VPN instance gets a unique port more efficiently, reducing the risk of assignment conflicts and improving the reliability of VPN setup.
2024-07-12 11:01:16 +02:00
08b4b28645
fix: ensure unique VPN port assignment
Updated the port assignment logic to guarantee that a newly assigned port is unique by avoiding conflicts with existing port assignments. This addresses potential issues with port collisions that could disrupt VPN operations.
2024-07-12 10:59:11 +02:00
ed86554e54
feat(admin): register VPN and Device models
Added VPN and Device models to the Django admin site for easier management and interaction through the administrative interface. This change improves the efficiency of handling these models by providing easy access to their data and operations.
2024-07-12 10:58:07 +02:00
083a3a4c7b
feat(users): combine first and last name into a single field
Replaced separate `first_name` and `last_name` fields with a unified
`name` field in the CustomUser model to simplify user data management.
Updated migration script to reflect this change.

This modification should streamline the handling of users' names, reduce
complexity in name fields, and address potential issues around name
localization and formatting.
2024-07-12 10:56:29 +02:00
dfb80d2aa3
feat: add CSRF trusted origins and new OTP plugin
Included CSRF_TRUSTED_ORIGINS for enhanced security based on ALLOWED_HOSTS. Updated ALLOWED_HOSTS config key from "AllowedHosts" to "Hosts" for consistency. Added `django_otp.plugins.otp_static` to INSTALLED_APPS for better OTP functionality.

Resolves issues with CSRF protection and OTP security.
2024-07-12 10:56:18 +02:00
89d908883a
feat(routing): streamline account URLs and remove custom login
- Integrated two-factor authentication URLs at the root level for cleaner URL structure
- Removed redundant custom login template, likely improving maintainability by relying on the default authentication views
2024-07-12 10:50:05 +02:00
928cd4a3d0
feat(vscode): configure dev server port to 8110 in launch.json
Updated VSCode launch configuration to explicitly set the Django development server to run on port 8110. This ensures consistency across different development environments and resolves conflicts with default ports.
2024-07-12 10:46:50 +02:00
5e202ac58d
feat(auth): implement two-factor authentication
Added Two-Factor Authentication (2FA) using django-otp and django-two-factor-auth along with support for custom user models. Introduced necessary settings, middleware, and URL patterns to support 2FA. Updated dependencies in pyproject.toml and poetry.lock.

- Included `django_otp` and `two_factor` modules.
- Configured custom user model with email as the primary identifier.
- Added new migrations and models for CustomUser.
- Incorporated login templates for two-factor authentication.
- Enabled two-factor login URLs and middleware.

This enhancement strengthens account security by requiring a second authentication factor.
2024-07-12 09:47:23 +02:00
b92e8871a1
feat(migrations): add initial VPN and Device models
Introduce initial database migration to create VPN and Device models.
These models include fields for UUID primary keys, encrypted keys,
and subnet fields, with foreign key relations to user accounts and
VPN instances. This migration sets up essential entities for the VPN
module, providing the foundational structure for VPN and device
management.
2024-07-12 08:41:48 +02:00
11e8fe8912
feat(settings): enhance configuration handling
Updated settings to ensure "ColdBrew" section exists in the config before accessing it. Defaulted `FIELD_ENCRYPTION_KEY` to a generated value if not present and corrected encoding. Made `ALLOWED_HOSTS` configurable via settings file and adjusted `DEBUG` logic to depend on `ALLOWED_HOSTS`.
2024-07-12 08:41:33 +02:00
d2893c3ffa
feat: add debugging configuration for Django in VSCode
Included a new launch.json for VSCode to enable easy debugging
of Django projects using the Python Debugger. This configuration
launches the Django server with debugpy, making it simpler for
developers to set breakpoints and debug their applications directly
within the editor.
2024-07-12 08:41:06 +02:00
c7c05f2677
feat(models): add validators for VPN port range
Added MinValueValidator and MaxValueValidator for the port field in the VPN model to ensure values are between 10000 and 40000. This change enforces port number constraints directly in the model, preventing invalid entries and improving data integrity.
2024-07-12 08:40:41 +02:00
e1bf6b9901
feat: initialize project structure with core setup
Initial setup of the ColdBrew Django-based VPN manager project. Added basic project structure including core Django configurations and essential files:
- Added `.gitignore` to exclude unnecessary files from version control.
- Introduced `LICENSE` with MIT license.
- Created basic `README.md` with setup and contribution guidance.
- Configured Django project settings with auto-generated secrets.
- Implemented essential VPN management models, views, and admin settings.
- Integrated core dependencies like Django Rest Framework, Celery for task management, and Redis for caching.
- Added Poetry for dependency management along with necessary dependencies for development and database support.
2024-07-12 08:31:39 +02:00