&ui_print_header(undef, $text{'misc_title'}, "", "misc");
$conf = &get_sshd_config();
-print "<form action=save_misc.cgi>\n";
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'misc_header'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
+print &ui_form_start("save_misc.cgi");
+print &ui_table_start($text{'misc_header'}, "width=100%", 2);
-&scmd();
+# X11 port forwarding
$x11 = &find_value("X11Forwarding", $conf);
-print "<td><b>$text{'misc_x11'}</b></td> <td nowrap>\n";
-if ($version{'type'} eq 'ssh') {
- printf "<input type=radio name=x11 value=1 %s> %s\n",
- lc($x11) eq 'no' ? "" : "checked", $text{'yes'};
- printf "<input type=radio name=x11 value=0 %s> %s</td>\n",
- lc($x11) eq 'no' ? "checked" : "", $text{'no'};
- }
-else {
- 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</td>\n",
- lc($x11) eq 'yes' ? "" : "checked", $text{'no'};
- }
-&ecmd();
+print &ui_table_row($text{'misc_x11'},
+ &ui_yesno_radio("x11", lc($x11) eq 'no' ? 0 :
+ lc($x11) eq 'yes' ? 1 :
+ $version{'type'} eq 'ssh' ? 1 : 0));
if ($version{'type'} ne 'ssh' || $version{'number'} < 2) {
- &scmd();
+ # X display offset
$xoff = &find_value("X11DisplayOffset", $conf);
- print "<td><b>$text{'misc_xoff'}</b></td> <td nowrap>\n";
- printf "<input type=radio name=xoff_def value=1 %s> %s\n",
- $xoff ? "" : "checked", $text{'default'};
- printf "<input type=radio name=xoff_def value=0 %s>\n",
- $xoff ? "checked" : "";
- print "<input name=xoff size=4 value='$xoff'></td>\n";
- &ecmd();
+ print &ui_table_row($text{'misc_xoff'},
+ &ui_opt_textbox("xoff", $xoff, 6, $text{'default'}));
if ($version{'type'} eq 'ssh' || $version{'number'} >= 2) {
- &scmd(1);
+ # Path to xauth
$xauth = &find_value("XAuthLocation", $conf);
- print "<td><b>$text{'misc_xauth'}</b></td> <td colspan=3>\n";
- printf "<input type=radio name=xauth_def value=1 %s> %s\n",
- $xauth ? "" : "checked", $text{'default'};
- printf "<input type=radio name=xauth_def value=0 %s>\n",
- $xauth ? "checked" : "";
- print "<input name=xauth size=50 value='$xauth'></td>\n";
- &ecmd();
+ print &ui_table_row($text{'misc_xauth'},
+ &ui_opt_textbox("xauth", $xauth, 40, $text{'default'}).
+ " ".&file_chooser_button("xauth"));
}
}
if ($version{'type'} eq 'ssh' && $version{'number'} < 2) {
- &scmd();
+ # Default umask
$umask = &find_value("Umask", $conf);
- print "<td><b>$text{'misc_umask'}</b></td> <td nowrap>\n";
- printf "<input type=radio name=umask_def value=1 %s> %s\n",
- $umask ? "" : "checked", $text{'misc_umask_def'};
- printf "<input type=radio name=umask_def value=0 %s>\n",
- $umask ? "checked" : "";
- print "<input name=umask size=4 value='$umask'></td>\n";
- &ecmd();
+ print &ui_table_row($text{'misc_umask'},
+ &ui_opt_textbox("umask", $umask, 4, $text{'misc_umask_def'}));
}
+# Syslog facility
+# XXX
&scmd();
$syslog = &find_value("SyslogFacility", $conf);
print "<td><b>$text{'misc_syslog'}</b></td> <td nowrap>\n";
require './sshd-lib.pl';
&ui_print_header(undef, $text{'sync_title'}, "");
-print "<form action=save_sync.cgi>\n";
print "$text{'sync_desc'}<p>\n";
+print &ui_form_start("save_sync.cgi");
+print &ui_table_start(undef, 2, 2);
-$sp = " " x 5;
+# Create keys for new users
+print &ui_table_row($text{'sync_create'},
+ &ui_yesno_radio("create", $config{'sync_create'}));
-print &ui_checkbox("create", 1, $text{'sync_create'}, $config{'sync_create'}),
- "<br>\n";
-print $sp,&ui_checkbox("auth", 1, $text{'sync_auth'}, $config{'sync_auth'}),
- "<br>\n";
-print $sp,&ui_checkbox("pass", 1, $text{'sync_pass'}, $config{'sync_pass'}),
- "<br>\n";
-print $sp,$text{'sync_type'}," ",
+# Authorize own key
+print &ui_table_row($text{'sync_auth'},
+ &ui_yesno_radio("auth", $config{'sync_auth'}));
+
+# Use password as passphrase
+print &ui_table_row($text{'sync_pass'},
+ &ui_yesno_radio("pass", $config{'sync_pass'}));
+
+# Key type
+print &ui_table_row($text{'sync_type'},
&ui_select("type", $config{'sync_type'},
[ [ "", $text{'sync_auto'} ],
- [ "rsa" ], [ "dsa" ], [ "rsa1" ] ]),"<br>\n";
+ [ "rsa" ], [ "dsa" ], [ "rsa1" ] ]));
+
+print &ui_table_end();
+print &ui_form_end([ [ undef, $text{'save'} ] ]);
-print "<input type=submit value='$text{'save'}'></form>\n";
&ui_print_footer("", $text{'index_return'});
}
# Check if sshd is the right version
-$out = &backquote_command("e_path($config{'sshd_path'})." -h 2>&1");
-if ($config{'sshd_version'}) {
- # Forced version
- $version{'type'} = 'openssh';
- $version{'number'} = $version{'full'} = $config{'sshd_version'};
- }
-elsif ($out =~ /(sshd\s+version\s+([0-9\.]+))/i ||
- $out =~ /(ssh\s+secure\s+shell\s+([0-9\.]+))/i) {
- # Classic commercial SSH
- $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 2.x
- $version{'type'} = 'openssh';
- $version{'number'} = 2.0;
- $version{'full'} = $1;
- }
-elsif (($out = $config{'sshd_version'}) && ($out =~ /(Sun_SSH_([0-9\.]+))/i)) {
- # Probably Solaris 10 SSHD that didn't display version. Use it.
- $version{'type'} = 'openssh';
- $version{'number'} = 2.0;
- $version{'full'} = $1;
- }
-else {
+%version = &get_sshd_version();
+if (!%version) {
# Unknown version
&ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1);
print &text('index_eversion', "<tt>$config{'sshd_path'}</tt>",
sync_title=User SSH Key Setup
sync_desc=This page allows you to configure the automatic setup of SSH for new Unix users created on your system. If configured, new users will not have to run <tt>ssh-keygen</tt> before using SSH.
-sync_create=Setup SSH key for new Unix users.
-sync_auth=Copy new <tt>identify.pub</tt> to <tt>authorized_keys</tt>.
-sync_pass=Use password as key passphrase.
+sync_create=Setup SSH key for new Unix users?
+sync_auth=Copy new <tt>identify.pub</tt> to <tt>authorized_keys</tt>?
+sync_pass=Use password as key passphrase?
sync_gnupg=Setup GNUPG key for new Unix users.
sync_type=Key type
sync_auto=<Automatic>
}
$i++;
}
-print &ui_subheading($text{'hosts_header'});
+$addlink = &ui_links_row(
+ [ "<a href='edit_host.cgi?new=1'>$text{'hosts_add'}</a>" ]);
if (@links) {
- print "<a href='edit_host.cgi?new=1'>$text{'hosts_add'}</a> <br>\n";
+ print $addlink;
&icons_table(\@links, \@titles, \@icons);
}
else {
print "<b>$text{'hosts_none'}</b><p>\n";
}
-print "<a href='edit_host.cgi?new=1'>$text{'hosts_add'}</a> <p>\n";
+print $addlink;
+
&ui_print_footer("", $text{'index_return'});
do '../ui-lib.pl';
# Get version information
-&read_file("$module_config_directory/version", \%version);
+if (!&read_file("$module_config_directory/version", \%version)) {
+ %version = &get_sshd_version();
+ }
+
+# get_sshd_version()
+# Returns a hash containing the version type, number and full version
+sub get_sshd_version
+{
+local %version;
+local $out = &backquote_command(
+ "e_path($config{'sshd_path'})." -h 2>&1 </dev/null");
+if ($config{'sshd_version'}) {
+ # Forced version
+ $version{'type'} = 'openssh';
+ $version{'number'} = $version{'full'} = $config{'sshd_version'};
+ }
+elsif ($out =~ /(sshd\s+version\s+([0-9\.]+))/i ||
+ $out =~ /(ssh\s+secure\s+shell\s+([0-9\.]+))/i) {
+ # Classic commercial SSH
+ $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 2.x
+ $version{'type'} = 'openssh';
+ $version{'number'} = 2.0;
+ $version{'full'} = $1;
+ }
+elsif (($out = $config{'sshd_version'}) && ($out =~ /(Sun_SSH_([0-9\.]+))/i)) {
+ # Probably Solaris 10 SSHD that didn't display version. Use it.
+ $version{'type'} = 'openssh';
+ $version{'number'} = 2.0;
+ $version{'full'} = $1;
+ }
+return %version;
+}
# get_sshd_config()
# Returns a reference to an array of SSHD config file options