]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/remote.cgi
Remove non working SSH1 checkbox.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / remote.cgi
index ec4424d246fb63155e3686ac6433f9c90c6d37b7..9737b078dde0739e947dfbd0c6f2f1da7ba01bb2 100644 (file)
@@ -1,13 +1,23 @@
 #!/usr/bin/perl
-#
-# SmoothWall CGIs
-#
-# This code is distributed under the terms of the GPL
-#
-# (c) The SmoothWall Team
-#
-# $Id: remote.cgi,v 1.6.2.8 2005/02/22 22:21:56 gespinasse Exp $
-#
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# 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 3 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, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 use strict;
 
@@ -15,23 +25,23 @@ use strict;
 #use warnings;
 #use CGI::Carp 'fatalsToBrowser';
 
-require 'CONFIG_ROOT/general-functions.pl';
+require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
 my %remotesettings=();
 my %checked=();
 my $errormessage='';
+my $counter = 0;
 
 &Header::showhttpheaders();
 
 $remotesettings{'ENABLE_SSH'} = 'off';
-$remotesettings{'ENABLE_SSH_PROTOCOL1'} = 'off';
 $remotesettings{'ENABLE_SSH_PORTFW'} = 'off';
 $remotesettings{'ACTION'} = '';
 &Header::getcgihash(\%remotesettings);
 
-if ($remotesettings{'ACTION'} eq $Lang::tr{'save'})
+if ( (($remotesettings{'ACTION'} eq $Lang::tr{'save'}) || ($remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'}) || ($remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'})) && $remotesettings{'ACTION'} ne "" )
 {
        # not existing here indicates the box is unticked
        $remotesettings{'ENABLE_SSH_PASSWORDS'} = 'off' unless exists $remotesettings{'ENABLE_SSH_PASSWORDS'};
@@ -47,25 +57,38 @@ if ($remotesettings{'ACTION'} eq $Lang::tr{'save'})
                {
                        $errormessage = $Lang::tr{'ssh no auth'};
                }
-               system ('/bin/touch', "${General::swroot}/remote/enablessh");
+               system ('/usr/bin/touch', "${General::swroot}/remote/enablessh");
        }
        else
        {
                &General::log($Lang::tr{'ssh is disabled'});
                unlink "${General::swroot}/remote/enablessh";
        }
-
-       if ($remotesettings{'ENABLE_SSH_PROTOCOL1'} eq 'on')
+       
+       if ($remotesettings{'SSH_PORT'} eq 'on')
        {
-               &General::log($Lang::tr{'ssh1 enabled'});
+               &General::log("SSH Port 22");
        }
        else
        {
-               &General::log($Lang::tr{'ssh1 disabled'});
+               &General::log("SSH Port 222");
        }
-
-       system('/usr/local/bin/restartssh') == 0
+       
+if ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'} || $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'} ){
+       if ($remotesettings{'ENABLE_SSH'} eq 'off')
+       {
+                       system ('/usr/bin/touch', "${General::swroot}/remote/enablessh");
+                       system('/usr/local/bin/sshctrl');
+       }
+  if ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'} ) { $counter = 900;}
+  elsif ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'} ) { $counter = 1800;}
+  system("/usr/local/bin/sshctrl tempstart $counter >/dev/null");
+ }
+else {
+       system('/usr/local/bin/sshctrl') == 0
                or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
+ }
 }
 
 &General::readhash("${General::swroot}/remote/settings", \%remotesettings);
@@ -78,9 +101,6 @@ if ($remotesettings{'ACTION'} eq $Lang::tr{'save'})
 $checked{'ENABLE_SSH'}{'off'} = '';
 $checked{'ENABLE_SSH'}{'on'} = '';
 $checked{'ENABLE_SSH'}{$remotesettings{'ENABLE_SSH'}} = "checked='checked'";
-$checked{'ENABLE_SSH_PROTOCOL1'}{'off'} = '';
-$checked{'ENABLE_SSH_PROTOCOL1'}{'on'} = '';
-$checked{'ENABLE_SSH_PROTOCOL1'}{$remotesettings{'ENABLE_SSH_PROTOCOL1'}} = "checked='checked'";
 $checked{'ENABLE_SSH_PORTFW'}{'off'} = '';
 $checked{'ENABLE_SSH_PORTFW'}{'on'} = '';
 $checked{'ENABLE_SSH_PORTFW'}{$remotesettings{'ENABLE_SSH_PORTFW'}} = "checked='checked'";
@@ -90,7 +110,9 @@ $checked{'ENABLE_SSH_PASSWORDS'}{$remotesettings{'ENABLE_SSH_PASSWORDS'}} = "che
 $checked{'ENABLE_SSH_KEYS'}{'off'} = '';
 $checked{'ENABLE_SSH_KEYS'}{'on'} = '';
 $checked{'ENABLE_SSH_KEYS'}{$remotesettings{'ENABLE_SSH_KEYS'}} = "checked='checked'";
-
+$checked{'SSH_PORT'}{'off'} = '';
+$checked{'SSH_PORT'}{'on'} = '';
+$checked{'SSH_PORT'}{$remotesettings{'SSH_PORT'}} = "checked='checked'";
 
 &Header::openpage($Lang::tr{'remote access'}, 1, '');
 
@@ -111,11 +133,6 @@ print <<END
        <td><input type='checkbox' name='ENABLE_SSH' $checked{'ENABLE_SSH'}{'on'} /></td>
        <td class='base' colspan='2'>$Lang::tr{'ssh access'}</td>
 </tr>
-<tr>
-       <td>&nbsp;</td>
-       <td><input type='checkbox' name='ENABLE_SSH_PROTOCOL1' $checked{'ENABLE_SSH_PROTOCOL1'}{'on'} /></td>
-       <td width='100%' class='base'>$Lang::tr{'ssh1 support'}</td>
-</tr>
 <tr>
        <td>&nbsp;</td>
        <td><input type='checkbox' name='ENABLE_SSH_PORTFW' $checked{'ENABLE_SSH_PORTFW'}{'on'} /></td>
@@ -132,7 +149,15 @@ print <<END
        <td width='100%' class='base'>$Lang::tr{'ssh keys'}</td>
 </tr>
 <tr>
-       <td colspan='3' align='center'><hr /><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
+       <td>&nbsp;</td>
+       <td><input type='checkbox' name='SSH_PORT' $checked{'SSH_PORT'}{'on'} /></td>
+       <td width='100%' class='base'>$Lang::tr{'ssh port'}</td>
+</tr>
+<tr>
+       <td align='center' colspan='3'><hr />
+       <input type='submit' name='ACTION' value='$Lang::tr{'ssh tempstart15'}' />
+       <input type='submit' name='ACTION' value='$Lang::tr{'ssh tempstart30'}' />
+       <input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
 </tr>
 </table>
 END