Commit 5044756b authored by Franco Fichtner's avatar Franco Fichtner

system: extend sudo usage for no password mode

(cherry picked from commit 041681ba)
parent 322348b1
{% if system.sudo_allow_wheel|default('0') == '1' %} {% if system.sudo_allow_wheel|default('0') == '1' %}
%wheel ALL=(ALL) ALL %wheel ALL=(ALL) ALL
{% elif system.sudo_allow_wheel|default('0') == '2' %}
%wheel ALL=(ALL) NOPASSWD: ALL
{% endif %} {% endif %}
...@@ -41,7 +41,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -41,7 +41,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['ssl-certref'] = $config['system']['webgui']['ssl-certref']; $pconfig['ssl-certref'] = $config['system']['webgui']['ssl-certref'];
$pconfig['disablehttpredirect'] = isset($config['system']['webgui']['disablehttpredirect']); $pconfig['disablehttpredirect'] = isset($config['system']['webgui']['disablehttpredirect']);
$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']); $pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
$pconfig['sudo_allow_wheel'] = isset($config['system']['sudo_allow_wheel']); $pconfig['sudo_allow_wheel'] = $config['system']['sudo_allow_wheel'];
$pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']); $pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
$pconfig['nodnsrebindcheck'] = isset($config['system']['webgui']['nodnsrebindcheck']); $pconfig['nodnsrebindcheck'] = isset($config['system']['webgui']['nodnsrebindcheck']);
$pconfig['nohttpreferercheck'] = isset($config['system']['webgui']['nohttpreferercheck']); $pconfig['nohttpreferercheck'] = isset($config['system']['webgui']['nohttpreferercheck']);
...@@ -114,8 +114,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -114,8 +114,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['disableconsolemenu']); unset($config['system']['disableconsolemenu']);
} }
if ($pconfig['sudo_allow_wheel'] == "yes") { if (!empty($pconfig['sudo_allow_wheel'])) {
$config['system']['sudo_allow_wheel'] = true; $config['system']['sudo_allow_wheel'] = $pconfig['sudo_allow_wheel'];
} elseif (isset($config['system']['sudo_allow_wheel'])) { } elseif (isset($config['system']['sudo_allow_wheel'])) {
unset($config['system']['sudo_allow_wheel']); unset($config['system']['sudo_allow_wheel']);
} }
...@@ -553,8 +553,11 @@ include("head.inc"); ...@@ -553,8 +553,11 @@ include("head.inc");
<tr> <tr>
<td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Sudo usage") ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Sudo usage") ?></td>
<td width="78%"> <td width="78%">
<input name="sudo_allow_wheel" type="checkbox" value="yes" <?= empty($pconfig['sudo_allow_wheel']) ? '' : 'checked="checked"' ?> /> <select name="sudo_allow_wheel" id="sudo_allow_wheel" class="formselect selectpicker">
<strong><?= gettext('Allow administrators to use the Sudo utility') ?></strong> <option value="" <?= empty($pconfig['sudo_allow_wheel']) ? 'selected="selected"' : '' ?>><?= gettext('Disallow') ?></option>
<option value="1" <?= $pconfig['sudo_allow_wheel'] == 1 ? 'selected="selected"' : '' ?>><?= gettext('Ask password') ?></option>
<option value="2" <?= $pconfig['sudo_allow_wheel'] == 2 ? 'selected="selected"' : '' ?>><?= gettext('No password') ?></option>
</select>
</td> </td>
</tr> </tr>
<tr> <tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment