Added wifi encrypt

This commit is contained in:
Jan 2019-05-02 11:59:49 +02:00
parent 2eb15bac0e
commit badbe68a1c
4 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-wlan-encryption-psk
PKG_VERSION:=1
include ../gluon.mk
define Package/gluon-wlan-encryption-psk
TITLE:=Encrypt wlan using a pre-shared key (psk)
DEPENDS:=+gluon-core +wpad-mesh-wolfssl
endef
$(eval $(call BuildPackageGluon,gluon-wlan-encryption-psk))

View File

@ -0,0 +1,15 @@
# Gluon wlan encrypt
Encrypt wireless networks in a non-Freifunk setup.
This package allows to encrypt 802.11s and infrastructure networks using a pre shared key (psk).
This setup results in passwords being stored in plain-text. Site-configuration, Firmware-downloads and
Devices must be protected against unauthorized access
*make sure to use exclude hostapd-mini site.mk*
Example configuration:
```lua
wlan_encryption_psk = { mesh = '802.11s.passwd', ap = ' infrastructure.passwd', },
```

View File

@ -0,0 +1 @@
need_table({'wlan_encryption_psk'})

View File

@ -0,0 +1,21 @@
#!/usr/bin/lua
local site = require 'gluon.site'
local uci = require('simple-uci').cursor()
local ap_password = site.wlan_encryption_psk()["ap"]
local mesh_password = site.wlan_encryption_psk()["mesh"]
uci:foreach('wireless', 'wifi-iface', function(wifi_if)
local ifname = wifi_if['.name']
if wifi_if.mode == 'ap' and ap_password ~= nil and ap_password ~= '' then
uci:set('wireless', ifname, 'encryption', 'psk2')
uci:set('wireless', ifname, 'key', ap_password)
elseif wifi_if.mode == "mesh" and mesh_password ~= nil and mesh_password ~= '' then
uci:set('wireless', ifname, 'encryption', 'psk2/aes')
uci:set('wireless', ifname, 'key', mesh_password)
end
end)
uci:save('wireless')