diff options
Diffstat (limited to 'config/anyterm')
-rw-r--r-- | config/anyterm/access_anyterm.php | 44 | ||||
-rw-r--r-- | config/anyterm/anyterm.inc | 108 | ||||
-rw-r--r-- | config/anyterm/anyterm.xml | 27 | ||||
-rwxr-xr-x | config/anyterm/binaries7/anytermd | bin | 0 -> 3111332 bytes |
4 files changed, 174 insertions, 5 deletions
diff --git a/config/anyterm/access_anyterm.php b/config/anyterm/access_anyterm.php new file mode 100644 index 00000000..bcbaa102 --- /dev/null +++ b/config/anyterm/access_anyterm.php @@ -0,0 +1,44 @@ +<?php +/* + access_anyterm.php + pfSense package (http://www.pfSense.com) + Copyright (C) 2009 Scott Ullrich <sullrich@pfsense.org> + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); + +if($config['installedpackages']['anyterm']['config']['stunnelport']) { + $port = $config['installedpackages']['anyterm']['config']['port']; + $httpors = "http"; +} else { + $port = $config['installedpackages']['anyterm']['config']['stunnelport']; + $httpors = "https"; +} + +$location = "{$SERVER['SERVER_ADDR']}:{$port}"; + +Header("Location: {$httpors}://{$location}"); + +?>
\ No newline at end of file diff --git a/config/anyterm/anyterm.inc b/config/anyterm/anyterm.inc new file mode 100644 index 00000000..6ae26147 --- /dev/null +++ b/config/anyterm/anyterm.inc @@ -0,0 +1,108 @@ +<?php +/* + anyterm.inc + pfSense package (http://www.pfSense.com) + Copyright (C) 2009 Scott Ullrich <sullrich@pfsense.org> + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +function anyterm_deinstall() { + global $g, $config; + conf_mount_rw(); + exec("killall anytermd"); + exec("rm /usr/local/etc/rc.d/anyterm.sh"); + exec("rm /usr/local/sbin/anytermd"); +} + +function anyterm_install() { + global $g, $config; + + conf_mount_rw(); + + // Grab latest version of executablevi / + $freebsdv=trim(`uname -r | cut -d'.' -f1`); + `fetch -q -o /usr/local/sbin/ http://www.pfsense.org/packages/config/anyterm/binaries{$freebsdv}/anytermd`; + exec("chmod a+rx /usr/local/sbin/anyterm"); + + if($config['installedpackages']['anyterm']['config']['username']) + $port = " --port {$config['installedpackages']['anyterm']['config']['port']}"; + + // This will bring up the pfSense style menu + $anytermd_command = "anytermd --user root --command \"/usr/libexec/getty Pc\" --auth trivial $port"; + + $anyterm = <<<EOD +#!/bin/sh + +# PROVIDE: anyterm +# REQUIRE: LOGIN +# KEYWORD: FreeBSD + +. /etc/rc.subr + +name="anyterm" +rcvar=`set_rcvar` +command="/usr/local/bin/anyterm" +anyterm_enable=\${anyterm-"YES"} + +start_cmd="anyterm_start" +stop_postcmd="anyterm_stop" + +load_rc_config \$name + +anyterm_start () { + if [ -f /var/etc/anyterm.conf ]; then + /usr/bin/env \ + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ + killall anytermd \ + $anytermd_command + fi +} + +anyterm_stop () { + echo "Stopping anyterm." + killall anyterm +} + +run_rc_command "\$1" + +EOD; + + // Write out file + $fd = fopen("/usr/local/etc/rc.d/anyterm.sh", "w"); + fwrite($fd, $anyterm); + fclose($fd); + // Make executable + exec("chmod a+rx /usr/local/etc/rc.d/anyterm.sh") + + // Write out Anyterm configuration file (username and password for auth) + $fd = fopen("/var/etc/anyterm.conf", "w"); + fwrite($fd, $config['installedpackages']['anyterm']['config']['username'] . "\n"); + fwrite($fd, $config['installedpackages']['anyterm']['config']['password'] . "\n"); + fclose($fd); + exec("chmod a-r /var/etc/anyterm.conf ; chmod ug+r /var/etc/anyterm.conf ; killall anytermd"); + exec($anytermd_command); + +} + +?>
\ No newline at end of file diff --git a/config/anyterm/anyterm.xml b/config/anyterm/anyterm.xml index 4bd1b445..0b87767d 100644 --- a/config/anyterm/anyterm.xml +++ b/config/anyterm/anyterm.xml @@ -8,7 +8,7 @@ /* ========================================================================== */ /* anyterm.xml - part of pfSense (http://www.pfSense.com) + pfSense package (http://www.pfSense.com) Copyright (C) 2009 Scott Ullrich All rights reserved. */ @@ -53,7 +53,7 @@ <name>anyterm</name> <rcfile>anyterm.sh</rcfile> <executable>anytermd</executable> - <description>The Reliable, High Performance TCP/HTTP Load Balancer</description> + <description>Ajax Interactive Shell</description> </service> <configpath>installedpackages->anyterm->config</configpath> <additional_files_needed> @@ -61,23 +61,40 @@ <chmod>077</chmod> <item>http://www.pfsense.com/packages/config/anyterm/anyterm.inc</item> </additional_files_needed> + <tabs> + <tab> + <text>Settings</text> + <url>/pkg.php?xml=spamd.xml</url> + <active/> + </tab> + <tab> + <text>Ajax Shell</text> + <url>access_anyterm.php</url> + </tab> + </tabs> <fields> <field> <fielddescr>Username</fielddescr> <fieldname>username</fieldname> - <description>Enter the username for Anyterm</description> + <description>Enter the username for accessing Anyterm</description> <type>input</type> </field> <field> <fielddescr>Password</fielddescr> <fieldname>password</fieldname> - <description>Enter the password for Anyterm</description> + <description>Enter the password for accessing Anyterm</description> <type>password</type> </field> <field> <fielddescr>Port</fielddescr> <fieldname>port</fieldname> - <description>Enter the port that Anyterm will listen on.</description> + <description>Enter the port that Anyterm will listen on Default is 8080.</description> + <type>input</type> + </field> + <field> + <fielddescr>STunnel Port</fielddescr> + <fieldname>stunnelport</fieldname> + <description>[OPTIONAL] If you have setup a STunnel forward enter its port here.</description> <type>input</type> </field> </fields> diff --git a/config/anyterm/binaries7/anytermd b/config/anyterm/binaries7/anytermd Binary files differnew file mode 100755 index 00000000..ce5304e7 --- /dev/null +++ b/config/anyterm/binaries7/anytermd |