mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 16:14:40 +00:00
openssh: feedback/discussion with @adschellevis for #1347
This commit is contained in:
parent
e3f6e4f7c1
commit
77458a2f64
@ -390,6 +390,15 @@ function legacy_get_interface_addresses($ifs)
|
||||
$addrs['ipaddr6'] = $intf_details['ipv6'][0]['ipaddr'];
|
||||
$addrs['subnetbits6'] = $intf_details['ipv6'][0]['subnetbits'];
|
||||
}
|
||||
foreach ($intf_details['ipv6'] as $ipv6) {
|
||||
if (empty($addrs['ipaddr6']) && empty($ipv6['link-local'])) {
|
||||
$addrs['ipaddr6'] = $ipv6['ipaddr'];
|
||||
$addrs['subnetbits6'] = $ipv6['subnetbits'];
|
||||
} elseif (empty($addrs['lladdr6']) && !empty($ipv6['link-local'])) {
|
||||
$addrs['ipaddr6_ll'] = $ipv6['ipaddr'];
|
||||
$addrs['subnetbits6_ll'] = $ipv6['subnetbits'];
|
||||
}
|
||||
}
|
||||
return $addrs;
|
||||
}
|
||||
|
||||
|
||||
@ -178,28 +178,29 @@ function openssh_configure_do($verbose = false, $interface = '')
|
||||
$sshconf .= "HostKey {$file}\n";
|
||||
}
|
||||
|
||||
$any = count($interfaces) ? false : true;
|
||||
$listeners = array();
|
||||
|
||||
foreach ($interfaces as $interface) {
|
||||
$realif = get_real_interface($interface);
|
||||
$addrs = legacy_get_interface_addresses($realif);
|
||||
if (!empty($addrs['ipaddr'])) {
|
||||
$sshconf .= "ListenAddress {$addrs['ipaddr']}\n";
|
||||
$any = true;
|
||||
}
|
||||
if (!empty($addrs['ipaddr6'])) {
|
||||
$sshconf .= "ListenAddress {$addrs['ipaddr6']}\n";
|
||||
$any = true;
|
||||
foreach (array('ipaddr', 'ipaddr6', 'ipaddr6_ll') as $type) {
|
||||
if (!empty($addrs[$type])) {
|
||||
$listeners[] = $addrs[$type];
|
||||
}
|
||||
}
|
||||
|
||||
$viparr = &config_read_array('virtualip', 'vip');
|
||||
foreach ($viparr as $vip) {
|
||||
if ($vip['interface'] == $interface && is_ipaddr($vip['subnet'])) {
|
||||
$sshconf .= "ListenAddress {$vip['subnet']}\n";
|
||||
$any = true;
|
||||
$listeners[] = $vip['subnet'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($listeners as $listener) {
|
||||
$sshconf .= "ListenAddress {$listener}\n";
|
||||
}
|
||||
|
||||
file_put_contents("/usr/local/etc/ssh/sshd_config", $sshconf);
|
||||
|
||||
if ($verbose) {
|
||||
@ -207,7 +208,7 @@ function openssh_configure_do($verbose = false, $interface = '')
|
||||
flush();
|
||||
}
|
||||
|
||||
if (!$any || mwexecf('/usr/bin/protect -i /usr/local/sbin/sshd')) {
|
||||
if ((count($interfaces) && !count($listeners)) || mwexecf('/usr/bin/protect -i /usr/local/sbin/sshd')) {
|
||||
if ($verbose) {
|
||||
echo "failed.\n";
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ include("head.inc");
|
||||
<tr>
|
||||
<td><a id="help_for_webguiport" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("TCP port"); ?></td>
|
||||
<td>
|
||||
<input name="webguiport" type="text" value="<?=$pconfig['webguiport'];?>" />
|
||||
<input name="webguiport" type="text" value="<?=$pconfig['webguiport'];?>" placeholder="<?= $pconfig['webguiproto'] == 'https' ? '443' : '80' ?>" />
|
||||
<div class="hidden" for="help_for_webguiport">
|
||||
<?=gettext("Enter a custom port number for the web GUI " .
|
||||
"above if you want to override the default (80 for HTTP, 443 " .
|
||||
@ -555,7 +555,7 @@ include("head.inc");
|
||||
<tr>
|
||||
<td><a id="help_for_sshport" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("SSH port"); ?></td>
|
||||
<td width="78%">
|
||||
<input name="sshport" type="text" value="<?=$pconfig['sshport'];?>"/>
|
||||
<input name="sshport" type="text" value="<?=$pconfig['sshport'];?>" placeholder="22" />
|
||||
<div class="hidden" for="help_for_sshport">
|
||||
<?=gettext("Leave this blank for the default of 22."); ?>
|
||||
</div>
|
||||
@ -566,7 +566,7 @@ include("head.inc");
|
||||
<td>
|
||||
<?php
|
||||
$interfaces = get_configured_interface_with_descr(); ?>
|
||||
<select name="sshinterfaces[]" multiple="multiple" class="selectpicker">
|
||||
<select name="sshinterfaces[]" multiple="multiple" class="selectpicker" title="<?= html_safe(gettext('All (recommended)')) ?>">
|
||||
<?php
|
||||
foreach ($interfaces as $iface => $ifacename): ?>
|
||||
<option value="<?= html_safe($iface) ?>" <?= in_array($iface, $pconfig['sshinterfaces']) ? 'selected="selected"' : '' ?>><?= html_safe($ifacename) ?></option>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user