From c3511bf2eb678f6532f359d633a4ba3811b411ea Mon Sep 17 00:00:00 2001 From: Keith Moyer Date: Mon, 1 Dec 2008 22:48:04 -0600 Subject: [PATCH] VPN GUI frontend --- release/src/router/httpd/misc.c | 17 +++ release/src/router/httpd/tomato.c | 1 + release/src/router/httpd/tomato.h | 1 + release/src/router/www/Makefile | 5 + release/src/router/www/tomato.js | 5 + release/src/router/www/vpn-client.asp | 230 ++++++++++++++++++++++++++++++++++ release/src/router/www/vpn-server.asp | 205 ++++++++++++++++++++++++++++++ 7 files changed, 464 insertions(+) create mode 100644 release/src/router/www/vpn-client.asp create mode 100644 release/src/router/www/vpn-server.asp diff --git a/release/src/router/httpd/misc.c b/release/src/router/httpd/misc.c index d9e7608418..e47118b8a7 100644 --- a/release/src/router/httpd/misc.c +++ b/release/src/router/httpd/misc.c @@ -177,6 +177,23 @@ void asp_psup(int argc, char **argv) if (argc == 1) web_printf("%d", pidof(argv[0]) > 0); } +void asp_vpn_ciphers(int argc, char **argv) +{ +#ifdef TCONFIG_OPENVPN + FILE *fp; + char buffer[16]; + + fp=popen("/usr/sbin/openvpn --show-ciphers | grep -v \"^$\" | awk '{print($1)}'", "r"); + if (fp == NULL) + return; + + while (fgets(&buffer[0], 16, fp) != NULL) + web_printf(",['%s','%s']", strtok(&buffer[0],"\n"), &buffer[0]); + + pclose(fp); +#endif +} + /* # cat /proc/meminfo total: used: free: shared: buffers: cached: diff --git a/release/src/router/httpd/tomato.c b/release/src/router/httpd/tomato.c index 24061cf98a..1089a69a7e 100644 --- a/release/src/router/httpd/tomato.c +++ b/release/src/router/httpd/tomato.c @@ -238,6 +238,7 @@ const aspapi_t aspapi[] = { { "time", asp_time }, { "upnpinfo", asp_upnpinfo }, { "version", asp_version }, + { "vpnciphers", asp_vpn_ciphers }, { "wanstatus", asp_wanstatus }, { "wanup", asp_wanup }, { "wlchannel", asp_wlchannel }, diff --git a/release/src/router/httpd/tomato.h b/release/src/router/httpd/tomato.h index cc52402632..09a49cc77a 100644 --- a/release/src/router/httpd/tomato.h +++ b/release/src/router/httpd/tomato.h @@ -72,6 +72,7 @@ extern void asp_compmac(int argc, char **argv); extern void asp_ident(int argc, char **argv); extern void asp_lanip(int argc, char **argv); extern void asp_psup(int argc, char **argv); +extern void asp_vpn_ciphers(int argc, char **argv); extern void asp_sysinfo(int argc, char **argv); extern void asp_statfs(int argc, char **argv); extern void asp_notice(int argc, char **argv); diff --git a/release/src/router/www/Makefile b/release/src/router/www/Makefile index 668780c82a..fbc0cfe42f 100644 --- a/release/src/router/www/Makefile +++ b/release/src/router/www/Makefile @@ -33,6 +33,11 @@ install: -e "/^$$/! { s,^\s\+, , }" $$F > $(INSTALLDIR)/www/$$F; \ done +# Only include the vpn pages in the navigation if OpenVPN is compiled in + +ifneq ($(TCONFIG_OPENVPN),y) + sed -i $(INSTALLDIR)/www/tomato.js -e "/VPN-BEGIN/,/VPN-END/d" +endif # make sure old and debugging crap is gone diff --git a/release/src/router/www/tomato.js b/release/src/router/www/tomato.js index 2857d28c90..81c4474505 100644 --- a/release/src/router/www/tomato.js +++ b/release/src/router/www/tomato.js @@ -1944,6 +1944,11 @@ function navi() ['View Details', 'detailed.asp'] ] ], ['Access Restriction', 'restrict.asp'], +/* VPN-BEGIN */ + ['VPN Tunneling', 'vpn', 0, [ + ['Server', 'server.asp'], + ['Client', 'client.asp'] ] ], +/* VPN-END */ null, ['Administration', 'admin', 0, [ ['Admin Access', 'access.asp'], diff --git a/release/src/router/www/vpn-client.asp b/release/src/router/www/vpn-client.asp new file mode 100644 index 0000000000..487fc7aa31 --- /dev/null +++ b/release/src/router/www/vpn-client.asp @@ -0,0 +1,230 @@ + + + + + + +[<% ident(); %>] VPN: Client + + + + + + + + + +
+ + + + + +
+
<% ident(); %>
+ + + + + +
VPN Client Configuration
+
+ +
+ +
+
+ + + + diff --git a/release/src/router/www/vpn-server.asp b/release/src/router/www/vpn-server.asp new file mode 100644 index 0000000000..6bb3cc806f --- /dev/null +++ b/release/src/router/www/vpn-server.asp @@ -0,0 +1,205 @@ + + + + + + +[<% ident(); %>] VPN: Server + + + + + + + + + +
+ + + + + +
+
<% ident(); %>
+ + + + + +
VPN Server Configuration
+
+ +
+ +
+
+ + + + -- 2.11.4.GIT