Implement custom SSIDs and WPA2-PSK encryption
This commit is contained in:
parent
1c69a1ebaa
commit
50cf4d5634
10 changed files with 98 additions and 5 deletions
|
@ -24,7 +24,8 @@ config wifi-device 'radio1'
|
||||||
config wifi-iface
|
config wifi-iface
|
||||||
option device 'radio1'
|
option device 'radio1'
|
||||||
option mode 'ap'
|
option mode 'ap'
|
||||||
option encryption 'none'
|
|
||||||
option ssid '$SSID'
|
option ssid '$SSID'
|
||||||
|
option encryption '$ENC'
|
||||||
|
option key '$KEY'
|
||||||
option network 'VPN360'
|
option network 'VPN360'
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ config wifi-iface 'default_radio0'
|
||||||
option device 'radio0'
|
option device 'radio0'
|
||||||
option network 'VPN360'
|
option network 'VPN360'
|
||||||
option mode 'ap'
|
option mode 'ap'
|
||||||
option encryption 'none'
|
option encryption '$ENC'
|
||||||
|
option key '$KEY'
|
||||||
option ifname 'wlan0'
|
option ifname 'wlan0'
|
||||||
option ssid '$SSID'
|
option ssid '$SSID'
|
||||||
|
|
||||||
|
|
28
manager/migrations/0049_auto_20190308_1334.py
Normal file
28
manager/migrations/0049_auto_20190308_1334.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 2.1.5 on 2019-03-08 13:34
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('manager', '0048_auto_20190219_1521'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='model',
|
||||||
|
name='key',
|
||||||
|
field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Broadcast WPA2 Key'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='model',
|
||||||
|
name='ssid',
|
||||||
|
field=models.CharField(blank=True, max_length=32, null=True, verbose_name='Broadcast SSID'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='device',
|
||||||
|
name='wifi',
|
||||||
|
field=models.ManyToManyField(blank=True, to='manager.Wifi'),
|
||||||
|
),
|
||||||
|
]
|
36
manager/migrations/0050_auto_20190308_1342.py
Normal file
36
manager/migrations/0050_auto_20190308_1342.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# Generated by Django 2.1.5 on 2019-03-08 13:42
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('manager', '0049_auto_20190308_1334'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='model',
|
||||||
|
name='key',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='model',
|
||||||
|
name='ssid',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='device',
|
||||||
|
name='key',
|
||||||
|
field=models.CharField(blank=True, max_length=64, null=True, verbose_name='Broadcast WPA2 Key'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='device',
|
||||||
|
name='ssid',
|
||||||
|
field=models.CharField(blank=True, max_length=32, null=True, verbose_name='Broadcast SSID'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='device',
|
||||||
|
name='wifi',
|
||||||
|
field=models.ManyToManyField(blank=True, to='manager.Wifi'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -63,9 +63,11 @@ class Device(models.Model):
|
||||||
reboot = models.BooleanField("Trigger Reboot", default=False)
|
reboot = models.BooleanField("Trigger Reboot", default=False)
|
||||||
changed = models.DateTimeField("Last Change of Device Config", auto_now_add=True)
|
changed = models.DateTimeField("Last Change of Device Config", auto_now_add=True)
|
||||||
wireless = models.DateTimeField("Last Update of Wireless Config", blank=True, null=True, editable=False)
|
wireless = models.DateTimeField("Last Update of Wireless Config", blank=True, null=True, editable=False)
|
||||||
|
ssid = models.CharField("Broadcast SSID", max_length=32, blank=True, null=True)
|
||||||
|
key = models.CharField("Broadcast WPA2 Key", max_length=64, blank=True, null=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s%s" % (self.serial, " (%s)" % self.curip if self.curip else "")
|
return "%s%s" % (self.serial, " (%s)" % self.ssid if self.ssid else "")
|
||||||
|
|
||||||
class DeviceLog(models.Model):
|
class DeviceLog(models.Model):
|
||||||
ADD = 0
|
ADD = 0
|
||||||
|
|
|
@ -53,7 +53,9 @@ def mkfirmware(device, path):
|
||||||
wirein = wireless.read()
|
wirein = wireless.read()
|
||||||
|
|
||||||
with open(tempdir.name + "/etc/config/wireless", "w") as wireout:
|
with open(tempdir.name + "/etc/config/wireless", "w") as wireout:
|
||||||
wire = wirein.replace("$SSID", device.serial)
|
wire = wirein.replace("$SSID", device.ssid or device.serial)
|
||||||
|
wire = wire.replace("$KEY", device.key or "")
|
||||||
|
wire = wire.replace("$ENC", "psk2" if device.key else "none")
|
||||||
wireout.write(wire + "\n" + makewificonfig(device))
|
wireout.write(wire + "\n" + makewificonfig(device))
|
||||||
|
|
||||||
# Create compilation environment
|
# Create compilation environment
|
||||||
|
|
|
@ -478,6 +478,8 @@ def makedevice(request):
|
||||||
device_name = request.POST.get("name", "")
|
device_name = request.POST.get("name", "")
|
||||||
device_organization = request.POST.get("organization", "")
|
device_organization = request.POST.get("organization", "")
|
||||||
device_model = request.POST.get("model", "")
|
device_model = request.POST.get("model", "")
|
||||||
|
device_ssid = request.POST.get("ssid", device_serial)
|
||||||
|
device_key = request.POST.get("key", "")
|
||||||
|
|
||||||
if not device_serial:
|
if not device_serial:
|
||||||
orga = Organization.objects.all()
|
orga = Organization.objects.all()
|
||||||
|
@ -515,6 +517,8 @@ def makedevice(request):
|
||||||
device = Device.objects.create(
|
device = Device.objects.create(
|
||||||
serial=device_serial,
|
serial=device_serial,
|
||||||
name=device_name,
|
name=device_name,
|
||||||
|
ssid=device_ssid,
|
||||||
|
key=device_key,
|
||||||
model=Model.objects.filter(id=device_model)[0],
|
model=Model.objects.filter(id=device_model)[0],
|
||||||
network=Network.objects.filter(intip="No VPN")[0],
|
network=Network.objects.filter(intip="No VPN")[0],
|
||||||
organization=Organization.objects.filter(id=device_organization)[0],
|
organization=Organization.objects.filter(id=device_organization)[0],
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
<label for="name">Device Name</label>
|
<label for="name">Device Name</label>
|
||||||
<input type="text" class="form-control" name="name" id="name" placeholder="Enter Device Name (Optional)"></input>
|
<input type="text" class="form-control" name="name" id="name" placeholder="Enter Device Name (Optional)"></input>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="ssid">Broadcast SSID</label>
|
||||||
|
<input type="text" class="form-control" name="ssid" id="ssid" placeholder="SSID to send, if different from Serial"></input>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="key">WPA2 Key</label>
|
||||||
|
<input type="text" class="form-control" name="key" id="key" value="exp360wifi" placeholder="WPA2 key if using encryption"></input>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="organization">Organization</label>
|
<label for="organization">Organization</label>
|
||||||
<select required class="custom-select mr-sm-2" id="organization" name="organization">
|
<select required class="custom-select mr-sm-2" id="organization" name="organization">
|
||||||
|
|
|
@ -30,6 +30,16 @@
|
||||||
<label for="name">Device Name</label>
|
<label for="name">Device Name</label>
|
||||||
<input type="text" class="form-control" name="name" id="name" placeholder="Enter Device Name (Optional)" {% if device.name %} value="{{ device.name }}" {% endif %}></input>
|
<input type="text" class="form-control" name="name" id="name" placeholder="Enter Device Name (Optional)" {% if device.name %} value="{{ device.name }}" {% endif %}></input>
|
||||||
</div>
|
</div>
|
||||||
|
{% if user.is_staff %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="ssid">Broadcast SSID</label>
|
||||||
|
<input type="text" class="form-control" name="ssid" id="ssid" {% if device.ssid %} value="{{ device.ssid }}" {% endif %} placeholder="SSID to send, if different from Serial"></input>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="key">WPA2 Key</label>
|
||||||
|
<input type="text" class="form-control" name="key" id="key" {% if device.key %} value="{{ device.key }}" {% endif %} placeholder="WPA2 key if using encryption"></input>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="subnet">Assigned Network</label>
|
<label for="subnet">Assigned Network</label>
|
||||||
<select class="custom-select mr-sm-2" id="subnet" name="subnet">
|
<select class="custom-select mr-sm-2" id="subnet" name="subnet">
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
<p><img src="{{ QR_URL }}" alt="QR Code" /></p>
|
<p><img src="{{ QR_URL }}" alt="QR Code" /></p>
|
||||||
{% elif wizard.steps.current == 'sms' %}
|
{% elif wizard.steps.current == 'sms' %}
|
||||||
<p>{% blocktrans %}Please enter the phone number you wish to receive the
|
<p>{% blocktrans %}Please enter the phone number you wish to receive the
|
||||||
text messages on. This number will be validated in the next step.
|
text messages on. This number will be validated in the next step. Make
|
||||||
|
sure to use the international number format, e.g. +43800093004.
|
||||||
{% endblocktrans %}</p>
|
{% endblocktrans %}</p>
|
||||||
{% elif wizard.steps.current == 'call' %}
|
{% elif wizard.steps.current == 'call' %}
|
||||||
<p>{% blocktrans %}Please enter the phone number you wish to be called on.
|
<p>{% blocktrans %}Please enter the phone number you wish to be called on.
|
||||||
|
|
Loading…
Reference in a new issue