luci-app-pptp-server: rollback pptpd server

This commit is contained in:
coolsnowwolf 2021-07-20 14:12:48 +08:00
parent facd06ed14
commit e34e5b584e
9 changed files with 211 additions and 1 deletions

View File

@ -49,7 +49,7 @@ DEFAULT_PACKAGES.router:=\
luci-newapi block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw \ luci-newapi block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw \
default-settings luci luci-app-ddns luci-app-upnp luci-app-autoreboot \ default-settings luci luci-app-ddns luci-app-upnp luci-app-autoreboot \
luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-unblockmusic luci-app-arpbind \ luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-unblockmusic luci-app-arpbind \
luci-app-vlmcsd luci-app-wol luci-app-ramfree \ luci-app-vlmcsd luci-app-wol luci-app-ramfree luci-app-pptp-server \
luci-app-turboacc luci-app-nlbwmon luci-app-accesscontrol ddns-scripts_aliyun ddns-scripts_dnspod luci-app-turboacc luci-app-nlbwmon luci-app-accesscontrol ddns-scripts_aliyun ddns-scripts_dnspod
ifneq ($(DUMP),) ifneq ($(DUMP),)

View File

@ -0,0 +1,21 @@
# Copyright (C) 2016 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for PPTP VPN Server
LUCI_DEPENDS:=+pptpd +kmod-mppe +ppp
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-pptp-server
PKG_VERSION:=1.0
PKG_RELEASE:=13
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,19 @@
module("luci.controller.pptp-server", package.seeall)
function index()
if not nixio.fs.access("/etc/config/pptpd") then
return
end
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
entry({"admin", "vpn", "pptp-server"}, cbi("pptp-server/pptp-server"), _("PPTP VPN Server"), 80).dependent=false
entry({"admin", "vpn", "pptp-server","status"},call("act_status")).leaf=true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep pptpd >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,37 @@
mp = Map("pptpd", translate("PPTP VPN Server"))
mp.description = translate("PPTP VPN Server connectivity using the native built-in VPN Client on Windows/Linux or Andriod")
mp:section(SimpleSection).template = "pptp/pptp_status"
s = mp:section(NamedSection, "pptpd", "service")
s.anonymouse = true
enabled = s:option(Flag, "enabled", translate("Enable"))
enabled.default = 0
enabled.rmempty = false
localip = s:option(Value, "localip", translate("Local IP"))
localip.datatype = "ip4addr"
clientip = s:option(Value, "remoteip", translate("Client IP"))
clientip.datatype = "string"
clientip.description = translate("LAN DHCP reserved start-to-end IP addresses with the same subnet mask")
remotedns = s:option(Value, "remotedns", translate("Remote Client DNS"))
remotedns.datatype = "ip4addr"
logging = s:option(Flag, "logwtmp", translate("Debug Logging"))
logging.default = 0
logging.rmempty = false
logins = mp:section(NamedSection, "login", "login", translate("PPTP Logins"))
logins.anonymouse = true
username = logins:option(Value, "username", translate("User name"))
username.datatype = "string"
password = logins:option(Value, "password", translate("Password"))
password.password = true
return mp

View File

@ -0,0 +1,22 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[pptp-server]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('pptp_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>PPTP VPN Server <%:RUNNING%></font></b></em>';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>PPTP VPN Server <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="pptp_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,56 @@
msgid "Disable from startup"
msgstr "禁止开机启动"
msgid "Enable on startup"
msgstr "允许开机启动"
msgid "PPTP VPN Server"
msgstr "PPTP VPN 服务器"
msgid "PPTP Service"
msgstr "PPTP 服务设置"
msgid "Local IP"
msgstr "PPTP 服务器IP"
msgid "Client IP"
msgstr "客户端分配的IP范围"
msgid "LAN DHCP reserved start-to-end IP addresses with the same subnet mask"
msgstr "使用和 LAN 同一网段。请使用 DHCP分配地址以外的空余IP地址范围例如 192.168.0.20-30"
msgid "Remote Client DNS"
msgstr "客户端分配IP的DNS服务器"
msgid "Debug Logging"
msgstr "记录日志"
msgid "PPTP Logins"
msgstr "PPTP 登录设置"
msgid "User name"
msgstr "用户名"
msgid "Password"
msgstr "密码"
msgid "Enable"
msgstr "启用"
msgid "PPTPD status"
msgstr "PPTPD 服务状态"
msgid "Start"
msgstr "启动"
msgid "Stop"
msgstr "关闭"
msgid "PPTP VPN Server"
msgstr "PPTP VPN 服务器"
msgid "PPTP VPN Server connectivity using the native built-in VPN Client on Windows/Linux or Andriod"
msgstr "使用Windows/Linux 或者 Andriod 内置的 PPTP VPN 客户端进行连接 "

View File

@ -0,0 +1,12 @@
config service 'pptpd'
option enabled '0'
option remoteip '192.168.0.20-30'
option remotedns '192.168.0.1'
option logwtmp '0'
option localip '192.168.0.1'
config login 'login'
option username 'lean'
option password 'I234567B'

View File

@ -0,0 +1,6 @@
iptables -D forwarding_rule -i ppp+ -j ACCEPT 2>/dev/null
iptables -D forwarding_rule -o ppp+ -j ACCEPT 2>/dev/null
iptables -A forwarding_rule -i ppp+ -j ACCEPT
iptables -A forwarding_rule -o ppp+ -j ACCEPT
echo 1 > /proc/sys/net/ipv4/conf/br-lan/proxy_arp

View File

@ -0,0 +1,37 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete firewall.pptpd
set firewall.pptpd=include
set firewall.pptpd.type=script
set firewall.pptpd.path=/etc/pptpd.include
set firewall.pptpd.reload=1
delete firewall.pptp
add firewall rule
rename firewall.@rule[-1]="pptp"
set firewall.@rule[-1].name="pptp"
set firewall.@rule[-1].target="ACCEPT"
set firewall.@rule[-1].src="wan"
set firewall.@rule[-1].proto="tcp"
set firewall.@rule[-1].dest_port="1723"
delete firewall.gre
add firewall rule
rename firewall.@rule[-1]="gre"
set firewall.@rule[-1].name="gre"
set firewall.@rule[-1].target="ACCEPT"
set firewall.@rule[-1].src="wan"
set firewall.@rule[-1].proto="47"
commit firewall
EOF
uci -q batch <<-EOF >/dev/null
delete ucitrack.@pptpd[-1]
add ucitrack pptpd
set ucitrack.@pptpd[-1].init=pptpd
commit ucitrack
EOF
/etc/init.d/pptpd enable && /etc/init.d/pptpd restart
rm -f /tmp/luci-indexcache
exit 0