diff --git a/status/CHANGELOG b/status/CHANGELOG
index 870a1b462..bc3d88d38 100644
--- a/status/CHANGELOG
+++ b/status/CHANGELOG
@@ -63,3 +63,4 @@ Added a tooltip to status icons to show the hostname.
---- Changes since 1.470 ----
Corrected the domain for AT&T SMS emails.
Added a new monitor type for Dovecot.
+Added an option to the SSH monitor type for a port number.
diff --git a/status/lang/en b/status/lang/en
index ec776bfdb..b06dfdec5 100644
--- a/status/lang/en
+++ b/status/lang/en
@@ -429,6 +429,9 @@ rssh_eproc=The Running Processes module is not supported on your system
rssh_wrongpass=Incorrect login
rssh_failed=Connection failed
rssh_error=SSH error
+rssh_haspass=Password
+rssh_port=SSH server port
+rssh_eport=Missing or invalid port number
tmpls_title=Email Templates
tmpls_ecannot=You are not allowed to edit email templates
diff --git a/status/rssh-monitor.pl b/status/rssh-monitor.pl
index d443cbee8..3f2b810d0 100644
--- a/status/rssh-monitor.pl
+++ b/status/rssh-monitor.pl
@@ -7,8 +7,10 @@ sub get_rssh_status
&foreign_require("proc", "proc-lib.pl");
local $ruser = $_[0]->{'ruser'} || "root";
local ($fh, $fpid) = &proc::pty_process_exec(
- "ssh ".quotemeta($ruser)."\@".
- quotemeta($_[0]->{'host'})." echo ok");
+ "ssh ".
+ ($_[0]->{'port'} ? "-p ".quotemeta($_[0]->{'port'})." " : "").
+ quotemeta($ruser)."\@".
+ quotemeta($_[0]->{'host'})." echo ok");
local ($out, $wrong_password, $connect_failed, $got_password);
while(1) {
local $rv = &wait_for($fh, "password:", "yes\\/no", "(^|\\n)\\s*Permission denied.*\n", "ssh: connect.*\n", ".*\n");
@@ -64,6 +66,10 @@ sub show_rssh_dialog
print &ui_table_row($text{'rssh_host'},
&ui_textbox("host", $_[0]->{'host'}, 50), 3);
+print &ui_table_row($text{'rssh_port'},
+ &ui_opt_textbox("port", $_[0]->{'port'}, 6,
+ $text{'default'}), 3);
+
print &ui_table_row($text{'rssh_ruser'},
&ui_textbox("ruser", $_[0]->{'ruser'}, 50), 3);
@@ -71,9 +77,10 @@ local $pmode = $_[0]->{'rpass'} eq '' ? 1 :
$_[0]->{'rpass'} eq '*' ? 2 : 0;
print &ui_table_row($text{'rssh_rpass'},
&ui_radio("rpass_def", $pmode,
- [ [ 1, $text{'rssh_nopass'} ],
- [ 2, $text{'rssh_nologin'} ],
- [ 0, &ui_textbox("rpass",
+ [ [ 1, $text{'rssh_nopass'}."
" ],
+ [ 2, $text{'rssh_nologin'}."
" ],
+ [ 0, $text{'rssh_haspass'}." ".
+ &ui_textbox("rpass",
$rpmode == 0 ? $_[0]->{'rpass'} : "", 30) ] ]));
}
@@ -83,6 +90,13 @@ sub parse_rssh_dialog
&foreign_installed("proc") || &error($text{'rssh_eproc'});
$in{'host'} =~ /^[a-z0-9\.\-\_]+$/i || &error($text{'rssh_ehost'});
$_[0]->{'host'} = $in{'host'};
+if ($in{'port_def'}) {
+ delete($_[0]->{'port'});
+ }
+else {
+ $in{'port'} =~ /^[1-9][0-9]*$/ || &error($text{'rssh_eport'});
+ $_[0]->{'port'} = $in{'port'};
+ }
$in{'rpass_def'} == 2 || $in{'ruser'} =~ /\S/ || &error($text{'rssh_eruser'});
$_[0]->{'ruser'} = $in{'ruser'};
$_[0]->{'rpass'} = $in{'rpass_def'} == 1 ? undef :