1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Encryption can be changed using the wizard

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-09-22 08:33:54 +02:00
parent eaea34503b
commit 4c28f46b06
2 changed files with 41 additions and 6 deletions

View file

@ -385,17 +385,28 @@ function wizard_add()
ucic:save("nginx-ha") ucic:save("nginx-ha")
ucic:commit("nginx-ha") ucic:commit("nginx-ha")
ucic:save("openvpn") ucic:save("openvpn")
ucic:commit("openvpn") --ucic:commit("openvpn")
ucic:save("mlvpn") ucic:save("mlvpn")
ucic:commit("mlvpn") --ucic:commit("mlvpn")
ucic:save("dsvpn") ucic:save("dsvpn")
ucic:commit("dsvpn") --ucic:commit("dsvpn")
ucic:save("glorytun") ucic:save("glorytun")
ucic:commit("glorytun") --ucic:commit("glorytun")
ucic:save("shadowsocks-libev") ucic:save("shadowsocks-libev")
ucic:commit("shadowsocks-libev") --ucic:commit("shadowsocks-libev")
local encryption = luci.http.formvalue("encryption")
if encryption == "none" then
ucic:set("shadowsocks-libev","sss0","method","none")
elseif encryption == "aes-256-gcm" then
ucic:set("shadowsocks-libev","sss0","method","aes-256-gcm")
ucic:set("glorytun","vpn","chacha20","0")
elseif encryption == "chacha20" then
ucic:set("shadowsocks-libev","sss0","method","chacha20")
ucic:set("glorytun","vpn","chacha20","1")
end
-- Set ShadowSocks settings -- Set ShadowSocks settings
local shadowsocks_key = luci.http.formvalue("shadowsocks_key") local shadowsocks_key = luci.http.formvalue("shadowsocks_key")
local shadowsocks_disable = luci.http.formvalue("disableshadowsocks") or "0" local shadowsocks_disable = luci.http.formvalue("disableshadowsocks") or "0"
@ -429,7 +440,6 @@ function wizard_add()
ucic:set("glorytun","vpn","port","65001") ucic:set("glorytun","vpn","port","65001")
ucic:set("glorytun","vpn","key",glorytun_key) ucic:set("glorytun","vpn","key",glorytun_key)
ucic:set("glorytun","vpn","mptcp",1) ucic:set("glorytun","vpn","mptcp",1)
ucic:set("glorytun","vpn","chacha20",1)
if default_vpn == "glorytun_udp" then if default_vpn == "glorytun_udp" then
ucic:set("glorytun","vpn","proto","udp") ucic:set("glorytun","vpn","proto","udp")
ucic:set("glorytun","vpn","localip","10.255.254.2") ucic:set("glorytun","vpn","localip","10.255.254.2")

View file

@ -5,6 +5,7 @@
local net = require "luci.model.network".init() local net = require "luci.model.network".init()
local fs = require "nixio.fs" local fs = require "nixio.fs"
local sys = require "luci.sys" local sys = require "luci.sys"
local ut = require "luci.util"
local ifaces = sys.net:devices() local ifaces = sys.net:devices()
local servers_ip = {} local servers_ip = {}
local server_ip = uci:get("shadowsocks-libev","sss0","server") local server_ip = uci:get("shadowsocks-libev","sss0","server")
@ -148,6 +149,30 @@ end
<input class="cbi-input-checkbox" type="checkbox" name="disableshadowsocks" value="1" <% if uci:get("shadowsocks-libev","sss0","disabled") == "1" then %>checked<% end %> /> <input class="cbi-input-checkbox" type="checkbox" name="disableshadowsocks" value="1" <% if uci:get("shadowsocks-libev","sss0","disabled") == "1" then %>checked<% end %> />
</div> </div>
</div> </div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Encryption%></label>
<div class="cbi-value-field">
<select class="cbi-input-select" name="encryption" size="1">
<%
local method=uci:get("shadowsocks-libev","sss0","method")
%>
<option value="none" <% if method == "none" then %>selected="selected"<% end %>><%:None%></option>
<option value="aes-256-gcm" <% if method == "aes-256-gcm" then %>selected="selected"<% end %>>AES-256-GCM</option>
<option value="chacha20" <% if method == "chacha20" then %>selected="selected"<% end %>>chacha20</option>
<option value="other" <% if method ~= "chacha20" and method ~= "aes-256-gcm" and method ~= "none" then %>selected="selected"<% end %>><%:other%></option>
</select>
<br />
<div class="cbi-value-description">
<%
if ut.trim(sys.exec("cat /proc/cpuinfo | grep aes")) ~= "" then
%>
<%:An Advanced Encryption Standard (AES) instruction set is integrated in the processor.%>
<% else %>
<%:There is no Advanced Encryption Standard (AES) instruction set integrated in the processor, you should use chacha20.%>
<% end %>
</div>
</div>
</div>
</fieldset> </fieldset>
<fieldset class="cbi-section" id="vpn"> <fieldset class="cbi-section" id="vpn">
<legend><%:VPN settings%></legend> <legend><%:VPN settings%></legend>