summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-01-06 13:30:48 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-01-06 13:30:48 +0000
commit3a8648ba285491f67c75c92e5e532f2b6e74ad8b (patch)
treecbac62bd563e58f2205a2c60b9fd0145c22a0cc0
parent48421749c15ba7e2e527b91cf3c5cffee3465b5e (diff)
Move rapid-tunneling-gui package into the main source package.
git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@6557 283159da-0705-0410-b60c-f2062b4bb6ad
-rw-r--r--Makefile8
-rw-r--r--gui/XPP_logo_watermark.gifbin0 -> 2995 bytes
-rw-r--r--gui/Xorcom_logo2.jpgbin0 -> 14452 bytes
-rw-r--r--gui/checkra.php43
-rw-r--r--gui/index.php76
-rw-r--r--rapid-tunneling.spec34
6 files changed, 160 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5d0e520..9e28b44 100644
--- a/Makefile
+++ b/Makefile
@@ -4,9 +4,12 @@ SPEC = rapid-tunneling.spec
SCRIPTS = rapid-tunneling rapid-tunneling-status rtadm rt-from-remote
CONFIGS = rtadm.config sshd_support_config support_env
INIT_D = sshd_support
-SOURCES = Makefile $(SPEC) $(SCRIPTS) $(CONFIGS) $(INIT_D) .placeholder
+GUI = gui
+SOURCES = Makefile $(SPEC) $(SCRIPTS) $(CONFIGS) $(INIT_D) $(GUI) .placeholder
SBINDIR = /usr/sbin
BINDIR = /usr/share/rapid-tunneling/bin
+WWWROOT = /var/www/html
+WWWHOME = $(WWWROOT)/support
VER = $(shell awk '/^Version: / {print $$2}' $(SPEC)| head -n 1)
RPM_REL = $(shell awk '/^Release: / {print $$2}' $(SPEC)| head -n 1)
@@ -21,6 +24,7 @@ rpm: checkver $(SPEC) SOURCES/$(PACKAGE)-$(VER).tar.gz
mkdir -p OUTPUT
cp RPMS/noarch/rapid-tunneling-$(VER)-$(RPM_REL).noarch.rpm OUTPUT/
cp RPMS/noarch/rapid-tunneling-server-$(VER)-$(RPM_REL).noarch.rpm OUTPUT/
+ cp RPMS/noarch/rapid-tunneling-gui-$(VER)-$(RPM_REL).noarch.rpm OUTPUT/
cp SRPMS/rapid-tunneling-$(VER)-$(RPM_REL).src.rpm OUTPUT/
deb: checkver
@@ -53,6 +57,8 @@ install:
install -m 644 sshd_support_config $(DESTDIR)/etc/ssh/
install -m 755 -d $(DESTDIR)/var/lib/rapid-tunneling
install -m 644 .placeholder $(DESTDIR)/var/lib/rapid-tunneling/
+ install -m 755 -d $(DESTDIR)$(WWWHOME)
+ install -m 644 gui/* $(DESTDIR)$(WWWHOME)/
.PHONY: clean dummy
dummy:
diff --git a/gui/XPP_logo_watermark.gif b/gui/XPP_logo_watermark.gif
new file mode 100644
index 0000000..62c597c
--- /dev/null
+++ b/gui/XPP_logo_watermark.gif
Binary files differ
diff --git a/gui/Xorcom_logo2.jpg b/gui/Xorcom_logo2.jpg
new file mode 100644
index 0000000..a078c9e
--- /dev/null
+++ b/gui/Xorcom_logo2.jpg
Binary files differ
diff --git a/gui/checkra.php b/gui/checkra.php
new file mode 100644
index 0000000..40f8f37
--- /dev/null
+++ b/gui/checkra.php
@@ -0,0 +1,43 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="1; url=checkra.php">
+</head>
+<body>
+<?php
+function get_status()
+{
+ exec("sudo -H -u rapid-tunneling /usr/sbin/rapid-tunneling-status -p", $pid, $status);
+ if (count($pid) > 0)
+ $pid = trim($pid[0]);
+ else
+ $pid = "";
+ return array($pid, $status);
+ // $status = 0 if connected, 1 if connecting, 2 if not connected
+}
+
+$res = get_status();
+$pid = $res[0];
+$status = $res[1];
+if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "disconnect" && $pid != "" && ($status == 0 || $status == 1)) {
+ // stop it
+ exec("sudo -H -u rapid-tunneling /usr/sbin/rapid-tunneling-status -s");
+ $res = get_status();
+ $pid = $res[0];
+ $status = $res[1];
+}
+
+if ($status == 0)
+ $netstat = "<span style='color: green'>Connected</span>";
+elseif ($status == 1)
+ $netstat = "<span style='color: orange'>Connecting</span>";
+else
+ $netstat = "<span style='color: red'>Not connected</span>";
+
+echo "Connection status:<br>\n";
+echo date("r") . "&nbsp;&nbsp;&nbsp; <b>$netstat</b><br>\n";
+if ($status == 0 || $status == 1) {
+ echo "<br><button onclick='location.href += \"?action=disconnect\"'>Disconnect</button>";
+}
+?>
+</body>
+</html>
diff --git a/gui/index.php b/gui/index.php
new file mode 100644
index 0000000..aede7c7
--- /dev/null
+++ b/gui/index.php
@@ -0,0 +1,76 @@
+<?php
+/*
+ * Written by Alex Landau <alex.landau@xorcom.com>
+ * Copyright (C) 2008 Xorcom
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+?>
+<title>Xorcom RapidTunneling</title>
+<style>
+.clsErrors
+{
+ background: pink;
+ border: 1px solid red;
+ padding: 5px;
+ text-align: center;
+}
+</style>
+<?php
+if (isset($_REQUEST["submit"]))
+{
+ $error = "";
+ // Not a true while due to the break at the end. A handy way to use goto...
+ while (true) {
+ if (!is_uploaded_file($_FILES["filename"]["tmp_name"])) {
+ $error = "Bad file uploaded: " . $_FILES['filename']['name'];
+ break;
+ }
+ if (!move_uploaded_file($_FILES["filename"]["tmp_name"], "/tmp/remote-access.tar.gz")) {
+ $error = "Bad file uploaded: " . $_FILES['filename']['name'];
+ break;
+ }
+ system("sudo -H -u rapid-tunneling rapid-tunneling /tmp/remote-access.tar.gz >/tmp/ra.log 2>&1", $ret);
+ if ($ret != 0) {
+ $error = "Invalid or corrupt file. Please try again.";
+ if ( $ret == 7) {
+ $error = "Invalid GPG signature. Please try again.";
+ }
+ break;
+ }
+ break;
+ }
+}
+if ($error != "") {
+?>
+<div class="clsErrors"><?php echo $error ?></div>
+<?php
+}
+?>
+<img src="Xorcom_logo2.jpg">
+<br>
+Click Browse and select the file 'remote-access.tar.gz' that you received from the Technical Support Service.<br>
+Then click the "Connect" button to initiate the <b>RapidTunneling&#8482;</b> secure communication.<br><br>
+<form id=form action="" method=post enctype="multipart/form-data">
+ <input type=file name=filename><br><br>
+ <input class="splbutton" type=submit name=submit value="Connect">
+</form>
+<p>
+<iframe src="checkra.php" width=500 height=100 frameborder=0 scrolling=no></iframe>
+<br>
+<img src="XPP_logo_watermark.gif">
diff --git a/rapid-tunneling.spec b/rapid-tunneling.spec
index 7e342ce..49811b5 100644
--- a/rapid-tunneling.spec
+++ b/rapid-tunneling.spec
@@ -10,6 +10,8 @@ Requires: openssh-clients busybox gnupg
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+%define webroot /var/www/html/support
+
%description
RapidTunneling (tm) allows remote access to machines behind firewalls
and NAT routers via SSH port forwarding.
@@ -22,6 +24,18 @@ Requires: openssh-server
%description server
This package contains the server files needed to run RapidTunneling Server.
+%package gui
+Summary: Xorcom RapidTunneling (tm) web GUI
+Group: Applications/Internet
+Requires: rapid-tunneling, sudo
+
+%description gui
+RapidTunneling (tm) allows remote access to machines behind firewalls
+and NAT routers via SSH port forwarding.
+
+This package contains the web-based user interface to initiate and
+control tunnels to the server.
+
%prep
%setup -q
@@ -62,6 +76,22 @@ fi
%postun server
/sbin/service sshd_support condrestart > /dev/null 2>&1 || :
+%post gui
+SUDOERS=/etc/sudoers
+LINE="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling"
+LINE2="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling-status"
+if ! fgrep -q "$LINE" $SUDOERS; then echo "$LINE" >> $SUDOERS; fi
+if ! fgrep -q "$LINE2" $SUDOERS; then echo "$LINE2" >> $SUDOERS; fi
+
+%preun gui
+if [ "$1" = 0 ]; then
+ SUDOERS=/etc/sudoers
+ LINE="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling"
+ LINE2="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling-status"
+ fgrep -v "$LINE" $SUDOERS > ${SUDOERS}.tmp && cp ${SUDOERS}.tmp $SUDOERS && rm ${SUDOERS}.tmp
+ fgrep -v "$LINE2" $SUDOERS > ${SUDOERS}.tmp && cp ${SUDOERS}.tmp $SUDOERS && rm ${SUDOERS}.tmp
+fi
+
%files
%defattr(-, root, root, 0755)
%{_sbindir}/rapid-tunneling
@@ -77,6 +107,10 @@ fi
%{_datadir}/rapid-tunneling/bin/rt-from-remote
/var/lib/rapid-tunneling
+%files gui
+%defattr(-, root, root, 0755)
+%{webroot}/
+
%changelog
* Sun Dec 14 2008 Alex Landau <alex.landau@xorcom.com> 1.0-1
- Initial RPM release.