Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling of secure_mode for UPnP #3727

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion net/upnp/src/etc/inc/plugins.inc.d/miniupnpd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ function miniupnpd_configure_do($verbose = false)
$config_text .= "bitrate_up={$upload}\n";
}

$config_text .= "secure_mode=yes\n";
/* set secure mode, checkbox in ui is for disabling rather than enabling */
$config_text .= "secure_mode=" . (empty($upnp_config['secure_mode']) ? "yes" : "no") . "\n";

/* enable logging of packets handled by miniupnpd rules */
if (!empty($upnp_config['logpackets'])) {
Expand Down
12 changes: 11 additions & 1 deletion net/upnp/src/www/services_upnp.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function miniupnpd_validate_port($port)
'overridesubnet',
'overridewanip',
'permdefault',
'secure_mode',
'stun_host',
'stun_port',
'sysuptime',
Expand Down Expand Up @@ -168,7 +169,7 @@ function miniupnpd_validate_port($port)
// save form data
$upnp = [];
// boolean types
foreach (['enable', 'enable_upnp', 'enable_natpmp', 'logpackets', 'sysuptime', 'permdefault'] as $fieldname) {
foreach (['enable', 'enable_upnp', 'enable_natpmp', 'logpackets', 'sysuptime', 'permdefault', 'secure_mode'] as $fieldname) {
$upnp[$fieldname] = !empty($pconfig[$fieldname]);
}
// text field types
Expand Down Expand Up @@ -364,6 +365,15 @@ function miniupnpd_validate_port($port)
</div>
</td>
</tr>
<tr>
<td><a id="help_for_secure_mode" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Disable secure mode");?></td>
<td>
<input name="secure_mode" type="checkbox" value="yes" <?=!empty($pconfig['secure_mode']) ? "checked=\"checked\"" : ""; ?> />
<div class="hidden" data-for="help_for_secure_mode">
<?=gettext("Secure mode means that a UPnP client can only add port mappings to its own IP address.");?>
</div>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down