IPv6 support
authorJamie Cameron <jcameron@webmin.com>
Mon, 1 Nov 2010 04:13:11 +0000 (21:13 -0700)
committerJamie Cameron <jcameron@webmin.com>
Mon, 1 Nov 2010 04:13:11 +0000 (21:13 -0700)
sshd/CHANGELOG
sshd/edit_net.cgi
sshd/lang/en
sshd/save_host.cgi
sshd/save_net.cgi

index c66e7b9..46b39b6 100644 (file)
@@ -15,3 +15,5 @@ Added a field to allow or deny SSH 2 public key authentication.
 Converted all pages the use the new Webmin UI library, for a more consistent look and layout.
 ---- Changes since 1.500 ----
 Added a field for editing the maximum login attempts per connection.
+---- Changes since 1.520 ----
+Added support for listening on IPv6 addresses.
index f744b88..ed06d4a 100755 (executable)
@@ -17,8 +17,15 @@ if ($version{'type'} eq 'openssh' && $version{'number'} >= 3) {
        foreach $l (@listens, { }) {
                local ($a, $p) = $l->{'values'}->[0] =~ /^(.*):(\d+)$/ ?
                                   ($1, $2) : ($l->{'values'}->[0]);
+               $amode = $a eq "::" ? 2 : $a eq "0.0.0.0" ? 1 :
+                        $a eq "" ? 0 : 3;
                push(@table, [
-                       &ui_textbox("address_$i", $a, 25),
+                       &ui_select("mode_$i", $amode,
+                                  [ [ 0, "&nbsp;" ],
+                                    [ 1, $text{'net_all4'} ],
+                                    [ 2, $text{'net_all6'} ],
+                                    [ 3, $text{'net_sel'} ] ])." ".
+                       &ui_textbox("address_$i", $amode == 3 ? $a : "", 25),
                        &ui_opt_textbox("port_$i", $p, 6, $text{'default'})
                        ]);
                $i++;
index dda1718..e1d5ef5 100644 (file)
@@ -59,6 +59,9 @@ users_emaxauthtries=Missing or non-numeric number of login attempts per connecti
 net_title=Networking
 net_header=Networking options
 net_port=Listen on port
+net_all4=All IPv4 addresses
+net_all6=All IPv6 addresses
+net_sel=Address..
 net_prots=Accept protocols
 net_prots_1=SSH v1
 net_prots_2=SSH v2
index c41c6c1..d349acd 100755 (executable)
@@ -58,8 +58,8 @@ else {
                &save_directive("HostName", $conf);
                }
        else {
-               &check_ipaddress($in{'hostname'}) ||
-                       gethostbyname($in{'hostname'}) ||
+               &to_ipaddress($in{'hostname'}) ||
+                   &to_ip6address($in{'hostname'}) ||
                        &error($text{'host_ehostname'});
                &save_directive("HostName", $conf, $in{'hostname'});
                }
index 523935f..f3a623e 100755 (executable)
@@ -14,10 +14,19 @@ if ($version{'type'} eq 'openssh' && $version{'number'} >= 3) {
                &save_directive("ListenAddress", $conf);
                }
        else {
-               for($i=0; defined($a = $in{"address_$i"}); $i++) {
-                       next if (!$a);
-                       &check_ipaddress($a) || gethostbyname($a) ||
-                               &error(&text('net_eladdress', $a));
+               for($i=0; defined($in{"mode_$i"}); $i++) {
+                       next if ($in{"mode_$i"} == 0);
+                       if ($in{"mode_$i"} == 1) {
+                               $a = "0.0.0.0";
+                               }
+                       elsif ($in{"mode_$i"} == 2) {
+                               $a = "::";
+                               }
+                       elsif ($in{"mode_$i"} == 3) {
+                               $a = $in{"address_$i"};
+                               &check_ipaddress($a) || &check_ip6address($a) ||
+                                       &error(&text('net_eladdress', $a));
+                               }
                        if ($in{"port_${i}_def"}) {
                                push(@listens, $a);
                                }
@@ -38,7 +47,7 @@ else {
                }
        else {
                &check_ipaddress($in{'listen'}) ||
-                 ($version{'number'} >= 2 && gethostbyname($in{'listen'})) ||
+                 ($version{'number'} >= 2 && &to_ipaddress($in{'listen'})) ||
                    &error($text{'net_elisten'});
                &save_directive("ListenAddress", $conf, $in{'listen'});
                }