first commit

main
Ben 1 year ago
commit b5ed8b8cf6

@ -0,0 +1,16 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for TorGuard OpenVPN
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+openvpn-openssl
define Package/tgopenvpn/conffiles
/etc/config/tgopenvpn_cfg
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

@ -0,0 +1,4 @@
module("luci.controller.admin.tgopenvpn", package.seeall)
function index()
entry({"admin", "vpn", "tgopenvpn"}, cbi("torguard/tgopenvpn"), _("TorGuard OpenVPN"), 102)
end

@ -0,0 +1,134 @@
-- Import the necessary LuCI modules
local uci = require("luci.model.uci").cursor()
local sys = require("luci.sys")
local util = require("luci.util")
-- Define the model
m = Map("tgopenvpn_cfg", "TorGuard OpenVPN Setup")
-- Define the section for the OpenVPN settings
s = m:section(TypedSection, "ovpnconfig", "OpenVPN Settings")
s.anonymous = true
s.addremove = false
-- Define the input fields for the OpenVPN settings
user = s:option(Value, "username", translate("VPN Username"))
pass = s:option(Value, "password", translate("VPN Password"))
pass.password = true
svr = s:option(ListValue, "server", translate("VPN Server"))
-- Add all servers here
svr:value("ar.torguard.com", "Argentina")
svr:value("au.torguard.com", "Australia Sydney")
svr:value("aus.torguard.com", "Austria")
svr:value("bg.torguard.com", "Belgium")
svr:value("br.torguard.com", "Brazil 1")
svr:value("br2.torguard.com", "Brazil 2")
svr:value("bul.torguard.com", "Bulgaria")
svr:value("ca.torguard.com", "Canada Toronto")
svr:value("cavan.torguard.com", "Canada Vancouver")
svr:value("ch.torguard.com", "Chile")
svr:value("cz.torguard.com", "Czech Republic")
svr:value("dn.torguard.com", "Denmark")
svr:value("fn.torguard.com", "Finland")
svr:value("fr.torguard.com", "France")
svr:value("ger.torguard.com", "Germany")
svr:value("gre.torguard.com", "Greece")
svr:value("hk.torguard.com", "Hong Kong")
svr:value("hg.torguard.com", "Hungary")
svr:value("ice.torguard.com", "Iceland")
svr:value("in.torguard.com", "India Mumbai")
svr:value("ire.torguard.com", "Ireland")
svr:value("isr-loc1.torguard.com", "Israel Tel Aviv")
svr:value("it.torguard.com", "Italy")
svr:value("id.torguard.com", "Indonesia")
svr:value("jp.torguard.com", "Japan")
svr:value("lux.torguard.com", "Luxembourg")
svr:value("mx.torguard.com", "Mexico")
svr:value("md.torguard.com", "Moldova")
svr:value("nl.torguard.com", "Netherlands")
svr:value("nz.torguard.com", "New Zealand")
svr:value("no.torguard.com", "Norway")
svr:value("pl.torguard.com", "Poland")
svr:value("pg.torguard.com", "Portugal")
svr:value("ro.torguard.com", "Romania")
svr:value("ru.torguard.com", "Russia")
svr:value("sg.torguard.com", "Singapore")
svr:value("slk.torguard.com", "Slovakia")
svr:value("sp.torguard.com", "Spain")
svr:value("sk.torguard.com", "South Korea")
svr:value("sa.torguard.com", "South Africa")
svr:value("swe.torguard.com", "Sweden")
svr:value("swiss.torguard.com", "Switzerland")
svr:value("tw.torguard.com", "Taiwan")
svr:value("th.torguard.com", "Thailand")
svr:value("tk.torguard.com", "Turkey")
svr:value("uae.torguard.com", "UAE")
svr:value("uk.torguard.com", "UK London")
svr:value("uk.man.torguard.com", "UK Manchester")
svr:value("ukr.torguard.com", "Ukraine")
svr:value("us-fl.torguard.com", "USA Miami")
svr:value("us-atl.torguard.com", "USA Atlanta")
svr:value("us-ny.torguard.com", "USA New York")
svr:value("us-chi.torguard.com", "USA Chicago")
svr:value("us-chi-loc2.torguard.com", "USA Chicago 2")
svr:value("us-dal.torguard.com", "USA Dallas")
svr:value("us-dal-loc2.torguard.com", "USA Dallas 2")
svr:value("us-la.torguard.com", "USA LA")
svr:value("us-lv.torguard.com", "USA Las Vegas")
svr:value("us-sa.torguard.com", "USA Seattle")
svr:value("us-sf.torguard.com", "USA San Francisco")
svr:value("us-nj.torguard.com", "USA New Jersey")
svr:value("us-nj-loc2.torguard.com", "USA New Jersey 2")
svr:value("us-slc.torguard.com", "USA Salt Lake City")
dedicated = s:option(ListValue, "dedicated", translate("Use Dedicated IP"))
dedicated:value("YES")
dedicated:value("NO")
dediserver = s:option(Value, "dediserver", translate("Dedicated IP"))
protocol = s:option(ListValue, "protocol", translate("VPN Protocol"))
protocol:value("udp")
protocol:value("tcp")
port = s:option(ListValue, "port", translate("VPN Port"))
-- Add all ports here
port:value("1912|SHA256", "1912|SHA256")
port:value("1195|SHA256", "1195|SHA256")
port:value("53|SHA256", "53|SHA256")
port:value("1198|SHA256", "1198|SHA256")
port:value("9201|SHA256", "9201|SHA256")
port:value("501|SHA256", "501|SHA256")
port:value("1194|SHA1", "1194|SHA1")
port:value("995|SHA1", "995|SHA1")
port:value("1215|SHA512", "1215|SHA512")
port:value("389|SHA512", "389|SHA512")
port:value("80|SHA1", "80|SHA1")
port:value("443|SHA1", "443|SHA1")
cipher = s:option(ListValue, "cipher", translate("VPN Cipher"))
-- Add all cipher options here
cipher:value("AES-128-CBC")
cipher:value("AES-256-CBC")
cipher:value("AES-128-GCM")
cipher:value("AES-256-GCM")
cipher:value("BF-CBC")
-- VPN Control: Start/Stop OpenVPN
ctrl = m:section(TypedSection, "ovpnconfig", "VPN Control: Start/Stop OpenVPN")
ctrl.anonymous = true
ctrl.addremove = false
btnStop = ctrl:option(Button, "_btn_start", translate("Click to Stop OpenVPN"))
function btnStop.write()
io.popen("/etc/init.d/tgopenvpn stop")
end
btnStart = ctrl:option(Button, "_btn_stop", translate("Click to Start OpenVPN"))
function btnStart.write()
io.popen("/etc/init.d/tgopenvpn start")
end
-- Return the configuration page
return m

@ -0,0 +1,9 @@
config ovpnconfig 'settings'
option server 'ar.torguard.com'
option dedicated 'NO'
option dediserver ''
option protocol 'tcp'
option port '1912|SHA256'
option cipher 'AES-256-GCM'
option username ''
option password ''

@ -0,0 +1,171 @@
#!/bin/bash /etc/rc.common
# TorGuard OpenVPN init script
START=10
STOP=15
USE_PROCD=1
NAME=tgopenvpn
stop_service() {
procd_kill openvpn
rm /etc/openvpn/torguard/userpass.txt
rm /etc/openvpn/client.conf
# Check if 'lan' to 'wan' forwarding exists
lan_wan_exists=0
lan_ovpn_indexes=()
forwarding_indexes=$(uci show firewall | awk -F'[][]' '/@forwarding/{print $2}')
for index in $forwarding_indexes; do
src=$(uci get firewall.@forwarding[$index].src)
dest=$(uci get firewall.@forwarding[$index].dest)
if [[ "$src" == "lan" && "$dest" == "wan" ]]; then
lan_wan_exists=1
elif [[ "$src" == "lan" && "$dest" == "ovpn" ]]; then
lan_ovpn_indexes+=($index)
fi
done
# If 'lan' to 'wan' forwarding doesn't exist, add it
if [[ "$lan_wan_exists" -eq "0" ]]; then
uci add firewall forwarding
uci set firewall.@forwarding[-1].src="lan"
uci set firewall.@forwarding[-1].dest="wan"
uci commit firewall
/etc/init.d/firewall reload
fi
# Delete 'lan' to 'ovpn' forwarding
for index in ${lan_ovpn_indexes[@]}; do
uci delete firewall.@forwarding[$index]
done
uci commit firewall
/etc/init.d/firewall reload
}
start_service() {
config_load tgopenvpn_cfg
local server
local dedicated
local dediserver
local protocol
local port
local cipher
local username
local password
local auth
config_get server settings server
config_get dedicated settings dedicated
config_get dediserver settings dediserver
config_get protocol settings protocol
config_get port settings port
config_get cipher settings cipher
config_get username settings username
config_get password settings password
if [ "$dedicated" = "YES" ]; then
vpnserver=$dediserver
else
vpnserver=$server
fi
# Add the OpenVPN interface
uci -q delete network.ovpn
uci set network.ovpn="interface"
uci set network.ovpn.proto="none"
uci set network.ovpn.device="tun0"
uci commit network
/etc/init.d/network reload
# Add the 'ovpn' network to the 'wan' firewall zone
uci rename firewall.@zone[0]="lan"
uci rename firewall.@zone[1]="wan"
uci del_list firewall.wan.device="tun+"
uci add_list firewall.wan.device="tun+"
uci -q delete firewall.ovpn
uci set firewall.ovpn="zone"
uci set firewall.ovpn.output="ACCEPT"
uci set firewall.ovpn.forward="REJECT"
uci set firewall.ovpn.input="REJECT"
uci set firewall.ovpn.masq="1"
uci set firewall.ovpn.name="ovpn"
uci add_list firewall.ovpn.network="ovpn"
uci commit firewall
# Check if 'lan' to 'ovpn' forwarding exists
lan_ovpn_exists=0
forwarding_indexes=$(uci show firewall | awk -F'[][]' '/@forwarding/{print $2}')
for index in $forwarding_indexes; do
src=$(uci get firewall.@forwarding[$index].src)
dest=$(uci get firewall.@forwarding[$index].dest)
if [[ "$src" == "lan" && "$dest" == "ovpn" ]]; then
lan_ovpn_exists=1
fi
done
# If 'lan' to 'ovpn' forwarding doesn't exist, add it
if [[ "$lan_ovpn_exists" -eq "0" ]]; then
uci add firewall forwarding
uci set firewall.@forwarding[-1].src="lan"
uci set firewall.@forwarding[-1].dest="ovpn"
uci commit firewall
/etc/init.d/firewall reload
fi
/etc/init.d/firewall reload
reload_config
IFS='|' read -r portnumber auth <<< "$port"
if [ ! -f /etc/openvpn/torguard/userpass.txt ]; then
umask go=
cat << EOF > /etc/openvpn/torguard/userpass.txt
$username
$password
EOF
fi
chmod 600 /etc/openvpn/torguard/userpass.txt
if [ ! -f /etc/openvpn/client.conf ]; then
umask go=
cat << EOF > /etc/openvpn/client.conf
client
dev tun
proto $protocol
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/torguard/ca.crt
remote-cert-tls server
tls-auth /etc/openvpn/torguard/ta.key 1
cipher $cipher
comp-lzo
verb 3
fast-io
auth-user-pass /etc/openvpn/torguard/userpass.txt
remote-random
auth $auth
reneg-sec 0
remote $vpnserver $portnumber
sndbuf 393216
rcvbuf 393216
log /tmp/openvpn.log
EOF
fi
procd_open_instance
procd_set_param command /usr/sbin/openvpn --config /etc/openvpn/client.conf
procd_set_param file /etc/openvpn/client.conf
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}

@ -0,0 +1,53 @@
-----BEGIN CERTIFICATE-----
MIIDMTCCAhmgAwIBAgIJAKnGGJK6qLqSMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
BAMMCVRHLVZQTi1DQTAgFw0xOTA1MjExNDIzMTFaGA8yMDU5MDUxMTE0MjMxMVow
FDESMBAGA1UEAwwJVEctVlBOLUNB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wdQYDVR0jBG4wbIAUM5sAY05zw9+2R6IdqRB5uRRmxpmhQaQ/
MD0xETAPBgNVBAoMCFRvckd1YXJkMSgwJgYDVQQDDB9Ub3JHdWFyZCBQcml2YXRl
IFJvb3QgQ0EgMSAyMDIwghEA+pt5IXXc8TTX1/hQ5SFvHzANBgkqhkiG9w0BAQ0F
AAOCAgEAnHPYMbo5Tf3tCD8HKVoibt4dtd9wEUh/XDFg2RNM8caa9x32gZJXCXSD
UatdHYabukrsYqZIIt/XeL0SB8KzCQVyiMIHadCZBKc8Va/ays9lP/Kky6f3jkbr
T5t9IhyHYNDWkrXmY/gNXCPoeulRQ55R0I1g5ko/JwvNp6q/V3fwvcpJJaFSh/NT
OvBGCPR/pnR8isgmjF/i7KcN/b8gvO4EiqCk4AVl30aDUJBDyjnisCk9JMS4JxAY
kJ9MGkqI1wHno3eKqBWoUEtyNe58VFQwxUgSf8cTV+p6DEZaM14qqDXzIQ3kHdGT
H5ciqlzok0ocUM3AXvpHyoPbMPIFJ1uNvrYBWyDeP/KT512VNjpW30GtfMzZXJ2s
EkcMAxghdqHxeKkOWVSsHHglHhq2qHsGF7eTZO1CFkV6kL0sn8shlPiJ/EE1//0t
XycWstBaTe1TpiOYjLiLpwJvu7oMQIrl/YtCi/tXfkl8BLG0hncCLUovsIqQdjpo
6jMux8p7D8L7yDV9GuQGxoT542GM53o83/esHhDSEMzDydH/cvpht/b9/YOzBxTM
cxdxL8RDOKommtIfro1VE2z0YJ0KURD7jZe9mygV2KXokIBG4V+vhOglb7hT//dr
KFz6GDZAqs/KKeUIZxUWlpPaNssJygwDq6EjlNdelrxdWIYtR9Y=
-----END CERTIFICATE-----

@ -0,0 +1,18 @@
-----BEGIN OpenVPN Static key V1-----
770e8de5fc56e0248cc7b5aab56be80d
0e19cbf003c1b3ed68efbaf08613c3a1
a019dac6a4b84f13a6198f73229ffc21
fa512394e288f82aa2cf0180f01fb3eb
1a71e00a077a20f6d7a83633f5b4f47f
27e30617eaf8485dd8c722a8606d56b3
c183f65da5d3c9001a8cbdb96c793d93
6251098b24fe52a6dd2472e98cfccbc4
66e63520d63ade7a0eacc36208c3142a
1068236a52142fbb7b3ed83d785e12a2
8261bccfb3bcb62a8d2f6d18f5df5f36
52e59c5627d8d9c8f7877c4d7b08e19a
5c363556ba68d392be78b75152dd55ba
0f74d45089e84f77f4492d886524ea6c
82b9f4dd83d46528d4f5c3b51cfeaf28
38d938bd0597c426b0e440434f2c451f
-----END OpenVPN Static key V1-----

@ -0,0 +1,12 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@tgopenvpn_def[-1]
add ucitrack tgopenvpn
set ucitrack.@tgopenvpn[-1].init=tgopenvpn
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

@ -0,0 +1,4 @@
module("luci.controller.admin.tgopenvpn", package.seeall)
function index()
entry({"admin", "vpn", "tgopenvpn"}, cbi("torguard/tgopenvpn"), _("TorGuard OpenVPN"), 102)
end

@ -0,0 +1,134 @@
-- Import the necessary LuCI modules
local uci = require("luci.model.uci").cursor()
local sys = require("luci.sys")
local util = require("luci.util")
-- Define the model
m = Map("tgopenvpn_cfg", "TorGuard OpenVPN Setup")
-- Define the section for the OpenVPN settings
s = m:section(TypedSection, "ovpnconfig", "OpenVPN Settings")
s.anonymous = true
s.addremove = false
-- Define the input fields for the OpenVPN settings
user = s:option(Value, "username", translate("VPN Username"))
pass = s:option(Value, "password", translate("VPN Password"))
pass.password = true
svr = s:option(ListValue, "server", translate("VPN Server"))
-- Add all servers here
svr:value("ar.torguard.com", "Argentina")
svr:value("au.torguard.com", "Australia Sydney")
svr:value("aus.torguard.com", "Austria")
svr:value("bg.torguard.com", "Belgium")
svr:value("br.torguard.com", "Brazil 1")
svr:value("br2.torguard.com", "Brazil 2")
svr:value("bul.torguard.com", "Bulgaria")
svr:value("ca.torguard.com", "Canada Toronto")
svr:value("cavan.torguard.com", "Canada Vancouver")
svr:value("ch.torguard.com", "Chile")
svr:value("cz.torguard.com", "Czech Republic")
svr:value("dn.torguard.com", "Denmark")
svr:value("fn.torguard.com", "Finland")
svr:value("fr.torguard.com", "France")
svr:value("ger.torguard.com", "Germany")
svr:value("gre.torguard.com", "Greece")
svr:value("hk.torguard.com", "Hong Kong")
svr:value("hg.torguard.com", "Hungary")
svr:value("ice.torguard.com", "Iceland")
svr:value("in.torguard.com", "India Mumbai")
svr:value("ire.torguard.com", "Ireland")
svr:value("isr-loc1.torguard.com", "Israel Tel Aviv")
svr:value("it.torguard.com", "Italy")
svr:value("id.torguard.com", "Indonesia")
svr:value("jp.torguard.com", "Japan")
svr:value("lux.torguard.com", "Luxembourg")
svr:value("mx.torguard.com", "Mexico")
svr:value("md.torguard.com", "Moldova")
svr:value("nl.torguard.com", "Netherlands")
svr:value("nz.torguard.com", "New Zealand")
svr:value("no.torguard.com", "Norway")
svr:value("pl.torguard.com", "Poland")
svr:value("pg.torguard.com", "Portugal")
svr:value("ro.torguard.com", "Romania")
svr:value("ru.torguard.com", "Russia")
svr:value("sg.torguard.com", "Singapore")
svr:value("slk.torguard.com", "Slovakia")
svr:value("sp.torguard.com", "Spain")
svr:value("sk.torguard.com", "South Korea")
svr:value("sa.torguard.com", "South Africa")
svr:value("swe.torguard.com", "Sweden")
svr:value("swiss.torguard.com", "Switzerland")
svr:value("tw.torguard.com", "Taiwan")
svr:value("th.torguard.com", "Thailand")
svr:value("tk.torguard.com", "Turkey")
svr:value("uae.torguard.com", "UAE")
svr:value("uk.torguard.com", "UK London")
svr:value("uk.man.torguard.com", "UK Manchester")
svr:value("ukr.torguard.com", "Ukraine")
svr:value("us-fl.torguard.com", "USA Miami")
svr:value("us-atl.torguard.com", "USA Atlanta")
svr:value("us-ny.torguard.com", "USA New York")
svr:value("us-chi.torguard.com", "USA Chicago")
svr:value("us-chi-loc2.torguard.com", "USA Chicago 2")
svr:value("us-dal.torguard.com", "USA Dallas")
svr:value("us-dal-loc2.torguard.com", "USA Dallas 2")
svr:value("us-la.torguard.com", "USA LA")
svr:value("us-lv.torguard.com", "USA Las Vegas")
svr:value("us-sa.torguard.com", "USA Seattle")
svr:value("us-sf.torguard.com", "USA San Francisco")
svr:value("us-nj.torguard.com", "USA New Jersey")
svr:value("us-nj-loc2.torguard.com", "USA New Jersey 2")
svr:value("us-slc.torguard.com", "USA Salt Lake City")
dedicated = s:option(ListValue, "dedicated", translate("Use Dedicated IP"))
dedicated:value("YES")
dedicated:value("NO")
dediserver = s:option(Value, "dediserver", translate("Dedicated IP"))
protocol = s:option(ListValue, "protocol", translate("VPN Protocol"))
protocol:value("udp")
protocol:value("tcp")
port = s:option(ListValue, "port", translate("VPN Port"))
-- Add all ports here
port:value("1912|SHA256", "1912|SHA256")
port:value("1195|SHA256", "1195|SHA256")
port:value("53|SHA256", "53|SHA256")
port:value("1198|SHA256", "1198|SHA256")
port:value("9201|SHA256", "9201|SHA256")
port:value("501|SHA256", "501|SHA256")
port:value("1194|SHA1", "1194|SHA1")
port:value("995|SHA1", "995|SHA1")
port:value("1215|SHA512", "1215|SHA512")
port:value("389|SHA512", "389|SHA512")
port:value("80|SHA1", "80|SHA1")
port:value("443|SHA1", "443|SHA1")
cipher = s:option(ListValue, "cipher", translate("VPN Cipher"))
-- Add all cipher options here
cipher:value("AES-128-CBC")
cipher:value("AES-256-CBC")
cipher:value("AES-128-GCM")
cipher:value("AES-256-GCM")
cipher:value("BF-CBC")
-- VPN Control: Start/Stop OpenVPN
ctrl = m:section(TypedSection, "ovpnconfig", "VPN Control: Start/Stop OpenVPN")
ctrl.anonymous = true
ctrl.addremove = false
btnStop = ctrl:option(Button, "_btn_start", translate("Click to Stop OpenVPN"))
function btnStop.write()
io.popen("/etc/init.d/tgopenvpn stop")
end
btnStart = ctrl:option(Button, "_btn_stop", translate("Click to Start OpenVPN"))
function btnStart.write()
io.popen("/etc/init.d/tgopenvpn start")
end
-- Return the configuration page
return m
Loading…
Cancel
Save