mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2025-04-19 08:55:12 +00:00
DNS primary/secondary not required anymore.
This commit is contained in:
parent
f9860bd808
commit
86f4bdadb0
@ -98,7 +98,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="{{ form.dns_primary.id_for_label }}">{{ form.dns_primary.label }}</label>
|
<label for="{{ form.dns_primary.id_for_label }}">{{ form.dns_primary.label }}</label>
|
||||||
<input type="text" class="form-control" id="{{ form.dns_primary.id_for_label }}" name="{{ form.dns_primary.html_name }}" placeholder="1.1.1.1" value="{{ form.dns_primary.value|default_if_none:'' }}" required>
|
<input type="text" class="form-control" id="{{ form.dns_primary.id_for_label }}" name="{{ form.dns_primary.html_name }}" placeholder="1.1.1.1" value="{{ form.dns_primary.value|default_if_none:'' }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="{{ form.dns_secondary.id_for_label }}">{{ form.dns_secondary.label }}</label>
|
<label for="{{ form.dns_secondary.id_for_label }}">{{ form.dns_secondary.label }}</label>
|
||||||
|
@ -15,7 +15,7 @@ class WireGuardInstanceForm(forms.ModelForm):
|
|||||||
post_up = forms.CharField(label='Post Up', required=False)
|
post_up = forms.CharField(label='Post Up', required=False)
|
||||||
post_down = forms.CharField(label='Post Down', required=False)
|
post_down = forms.CharField(label='Post Down', required=False)
|
||||||
peer_list_refresh_interval = forms.IntegerField(label='Web Refresh Interval', initial=20)
|
peer_list_refresh_interval = forms.IntegerField(label='Web Refresh Interval', initial=20)
|
||||||
dns_primary = forms.GenericIPAddressField(label='Primary DNS', initial='1.1.1.1')
|
dns_primary = forms.GenericIPAddressField(label='Primary DNS', initial='1.1.1.1', required=False)
|
||||||
dns_secondary = forms.GenericIPAddressField(label='Secondary DNS', initial='1.0.0.1', required=False)
|
dns_secondary = forms.GenericIPAddressField(label='Secondary DNS', initial='1.0.0.1', required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0.2 on 2024-03-11 13:28
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('wireguard', '0021_remove_peerallowedip_missing_from_wireguard'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='wireguardinstance',
|
||||||
|
name='dns_primary',
|
||||||
|
field=models.GenericIPAddressField(blank=True, default='1.1.1.1', null=True, protocol='IPv4'),
|
||||||
|
),
|
||||||
|
]
|
@ -56,7 +56,7 @@ class WireGuardInstance(models.Model):
|
|||||||
post_up = models.TextField(blank=True, null=True)
|
post_up = models.TextField(blank=True, null=True)
|
||||||
post_down = models.TextField(blank=True, null=True)
|
post_down = models.TextField(blank=True, null=True)
|
||||||
peer_list_refresh_interval = models.IntegerField(default=20)
|
peer_list_refresh_interval = models.IntegerField(default=20)
|
||||||
dns_primary = models.GenericIPAddressField(unique=False, protocol='IPv4', default='1.1.1.1')
|
dns_primary = models.GenericIPAddressField(unique=False, protocol='IPv4', default='1.1.1.1', blank=True, null=True)
|
||||||
dns_secondary = models.GenericIPAddressField(unique=False, protocol='IPv4', default='1.0.0.1', blank=True, null=True)
|
dns_secondary = models.GenericIPAddressField(unique=False, protocol='IPv4', default='1.0.0.1', blank=True, null=True)
|
||||||
pending_changes = models.BooleanField(default=True)
|
pending_changes = models.BooleanField(default=True)
|
||||||
legacy_firewall = models.BooleanField(default=False)
|
legacy_firewall = models.BooleanField(default=False)
|
||||||
|
@ -35,12 +35,14 @@ def generate_peer_config(peer_uuid):
|
|||||||
allowed_ips_line = ", ".join([f"{ip.allowed_ip}/{ip.netmask}" for ip in allowed_ips])
|
allowed_ips_line = ", ".join([f"{ip.allowed_ip}/{ip.netmask}" for ip in allowed_ips])
|
||||||
else:
|
else:
|
||||||
allowed_ips_line = "0.0.0.0/0, ::/0"
|
allowed_ips_line = "0.0.0.0/0, ::/0"
|
||||||
|
dns_entries = [wg_instance.dns_primary, wg_instance.dns_secondary]
|
||||||
|
dns_line = ", ".join(filter(None, dns_entries))
|
||||||
|
|
||||||
config_lines = [
|
config_lines = [
|
||||||
"[Interface]",
|
"[Interface]",
|
||||||
f"PrivateKey = {peer.private_key}" if peer.private_key else "",
|
f"PrivateKey = {peer.private_key}" if peer.private_key else "",
|
||||||
f"Address = {client_address}",
|
f"Address = {client_address}",
|
||||||
f"DNS = {wg_instance.dns_primary}" + (f", {wg_instance.dns_secondary}" if wg_instance.dns_secondary else ""),
|
f"DNS = {dns_line}" if dns_line else "",
|
||||||
"\n[Peer]",
|
"\n[Peer]",
|
||||||
f"PublicKey = {wg_instance.public_key}",
|
f"PublicKey = {wg_instance.public_key}",
|
||||||
f"Endpoint = {wg_instance.hostname}:{wg_instance.listen_port}",
|
f"Endpoint = {wg_instance.hostname}:{wg_instance.listen_port}",
|
||||||
|
@ -129,6 +129,6 @@ STATICFILES_DIRS = [
|
|||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
WIREGUARD_WEBADMIN_VERSION = 9601
|
WIREGUARD_WEBADMIN_VERSION = 9602
|
||||||
|
|
||||||
from wireguard_webadmin.production_settings import *
|
from wireguard_webadmin.production_settings import *
|
Loading…
x
Reference in New Issue
Block a user