diff --git a/include/target.mk b/include/target.mk index 16381bc32..778a1b5fc 100644 --- a/include/target.mk +++ b/include/target.mk @@ -49,7 +49,7 @@ DEFAULT_PACKAGES.router:=\ 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 \ 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 ifneq ($(DUMP),) diff --git a/package/lean/luci-app-pptp-server/Makefile b/package/lean/luci-app-pptp-server/Makefile new file mode 100644 index 000000000..2e13beb86 --- /dev/null +++ b/package/lean/luci-app-pptp-server/Makefile @@ -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 + + + + diff --git a/package/lean/luci-app-pptp-server/luasrc/controller/pptp-server.lua b/package/lean/luci-app-pptp-server/luasrc/controller/pptp-server.lua new file mode 100644 index 000000000..5bda83098 --- /dev/null +++ b/package/lean/luci-app-pptp-server/luasrc/controller/pptp-server.lua @@ -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 diff --git a/package/lean/luci-app-pptp-server/luasrc/model/cbi/pptp-server/pptp-server.lua b/package/lean/luci-app-pptp-server/luasrc/model/cbi/pptp-server/pptp-server.lua new file mode 100644 index 000000000..7fa03cfdb --- /dev/null +++ b/package/lean/luci-app-pptp-server/luasrc/model/cbi/pptp-server/pptp-server.lua @@ -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 diff --git a/package/lean/luci-app-pptp-server/luasrc/view/pptp/pptp_status.htm b/package/lean/luci-app-pptp-server/luasrc/view/pptp/pptp_status.htm new file mode 100644 index 000000000..11a2852d9 --- /dev/null +++ b/package/lean/luci-app-pptp-server/luasrc/view/pptp/pptp_status.htm @@ -0,0 +1,22 @@ + + +
\ No newline at end of file diff --git a/package/lean/luci-app-pptp-server/po/zh-cn/pptp.po b/package/lean/luci-app-pptp-server/po/zh-cn/pptp.po new file mode 100644 index 000000000..0c2f78df3 --- /dev/null +++ b/package/lean/luci-app-pptp-server/po/zh-cn/pptp.po @@ -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 客户端进行连接 " + + + diff --git a/package/lean/luci-app-pptp-server/root/etc/config/pptpd b/package/lean/luci-app-pptp-server/root/etc/config/pptpd new file mode 100644 index 000000000..c55cfa60c --- /dev/null +++ b/package/lean/luci-app-pptp-server/root/etc/config/pptpd @@ -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' + diff --git a/package/lean/luci-app-pptp-server/root/etc/pptpd.include b/package/lean/luci-app-pptp-server/root/etc/pptpd.include new file mode 100755 index 000000000..e59a7b7ea --- /dev/null +++ b/package/lean/luci-app-pptp-server/root/etc/pptpd.include @@ -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 diff --git a/package/lean/luci-app-pptp-server/root/etc/uci-defaults/pptpd b/package/lean/luci-app-pptp-server/root/etc/uci-defaults/pptpd new file mode 100755 index 000000000..68c9f3e66 --- /dev/null +++ b/package/lean/luci-app-pptp-server/root/etc/uci-defaults/pptpd @@ -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