Sean Cox <throwarock@gmail.com>
authorSean Cox <throwarock@gmail.com>
Mon, 18 Aug 2008 20:32:57 +0000 (20:32 +0000)
committerSean Cox <throwarock@gmail.com>
Mon, 18 Aug 2008 20:32:57 +0000 (20:32 +0000)
* Added a page to display host keys. It finds the host keys by
*  reading the SSHD config and grabbing any lines that start with HostKey
*  using a new funstion in the ssh-lib.pl called getmlvalues.
* I also deleted all the .bak files in the folder.
*
* The icon useed is a copy from usermin/ssh/images/keys.gif

CHANGELOG
sshd/config-solaris-9.bak [deleted file]
sshd/edit_host.cgi.bak [deleted file]
sshd/edit_keys.cgi [new file with mode: 0755]
sshd/edit_net.cgi.bak [deleted file]
sshd/edit_sync.cgi.bak [deleted file]
sshd/images/keys.gif [new file with mode: 0755]
sshd/index.cgi
sshd/index.cgi.bak [deleted file]
sshd/lang/en
sshd/sshd-lib.pl

index e64779d..140572b 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -100,3 +100,5 @@ Added a debugging log file, which records all files read and written, commands r
 Many Greek translation updates, thanks to Vagelis Koutsomitros.
 Catalan translation updates by Jaume Badiella.
 Many Dutch translation contributions by Gandyman.
+---- Changes since 1.430 ----
+You can now view the Public side of the host keys, thanks to Sean Cox.
diff --git a/sshd/config-solaris-9.bak b/sshd/config-solaris-9.bak
deleted file mode 100644 (file)
index 36a8f4b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-sshd_path=/usr/lib/ssh/sshd 
-sshd_config=/etc/ssh/sshd_config
-client_config=/etc/ssh/ssh_config
-pid_file=/var/run/sshd.pid
-keygen_path=ssh-keygen
-sync_create=0
-sync_auth=1
-sync_pass=0
-sync_gnupg=0
diff --git a/sshd/edit_host.cgi.bak b/sshd/edit_host.cgi.bak
deleted file mode 100644 (file)
index f5f1a13..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-#!/usr/local/bin/perl
-# edit_host.cgi
-# Display options for a new or existing host config
-
-require './sshd-lib.pl';
-&ReadParse();
-if ($in{'new'}) {
-       &header($text{'host_create'}, "", "chost");
-       }
-else {
-       &header($text{'host_edit'}, "", "ehost");
-       $hconf = &get_client_config();
-       $host = $hconf->[$in{'idx'}];
-       $conf = $host->{'members'};
-       }
-print "<hr>\n";
-
-print "<form action=save_host.cgi>\n";
-print "<input type=hidden name=idx value='$in{'idx'}'>\n";
-print "<input type=hidden name=new value='$in{'new'}'>\n";
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'host_header'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
-
-&scmd(1);
-print "<td><b>$text{'host_name'}</b></td> <td colspan=3>\n";
-printf "<input type=radio name=name_def value=1 %s> %s\n",
-       $host->{'values'}->[0] eq '*' ? 'checked' : '', $text{'hosts_all'};
-printf "<input type=radio name=name_def value=0 %s>\n",
-       $host->{'values'}->[0] eq '*' ? '' : 'checked'; 
-printf "<input name=name size=40 value='%s'></td>\n",
-       $host->{'values'}->[0] eq '*' ? '' : $host->{'values'}->[0];
-&ecmd();
-
-&scmd();
-$user = &find_value("User", $conf);
-print "<td><b>$text{'host_user'}</b></td> <td nowrap>\n";
-printf "<input type=radio name=user_def value=1 %s> %s\n",
-       $user ? "" : "checked", $text{'host_user_def'};
-printf "<input type=radio name=user_def value=0 %s>\n",
-       $user ? "checked" : "";
-print "<input name=user size=13 value='$user'></td>\n";
-&ecmd();
-
-&scmd();
-$keep = &find_value("KeepAlive", $conf);
-print "<td><b>$text{'host_keep'}</b></td> <td>\n";
-printf "<input type=radio name=keep value=1 %s> %s\n",
-       lc($keep) eq 'yes' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=keep value=0 %s> %s\n",
-       lc($keep) eq 'no' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=keep value=2 %s> %s</td>\n",
-       !$keep ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$hostname = &find_value("HostName", $conf);
-print "<td><b>$text{'host_hostname'}</b></td> <td nowrap>\n";
-printf "<input type=radio name=hostname_def value=1 %s> %s\n",
-       $hostname ? "" : "checked", $text{'host_hostname_def'};
-printf "<input type=radio name=hostname_def value=0 %s>\n",
-       $hostname ? "checked" : "";
-print "<input name=hostname size=20 value='$hostname'></td>\n";
-&ecmd();
-
-&scmd();
-$batch = &find_value("BatchMode", $conf);
-print "<td><b>$text{'host_batch'}</b></td> <td>\n";
-printf "<input type=radio name=batch value=0 %s> %s\n",
-       lc($batch) eq 'no' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=batch value=1 %s> %s\n",
-       lc($batch) eq 'yes' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=batch value=2 %s> %s</td>\n",
-       !$batch ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$port = &find_value("Port", $conf);
-print "<td><b>$text{'host_port'}</b></td> <td nowrap>\n";
-printf "<input type=radio name=port_def value=1 %s> %s\n",
-       $port ? "" : "checked", $text{'default'};
-printf "<input type=radio name=port_def value=0 %s>\n",
-       $port ? "checked" : "";
-print "<input name=port size=6 value='$port'></td>\n";
-&ecmd();
-
-&scmd();
-$comp = &find_value("Compression", $conf);
-print "<td><b>$text{'host_comp'}</b></td> <td>\n";
-printf "<input type=radio name=comp value=1 %s> %s\n",
-       lc($comp) eq 'yes' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=comp value=0 %s> %s\n",
-       lc($comp) eq 'no' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=comp value=2 %s> %s</td>\n",
-       !$comp ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$escape = &find_value("EscapeChar", $conf);
-print "<td><b>$text{'host_escape'}</b></td> <td nowrap>\n";
-printf "<input type=radio name=escape_def value=1 %s> %s\n",
-       $escape eq "" ? "checked" : "", $text{'default'};
-printf "<input type=radio name=escape_def value=2 %s> %s\n",
-       $escape eq "none" ? "checked" : "", $text{'host_escape_none'};
-printf "<input type=radio name=escape_def value=0 %s>\n",
-       $escape eq "" || $escape eq "none" ? "" : "checked";
-printf "<input name=escape size=2 value='%s'></td>\n",
-       $escape eq "" || $escape eq "none" ? "" : $escape;
-&ecmd();
-
-&scmd();
-$clevel = &find_value("CompressionLevel", $conf);
-print "<td><b>$text{'host_clevel'}</b></td> <td nowrap>\n";
-printf "<input type=radio name=clevel_def value=1 %s> %s\n",
-       $clevel ? "" : "checked", $text{'default'};
-printf "<input type=radio name=clevel_def value=0 %s>\n",
-       $clevel ? "checked" : "";
-print "<select name=clevel>\n";
-foreach $l (1 .. 9) {
-       printf "<option %s value=%s>%s %s\n", $clevel == $l ? 'selected' : '',
-               $l, $l, $text{"host_clevel_$l"};
-       }
-print "</select></td>\n";
-&ecmd();
-
-&scmd();
-$attempts = &find_value("ConnectionAttempts", $conf);
-print "<td><b>$text{'host_attempts'}</b></td> <td nowrap>\n";
-printf "<input type=radio name=attempts_def value=1 %s> %s\n",
-       $attempts ? "" : "checked", $text{'default'};
-printf "<input type=radio name=attempts_def value=0 %s>\n",
-       $attempts ? "checked" : "";
-print "<input name=attempts size=2 value='$attempts'></td>\n";
-&ecmd();
-
-&scmd();
-$priv = &find_value("UsePrivilegedPort", $conf);
-print "<td><b>$text{'host_priv'}</b></td> <td>\n";
-printf "<input type=radio name=priv value=1 %s> %s\n",
-       lc($priv) eq 'yes' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=priv value=0 %s> %s\n",
-       lc($priv) eq 'no' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=priv value=2 %s> %s</td>\n",
-       !$priv ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$rsh = &find_value("FallBackToRsh", $conf);
-print "<td><b>$text{'host_rsh'}</b></td> <td>\n";
-printf "<input type=radio name=rsh value=1 %s> %s\n",
-       lc($rsh) eq 'yes' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=rsh value=0 %s> %s\n",
-       lc($rsh) eq 'no' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=rsh value=2 %s> %s</td>\n",
-       !$rsh ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$usersh = &find_value("UseRsh", $conf);
-print "<td><b>$text{'host_usersh'}</b></td> <td>\n";
-printf "<input type=radio name=usersh value=1 %s> %s\n",
-       lc($usersh) eq 'yes' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=usersh value=0 %s> %s\n",
-       lc($usersh) eq 'no' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=usersh value=2 %s> %s</td>\n",
-       !$usersh ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$agent = &find_value("ForwardAgent", $conf);
-print "<td><b>$text{'host_agent'}</b></td> <td>\n";
-printf "<input type=radio name=agent value=1 %s> %s\n",
-       lc($agent) eq 'yes' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=agent value=0 %s> %s\n",
-       lc($agent) eq 'no' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=agent value=2 %s> %s</td>\n",
-       !$agent ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$x11 = &find_value("ForwardX11", $conf);
-print "<td><b>$text{'host_x11'}</b></td> <td>\n";
-printf "<input type=radio name=x11 value=1 %s> %s\n",
-       lc($x11) eq 'yes' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=x11 value=0 %s> %s\n",
-       lc($x11) eq 'no' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=x11 value=2 %s> %s</td>\n",
-       !$x11 ? "checked" : "", $text{'default'};
-&ecmd();
-
-&scmd();
-$strict = &find_value("StrictHostKeyChecking", $conf);
-print "<td><b>$text{'host_strict'}</b></td> <td>\n";
-printf "<input type=radio name=strict value=0 %s> %s\n",
-       lc($strict) eq 'no' ? "checked" : "", $text{'yes'};
-printf "<input type=radio name=strict value=1 %s> %s\n",
-       lc($strict) eq 'yes' ? "checked" : "", $text{'no'};
-printf "<input type=radio name=strict value=3 %s> %s\n",
-       lc($strict) eq 'ask' ? "checked" : "", $text{'host_ask'};
-printf "<input type=radio name=strict value=2 %s> %s</td>\n",
-       !$strict ? "checked" : "", $text{'default'};
-&ecmd();
-
-if ($version{'type'} eq 'openssh') {
-       &scmd();
-       $checkip = &find_value("CheckHostIP", $conf);
-       print "<td><b>$text{'host_checkip'}</b></td> <td>\n";
-       printf "<input type=radio name=checkip value=1 %s> %s\n",
-               lc($checkip) eq 'yes' ? "checked" : "", $text{'yes'};
-       printf "<input type=radio name=checkip value=0 %s> %s\n",
-               lc($checkip) eq 'no' ? "checked" : "", $text{'no'};
-       printf "<input type=radio name=checkip value=2 %s> %s</td>\n",
-               !$checkip ? "checked" : "", $text{'default'};
-       &ecmd();
-
-       &scmd(1);
-       $prots = &find_value("Protocol", $conf);
-       @prots = split(/,/, $prots);
-       print "<td><b>$text{'host_prots'}</b></td> <td>\n";
-       printf "<input type=radio name=prots_def value=1 %s> %s\n",
-               $prots ? '' : 'checked', $text{'default'};
-       printf "<input type=radio name=prots_def value=0 %s> %s\n",
-               $prots ? 'checked' : '', $text{'host_prots_sel'};
-       foreach $p (1, 2) {
-               printf "<input type=checkbox name=prots value=%s %s> %s\n",
-                       $p, &indexof($p, @prots) >= 0 ? "checked" : "",
-                       $text{"net_prots_$p"};
-               }
-       print "</td>\n";
-       &ecmd();
-       }
-
-&scmd(1);
-print "<td colspan=4><hr></td>\n";
-&ecmd();
-
-&scmd(1);
-print "<td valign=top><b>$text{'host_lforward'}</b></td>\n";
-print "<td colspan=3><table border>\n";
-print "<tr $tb> <td><b>$text{'host_llport'}</b></td> ",
-      "<td><b>$text{'host_lrhost'}</b></td> ",
-      "<td><b>$text{'host_lrport'}</b></td> </tr>\n";
-@lforward = &find("LocalForward", $conf);
-$i = 0;
-foreach $l (@lforward, { }) {
-       local ($lp, $rh, $rp) = ( $l->{'values'}->[0],
-                                 split(/:/, $l->{'values'}->[1]) );
-       print "<tr>\n";
-       print "<td><input name=llport_$i size=8 value='$lp'></td>\n";
-       print "<td><input name=lrhost_$i size=40 value='$rh'></td>\n";
-       print "<td><input name=lrport_$i size=8 value='$rp'></td>\n";
-       print "</tr>\n";
-       $i++;
-       }
-print "</table></td>\n";
-&ecmd();
-
-&scmd(1);
-print "<td colspan=4><hr></td>\n";
-&ecmd();
-
-&scmd(1);
-print "<td valign=top><b>$text{'host_rforward'}</b></td>\n";
-print "<td colspan=3><table border>\n";
-print "<tr $tb> <td><b>$text{'host_rrport'}</b></td> ",
-      "<td><b>$text{'host_rlhost'}</b></td> ",
-      "<td><b>$text{'host_rlport'}</b></td> </tr>\n";
-@rforward = &find("RemoteForward", $conf);
-$i = 0;
-foreach $r (@rforward, { }) {
-       local ($rp, $lh, $lp) = ( $r->{'values'}->[0],
-                                 split(/:/, $r->{'values'}->[1]) );
-       print "<tr>\n";
-       print "<td><input name=rrport_$i size=8 value='$rp'></td>\n";
-       print "<td><input name=rlhost_$i size=40 value='$lh'></td>\n";
-       print "<td><input name=rlport_$i size=8 value='$lp'></td>\n";
-       print "</tr>\n";
-       $i++;
-       }
-print "</table></td>\n";
-&ecmd();
-
-print "</table></td></tr></table>\n";
-print "<table width=100%><tr>\n";
-print "<td><input type=submit value='$text{'save'}'></td>\n";
-print "<td align=right><input type=submit name=delete ",
-      "value='$text{'delete'}'></td>\n";
-print "</tr></table>\n";
-
-print "<hr>\n";
-&footer("list_hosts.cgi", $text{'hosts_return'});
-
diff --git a/sshd/edit_keys.cgi b/sshd/edit_keys.cgi
new file mode 100755 (executable)
index 0000000..93325bc
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/local/bin/perl
+# Show a page for manually editing host keys
+# Only displays keys for now
+
+require './sshd-lib.pl';
+&ReadParse();
+&ui_print_header(undef, $text{'keys_title'}, "");
+
+# Work out and show the files
+@files = &get_mlvalues($config{'sshd_config'}, "HostKey");
+foreach $key (@files) {
+        $key = $key . ".pub";
+        }
+       
+$in{'file'} ||= $files[0];
+&indexof($in{'file'}, @files) >= 0 || &error($text{'keys_none'});
+print &ui_form_start("edit_keys.cgi");
+print "<b>Key filename</b>\n";
+print &ui_select("file", $in{'file'},
+                [ map { [ $_ ] } @files ]),"\n";
+print &ui_submit('View');
+print &ui_form_end();
+
+# Show the file contents
+print &ui_form_start("save_manual.cgi", "form-data");
+print &ui_hidden("file", $in{'file'}),"\n";
+$data = &read_file_contents($in{'file'});
+print &ui_textarea("data", $data, 20, 80),"\n";
+
+&ui_print_footer("", $text{'index_sharelist'});
+
diff --git a/sshd/edit_net.cgi.bak b/sshd/edit_net.cgi.bak
deleted file mode 100755 (executable)
index 71dfe8b..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/local/bin/perl
-# edit_net.cgi
-# Display networking related SSHd options
-
-require './sshd-lib.pl';
-&header($text{'net_title'}, "", "net");
-print "<hr>\n";
-$conf = &get_sshd_config();
-
-print "<form action=save_net.cgi>\n";
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'net_header'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
-
-if ($version{'type'} eq 'openssh' && $version{'number'} >= 3 || 1) {
-       # Multiple listen addresses supported
-       &scmd(1);
-       @listens = &find("ListenAddress", $conf);
-       print "<td valign=top><b>$text{'net_listen2'}</b></td>\n";
-       print "<td colspan=3>\n";
-       printf "<input type=radio name=listen_def value=1 %s> %s\n",
-               @listens ? "" : "checked", $text{'net_listen_def'};
-       printf "<input type=radio name=listen_def value=0 %s> %s<br>\n",
-               @listens ? "checked" : "", $text{'net_below'};
-       print "<table border>\n";
-       print "<tr $tb> <td><b>$text{'net_laddress'}</b></td> ",
-             "<td><b>$text{'net_lport'}</b></td> </tr>\n";
-       $i = 0;
-       foreach $l (@listens, { }) {
-               local ($a, $p) = $l->{'values'}->[0] =~ /^(.*):(\d+)$/ ?
-                                  ($1, $2) : ($l->{'values'}->[0]);
-               print "<tr $cb>\n";
-               print "<td><input name=address_$i size=25 value='$a'></td>\n";
-               printf "<td><input type=radio name=port_def_$i value=1 %s> %s ",
-                       $p ? "" : "checked", $text{'default'};
-               printf "<input type=radio name=port_def_$i value=0 %s>\n",
-                       $p ? "checked" : "";
-               print "<input name=port_$i size=6 value='$p'></td>\n";
-               print "</tr>\n";
-               $i++;
-               }
-       print "</table>\n";
-       &ecmd();
-       }
-else {
-       # Just one listen address
-       &scmd();
-       $listen = &find_value("ListenAddress", $conf);
-       $listen = "" if ($listen eq "0.0.0.0");
-       print "<td><b>$text{'net_listen'}</b></td> <td nowrap>\n";
-       printf "<input type=radio name=listen_def value=1 %s> %s\n",
-               $listen ? "" : "checked", $text{'net_listen_def'};
-       printf "<input type=radio name=listen_def value=0 %s>\n",
-               $listen ? "checked" : "";
-       print "<input name=listen size=15 value='$listen'></td>\n";
-       &ecmd();
-       }
-
-&scmd();
-@ports = &find("Port", $conf);
-$port = join(" ", map { $_->{'values'}->[0] } @ports);
-print "<td><b>$text{'net_port'}</b></td> <td nowrap>\n";
-printf "<input type=radio name=port_def value=1 %s> %s (22)\n",
-       $port ? "" : "checked", $text{'default'};
-printf "<input type=radio name=port_def value=0 %s>\n",
-       $port ? "checked" : "";
-print "<input name=port size=6 value='$port'></td>\n";
-&ecmd();
-
-if ($version{'type'} eq 'openssh' && $version{'number'} >= 2) {
-       &scmd();
-       $prots = &find_value("Protocol", $conf);
-       @prots = $prots ? split(/,/, $prots) :
-                $version{'number'} >= 2.9 ? (1, 2) : (1);
-       print "<td><b>$text{'net_prots'}</b></td> <td>\n";
-       foreach $p (1, 2) {
-               printf "<input type=checkbox name=prots value=%s %s> %s\n",
-                       $p, &indexof($p, @prots) >= 0 ? "checked" : "",
-                       $text{"net_prots_$p"};
-               }
-       print "</td>\n";
-       &ecmd();
-       }
-
-if ($version{'type'} eq 'ssh' &&
-    ($version{'number'} < 2 || $version{'number'} >= 3)) {
-       &scmd();
-       $idle = &find_value("IdleTimeout", $conf);
-       if ($idle =~ /^(\d+)([smhdw])$/i) {
-               $idle = $1; $units = $2;
-               }
-       print "<td><b>$text{'net_idle'}</b></td> <td>\n";
-       printf "<input type=radio name=idle_def value=1 %s> %s\n",
-               $idle ? "" : "checked", $text{'default'};
-       printf "<input type=radio name=idle_def value=0 %s>\n",
-               $idle ? "checked" : "";
-       print "<input name=idle size=6 value='$idle'>\n";
-       print "<select name=idle_units>\n";
-       foreach $u ('s', 'm', 'h', 'd', 'w') {
-               printf "<option value=%s %s>%s\n",
-                       $u, $units eq $u ? 'selected' : '',
-                       $text{"net_idle_$u"};
-               }
-       print "</select></td>\n";
-       &ecmd();
-       }
-
-&scmd();
-$keep = &find_value("KeepAlive", $conf);
-print "<td><b>$text{'net_keep'}</b></td> <td>\n";
-printf "<input type=radio name=keep value=1 %s> %s\n",
-       lc($keep) eq 'no' ? "" : "checked", $text{'yes'};
-printf "<input type=radio name=keep value=0 %s> %s</td>\n",
-       lc($keep) eq 'no' ? "checked" : "", $text{'no'};
-&ecmd();
-
-&scmd();
-$grace = &find_value("LoginGraceTime", $conf);
-print "<td><b>$text{'net_grace'}</b></td> <td>\n";
-printf "<input type=radio name=grace_def value=1 %s> %s\n",
-       $grace ? "" : "checked", $text{'net_grace_def'};
-printf "<input type=radio name=grace_def value=0 %s>\n",
-       $grace ? "checked" : "";
-print "<input name=grace size=6 value='$grace'> $text{'net_grace_s'}</td>\n";
-&ecmd();
-
-if ($version{'type'} ne 'openssh' || $version{'number'} >= 2) {
-       &scmd();
-       $tcp = &find_value("AllowTcpForwarding", $conf);
-       print "<td><b>$text{'net_tcp'}</b></td> <td>\n";
-       printf "<input type=radio name=tcp value=1 %s> %s\n",
-               lc($tcp) eq 'no' ? "" : "checked", $text{'yes'};
-       printf "<input type=radio name=tcp value=0 %s> %s</td>\n",
-               lc($tcp) eq 'no' ? "checked" : "", $text{'no'};
-       &ecmd();
-       }
-
-if ($version{'type'} eq 'openssh' && $version{'number'} >= 2) {
-       &scmd();
-       $gateway = &find_value("GatewayPorts", $conf);
-       print "<td><b>$text{'net_gateway'}</b></td> <td>\n";
-       printf "<input type=radio name=gateway value=1 %s> %s\n",
-               lc($gateway) eq 'yes' ? "checked" : "", $text{'yes'};
-       printf "<input type=radio name=gateway value=0 %s> %s</td>\n",
-               lc($gateway) eq 'yes' ? "" : "checked", $text{'no'};
-       &ecmd();
-
-       if ($version{'number'} > 2.3) {
-               &scmd();
-               $reverse = &find_value("ReverseMappingCheck", $conf);
-               print "<td><b>$text{'net_reverse'}</b></td> <td>\n";
-               printf "<input type=radio name=reverse value=1 %s> %s\n",
-                       lc($reverse) eq 'yes' ? "checked" : "", $text{'yes'};
-               printf "<input type=radio name=reverse value=0 %s> %s</td>\n",
-                       lc($reverse) eq 'yes' ? "" : "checked", $text{'no'};
-               &ecmd();
-               }
-       }
-
-print "</table></td></tr></table>\n";
-print "<input type=submit value='$text{'save'}'></form>\n";
-
-print "<hr>\n";
-&footer("", $text{'index_return'});
-
diff --git a/sshd/edit_sync.cgi.bak b/sshd/edit_sync.cgi.bak
deleted file mode 100644 (file)
index 4ee3e44..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/local/bin/perl
-# edit_sync.cgi
-# Display options for the automatic setting up of SSH for new users
-
-require './sshd-lib.pl';
-&header($text{'sync_title'}, "");
-print "<hr>\n";
-
-print "<form action=save_sync.cgi>\n";
diff --git a/sshd/images/keys.gif b/sshd/images/keys.gif
new file mode 100755 (executable)
index 0000000..963342a
Binary files /dev/null and b/sshd/images/keys.gif differ
index 1200b39..1c720cf 100755 (executable)
@@ -84,10 +84,15 @@ if (-r $config{'client_config'}) {
 push(@links, "edit_sync.cgi");
 push(@titles, $text{'sync_title'});
 push(@icons, "images/sync.gif");
+
+push(@links, "edit_keys.cgi");
+push(@titles, $text{'keys_title'});
+push(@icons, "images/keys.gif");
+
 push(@links, "edit_manual.cgi");
 push(@titles, $text{'manual_title'});
 push(@icons, "images/manual.gif");
-&icons_table(\@links, \@titles, \@icons, scalar(@links));
+&icons_table(\@links, \@titles, \@icons, 4);
 
 # Check if sshd is running
 $pid = &get_sshd_pid();
diff --git a/sshd/index.cgi.bak b/sshd/index.cgi.bak
deleted file mode 100755 (executable)
index e1ddd65..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/local/bin/perl
-# index.cgi
-# Display sshd option categories
-
-require './sshd-lib.pl';
-
-# Check if config file exists
-if (!-r $config{'sshd_config'}) {
-       &header($text{'index_title'}, "", "intro", 1, 1);
-       print "<hr>\n";
-       print &text('index_econfig', "<tt>$config{'sshd_config'}</tt>",
-                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
-       print "<hr>\n";
-       &footer("/", $text{"index"});
-       exit;
-       }
-
-# Check if sshd exists
-if (!&has_command($config{'sshd_path'})) {
-       &header($text{'index_title'}, "", "intro", 1, 1);
-       print "<hr>\n";
-       print &text('index_esshd', "<tt>$config{'sshd_path'}</tt>",
-                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
-       print "<hr>\n";
-       &footer("/", $text{"index"});
-       exit;
-       }
-
-# Check if sshd is the right version
-$out = `$config{'sshd_path'} -h 2>&1`;
-if ($out =~ /(sshd\s+version\s+([0-9\.]+))/i ||
-    $out =~ /(ssh\s+secure\s+shell\s+([0-9\.]+))/i) {
-       # Classic SSH - only versions 1 and 2 are supported
-       if ($2 >= 3) {
-               &header($text{'index_title'}, "", "intro", 1, 1);
-               print "<hr>\n";
-               print &text('index_eversion2',
-                           "<tt>$config{'sshd_path'}</tt>", $2),"<p>\n";
-               print "<hr>\n";
-               &footer("/", $text{"index"});
-               exit;
-               }
-       $version{'type'} = 'ssh';
-       $version{'number'} = $2;
-       $version{'full'} = $1;
-       }
-elsif ($out =~ /(OpenSSH.([0-9\.]+))/i) {
-       # OpenSSH .. assume all versions are supported
-       $version{'type'} = 'openssh';
-       $version{'number'} = $2;
-       $version{'full'} = $1;
-       }
-elsif ($out =~ /(Sun_SSH_([0-9\.]+))/i) {
-       # Solaris 9 SSH is actually OpenSSH 3.0
-       $version{'type'} = 'openssh';
-       $version{'number'} = 3.0;
-       $version{'full'} = $1;
-       }
-else {
-       # Unknown version
-       &header($text{'index_title'}, "", "intro", 1, 1);
-       print "<hr>\n";
-       print &text('index_eversion', "<tt>$config{'sshd_path'}</tt>",
-                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
-       print "<hr>\n";
-       &footer("/", $text{"index"});
-       exit;
-       }
-&write_file("$module_config_directory/version", \%version);
-
-&header($text{'index_title'}, "", "intro", 1, 1, 0,
-       &help_search_link("ssh", "man", "doc", "google"), undef, undef,
-       &text('index_version', $version{'full'}));
-print "<hr>\n";
-
-# Display icons for options
-foreach $i ('users', 'net', 'access', 'misc') {
-       push(@links, "edit_$i.cgi");
-       push(@titles, $text{$i.'_title'});
-       push(@icons, "images/$i.gif");
-       }
-if (-r $config{'client_config'}) {
-       push(@links, "list_hosts.cgi");
-       push(@titles, $text{'hosts_title'});
-       push(@icons, "images/hosts.gif");
-       }
-push(@links, "edit_sync.cgi");
-push(@titles, $text{'sync_title'});
-push(@icons, "images/sync.gif");
-&icons_table(\@links, \@titles, \@icons, scalar(@links));
-
-# Check if sshd is running
-$conf = &get_sshd_config();
-$pidfile = &find_value("PidFile", $conf);
-$pidfile = $config{'pid_file'} if (!$pidfile);
-if (open(PID, $pidfile) && ($pid = int(<PID>)) && kill(0, $pid)) {
-       # Running .. offer to apply changes
-       print "<hr>\n";
-       print "<form action=apply.cgi>\n";
-       print "<input name=pid type=hidden value='$pid'>\n";
-       print "<table width=100%><tr>\n";
-       print "<td><input type=submit value=\"$text{'index_apply'}\"></td>\n";
-       print "<td>$text{'index_applymsg'}</td>\n";
-       print "</tr></table></form>\n";
-       }
-else {
-       # Not running .. offer to start
-       print "<hr>\n";
-       print "<form action=start.cgi>\n";
-       print "<table width=100%><tr>\n";
-       print "<td><input type=submit value=\"$text{'index_start'}\"></td>\n";
-       print "<td>$text{'index_startmsg'}</td>\n";
-       print "</tr></table></form>\n";
-       }
-close(PID);
-
-print "<hr>\n";
-&footer("/", $text{"index"});
-
index cf4c182..91e83f9 100644 (file)
@@ -214,6 +214,10 @@ sync_gnupg=Setup GNUPG key for new Unix users.
 sync_type=Key type
 sync_auto=&lt;Automatic&gt;
 
+keys_title=Host SSH Keys
+keys_desc=This page allows you to view the SSH keys for this host.
+keys_none=Could not find any HostKey entries in your SSHD configuration.
+
 manual_title=Edit Config Files
 manual_ecannot=You are not allowed to edit the SSH server config file
 manual_ok=Edit
index da9a091..7132d4f 100644 (file)
@@ -274,5 +274,33 @@ else {
        }
 }
 
+# get_mlvalues(file, id, [splitchar])
+# Return an array with values from a file, where the
+# values are one per line with an id preceeding them
+sub get_mlvalues
+{
+local @rv;
+local $_;
+local $split = defined($_[2]) ? $_[2] : " ";
+local $realfile = &translate_filename($_[0]);
+&open_readfile(ARFILE, $_[0]) || return 0;
+while(<ARFILE>) {
+       chomp;
+       local $hash = index($_, "#");
+       local $eq = index($_, $split);
+       if ($hash != 0 && $eq >= 0) {
+               local $n = substr($_, 0, $eq);
+               local $v = substr($_, $eq+1);
+               chomp($v);
+               if ($n eq $_[1]) {
+                       push(@rv, $v);
+                                               }
+               }
+        }
+close(ARFILE);
+return @rv;
+}
+
+
 1;